Skip to content

fix(core): Default trace context status to OK - #6418

Draft
adinauer wants to merge 5 commits into
9.x.xfrom
fix/default-trace-context-status
Draft

adinauer wants to merge 5 commits into
9.x.xfrom
fix/default-trace-context-status

Conversation

@adinauer

@adinauer adinauer commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

📜 Description

Default trace contexts created from active spans to ok when the span does not have an explicit status.

The SDK copies the span context before applying the default, so the running span remains unchanged. Explicitly assigned span statuses continue to be preserved.

💡 Motivation and Context

Active spans usually do not have a status until they finish. When their context is attached to an event, feedback, check-in, replay, or persisted scope, Sentry currently displays the missing status as unknown, which is confusing to users.

This aligns Java with the span-first default and the equivalent Cocoa change.

💚 How did you test it?

  • Added tests for the default status, preservation of explicit statuses, and ensuring the active span is not mutated.
  • Ran ./gradlew :sentry:test --rerun-tasks --tests io.sentry.SpanContextTest --tests io.sentry.ScopeTest --tests io.sentry.ScopesTest --tests io.sentry.SentryClientTest.
  • Ran ./gradlew spotlessApply updateKotlinAbi.

📝 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

Run the SDK team review and address any findings.

Active spans usually have no status until they finish, which causes trace contexts attached to events to appear as unknown. Default copied trace contexts to OK without mutating the running span, while preserving explicitly set statuses.

Fixes GH-4769
@linear-code

linear-code Bot commented Oct 29, 2026

Copy link
Copy Markdown

JAVA-192

@sentry

sentry Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

adinauer and others added 3 commits October 29, 2026 17:47
Copy the span context before checking whether its status needs a default. This prevents a concurrent explicit status update from being overwritten with OK.

Refs #4769
Co-Authored-By: Claude <noreply@anthropic.com>
This reverts commit fee62a1.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant