Skip to content

fix(db): Clarify db.query.text and db.query.summary attributes#208

Merged
Lms24 merged 4 commits intomainfrom
lms/fix-db-param-attributes
Jan 23, 2026
Merged

fix(db): Clarify db.query.text and db.query.summary attributes#208
Lms24 merged 4 commits intomainfrom
lms/fix-db-param-attributes

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Dec 15, 2025

  • db.query.text: We previously specified this attribute to contain a full/raw query without parameterization. OTel requires the paramterized query.
  • db.query.summary We specified this attribute to contain the paramterized query. OTel specifies a shortened operation/table "grouping".

This came up while reviewing getsentry/sentry-javascript#17961

@Lms24 Lms24 self-assigned this Dec 15, 2025
Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

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

LGTM, you will need to regenerate and reformat.
Also, example needs to be a string, we can change that but for the purpose of the PR just provide a single example as a string.

@Lms24
Copy link
Member Author

Lms24 commented Dec 15, 2025

+1 for being able to add more than one example. For now I removed the second example. Thanks for the review!

@cleptric
Copy link
Member

@mjq and @Ahmed-Labs should take a look here as well.

@Ahmed-Labs
Copy link
Contributor

Makes sense! We will probably have to update db attribute normalization logic because we currently expect a raw query as opposed to a parametrized one in db.query.text.

@Lms24
Copy link
Member Author

Lms24 commented Dec 16, 2025

Just to add here, JS SDK instrumentations have been sending the parametrized version in db.query.text ever since sending this attribute. I don't have the full picture if other SDKs handle this differently. If so, we need to be very mindful with this change in specification but it also means we're living with duality (in terms of semantics) already anyway.

@Lms24
Copy link
Member Author

Lms24 commented Jan 8, 2026

@Ahmed-Labs @cleptric should we move forward with this change?

},
"is_in_otel": true,
"example": "SELECT * FROM users",
"example": "SELECT * FROM users WHERE id = $1",
Copy link

Choose a reason for hiding this comment

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

If I have this query:

INSERT INTO exec_test (id, name) VALUES (?, ?, ?, ?)

Should it become as it is, or:

INSERT INTO exec_test (id, name) VALUES (?)

Copy link
Member Author

Choose a reason for hiding this comment

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

OTel gives an example for an IN claus which I guess is the closest thing to your case. So you MAY shorten it to one ? but it's not required. Unless anyone has different opinions, I'd recommend we go with the actual number of values (as it is, in your case).

@cleptric
Copy link
Member

@mjq need your input here.

@mjq
Copy link
Member

mjq commented Jan 12, 2026

Yeah this is fine. We're already set up to use .text for insights. The product has no plans for using .summary (relying on our own parameterization and normalization instead), but if we want to document it because POtel SDKs send it, that's cool. (Other SDKs can send it too when it's easy, but it should definitely be optional).

@Lms24 Lms24 force-pushed the lms/fix-db-param-attributes branch from 2e1a59e to 77c0e7f Compare January 23, 2026 12:50
@Lms24 Lms24 requested a review from a team as a code owner January 23, 2026 12:50
@github-actions
Copy link

github-actions bot commented Jan 23, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Add attribute gen_ai.response.time_to_first_token by constantinius in #227
  • Add sentry.status_code attribute by mjq in #223
  • Backfill db.system attribute by mjq in #224
  • Add sentry.category attribute by mjq in #218
  • Add sentry.normalized_db_query.hash by Ahmed-Labs in #200

Other

  • (ai) Add input tokens cache write by shellmayr in #217
  • (gen_ai) Add new Gen AI attributes by obostjancic in #221
  • Add page listing all attributes by Lms24 in #207

Bug Fixes 🐛

Attributes

  • Migrating several numeric fields to pii=maybe by constantinius in #228
  • Improve gen_ai.operation.name description by obostjancic in #225

Other

  • (db) Clarify db.query.text and db.query.summary attributes by Lms24 in #208

Internal Changes 🔧

Attributes

  • Update sentry.span.source with known values by Lms24 in #214
  • Add legacy attribute definitions for transaction spans by Ahmed-Labs in #212
  • Normalize deprecated db attribute names by Ahmed-Labs in #199

Deps Dev

  • Bump tar from 7.5.3 to 7.5.4 by dependabot in #226
  • Bump tar from 7.4.3 to 7.5.3 by dependabot in #220

Repo

  • Add Claude Code settings with basic permissions by philipphofmann in #222
  • Unstale yarn lock by Lms24 in #215

Other

  • (ai) Remove gen_ai_usage_total_cost attribute by vgrozdanic in #206
  • (lint) Don't lint Claude's config files by mjq in #219
  • (release) Switch from action-prepare-release to Craft by BYK in #216
  • Add statuses permission to Changelog Preview by lcian in #232

Other

  • Add @getsentry/ingest to CODEOWNERS by cleptric in #236
  • Update CODEOWNERS to change global ownership by cleptric in #230

🤖 This preview updates automatically when you update the PR.

@Lms24 Lms24 merged commit 198eb12 into main Jan 23, 2026
9 checks passed
@Lms24 Lms24 deleted the lms/fix-db-param-attributes branch January 23, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants