Skip to content

fix(opentelemetry): Align GraphQL span operations - #6764

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

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

Conversation

@adinauer

Copy link
Copy Markdown
Member

📜 Description

Maps OpenTelemetry spans with graphql.operation.type to Sentry's graphql span operation while preserving the OpenTelemetry operation-level span name, such as query GreetingQuery, as the description.

GraphQL detection takes precedence over HTTP attributes when both are present. The mapping intentionally remains operation-level because OpenTelemetry does not provide the parent type needed to reproduce native resolver descriptions such as Task.assignee.

The OpenTelemetry GraphQL property migration is handled separately in #6750.

💡 Motivation and Context

OpenTelemetry GraphQL spans currently use their complete span name as both the Sentry operation and description. This produces operations such as query GreetingQuery instead of grouping the spans under Sentry's established graphql operation.

The new mapping aligns the operation category while retaining the useful named operation as the span description.

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' --tests='*GraphqlIntegrationTest*'

All 33 extractor tests pass. All six GraphQL scenarios pass in both agent initialization modes.

📝 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

Database span alignment remains separate from this GraphQL-only change.

adinauer and others added 2 commits November 25, 2026 11:54
Map OpenTelemetry spans carrying a GraphQL operation type to the graphql operation and retain their operation-level span name as the description.

This aligns OpenTelemetry GraphQL spans with Sentry's GraphQL operation category without treating operation spans as native resolver-level spans.

Refs #4547

Co-Authored-By: Claude <[email protected]>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 4ba0d43.

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

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

@sentry

sentry Bot commented Nov 25, 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

Bring the GraphQL span alignment branch onto the latest 9.x.x state, including the OpenTelemetry 2.34.0 messaging semantic convention updates. Resolve the changelog conflict while retaining the GraphQL fix entry.

Co-Authored-By: Claude <[email protected]>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 26, 2026
Co-Authored-By: Claude <[email protected]>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 26, 2026

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