Skip to content

feat(core): Remove kind for spans, move to sentry.kind attribute#22528

Draft
mydea wants to merge 4 commits into
developfrom
fn/span-kind
Draft

feat(core): Remove kind for spans, move to sentry.kind attribute#22528
mydea wants to merge 4 commits into
developfrom
fn/span-kind

Conversation

@mydea

@mydea mydea commented Jul 23, 2026

Copy link
Copy Markdown
Member

This removes kind from start span options, and refactors all our usage to instead set the sentry.kind attribute directly.
This is one of the things we rely on for span description inferral, so removing this takes us a step closer to this.

While at it, this also aligns the values to actually be lowercase as specced.

@mydea mydea self-assigned this Jul 23, 2026
Comment thread packages/aws-serverless/src/integration/aws/vendored/aws-sdk.ts
/** An op for the span. This is a categorization for spans. */
op?: string;

/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Public API broken without deprecation

High Severity

This removes public surface without a deprecation path in a v10 minor: the kind option on StartSpanOptions, the SPAN_KIND / SpanKindValue exports from @sentry/core, and getSpanKind from @sentry/opentelemetry. The review rules require deprecation notices for public API removals and signature changes. Flagged because it was mentioned in this rules file.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 973aafc. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

need to add deprecation in follow up

attributes: {
...opts.attributes,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual',
...(op ? { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deno tracer drops kind mapping

Medium Severity

The Deno OTel shim no longer maps SpanOptions.kind to an op or to sentry.kind. Callers using OpenTelemetry SpanKind.CLIENT / SERVER (and friends) previously got http.client / http.server ops; those spans now lose that classification, and inference cannot recover it without sentry.kind.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 973aafc. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this was totally incorrect anyhow, simply removing this...

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.78 kB - -
@sentry/browser - with treeshaking flags 26.23 kB - -
@sentry/browser (incl. Tracing) 46.3 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.06 kB -0.04% -19 B 🔽
@sentry/browser (incl. Tracing, Profiling) 51.11 kB - -
@sentry/browser (incl. Tracing, Replay) 85.58 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.22 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.29 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.97 kB - -
@sentry/browser (incl. Feedback) 44.96 kB - -
@sentry/browser (incl. sendFeedback) 32.58 kB - -
@sentry/browser (incl. FeedbackAsync) 37.63 kB - -
@sentry/browser (incl. Metrics) 28.87 kB - -
@sentry/browser (incl. Logs) 29.1 kB - -
@sentry/browser (incl. Metrics & Logs) 29.8 kB - -
@sentry/react 29.58 kB - -
@sentry/react (incl. Tracing) 48.6 kB - -
@sentry/vue 33.22 kB - -
@sentry/vue (incl. Tracing) 48.27 kB - -
@sentry/svelte 27.81 kB - -
CDN Bundle 30.11 kB - -
CDN Bundle (incl. Tracing) 48.15 kB -0.04% -17 B 🔽
CDN Bundle (incl. Logs, Metrics) 31.69 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.47 kB -0.03% -14 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 70.95 kB - -
CDN Bundle (incl. Tracing, Replay) 85.71 kB -0.02% -15 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.01 kB -0.02% -15 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 91.49 kB -0.02% -14 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.77 kB -0.02% -13 B 🔽
CDN Bundle - uncompressed 89.75 kB - -
CDN Bundle (incl. Tracing) - uncompressed 144.82 kB -0.02% -28 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 148.8 kB -0.02% -28 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.22 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.06 kB -0.02% -28 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.02 kB -0.02% -28 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.76 kB -0.02% -28 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.72 kB -0.01% -28 B 🔽
@sentry/nextjs (client) 51.13 kB - -
@sentry/sveltekit (client) 46.75 kB - -
@sentry/core/server 80.08 kB -0.15% -113 B 🔽
@sentry/core/browser 51.9 kB -0.18% -90 B 🔽
@sentry/node 124.23 kB -0.08% -88 B 🔽
@sentry/node (incl. diagnostics channel injection) 149.66 kB -0.05% -71 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB - -
@sentry/node - without tracing 74.32 kB -0.14% -97 B 🔽
@sentry/aws-serverless 83.79 kB -0.16% -130 B 🔽
@sentry/cloudflare (withSentry) - minified 196.61 kB -0.02% -26 B 🔽
@sentry/cloudflare (withSentry) 483.83 kB -0.01% -44 B 🔽

View base workflow run

@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 3 potential issues.

There are 5 total unresolved issues (including 2 from previous reviews).

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 0863e20. Configure here.


const kind = getSpanKind(span);
return inferSpanData(name, attributes, kind);
return inferSpanData(name, attributes);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

OTel span kind ignored in inference

High Severity

inferSpanData now reads kind only from the sentry.kind attribute, but classic OTel SDK spans keep kind on the span's .kind property and never set that attribute. With BasicTracerProvider / SentrySpanProcessor, HTTP ops fall back to bare http instead of http.server/http.client, and streamed backfill plus sampler inference lose kind entirely. spanExporter.getData still emits sentry.kind later, so the payload can look correct while op/source inference is already wrong.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0863e20. Configure here.

// Convert otel kind to our sentry.kind attribtue
if (options.kind) {
sentryOptions.attributes[SENTRY_KIND] = spanKindToName(options.kind);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caller attributes object mutated

Medium Severity

_startSentrySpan reuses the caller's options.attributes object and then writes sentry.kind onto it. Any shared attributes object passed into startSpan is mutated for later callers, which can leak kind across unrelated spans.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0863e20. Configure here.

hook: 'preprocessSpan',
callback: (streamedSpanJSON: StreamedSpanJSON, hint?: { spanKind?: number }) => void,
): () => void;
public on(hook: 'preprocessSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

preprocessSpan hint removed undeprecated

Medium Severity

The public preprocessSpan hook no longer accepts the { spanKind } hint argument. External subscribers typing or depending on that second parameter break without a deprecation path. Flagged because it was mentioned in the PR review rules file.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 0863e20. Configure here.

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