File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 initAndBind ,
1010 linkedErrorsIntegration ,
1111 requestDataIntegration ,
12- spanStreamingIntegration ,
1312 stackParserFromStackParserOptions ,
1413} from '@sentry/core' ;
1514import type { CloudflareClientOptions , CloudflareOptions } from './client' ;
@@ -59,15 +58,10 @@ export function init(options: CloudflareOptions): CloudflareClient | undefined {
5958 const flushLock = options . ctx ? makeFlushLock ( options . ctx ) : undefined ;
6059 delete options . ctx ;
6160
62- const resolvedIntegrations = getIntegrationsToSetup ( options ) ;
63- if ( options . traceLifecycle === 'stream' && ! resolvedIntegrations . some ( i => i . name === 'SpanStreaming' ) ) {
64- resolvedIntegrations . push ( spanStreamingIntegration ( ) ) ;
65- }
66-
6761 const clientOptions : CloudflareClientOptions = {
6862 ...options ,
6963 stackParser : stackParserFromStackParserOptions ( options . stackParser || defaultStackParser ) ,
70- integrations : resolvedIntegrations ,
64+ integrations : getIntegrationsToSetup ( options ) ,
7165 transport : options . transport || makeCloudflareTransport ,
7266 flushLock,
7367 } ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { createCheckInEnvelope } from './checkin';
22import { Client } from './client' ;
33import { getIsolationScope } from './currentScopes' ;
44import { DEBUG_BUILD } from './debug-build' ;
5+ import { spanStreamingIntegration } from './integrations/spanStreaming' ;
56import type { Scope } from './scope' ;
67import { DEFAULT_TRANSPORT_BUFFER_SIZE } from './transports/base' ;
78import { addUserAgentToTransportHeaders } from './transports/userAgent' ;
@@ -39,6 +40,13 @@ export class ServerRuntimeClient<
3940 public constructor ( options : O ) {
4041 addUserAgentToTransportHeaders ( options ) ;
4142
43+ // When span streaming is enabled (`traceLifecycle: 'stream'`), the `spanStreamingIntegration`
44+ // is required to flush spans. We add it here so the individual server SDKs don't have to.
45+ // A user-provided `spanStreamingIntegration` always takes precedence over the one we add.
46+ if ( options . traceLifecycle === 'stream' && ! options . integrations . some ( i => i . name === 'SpanStreaming' ) ) {
47+ options . integrations . push ( spanStreamingIntegration ( ) ) ;
48+ }
49+
4250 super ( options ) ;
4351
4452 this . _setUpMetricsProcessing ( ) ;
Original file line number Diff line number Diff line change 99 linkedErrorsIntegration ,
1010 nodeStackLineParser ,
1111 requestDataIntegration ,
12- spanStreamingIntegration ,
1312 stackParserFromStackParserOptions ,
1413} from '@sentry/core' ;
1514import { DenoClient } from './client' ;
@@ -118,15 +117,10 @@ export function init(options: DenoOptions = {}): Client {
118117 options . defaultIntegrations = getDefaultIntegrations ( options ) ;
119118 }
120119
121- const resolvedIntegrations = getIntegrationsToSetup ( options ) ;
122- if ( options . traceLifecycle === 'stream' && ! resolvedIntegrations . some ( i => i . name === 'SpanStreaming' ) ) {
123- resolvedIntegrations . push ( spanStreamingIntegration ( ) ) ;
124- }
125-
126120 const clientOptions : ServerRuntimeClientOptions = {
127121 ...options ,
128122 stackParser : stackParserFromStackParserOptions ( options . stackParser || defaultStackParser ) ,
129- integrations : resolvedIntegrations ,
123+ integrations : getIntegrationsToSetup ( options ) ,
130124 transport : options . transport || makeFetchTransport ,
131125 } ;
132126
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import {
1111 linkedErrorsIntegration ,
1212 propagationContextFromHeaders ,
1313 requestDataIntegration ,
14- spanStreamingIntegration ,
1514 stackParserFromStackParserOptions ,
1615} from '@sentry/core' ;
1716import { DEBUG_BUILD } from '../debug-build' ;
@@ -168,10 +167,6 @@ function getClientOptions(
168167 integrations,
169168 } ) ;
170169
171- if ( mergedOptions . traceLifecycle === 'stream' && ! resolvedIntegrations . some ( i => i . name === 'SpanStreaming' ) ) {
172- resolvedIntegrations . push ( spanStreamingIntegration ( ) ) ;
173- }
174-
175170 return {
176171 ...mergedOptions ,
177172 integrations : resolvedIntegrations ,
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import {
1313 linkedErrorsIntegration ,
1414 propagationContextFromHeaders ,
1515 requestDataIntegration ,
16- spanStreamingIntegration ,
1716 stackParserFromStackParserOptions ,
1817} from '@sentry/core' ;
1918import {
@@ -218,10 +217,6 @@ function getClientOptions(
218217 integrations,
219218 } ) ;
220219
221- if ( mergedOptions . traceLifecycle === 'stream' && ! resolvedIntegrations . some ( i => i . name === 'SpanStreaming' ) ) {
222- resolvedIntegrations . push ( spanStreamingIntegration ( ) ) ;
223- }
224-
225220 return {
226221 ...mergedOptions ,
227222 integrations : resolvedIntegrations ,
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import {
1616 linkedErrorsIntegration ,
1717 nodeStackLineParser ,
1818 requestDataIntegration ,
19- spanStreamingIntegration ,
2019 stackParserFromStackParserOptions ,
2120} from '@sentry/core' ;
2221import {
@@ -95,15 +94,10 @@ export function init(options: VercelEdgeOptions = {}): Client | undefined {
9594 options . environment =
9695 options . environment || process . env . SENTRY_ENVIRONMENT || getVercelEnv ( false ) || process . env . NODE_ENV ;
9796
98- const resolvedIntegrations = getIntegrationsToSetup ( options ) ;
99- if ( options . traceLifecycle === 'stream' && ! resolvedIntegrations . some ( i => i . name === 'SpanStreaming' ) ) {
100- resolvedIntegrations . push ( spanStreamingIntegration ( ) ) ;
101- }
102-
10397 const client = new VercelEdgeClient ( {
10498 ...options ,
10599 stackParser : stackParserFromStackParserOptions ( options . stackParser || nodeStackParser ) ,
106- integrations : resolvedIntegrations ,
100+ integrations : getIntegrationsToSetup ( options ) ,
107101 transport : options . transport || makeEdgeTransport ,
108102 } ) ;
109103 // The client is on the current scope, from where it generally is inherited
You can’t perform that action at this time.
0 commit comments