Skip to content

feat(tracing): Simplify span v2 status to ok/error#3840

Merged
buenaflor merged 3 commits into
mainfrom
ref/remove-span-status-v2-fields
Jul 2, 2026
Merged

feat(tracing): Simplify span v2 status to ok/error#3840
buenaflor merged 3 commits into
mainfrom
ref/remove-span-status-v2-fields

Conversation

@buenaflor

Copy link
Copy Markdown
Contributor

Closes #3839

SentrySpanStatusV2 now only distinguishes ok from error. The cancelled and deadlineExceeded values are removed, and the finer-grained outcome of a v2 idle span moves onto semantic attributes set when the span finishes:

Scenario Status Attribute
Final timeout error sentry.status.message = deadline_exceeded
Idle timeout ok
Still-active children force-finished on timeout ok
External cancel (navigation route change, user-interaction different-widget tap) ok sentry.idle_span_finish_reason = cancelled

sentry.idle_span_finish_reason mirrors the JS SDK's browserTracingIntegration. Two new @internal SemanticAttributesConstants back these attributes: sentryStatusMessage and sentryIdleSpanFinishReason.

SentrySpanStatusV2 is @internal and not exported from any public barrel, so SDK users are unaffected. The v1 SpanStatus (cancelled() / deadlineExceeded()) is a separate protocol type and is left untouched — its use in gRPC and the v1 navigation trackers is unchanged.

Reduce SentrySpanStatusV2 to `ok` and `error`, removing `cancelled`
and `deadlineExceeded`, and define how v2 idle spans finish:

- finalTimeout: error + `sentry.status.message` = `deadline_exceeded`
- idleTimeout: ok
- still-active children force-finished on timeout: ok
- external cancel (route change, different-widget tap): ok +
  `sentry.idle_span_finish_reason` = `cancelled`

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

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


Features

Dart

  • Add array attributes to telemetry by buenaflor in #3778
  • Mark span streaming API as non-experimental by buenaflor in #3756

Other

  • (grpc) Add integration support for GRPC by lucas-zimerman in #3721
  • (tracing) Simplify span v2 status to ok/error by buenaflor in #3840

Fixes

  • Correct feature flag scope buffer updates by denrase in #3797

Enhancements

  • (flutter) Support int64 values from sentry-native by buenaflor in #3760

Dependencies

Deps

  • chore(deps): update Android SDK to v8.46.0 by github-actions in #3793
  • chore(deps): update Native SDK to v0.15.2 by github-actions in #3785
  • chore(deps): update Android SDK to v8.45.0 by github-actions in #3790
  • chore(deps): update Native SDK to v0.15.1 by github-actions in #3757

Internal Changes

  • (flutter) Remove flaky frames measurement tests by buenaflor in #3783
  • (skills) Expand test-guidelines and drop stale deps by buenaflor in #3807
  • Add PR template checkbox for cross sdk review on public API changes by antonis in #3822
  • Block manual CHANGELOG.md edits by buenaflor in #3810
  • Fix Dependabot pub paths and pin GitHub Action by buenaflor in #3804
  • Add AI Use section to CONTRIBUTING.md by christophaigner in #3803

🤖 This preview updates automatically when you update the PR.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.39%. Comparing base (ff48f34) to head (e17558b).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../telemetry/span/idle_recording_sentry_span_v2.dart 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3840      +/-   ##
==========================================
+ Coverage   87.34%   87.39%   +0.04%     
==========================================
  Files         337      337              
  Lines       12205    12205              
==========================================
+ Hits        10660    10666       +6     
+ Misses       1545     1539       -6     
Flag Coverage Δ
sentry 87.33% <66.66%> (+0.08%) ⬆️
sentry_dio 97.73% <ø> (ø)
sentry_drift 93.57% <ø> (ø)
sentry_file 65.29% <ø> (ø)
sentry_firebase_remote_config 100.00% <ø> (ø)
sentry_flutter 91.52% <100.00%> (+<0.01%) ⬆️
sentry_grpc 99.09% <ø> (ø)
sentry_hive 77.48% <ø> (ø)
sentry_isar 74.37% <ø> (ø)
sentry_link 21.50% <ø> (ø)
sentry_logging 97.01% <ø> (ø)
sentry_sqflite 88.81% <ø> (ø)
sentry_supabase 97.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1245.37 ms 1247.47 ms 2.10 ms
Size 5.83 MiB 6.28 MiB 459.63 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
192b44c 1269.08 ms 1275.52 ms 6.44 ms
eca355d 1238.39 ms 1266.98 ms 28.59 ms
79f6b41 1269.33 ms 1279.71 ms 10.38 ms
c26ed0a 1244.11 ms 1263.85 ms 19.75 ms
ea06d23 1254.02 ms 1252.60 ms -1.42 ms
a2c8611 1253.83 ms 1246.92 ms -6.91 ms
f42e9fb 1247.60 ms 1255.89 ms 8.29 ms
d052aef 1246.33 ms 1253.04 ms 6.71 ms
de377fd 1252.28 ms 1254.76 ms 2.48 ms
dc53d48 1252.06 ms 1255.61 ms 3.55 ms

App size

Revision Plain With Sentry Diff
192b44c 5.53 MiB 5.96 MiB 444.33 KiB
eca355d 7.86 MiB 9.44 MiB 1.58 MiB
79f6b41 7.86 MiB 9.44 MiB 1.58 MiB
c26ed0a 5.53 MiB 5.97 MiB 453.76 KiB
ea06d23 5.53 MiB 5.96 MiB 443.26 KiB
a2c8611 5.66 MiB 6.10 MiB 452.11 KiB
f42e9fb 5.83 MiB 6.28 MiB 462.32 KiB
d052aef 5.73 MiB 6.17 MiB 453.76 KiB
de377fd 20.71 MiB 22.43 MiB 1.73 MiB
dc53d48 5.65 MiB 6.09 MiB 446.96 KiB

@buenaflor buenaflor marked this pull request as ready for review July 1, 2026 15:11
@buenaflor buenaflor requested a review from denrase as a code owner July 1, 2026 15:11
Copilot AI review requested due to automatic review settings July 1, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies the v2 span status model in the streaming telemetry pipeline by reducing SentrySpanStatusV2 to just ok/error, and moves idle-span “why it ended” semantics onto semantic attributes set at finish time (e.g. sentry.status.message=deadline_exceeded and sentry.idle_span_finish_reason=cancelled).

Changes:

  • Remove cancelled and deadlineExceeded from SentrySpanStatusV2 and update status conversions accordingly.
  • Set semantic attributes on idle span final-timeout (sentry.status.message) and external-cancel flows (sentry.idle_span_finish_reason) while keeping status as ok/error.
  • Update Dart + Flutter tests to validate the new status/attribute behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/flutter/test/user_interaction/sentry_user_interaction_widget_test.dart Updates expectations to ok + sentry.idle_span_finish_reason=cancelled.
packages/flutter/test/navigation/time_to_display_tracker_v2_test.dart Updates route-cancel test expectations to ok + cancelled finish reason; renames a test accordingly.
packages/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart On superseding interaction, ends prior idle span with ok and sets cancelled finish-reason attribute.
packages/flutter/lib/src/navigation/time_to_display_tracker_v2.dart On route cancel, ends active idle span with ok and sets cancelled finish-reason attribute.
packages/dart/test/hub_span_test.dart Updates idle-span timeout semantics tests and adds coverage for idle-timeout resulting in ok and no status-message attribute.
packages/dart/lib/src/tracing/instrumentation/instrumentation_span.dart Simplifies v2↔v1 status mapping now that v2 only has ok/error.
packages/dart/lib/src/telemetry/span/sentry_span_status_v2.dart Removes cancelled/deadlineExceeded enum values, leaving only ok/error.
packages/dart/lib/src/telemetry/span/idle_recording_sentry_span_v2.dart Sets error + sentry.status.message=deadline_exceeded on final timeout; force-finished children now end with ok.
packages/dart/lib/src/constants.dart Adds internal semantic attribute keys for status message and idle-span finish reason.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/dart/lib/src/telemetry/span/sentry_span_status_v2.dart
Replace the inline 'deadline_exceeded' and 'cancelled' attribute-value
literals with named constants in constants.dart. 'cancelled' was
duplicated across two production call sites; centralizing avoids drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@@ -1,7 +1,5 @@
enum SentrySpanStatusV2 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If what warden says is correct, we should at least mark it now as internal, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

imo it's okay, span-streaming is not yet GA (no docs, etc...)

}

SentrySpanStatusV2 _convertToV2Status(SpanStatus status) {
if (status == SpanStatus.ok()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are there now cases in SpanStatus that would also match to error, like deadlineExceeded?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, which is fine imo. I dont expect this to be perfect now

@buenaflor buenaflor requested a review from denrase July 2, 2026 09:41
@buenaflor buenaflor merged commit 6bb2dbd into main Jul 2, 2026
162 of 163 checks passed
@buenaflor buenaflor deleted the ref/remove-span-status-v2-fields branch July 2, 2026 11:41
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.

Simplify span status v2 to ok/error and define idle span finish semantics

3 participants