Skip to content

ref(sveltekit): Handle SvelteKit-generated spans in sentryHandle #17423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Aug 14, 2025

(This is still WIP and for now a conglomerate of changes)

If Kit tracing is used:

  • Don't start a span if the kit request event signals that Sveltekit emits its own spans
  • Don't emit httpIntegration incoming request span (kit or our handler take care of that)
  • Process kit-emitted spans to include sentry op and origin
  • Change name of root span to Sentry-esque http.server name conventions
    • store original name as sveltekit.tracing.original_name attribute
  • We still isolate the request in addition and this works correctly

Build time adjustments

  • Read tracing config from svelte.config.js
  • Inject config into hooks.server.ts and instrumentation.server.ts
  • Use this information at runtime to determine which integration to add (how)
  • Make sure to always inject this value, independently of source maps config

Misc

  • Add tests for span processing
  • Add tests for buildtime tracing config functionality
  • Add tests for runtime tracing config functionality
  • Add e2e test app with full tracing functionality enabled
  • Add e2e test app only with instrumentation but not tracing enabled

Maybe/follow-up

  • Add build time or runtime log message to instruct users to use the new feature if we detect they don't yet

see sveltejs/kit#13899

ref #16982

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