Skip to content

fix(opentelemetry): Align database span operations - #6791

Draft
adinauer wants to merge 2 commits into
9.x.xfrom
fix/otel-database-span-alignment
Draft

adinauer wants to merge 2 commits into
9.x.xfrom
fix/otel-database-span-alignment

Conversation

@adinauer

Copy link
Copy Markdown
Member

📜 Description

Aligns OpenTelemetry database spans with native Sentry JDBC instrumentation:

  • Maps spans containing db.query.text or legacy db.statement to op=db.query.
  • Keeps op=db for database spans without query semantics.
  • Prefers db.query.text, then legacy db.statement, then the OpenTelemetry span name as the description.
  • Recognizes stable db.system.name and legacy db.system attributes.

OpenTelemetry attributes, including db.query.summary, continue to be retained as span data. This change does not sanitize or generate SQL.

💡 Motivation and Context

Native JDBC instrumentation uses db.query for query spans, while equivalent OpenTelemetry spans were exported with op=db. Aligning the operation and description makes database spans consistent across the two integrations.

Refs #4547

💚 How did you test it?

  • make format api
  • ./gradlew ':sentry-opentelemetry:sentry-opentelemetry-core:test' --tests='*SpanDescriptionExtractorTest*'
  • ./gradlew ':sentry-spring-boot:integrationTestOtelAgent' ':sentry-spring-boot:integrationTestOtelAgentWithoutAutoInit' ':sentry-spring-boot:integrationTestOtelNoAgent' --tests='*PersonIntegrationTest*'

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

SQL sanitization and database query-summary generation remain separate work tracked by #6019 and #6018.

adinauer and others added 2 commits November 26, 2026 10:04
Map query-bearing OpenTelemetry database spans to db.query while keeping db for spans without query semantics. Prefer db.query.text over legacy db.statement and recognize both stable and legacy database system attributes.

Align agent and agentless integration expectations with native JDBC spans.

Refs #4547

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit fa0fcd5.

Main concerns: reach, data sent to Sentry, host performance.

This label is a hint for reviewers, not an approval.

@sentry

sentry Bot commented Nov 26, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.66.0 (1) release

⚙️ sentry-android Build Distribution Settings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant