Skip to content

ref(core): Ensure error span status is always valid#22522

Open
mydea wants to merge 3 commits into
developfrom
fn/otel-span-status
Open

ref(core): Ensure error span status is always valid#22522
mydea wants to merge 3 commits into
developfrom
fn/otel-span-status

Conversation

@mydea

@mydea mydea commented Jul 23, 2026

Copy link
Copy Markdown
Member

We have some code in otel span serialization that ensures that span statuses are correct. if we remove this layer, however we can "invalid" span statuses (e.g. random error messages etc). This change ensures we always have valid span statuses everywhere, in the legacy transaction mode.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.94 kB +0.55% +152 B 🔺
@sentry/browser - with treeshaking flags 26.38 kB +0.61% +158 B 🔺
@sentry/browser (incl. Tracing) 46.4 kB +0.21% +95 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.18 kB +0.23% +107 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.2 kB +0.18% +90 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.68 kB +0.12% +96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.32 kB +0.13% +94 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.39 kB +0.12% +103 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.05 kB +0.09% +85 B 🔺
@sentry/browser (incl. Feedback) 45.11 kB +0.35% +157 B 🔺
@sentry/browser (incl. sendFeedback) 32.73 kB +0.46% +149 B 🔺
@sentry/browser (incl. FeedbackAsync) 37.8 kB +0.44% +163 B 🔺
@sentry/browser (incl. Metrics) 29.03 kB +0.57% +162 B 🔺
@sentry/browser (incl. Logs) 29.25 kB +0.52% +151 B 🔺
@sentry/browser (incl. Metrics & Logs) 29.95 kB +0.52% +152 B 🔺
@sentry/react 29.74 kB +0.53% +154 B 🔺
@sentry/react (incl. Tracing) 48.69 kB +0.19% +88 B 🔺
@sentry/vue 33.37 kB +0.48% +158 B 🔺
@sentry/vue (incl. Tracing) 48.38 kB +0.23% +111 B 🔺
@sentry/svelte 27.96 kB +0.54% +148 B 🔺
CDN Bundle 30.27 kB +0.55% +163 B 🔺
CDN Bundle (incl. Tracing) 48.24 kB +0.18% +83 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.84 kB +0.49% +153 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.57 kB +0.18% +89 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 71.12 kB +0.24% +167 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.83 kB +0.12% +98 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.14 kB +0.13% +111 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.59 kB +0.1% +90 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.87 kB +0.1% +92 B 🔺
CDN Bundle - uncompressed 90.06 kB +0.36% +316 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 145.16 kB +0.22% +316 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.78 kB +0.34% +316 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.15 kB +0.22% +316 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.54 kB +0.15% +316 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.4 kB +0.12% +316 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.37 kB +0.12% +316 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.11 kB +0.12% +316 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.06 kB +0.12% +316 B 🔺
@sentry/nextjs (client) 51.22 kB +0.19% +93 B 🔺
@sentry/sveltekit (client) 46.83 kB +0.19% +88 B 🔺
@sentry/core/server 80.28 kB +0.12% +89 B 🔺
@sentry/core/browser 52.09 kB +0.2% +99 B 🔺
@sentry/node 124.37 kB +0.05% +56 B 🔺
@sentry/node (incl. diagnostics channel injection) 149.81 kB +0.06% +78 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB +0.01% +2 B 🔺
@sentry/node - without tracing 74.48 kB +0.1% +73 B 🔺
@sentry/aws-serverless 83.97 kB +0.07% +54 B 🔺
@sentry/cloudflare (withSentry) - minified 197.04 kB +0.21% +404 B 🔺
@sentry/cloudflare (withSentry) 485.37 kB +0.31% +1.5 kB 🔺

View base workflow run

@mydea
mydea marked this pull request as ready for review July 23, 2026 08:01
@mydea
mydea requested a review from a team as a code owner July 23, 2026 08:01
@mydea
mydea requested review from JPeer264 and isaacs and removed request for a team July 23, 2026 08:01
@mydea
mydea requested a review from Lms24 July 23, 2026 08:09

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7bd130c. Configure here.


export function isStatusErrorMessageValid(message: string): boolean {
return SPAN_STATUS_TYPES.includes(message as SpanStatusType);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ok accepted as error status

Low Severity

isStatusErrorMessageValid now checks membership in SPAN_STATUS_TYPES, which includes 'ok'. For a span with error code and message 'ok', getStatusMessage and mapStatus treat that message as valid, so legacy transaction serialization can emit status: 'ok' for an error span instead of normalizing to 'internal_error'.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7bd130c. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is legit

@mydea
mydea requested a review from a team as a code owner July 23, 2026 09:09
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.

2 participants