Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB: fix how operation and collection names are recorded for complex queries (opt-in db.query.text on metrics, new db.query.summary recommended attribute) #1482

Merged
merged 19 commits into from
Oct 18, 2024

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Oct 15, 2024

Fixes #1159, #805

Related: #521

Based on the discussion on slack https://cloud-native.slack.com/archives/C06HH05KNMC/p1728891505239829 and spec discussion on 10/25/24:

  • having a single operation/collection name on metrics is not enough
  • it provides a baseline that works for nosql and sql with simple queries
  • it can work better if/once we provide a way for users to supply their own operation alias/other context
  • it's misleading to record one operation/collection when in fact there are multiple

We can however:

  • allow users to enable capturing sanitized value of a db.query.text as opt-in to mitigate shortcomings of single operation/collection name.
  • create a synthetic query text from a combination of operations and collections (like SELECT foo, UPDATE bar, DELETE bar - it'd have low-ish cardinality, would be shorter than a query, won't have any sensitive information that needs sanitization and would be readable enough. This allows to make it recommended on metrics.

This PR implements both options as discussed in #805 (comment)

Merge requirement checklist

@lmolkova lmolkova changed the title Add opt-in db.query.text on DB client duration metric DB: fix how operation and collection names are recorded for complex queries (opt-in db.query.text on metrics, new db.query.synthetic recommended attribute) Oct 16, 2024
@trask
Copy link
Member

trask commented Oct 16, 2024

some possibilities for naming:

  • db.query.synthetic
  • db.query.short
  • db.query.summary
  • db.query.description

@lmolkova
Copy link
Contributor Author

I really like the db.query.summary - it's accurate, it can be collected by other means (e.g. via a comment or a contextual attribute like in open-telemetry/oteps#207). the db.query.synthetic would have limited opportunity to evolve into something more usable.

docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 👍 on this

@lmolkova lmolkova changed the title DB: fix how operation and collection names are recorded for complex queries (opt-in db.query.text on metrics, new db.query.synthetic recommended attribute) DB: fix how operation and collection names are recorded for complex queries (opt-in db.query.text on metrics, new db.query.summary recommended attribute) Oct 16, 2024
@lmolkova lmolkova marked this pull request as ready for review October 16, 2024 18:44
@lmolkova lmolkova requested review from a team as code owners October 16, 2024 18:44
.chloggen/1482.yaml Show resolved Hide resolved
model/database/registry.yaml Outdated Show resolved Hide resolved
model/database/registry.yaml Outdated Show resolved Hide resolved
model/database/registry.yaml Outdated Show resolved Hide resolved
model/database/common.yaml Show resolved Hide resolved
model/database/registry.yaml Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
Copy link
Member

@XSAM XSAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

docs/database/database-spans.md Show resolved Hide resolved
docs/database/database-spans.md Outdated Show resolved Hide resolved
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌟

@lmolkova lmolkova merged commit 25f7419 into open-telemetry:main Oct 18, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Database: add db.query.text as opt-in on metrics
6 participants