Skip to content

fix(sveltekit): add op and origin to Kit's sveltekit.endpoint span - #25376

Merged
isaacs merged 1 commit into
developfrom
isaacs/fix-sveltkit-3-e2e
Oct 15, 2026
Merged

isaacs merged 1 commit into
developfrom
isaacs/fix-sveltkit-3-e2e

Conversation

@isaacs

@isaacs isaacs commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

SvelteKit 3.1.0 emits a sveltekit.endpoint span for +server handlers when server tracing is on. The SDK did not know the span, so it went out with origin manual and no op, unlike Kit's other spans. It also broke the sveltekit-3 e2e test, which counts the child spans of a page that fetches a +server route.

The span now gets op function and origin auto.function.sveltekit.endpoint. The origin follows the trace origin format and the other Kit span origins (auto.function.sveltekit.load, auto.function.sveltekit.action). Its part keeps the span apart from the SDK's own wrapServerRouteWithSentry span (auto.function.sveltekit), which can now appear next to it. Under span streaming, the span also gets sentry.description, as Kit's other spans do, because the function description template needs code.function.name, which Kit does not set.

Re: sveltejs/kit#17325

SvelteKit 3.1.0 emits a `sveltekit.endpoint` span for `+server` handlers
when server tracing is on. The SDK did not know the span, so it went out
with origin `manual` and no op, unlike Kit's other spans. It also broke
the `sveltekit-3` e2e test, which counts the child spans of a page that
fetches a `+server` route.

The span now gets op `function` and origin
`auto.function.sveltekit.endpoint`. The origin follows the trace origin
format and the other Kit span origins (`auto.function.sveltekit.load`,
`auto.function.sveltekit.action`). Its part keeps the span apart from
the SDK's own `wrapServerRouteWithSentry` span
(`auto.function.sveltekit`), which can now appear next to it. Under span
streaming, the span also gets `sentry.description`, as Kit's other spans
do, because the `function` description template needs
`code.function.name`, which Kit does not set.

Re: sveltejs/kit#17325

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@isaacs
isaacs requested a review from a team as a code owner October 15, 2026 00:10
@isaacs
isaacs requested review from chargome and s1gr1d and removed request for a team October 15, 2026 00:10
@isaacs
isaacs enabled auto-merge (squash) October 15, 2026 00:22

@nicohrubec nicohrubec left a comment

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.

thanks!

@isaacs
isaacs merged commit 0ed4606 into develop Oct 15, 2026
54 checks passed
@isaacs
isaacs deleted the isaacs/fix-sveltkit-3-e2e branch October 15, 2026 05:43
nicohrubec pushed a commit that referenced this pull request Oct 16, 2026
…pan (#25429)

Backport of: #25376

## Differences to the original PR

- `packages/sveltekit/src/server-common/integrations/svelteKitSpans.ts`:
v10's span mapping returns `{ op, origin }` instead of only an origin,
so the endpoint case returns `{ op: 'function.sveltekit.endpoint',
origin: 'auto.function.sveltekit.endpoint' }`. Unit and e2e test
expectations were adjusted to match.

This branch was prepared by the v10 backport automation, which was
blocked at PR creation; it's opened manually now.

<!-- junior-request-attribution:start -->
via **Jan Peer Stöcklmair**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3A83fc948beed4fb12a54d41cb -->

--

[View Junior Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A83fc948beed4fb12a54d41cb/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Jan Peer Stöcklmair <jan.peer@sentry.io>
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