Repository navigation
fix(otel): recognize db spans that use the stable OpenTelemetry database attributes - #5692
Closed
michielvandermeer wants to merge 1 commit into
Closed
michielvandermeer wants to merge 1 commit into
michielvandermeer wants to merge 1 commit into
Conversation
…ase attributes The span processor read only db.system and db.statement. Instrumentation that follows the stable database conventions (semconv v1.33.0, e.g. Npgsql 10) sends db.system.name and db.query.text instead, so its query spans kept the activity's operation name as op and description and never showed their SQL. Read the stable names first and fall back to the old ones, as the HTTP attributes already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michielvandermeer
marked this pull request as ready for review
October 7, 2026 22:53
michielvandermeer
requested review from
jamescrosswell and
ric-oliv
as code owners
October 7, 2026 22:53
Collaborator
|
Hi @michielvandermeer - thanks for the PR. However we've marked the We'd recommend you migrate to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
SentrySpanProcessortreats a span as a database span only when it hasdb.system, and takes the query fromdb.statement. The stable OpenTelemetry database conventions (v1.33.0) renamed these todb.system.name(v1.30.0) anddb.query.text(v1.26.0). Instrumentation that follows them, such as Npgsql 10, sends only the new names. The processor then skips its database branch, so every Npgsql query reaches Sentry with oppostgresqland descriptionpostgresql. The SQL appears nowhere in the trace view, and the spans never show in Queries insights.ParseOtelSpanDescriptionnow reads the new names first and falls back to the old ones, through two helpers inOpenTelemetryExtensions(HasDbSystemAttribute,DbQueryTextAttribute). This is the same patternHttpMethodAttributeandUrlFullAttributealready use. Relay already understandsdb.system.namein span data, and the processor already copies every attribute into the span's data, so recognizing the span here is the only missing piece.Notes for review:
db.systemanddb.statementtake the same path as before. The new tests cover both the old and the new names. With theSentrySpanProcessor.cschange reverted, only the two new-name cases fail.postgresql) todb, and their description to the query. A span that sends both old and new names now takes its description fromdb.query.text.Sentry.OpenTelemetry.Testsonnet10.0(49 passed). Thenet8.0andnet9.0targets build, but I don't have those runtimes installed, so CI covers them.Issues
No issue tracks this. #5435 touches the same database branch of
SentrySpanProcessor.Reminders
feat:,fix:,chore:,meta:) — it becomes the changelog entry. Do not editCHANGELOG.mdmanually; mark changes that aren't user-facing withskip-changelog🤖 Generated with Claude Code