@sentry/browser 10.39.0-alpha.0 → 10.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/npm/cjs/dev/client.js +0 -7
- package/build/npm/cjs/dev/client.js.map +1 -1
- package/build/npm/cjs/dev/index.js +0 -3
- package/build/npm/cjs/dev/index.js.map +1 -1
- package/build/npm/cjs/dev/integrations/httpcontext.js +1 -25
- package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/dev/integrations/spotlight.js +0 -1
- package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/dev/profiling/UIProfiler.js +0 -10
- package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
- package/build/npm/cjs/dev/profiling/integration.js +0 -10
- package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +9 -7
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/cjs/dev/tracing/request.js +0 -1
- package/build/npm/cjs/dev/tracing/request.js.map +1 -1
- package/build/npm/cjs/prod/client.js +0 -7
- package/build/npm/cjs/prod/client.js.map +1 -1
- package/build/npm/cjs/prod/index.js +0 -3
- package/build/npm/cjs/prod/index.js.map +1 -1
- package/build/npm/cjs/prod/integrations/httpcontext.js +1 -25
- package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/cjs/prod/integrations/spotlight.js +0 -1
- package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/cjs/prod/profiling/UIProfiler.js +0 -10
- package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
- package/build/npm/cjs/prod/profiling/integration.js +0 -10
- package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +9 -7
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/cjs/prod/tracing/request.js +0 -1
- package/build/npm/cjs/prod/tracing/request.js.map +1 -1
- package/build/npm/esm/dev/client.js +0 -7
- package/build/npm/esm/dev/client.js.map +1 -1
- package/build/npm/esm/dev/index.js +1 -2
- package/build/npm/esm/dev/index.js.map +1 -1
- package/build/npm/esm/dev/integrations/httpcontext.js +2 -26
- package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/dev/integrations/spotlight.js +0 -1
- package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/dev/package.json +1 -1
- package/build/npm/esm/dev/profiling/UIProfiler.js +0 -10
- package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
- package/build/npm/esm/dev/profiling/integration.js +0 -10
- package/build/npm/esm/dev/profiling/integration.js.map +1 -1
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js +10 -8
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/esm/dev/tracing/request.js +0 -1
- package/build/npm/esm/dev/tracing/request.js.map +1 -1
- package/build/npm/esm/prod/client.js +0 -7
- package/build/npm/esm/prod/client.js.map +1 -1
- package/build/npm/esm/prod/index.js +1 -2
- package/build/npm/esm/prod/index.js.map +1 -1
- package/build/npm/esm/prod/integrations/httpcontext.js +2 -26
- package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
- package/build/npm/esm/prod/integrations/spotlight.js +0 -1
- package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
- package/build/npm/esm/prod/package.json +1 -1
- package/build/npm/esm/prod/profiling/UIProfiler.js +0 -10
- package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
- package/build/npm/esm/prod/profiling/integration.js +0 -10
- package/build/npm/esm/prod/profiling/integration.js.map +1 -1
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js +10 -8
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
- package/build/npm/esm/prod/tracing/request.js +0 -1
- package/build/npm/esm/prod/tracing/request.js.map +1 -1
- package/build/npm/types/client.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.d.ts +1 -2
- package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +1 -2
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.d.ts +1 -2
- package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +1 -2
- package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -2
- package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +1 -2
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
- package/build/npm/types/index.d.ts +1 -2
- package/build/npm/types/index.d.ts.map +1 -1
- package/build/npm/types/integrations/httpcontext.d.ts.map +1 -1
- package/build/npm/types/integrations/spotlight.d.ts.map +1 -1
- package/build/npm/types/profiling/UIProfiler.d.ts +0 -4
- package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
- package/build/npm/types/profiling/integration.d.ts.map +1 -1
- package/build/npm/types/tracing/browserTracingIntegration.d.ts +0 -8
- package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
- package/build/npm/types/tracing/request.d.ts.map +1 -1
- package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +1 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +1 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +1 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +1 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -2
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +1 -2
- package/build/npm/types-ts3.8/index.d.ts +1 -2
- package/build/npm/types-ts3.8/profiling/UIProfiler.d.ts +0 -4
- package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +0 -8
- package/package.json +7 -7
- package/build/npm/cjs/dev/integrations/spanstreaming.js +0 -87
- package/build/npm/cjs/dev/integrations/spanstreaming.js.map +0 -1
- package/build/npm/cjs/prod/integrations/spanstreaming.js +0 -87
- package/build/npm/cjs/prod/integrations/spanstreaming.js.map +0 -1
- package/build/npm/esm/dev/integrations/spanstreaming.js +0 -85
- package/build/npm/esm/dev/integrations/spanstreaming.js.map +0 -1
- package/build/npm/esm/prod/integrations/spanstreaming.js +0 -85
- package/build/npm/esm/prod/integrations/spanstreaming.js.map +0 -1
- package/build/npm/types/integrations/spanstreaming.d.ts +0 -5
- package/build/npm/types/integrations/spanstreaming.d.ts.map +0 -1
- package/build/npm/types-ts3.8/integrations/spanstreaming.d.ts +0 -5
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, debug, isV2BeforeSendSpanCallback, SpanBuffer, captureSpan, safeSetSpanJSONAttributes } from '@sentry/core';
|
|
2
|
-
import { DEBUG_BUILD } from '../debug-build.js';
|
|
3
|
-
|
|
4
|
-
const spanStreamingIntegration = defineIntegration(((userOptions) => {
|
|
5
|
-
const validatedUserProvidedBatchLimit =
|
|
6
|
-
userOptions?.batchLimit && userOptions.batchLimit <= 1000 && userOptions.batchLimit >= 1
|
|
7
|
-
? userOptions.batchLimit
|
|
8
|
-
: undefined;
|
|
9
|
-
|
|
10
|
-
if (DEBUG_BUILD && userOptions?.batchLimit && !validatedUserProvidedBatchLimit) {
|
|
11
|
-
debug.warn('SpanStreaming batchLimit must be between 1 and 1000, defaulting to 1000');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let sdkConfigured = false;
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
name: 'SpanStreaming',
|
|
18
|
-
beforeSetup(client) {
|
|
19
|
-
const clientOptions = client.getOptions();
|
|
20
|
-
if (!clientOptions.traceLifecycle) {
|
|
21
|
-
client.getOptions().traceLifecycle = 'stream';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const initialMessage = 'spanStreamingIntegration requires';
|
|
25
|
-
const fallbackMsg = 'Falling back to static trace lifecycle.';
|
|
26
|
-
|
|
27
|
-
if (!clientOptions.traceLifecycle) {
|
|
28
|
-
// For browser, we auto-enable span streaming already if this integration is enabled
|
|
29
|
-
// This avoids requiring users to manually opt into span streaming via 2 mechanisms
|
|
30
|
-
// so we set `traceLifecycle` to `stream` if it's not set.
|
|
31
|
-
client.getOptions().traceLifecycle = 'stream';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (clientOptions.traceLifecycle !== 'stream') {
|
|
35
|
-
// If there's a conflict between this integration being added and `traceLifecycle` being set to `static`
|
|
36
|
-
// we prefer static (non-span-streaming) mode.
|
|
37
|
-
DEBUG_BUILD &&
|
|
38
|
-
debug.warn(
|
|
39
|
-
`${initialMessage} \`traceLifecycle\` is set to ${clientOptions.traceLifecycle}. ${fallbackMsg}. Either remove \`spanStreamingIntegration\` or set \`traceLifecycle\` to "stream".`,
|
|
40
|
-
);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const beforeSendSpan = clientOptions.beforeSendSpan;
|
|
45
|
-
if (beforeSendSpan && !isV2BeforeSendSpanCallback(beforeSendSpan)) {
|
|
46
|
-
client.getOptions().traceLifecycle = 'static';
|
|
47
|
-
debug.warn(`${initialMessage} a beforeSendSpan callback using \`withStreamSpan\`! ${fallbackMsg}`);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
sdkConfigured = true;
|
|
52
|
-
},
|
|
53
|
-
setup(client) {
|
|
54
|
-
if (!sdkConfigured) {
|
|
55
|
-
// options validation failed in beforeSetup, so we don't do anything here
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const buffer = new SpanBuffer(client);
|
|
60
|
-
|
|
61
|
-
client.on('enqueueSpan', spanJSON => {
|
|
62
|
-
buffer.addSpan(spanJSON);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
client.on('afterSpanEnd', span => {
|
|
66
|
-
captureSpan(span, client);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
client.on('processSpan', spanJSON => {
|
|
70
|
-
safeSetSpanJSONAttributes(spanJSON, {
|
|
71
|
-
// browser-only: tell Sentry to infer the IP address from the request
|
|
72
|
-
'client.address': client.getOptions().sendDefaultPii ? '{{auto}}' : undefined,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// in addition to capturing the span, we also flush the trace when the segment
|
|
77
|
-
// span ends to ensure things are sent timely. We never know when the browser
|
|
78
|
-
// is closed, users navigate away, etc.
|
|
79
|
-
client.on('afterSegmentSpanEnd', segmentSpan => buffer.flushTrace(segmentSpan.spanContext().traceId));
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}) );
|
|
83
|
-
|
|
84
|
-
export { spanStreamingIntegration };
|
|
85
|
-
//# sourceMappingURL=spanstreaming.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spanstreaming.js","sources":["../../../../../src/integrations/spanstreaming.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport {\n captureSpan,\n debug,\n defineIntegration,\n isV2BeforeSendSpanCallback,\n safeSetSpanJSONAttributes,\n SpanBuffer,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport interface SpanStreamingOptions {\n batchLimit: number;\n}\n\nexport const spanStreamingIntegration = defineIntegration(((userOptions?: Partial<SpanStreamingOptions>) => {\n const validatedUserProvidedBatchLimit =\n userOptions?.batchLimit && userOptions.batchLimit <= 1000 && userOptions.batchLimit >= 1\n ? userOptions.batchLimit\n : undefined;\n\n if (DEBUG_BUILD && userOptions?.batchLimit && !validatedUserProvidedBatchLimit) {\n debug.warn('SpanStreaming batchLimit must be between 1 and 1000, defaulting to 1000');\n }\n\n let sdkConfigured = false;\n\n return {\n name: 'SpanStreaming',\n beforeSetup(client) {\n const clientOptions = client.getOptions();\n if (!clientOptions.traceLifecycle) {\n client.getOptions().traceLifecycle = 'stream';\n }\n\n const initialMessage = 'spanStreamingIntegration requires';\n const fallbackMsg = 'Falling back to static trace lifecycle.';\n\n if (!clientOptions.traceLifecycle) {\n // For browser, we auto-enable span streaming already if this integration is enabled\n // This avoids requiring users to manually opt into span streaming via 2 mechanisms\n // so we set `traceLifecycle` to `stream` if it's not set.\n client.getOptions().traceLifecycle = 'stream';\n }\n\n if (clientOptions.traceLifecycle !== 'stream') {\n // If there's a conflict between this integration being added and `traceLifecycle` being set to `static`\n // we prefer static (non-span-streaming) mode.\n DEBUG_BUILD &&\n debug.warn(\n `${initialMessage} \\`traceLifecycle\\` is set to ${clientOptions.traceLifecycle}. ${fallbackMsg}. Either remove \\`spanStreamingIntegration\\` or set \\`traceLifecycle\\` to \"stream\".`,\n );\n return;\n }\n\n const beforeSendSpan = clientOptions.beforeSendSpan;\n if (beforeSendSpan && !isV2BeforeSendSpanCallback(beforeSendSpan)) {\n client.getOptions().traceLifecycle = 'static';\n debug.warn(`${initialMessage} a beforeSendSpan callback using \\`withStreamSpan\\`! ${fallbackMsg}`);\n return;\n }\n\n sdkConfigured = true;\n },\n setup(client) {\n if (!sdkConfigured) {\n // options validation failed in beforeSetup, so we don't do anything here\n return;\n }\n\n const buffer = new SpanBuffer(client);\n\n client.on('enqueueSpan', spanJSON => {\n buffer.addSpan(spanJSON);\n });\n\n client.on('afterSpanEnd', span => {\n captureSpan(span, client);\n });\n\n client.on('processSpan', spanJSON => {\n safeSetSpanJSONAttributes(spanJSON, {\n // browser-only: tell Sentry to infer the IP address from the request\n 'client.address': client.getOptions().sendDefaultPii ? '{{auto}}' : undefined,\n });\n });\n\n // in addition to capturing the span, we also flush the trace when the segment\n // span ends to ensure things are sent timely. We never know when the browser\n // is closed, users navigate away, etc.\n client.on('afterSegmentSpanEnd', segmentSpan => buffer.flushTrace(segmentSpan.spanContext().traceId));\n },\n };\n}) satisfies IntegrationFn);\n"],"names":[],"mappings":";;;AAeO,MAAM,2BAA2B,iBAAiB,EAAE,CAAC,WAAW,KAAqC;AAC5G,EAAE,MAAM,+BAAA;AACR,IAAI,WAAW,EAAE,UAAA,IAAc,WAAW,CAAC,UAAA,IAAc,IAAA,IAAQ,WAAW,CAAC,cAAc;AAC3F,QAAQ,WAAW,CAAC;AACpB,QAAQ,SAAS;;AAEjB,EAAE,IAAI,WAAA,IAAe,WAAW,EAAE,UAAA,IAAc,CAAC,+BAA+B,EAAE;AAClF,IAAI,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC;AACzF,EAAE;;AAEF,EAAE,IAAI,aAAA,GAAgB,KAAK;;AAE3B,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,eAAe;AACzB,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,MAAM,MAAM,aAAA,GAAgB,MAAM,CAAC,UAAU,EAAE;AAC/C,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;AACzC,QAAQ,MAAM,CAAC,UAAU,EAAE,CAAC,cAAA,GAAiB,QAAQ;AACrD,MAAM;;AAEN,MAAM,MAAM,cAAA,GAAiB,mCAAmC;AAChE,MAAM,MAAM,WAAA,GAAc,yCAAyC;;AAEnE,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;AACzC;AACA;AACA;AACA,QAAQ,MAAM,CAAC,UAAU,EAAE,CAAC,cAAA,GAAiB,QAAQ;AACrD,MAAM;;AAEN,MAAM,IAAI,aAAa,CAAC,cAAA,KAAmB,QAAQ,EAAE;AACrD;AACA;AACA,QAAQ,WAAA;AACR,UAAU,KAAK,CAAC,IAAI;AACpB,YAAY,CAAC,EAAA,cAAA,CAAA,8BAAA,EAAA,aAAA,CAAA,cAAA,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,GAAA;AACA,CAAA;;;;"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, debug, isV2BeforeSendSpanCallback, SpanBuffer, captureSpan, safeSetSpanJSONAttributes } from '@sentry/core';
|
|
2
|
-
import { DEBUG_BUILD } from '../debug-build.js';
|
|
3
|
-
|
|
4
|
-
const spanStreamingIntegration = defineIntegration(((userOptions) => {
|
|
5
|
-
const validatedUserProvidedBatchLimit =
|
|
6
|
-
userOptions?.batchLimit && userOptions.batchLimit <= 1000 && userOptions.batchLimit >= 1
|
|
7
|
-
? userOptions.batchLimit
|
|
8
|
-
: undefined;
|
|
9
|
-
|
|
10
|
-
if (DEBUG_BUILD && userOptions?.batchLimit && !validatedUserProvidedBatchLimit) {
|
|
11
|
-
debug.warn('SpanStreaming batchLimit must be between 1 and 1000, defaulting to 1000');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let sdkConfigured = false;
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
name: 'SpanStreaming',
|
|
18
|
-
beforeSetup(client) {
|
|
19
|
-
const clientOptions = client.getOptions();
|
|
20
|
-
if (!clientOptions.traceLifecycle) {
|
|
21
|
-
client.getOptions().traceLifecycle = 'stream';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const initialMessage = 'spanStreamingIntegration requires';
|
|
25
|
-
const fallbackMsg = 'Falling back to static trace lifecycle.';
|
|
26
|
-
|
|
27
|
-
if (!clientOptions.traceLifecycle) {
|
|
28
|
-
// For browser, we auto-enable span streaming already if this integration is enabled
|
|
29
|
-
// This avoids requiring users to manually opt into span streaming via 2 mechanisms
|
|
30
|
-
// so we set `traceLifecycle` to `stream` if it's not set.
|
|
31
|
-
client.getOptions().traceLifecycle = 'stream';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (clientOptions.traceLifecycle !== 'stream') {
|
|
35
|
-
// If there's a conflict between this integration being added and `traceLifecycle` being set to `static`
|
|
36
|
-
// we prefer static (non-span-streaming) mode.
|
|
37
|
-
DEBUG_BUILD &&
|
|
38
|
-
debug.warn(
|
|
39
|
-
`${initialMessage} \`traceLifecycle\` is set to ${clientOptions.traceLifecycle}. ${fallbackMsg}. Either remove \`spanStreamingIntegration\` or set \`traceLifecycle\` to "stream".`,
|
|
40
|
-
);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const beforeSendSpan = clientOptions.beforeSendSpan;
|
|
45
|
-
if (beforeSendSpan && !isV2BeforeSendSpanCallback(beforeSendSpan)) {
|
|
46
|
-
client.getOptions().traceLifecycle = 'static';
|
|
47
|
-
debug.warn(`${initialMessage} a beforeSendSpan callback using \`withStreamSpan\`! ${fallbackMsg}`);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
sdkConfigured = true;
|
|
52
|
-
},
|
|
53
|
-
setup(client) {
|
|
54
|
-
if (!sdkConfigured) {
|
|
55
|
-
// options validation failed in beforeSetup, so we don't do anything here
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const buffer = new SpanBuffer(client);
|
|
60
|
-
|
|
61
|
-
client.on('enqueueSpan', spanJSON => {
|
|
62
|
-
buffer.addSpan(spanJSON);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
client.on('afterSpanEnd', span => {
|
|
66
|
-
captureSpan(span, client);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
client.on('processSpan', spanJSON => {
|
|
70
|
-
safeSetSpanJSONAttributes(spanJSON, {
|
|
71
|
-
// browser-only: tell Sentry to infer the IP address from the request
|
|
72
|
-
'client.address': client.getOptions().sendDefaultPii ? '{{auto}}' : undefined,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// in addition to capturing the span, we also flush the trace when the segment
|
|
77
|
-
// span ends to ensure things are sent timely. We never know when the browser
|
|
78
|
-
// is closed, users navigate away, etc.
|
|
79
|
-
client.on('afterSegmentSpanEnd', segmentSpan => buffer.flushTrace(segmentSpan.spanContext().traceId));
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}) );
|
|
83
|
-
|
|
84
|
-
export { spanStreamingIntegration };
|
|
85
|
-
//# sourceMappingURL=spanstreaming.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spanstreaming.js","sources":["../../../../../src/integrations/spanstreaming.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport {\n captureSpan,\n debug,\n defineIntegration,\n isV2BeforeSendSpanCallback,\n safeSetSpanJSONAttributes,\n SpanBuffer,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport interface SpanStreamingOptions {\n batchLimit: number;\n}\n\nexport const spanStreamingIntegration = defineIntegration(((userOptions?: Partial<SpanStreamingOptions>) => {\n const validatedUserProvidedBatchLimit =\n userOptions?.batchLimit && userOptions.batchLimit <= 1000 && userOptions.batchLimit >= 1\n ? userOptions.batchLimit\n : undefined;\n\n if (DEBUG_BUILD && userOptions?.batchLimit && !validatedUserProvidedBatchLimit) {\n debug.warn('SpanStreaming batchLimit must be between 1 and 1000, defaulting to 1000');\n }\n\n let sdkConfigured = false;\n\n return {\n name: 'SpanStreaming',\n beforeSetup(client) {\n const clientOptions = client.getOptions();\n if (!clientOptions.traceLifecycle) {\n client.getOptions().traceLifecycle = 'stream';\n }\n\n const initialMessage = 'spanStreamingIntegration requires';\n const fallbackMsg = 'Falling back to static trace lifecycle.';\n\n if (!clientOptions.traceLifecycle) {\n // For browser, we auto-enable span streaming already if this integration is enabled\n // This avoids requiring users to manually opt into span streaming via 2 mechanisms\n // so we set `traceLifecycle` to `stream` if it's not set.\n client.getOptions().traceLifecycle = 'stream';\n }\n\n if (clientOptions.traceLifecycle !== 'stream') {\n // If there's a conflict between this integration being added and `traceLifecycle` being set to `static`\n // we prefer static (non-span-streaming) mode.\n DEBUG_BUILD &&\n debug.warn(\n `${initialMessage} \\`traceLifecycle\\` is set to ${clientOptions.traceLifecycle}. ${fallbackMsg}. Either remove \\`spanStreamingIntegration\\` or set \\`traceLifecycle\\` to \"stream\".`,\n );\n return;\n }\n\n const beforeSendSpan = clientOptions.beforeSendSpan;\n if (beforeSendSpan && !isV2BeforeSendSpanCallback(beforeSendSpan)) {\n client.getOptions().traceLifecycle = 'static';\n debug.warn(`${initialMessage} a beforeSendSpan callback using \\`withStreamSpan\\`! ${fallbackMsg}`);\n return;\n }\n\n sdkConfigured = true;\n },\n setup(client) {\n if (!sdkConfigured) {\n // options validation failed in beforeSetup, so we don't do anything here\n return;\n }\n\n const buffer = new SpanBuffer(client);\n\n client.on('enqueueSpan', spanJSON => {\n buffer.addSpan(spanJSON);\n });\n\n client.on('afterSpanEnd', span => {\n captureSpan(span, client);\n });\n\n client.on('processSpan', spanJSON => {\n safeSetSpanJSONAttributes(spanJSON, {\n // browser-only: tell Sentry to infer the IP address from the request\n 'client.address': client.getOptions().sendDefaultPii ? '{{auto}}' : undefined,\n });\n });\n\n // in addition to capturing the span, we also flush the trace when the segment\n // span ends to ensure things are sent timely. We never know when the browser\n // is closed, users navigate away, etc.\n client.on('afterSegmentSpanEnd', segmentSpan => buffer.flushTrace(segmentSpan.spanContext().traceId));\n },\n };\n}) satisfies IntegrationFn);\n"],"names":[],"mappings":";;;AAeO,MAAM,2BAA2B,iBAAiB,EAAE,CAAC,WAAW,KAAqC;AAC5G,EAAE,MAAM,+BAAA;AACR,IAAI,WAAW,EAAE,UAAA,IAAc,WAAW,CAAC,UAAA,IAAc,IAAA,IAAQ,WAAW,CAAC,cAAc;AAC3F,QAAQ,WAAW,CAAC;AACpB,QAAQ,SAAS;;AAEjB,EAAE,IAAI,WAAA,IAAe,WAAW,EAAE,UAAA,IAAc,CAAC,+BAA+B,EAAE;AAClF,IAAI,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC;AACzF,EAAE;;AAEF,EAAE,IAAI,aAAA,GAAgB,KAAK;;AAE3B,EAAE,OAAO;AACT,IAAI,IAA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