Skip to content

Commit 74a1167

Browse files
Lms24claude
andcommitted
ref(core): Tree-shake spanStreamingIntegration when tracing is disabled
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 4910062 commit 74a1167

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎packages/browser/src/sdk.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { makeFetchTransport } from './transports/fetch';
2828
import { normalizeStringifyValue } from './normalizeStringifyValue';
2929
import { checkAndWarnIfIsEmbeddedBrowserExtension } from './utils/detectBrowserExtension';
3030

31+
declare const __SENTRY_TRACING__: boolean;
32+
3133
/** Get the default integrations for the browser SDK. */
3234
export function getDefaultIntegrations(_options: Options): Integration[] {
3335
/**
@@ -120,6 +122,7 @@ export function init(options: BrowserOptions = {}): Client | undefined {
120122
});
121123

122124
if (
125+
(typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) &&
123126
options.traceLifecycle !== 'static' &&
124127
!integrations.some(integration => integration.name === SPAN_STREAMING_INTEGRATION_NAME)
125128
) {

‎packages/core/src/server-runtime-client.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export interface ServerRuntimeClientOptions extends ClientOptions<BaseTransportO
2828
serverName?: string;
2929
}
3030

31+
declare const __SENTRY_TRACING__: boolean;
32+
3133
/**
3234
* The Sentry Server Runtime Client SDK.
3335
*/
@@ -47,6 +49,7 @@ export class ServerRuntimeClient<
4749
// is required to flush spans. We add it here so the individual server SDKs don't have to.
4850
// A user-provided `spanStreamingIntegration` always takes precedence over the one we add.
4951
if (
52+
(typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) &&
5053
options.traceLifecycle !== 'static' &&
5154
!options.integrations.some(i => i.name === SPAN_STREAMING_INTEGRATION_NAME)
5255
) {

0 commit comments

Comments
 (0)