sentry-span-streaming-js

Migrates JavaScript Sentry SDKs from transaction-based tracing to span streaming delivery.

Updated Apr 22, 2026
One-click install
npx skills add https://github.com/imrishuroy/algopatterns --skill sentry-span-streaming-js-imrishuroy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sentry-span-streaming-js
Source: https://github.com/imrishuroy/algopatterns/tree/main/.agents/skills/sentry-span-streaming-js
Command: npx skills add https://github.com/imrishuroy/algopatterns --skill sentry-span-streaming-js-imrishuroy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Switching a JavaScript project from Sentry's default transaction-based trace lifecycle to span streaming requires coordinated changes across init options, callbacks, tags, and profiling settings, and missing any one of them causes silent fallback to static mode or lost span data. ## Core Features & Use Cases - Environment Detection: Scans the codebase to classify each Sentry.init call as browser, server, or framework (Next.js, Nuxt, SvelteKit, Remix, Astro) and applies the correct migration path. - Config Migration: Adds traceLifecycle 'stream' on server SDKs or spanStreamingIntegration() on browser SDKs, wraps beforeSendSpan with withStreamedSpan, and updates the callback shape from description/data to name/attributes. - Tag and Transaction Callback Handling: Pairs existing setTag/setTags calls with setAttribute/setAttributes equivalents and migrates beforeSendTransaction logic to beforeSendSpan or ignoreSpans filters. - Use Case: A team running @sentry/nextjs wants spans delivered individually with lower latency; the skill updates both sentry.client.config.ts and sentry.server.config.ts, fixes their beforeSendSpan callback, and verifies the build passes. ## Quick Start Migrate my JavaScript project to Sentry span streaming and update all Sentry.init configurations accordingly.

Frequently Asked Questions about sentry-span-streaming-js

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable Sentry span streaming in a JavaScript project?

Enable span streaming by adding traceLifecycle: 'stream' to Sentry.init for server SDKs like @sentry/node, or by adding Sentry.spanStreamingIntegration() to the integrations array for browser SDKs. The SDK must be version 10.61.0 or higher with tracing enabled.

How do I migrate beforeSendSpan to Sentry streaming mode?

Wrap the beforeSendSpan callback with Sentry.withStreamedSpan, otherwise the SDK falls back to static mode. Also update the callback shape: span.description becomes span.name and span.data becomes span.attributes, since the callback now receives StreamedSpanJSON.

Does beforeSendTransaction work with Sentry span streaming?

No, beforeSendTransaction has no effect in streaming mode because spans are sent individually rather than batched into transactions. Migrate its logic to beforeSendSpan with withStreamedSpan for modifications, or to the ignoreSpans option for dropping spans by name or attributes.

Why is my Sentry SDK falling back to static mode after enabling span streaming?

Fallback to static mode happens when a beforeSendSpan callback exists but is not wrapped with Sentry.withStreamedSpan. Wrap the callback and confirm traceLifecycle is set to 'stream' on server configs or spanStreamingIntegration() is present on browser configs.

Do Sentry tags still apply to spans in streaming mode?

No, tags set via setTag or setTags do not apply to streamed spans, only attributes do. Keep the existing setTag calls for error reporting and add matching setAttribute or setAttributes calls with the same key-value pairs so the data reaches spans.

Can I use profilesSampleRate with Sentry span streaming in the browser?

No, the legacy profilesSampleRate option is deprecated and does not integrate with the span streaming lifecycle. Use the v2 options profileSessionSampleRate and profileLifecycle together with browserProfilingIntegration() instead.