@sentry/opentelemetry 7.104.0 → 8.0.0-alpha.1
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/README.md +8 -14
- package/cjs/asyncContextStrategy.js +87 -19
- package/cjs/asyncContextStrategy.js.map +1 -1
- package/cjs/constants.js +14 -0
- package/cjs/constants.js.map +1 -1
- package/cjs/contextManager.js +37 -15
- package/cjs/contextManager.js.map +1 -1
- package/cjs/custom/client.js +0 -28
- package/cjs/custom/client.js.map +1 -1
- package/cjs/custom/getCurrentHub.js +106 -0
- package/cjs/custom/getCurrentHub.js.map +1 -0
- package/cjs/custom/hub.js +3 -136
- package/cjs/custom/hub.js.map +1 -1
- package/cjs/custom/transaction.js +3 -32
- package/cjs/custom/transaction.js.map +1 -1
- package/cjs/index.js +7 -7
- package/cjs/index.js.map +1 -1
- package/cjs/propagator.js +39 -12
- package/cjs/propagator.js.map +1 -1
- package/cjs/sampler.js +0 -1
- package/cjs/sampler.js.map +1 -1
- package/cjs/semanticAttributes.js +0 -9
- package/cjs/semanticAttributes.js.map +1 -1
- package/cjs/setupEventContextTrace.js +12 -7
- package/cjs/setupEventContextTrace.js.map +1 -1
- package/cjs/spanExporter.js +69 -58
- package/cjs/spanExporter.js.map +1 -1
- package/cjs/spanProcessor.js +14 -19
- package/cjs/spanProcessor.js.map +1 -1
- package/cjs/trace.js +120 -23
- package/cjs/trace.js.map +1 -1
- package/cjs/utils/addOriginToSpan.js +2 -2
- package/cjs/utils/addOriginToSpan.js.map +1 -1
- package/cjs/utils/contextData.js +38 -0
- package/cjs/utils/contextData.js.map +1 -1
- package/cjs/utils/dynamicSamplingContext.js +64 -0
- package/cjs/utils/dynamicSamplingContext.js.map +1 -0
- package/cjs/utils/spanData.js +23 -23
- package/cjs/utils/spanData.js.map +1 -1
- package/esm/asyncContextStrategy.js +89 -18
- package/esm/asyncContextStrategy.js.map +1 -1
- package/esm/constants.js +10 -1
- package/esm/constants.js.map +1 -1
- package/esm/contextManager.js +36 -17
- package/esm/contextManager.js.map +1 -1
- package/esm/custom/client.js +0 -28
- package/esm/custom/client.js.map +1 -1
- package/esm/custom/getCurrentHub.js +101 -0
- package/esm/custom/getCurrentHub.js.map +1 -0
- package/esm/custom/hub.js +4 -133
- package/esm/custom/hub.js.map +1 -1
- package/esm/custom/transaction.js +4 -32
- package/esm/custom/transaction.js.map +1 -1
- package/esm/index.js +6 -5
- package/esm/index.js.map +1 -1
- package/esm/propagator.js +42 -15
- package/esm/propagator.js.map +1 -1
- package/esm/sampler.js +0 -1
- package/esm/sampler.js.map +1 -1
- package/esm/semanticAttributes.js +0 -9
- package/esm/semanticAttributes.js.map +1 -1
- package/esm/setupEventContextTrace.js +14 -9
- package/esm/setupEventContextTrace.js.map +1 -1
- package/esm/spanExporter.js +70 -59
- package/esm/spanExporter.js.map +1 -1
- package/esm/spanProcessor.js +10 -15
- package/esm/spanProcessor.js.map +1 -1
- package/esm/trace.js +122 -26
- package/esm/trace.js.map +1 -1
- package/esm/utils/addOriginToSpan.js +2 -2
- package/esm/utils/addOriginToSpan.js.map +1 -1
- package/esm/utils/contextData.js +36 -2
- package/esm/utils/contextData.js.map +1 -1
- package/esm/utils/dynamicSamplingContext.js +59 -0
- package/esm/utils/dynamicSamplingContext.js.map +1 -0
- package/esm/utils/spanData.js +22 -20
- package/esm/utils/spanData.js.map +1 -1
- package/package.json +5 -5
- package/types/asyncContextStrategy.d.ts.map +1 -1
- package/types/constants.d.ts +5 -0
- package/types/constants.d.ts.map +1 -1
- package/types/contextManager.d.ts +1 -1
- package/types/contextManager.d.ts.map +1 -1
- package/types/custom/client.d.ts.map +1 -1
- package/types/custom/getCurrentHub.d.ts +7 -0
- package/types/custom/getCurrentHub.d.ts.map +1 -0
- package/types/custom/hub.d.ts +2 -33
- package/types/custom/hub.d.ts.map +1 -1
- package/types/custom/transaction.d.ts +1 -10
- package/types/custom/transaction.d.ts.map +1 -1
- package/types/index.d.ts +6 -5
- package/types/index.d.ts.map +1 -1
- package/types/propagator.d.ts.map +1 -1
- package/types/semanticAttributes.d.ts +0 -9
- package/types/semanticAttributes.d.ts.map +1 -1
- package/types/setupEventContextTrace.d.ts.map +1 -1
- package/types/spanExporter.d.ts.map +1 -1
- package/types/spanProcessor.d.ts +1 -5
- package/types/spanProcessor.d.ts.map +1 -1
- package/types/trace.d.ts +14 -3
- package/types/trace.d.ts.map +1 -1
- package/types/types.d.ts +7 -12
- package/types/types.d.ts.map +1 -1
- package/types/utils/addOriginToSpan.d.ts.map +1 -1
- package/types/utils/contextData.d.ts +22 -1
- package/types/utils/contextData.d.ts.map +1 -1
- package/types/utils/dynamicSamplingContext.d.ts +11 -0
- package/types/utils/dynamicSamplingContext.d.ts.map +1 -0
- package/types/utils/spanData.d.ts +14 -8
- package/types/utils/spanData.d.ts.map +1 -1
- package/types-ts3.8/constants.d.ts +5 -0
- package/types-ts3.8/contextManager.d.ts +1 -1
- package/types-ts3.8/custom/getCurrentHub.d.ts +7 -0
- package/types-ts3.8/custom/hub.d.ts +2 -33
- package/types-ts3.8/custom/transaction.d.ts +1 -10
- package/types-ts3.8/index.d.ts +6 -5
- package/types-ts3.8/semanticAttributes.d.ts +0 -9
- package/types-ts3.8/spanProcessor.d.ts +1 -5
- package/types-ts3.8/trace.d.ts +14 -3
- package/types-ts3.8/types.d.ts +7 -12
- package/types-ts3.8/utils/contextData.d.ts +22 -1
- package/types-ts3.8/utils/dynamicSamplingContext.d.ts +11 -0
- package/types-ts3.8/utils/spanData.d.ts +14 -8
- package/cjs/custom/scope.js +0 -202
- package/cjs/custom/scope.js.map +0 -1
- package/esm/custom/scope.js +0 -200
- package/esm/custom/scope.js.map +0 -1
- package/types/custom/scope.d.ts +0 -42
- package/types/custom/scope.d.ts.map +0 -1
- package/types-ts3.8/custom/scope.d.ts +0 -42
package/esm/trace.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { suppressTracing } from '@opentelemetry/core';
|
|
3
|
-
import { handleCallbackErrors, SDK_VERSION } from '@sentry/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { trace, SpanStatusCode, context, TraceFlags } from '@opentelemetry/api';
|
|
2
|
+
import { suppressTracing, TraceState } from '@opentelemetry/core';
|
|
3
|
+
import { handleCallbackErrors, getCurrentScope, getClient, SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
|
|
4
|
+
import { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';
|
|
5
|
+
import { SENTRY_TRACE_STATE_DSC } from './constants.js';
|
|
6
|
+
import { getContextFromScope } from './utils/contextData.js';
|
|
7
|
+
import { getDynamicSamplingContextFromSpan } from './utils/dynamicSamplingContext.js';
|
|
8
|
+
import { getRootSpan } from './utils/getActiveSpan.js';
|
|
6
9
|
import { setSpanMetadata } from './utils/spanData.js';
|
|
7
10
|
|
|
8
11
|
/**
|
|
@@ -14,17 +17,19 @@ import { setSpanMetadata } from './utils/spanData.js';
|
|
|
14
17
|
*
|
|
15
18
|
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
|
|
16
19
|
*/
|
|
17
|
-
function startSpan(
|
|
20
|
+
function startSpan(options, callback) {
|
|
18
21
|
const tracer = getTracer();
|
|
19
22
|
|
|
20
|
-
const { name } =
|
|
23
|
+
const { name } = options;
|
|
21
24
|
|
|
22
|
-
const activeCtx =
|
|
23
|
-
const shouldSkipSpan =
|
|
25
|
+
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
26
|
+
const shouldSkipSpan = options.onlyIfParent && !trace.getSpan(activeCtx);
|
|
24
27
|
const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;
|
|
25
28
|
|
|
29
|
+
const spanContext = getSpanContext(options);
|
|
30
|
+
|
|
26
31
|
return tracer.startActiveSpan(name, spanContext, ctx, span => {
|
|
27
|
-
_applySentryAttributesToSpan(span,
|
|
32
|
+
_applySentryAttributesToSpan(span, options);
|
|
28
33
|
|
|
29
34
|
return handleCallbackErrors(
|
|
30
35
|
() => callback(span),
|
|
@@ -45,17 +50,19 @@ function startSpan(spanContext, callback) {
|
|
|
45
50
|
*
|
|
46
51
|
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
|
|
47
52
|
*/
|
|
48
|
-
function startSpanManual(
|
|
53
|
+
function startSpanManual(options, callback) {
|
|
49
54
|
const tracer = getTracer();
|
|
50
55
|
|
|
51
|
-
const { name } =
|
|
56
|
+
const { name } = options;
|
|
52
57
|
|
|
53
|
-
const activeCtx =
|
|
54
|
-
const shouldSkipSpan =
|
|
58
|
+
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
59
|
+
const shouldSkipSpan = options.onlyIfParent && !trace.getSpan(activeCtx);
|
|
55
60
|
const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;
|
|
56
61
|
|
|
62
|
+
const spanContext = getSpanContext(options);
|
|
63
|
+
|
|
57
64
|
return tracer.startActiveSpan(name, spanContext, ctx, span => {
|
|
58
|
-
_applySentryAttributesToSpan(span,
|
|
65
|
+
_applySentryAttributesToSpan(span, options);
|
|
59
66
|
|
|
60
67
|
return handleCallbackErrors(
|
|
61
68
|
() => callback(span),
|
|
@@ -76,40 +83,57 @@ function startSpanManual(spanContext, callback) {
|
|
|
76
83
|
* or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans
|
|
77
84
|
* and the `span` returned from the callback will be undefined.
|
|
78
85
|
*/
|
|
79
|
-
function startInactiveSpan(
|
|
86
|
+
function startInactiveSpan(options) {
|
|
80
87
|
const tracer = getTracer();
|
|
81
88
|
|
|
82
|
-
const { name } =
|
|
89
|
+
const { name } = options;
|
|
83
90
|
|
|
84
|
-
const activeCtx =
|
|
85
|
-
const shouldSkipSpan =
|
|
91
|
+
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
92
|
+
const shouldSkipSpan = options.onlyIfParent && !trace.getSpan(activeCtx);
|
|
86
93
|
const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;
|
|
87
94
|
|
|
95
|
+
const spanContext = getSpanContext(options);
|
|
96
|
+
|
|
88
97
|
const span = tracer.startSpan(name, spanContext, ctx);
|
|
89
98
|
|
|
90
|
-
_applySentryAttributesToSpan(span,
|
|
99
|
+
_applySentryAttributesToSpan(span, options);
|
|
91
100
|
|
|
92
101
|
return span;
|
|
93
102
|
}
|
|
94
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Forks the current scope and sets the provided span as active span in the context of the provided callback. Can be
|
|
106
|
+
* passed `null` to start an entirely new span tree.
|
|
107
|
+
*
|
|
108
|
+
* @param span Spans started in the context of the provided callback will be children of this span. If `null` is passed,
|
|
109
|
+
* spans started within the callback will not be attached to a parent span.
|
|
110
|
+
* @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.
|
|
111
|
+
* @returns the value returned from the provided callback function.
|
|
112
|
+
*/
|
|
113
|
+
function withActiveSpan(span, callback) {
|
|
114
|
+
const newContextWithActiveSpan = span ? trace.setSpan(context.active(), span) : trace.deleteSpan(context.active());
|
|
115
|
+
return context.with(newContextWithActiveSpan, () => callback(getCurrentScope()));
|
|
116
|
+
}
|
|
117
|
+
|
|
95
118
|
function getTracer() {
|
|
96
119
|
const client = getClient();
|
|
97
120
|
return (client && client.tracer) || trace.getTracer('@sentry/opentelemetry', SDK_VERSION);
|
|
98
121
|
}
|
|
99
122
|
|
|
100
|
-
function _applySentryAttributesToSpan(span,
|
|
101
|
-
|
|
123
|
+
function _applySentryAttributesToSpan(span, options) {
|
|
124
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
125
|
+
const { origin, op, source, metadata } = options;
|
|
102
126
|
|
|
103
127
|
if (origin) {
|
|
104
|
-
span.setAttribute(
|
|
128
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
|
|
105
129
|
}
|
|
106
130
|
|
|
107
131
|
if (op) {
|
|
108
|
-
span.setAttribute(
|
|
132
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, op);
|
|
109
133
|
}
|
|
110
134
|
|
|
111
135
|
if (source) {
|
|
112
|
-
span.setAttribute(
|
|
136
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
|
|
113
137
|
}
|
|
114
138
|
|
|
115
139
|
if (metadata) {
|
|
@@ -117,5 +141,77 @@ function _applySentryAttributesToSpan(span, spanContext) {
|
|
|
117
141
|
}
|
|
118
142
|
}
|
|
119
143
|
|
|
120
|
-
|
|
144
|
+
function getSpanContext(options) {
|
|
145
|
+
const { startTime, attributes, kind } = options;
|
|
146
|
+
|
|
147
|
+
// OTEL expects timestamps in ms, not seconds
|
|
148
|
+
const fixedStartTime = typeof startTime === 'number' ? ensureTimestampInMilliseconds(startTime) : startTime;
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
attributes,
|
|
152
|
+
kind,
|
|
153
|
+
startTime: fixedStartTime,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function ensureTimestampInMilliseconds(timestamp) {
|
|
158
|
+
const isMs = timestamp < 9999999999;
|
|
159
|
+
return isMs ? timestamp * 1000 : timestamp;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function getContext(scope, forceTransaction) {
|
|
163
|
+
const ctx = getContextForScope(scope);
|
|
164
|
+
|
|
165
|
+
if (!forceTransaction) {
|
|
166
|
+
return ctx;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Else we need to "fix" the context to have no parent span
|
|
170
|
+
const parentSpan = trace.getSpan(ctx);
|
|
171
|
+
|
|
172
|
+
// If there is no parent span, all good, nothing to do!
|
|
173
|
+
if (!parentSpan) {
|
|
174
|
+
return ctx;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Else, we need to do two things:
|
|
178
|
+
// 1. Unset the parent span from the context, so we'll create a new root span
|
|
179
|
+
// 2. Ensure the propagation context is correct, so we'll continue from the parent span
|
|
180
|
+
const ctxWithoutSpan = trace.deleteSpan(ctx);
|
|
181
|
+
|
|
182
|
+
const { spanId, traceId, traceFlags } = parentSpan.spanContext();
|
|
183
|
+
// eslint-disable-next-line no-bitwise
|
|
184
|
+
const sampled = Boolean(traceFlags & TraceFlags.SAMPLED);
|
|
185
|
+
|
|
186
|
+
const rootSpan = getRootSpan(parentSpan);
|
|
187
|
+
const dsc = getDynamicSamplingContextFromSpan(rootSpan);
|
|
188
|
+
const dscString = dynamicSamplingContextToSentryBaggageHeader(dsc);
|
|
189
|
+
|
|
190
|
+
const traceState = dscString ? new TraceState().set(SENTRY_TRACE_STATE_DSC, dscString) : undefined;
|
|
191
|
+
|
|
192
|
+
const spanContext = {
|
|
193
|
+
traceId,
|
|
194
|
+
spanId,
|
|
195
|
+
isRemote: true,
|
|
196
|
+
traceFlags: sampled ? TraceFlags.SAMPLED : TraceFlags.NONE,
|
|
197
|
+
traceState,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const ctxWithSpanContext = trace.setSpanContext(ctxWithoutSpan, spanContext);
|
|
201
|
+
|
|
202
|
+
return ctxWithSpanContext;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function getContextForScope(scope) {
|
|
206
|
+
if (scope) {
|
|
207
|
+
const ctx = getContextFromScope(scope);
|
|
208
|
+
if (ctx) {
|
|
209
|
+
return ctx;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return context.active();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { startInactiveSpan, startSpan, startSpanManual, withActiveSpan };
|
|
121
217
|
//# sourceMappingURL=trace.js.map
|
package/esm/trace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.js","sources":["../../src/trace.ts"],"sourcesContent":["import type { Span, Tracer } from '@opentelemetry/api';\nimport { context } from '@opentelemetry/api';\nimport { SpanStatusCode, trace } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport { SDK_VERSION, handleCallbackErrors } from '@sentry/core';\nimport type { Client } from '@sentry/types';\n\nimport { getClient } from './custom/hub';\nimport { InternalSentrySemanticAttributes } from './semanticAttributes';\nimport type { OpenTelemetryClient, OpenTelemetrySpanContext } from './types';\nimport { setSpanMetadata } from './utils/spanData';\n\n/**\n * Wraps a function with a transaction/span and finishes the span after the function is done.\n * The created span is the active span and will be used as parent by other spans created inside the function\n * and can be accessed via `Sentry.getSpan()`, as long as the function is executed while the scope is active.\n *\n * If you want to create a span that is not set as active, use {@link startInactiveSpan}.\n *\n * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.\n */\nexport function startSpan<T>(spanContext: OpenTelemetrySpanContext, callback: (span: Span) => T): T {\n const tracer = getTracer();\n\n const { name } = spanContext;\n\n const activeCtx = context.active();\n const shouldSkipSpan = spanContext.onlyIfParent && !trace.getSpan(activeCtx);\n const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;\n\n return tracer.startActiveSpan(name, spanContext, ctx, span => {\n _applySentryAttributesToSpan(span, spanContext);\n\n return handleCallbackErrors(\n () => callback(span),\n () => {\n span.setStatus({ code: SpanStatusCode.ERROR });\n },\n () => span.end(),\n );\n });\n}\n\n/**\n * Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span\n * after the function is done automatically. You'll have to call `span.end()` manually.\n *\n * The created span is the active span and will be used as parent by other spans created inside the function\n * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.\n *\n * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.\n */\nexport function startSpanManual<T>(spanContext: OpenTelemetrySpanContext, callback: (span: Span) => T): T {\n const tracer = getTracer();\n\n const { name } = spanContext;\n\n const activeCtx = context.active();\n const shouldSkipSpan = spanContext.onlyIfParent && !trace.getSpan(activeCtx);\n const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;\n\n return tracer.startActiveSpan(name, spanContext, ctx, span => {\n _applySentryAttributesToSpan(span, spanContext);\n\n return handleCallbackErrors(\n () => callback(span),\n () => {\n span.setStatus({ code: SpanStatusCode.ERROR });\n },\n );\n });\n}\n\n/**\n * @deprecated Use {@link startSpan} instead.\n */\nexport const startActiveSpan = startSpan;\n\n/**\n * Creates a span. This span is not set as active, so will not get automatic instrumentation spans\n * as children or be able to be accessed via `Sentry.getSpan()`.\n *\n * If you want to create a span that is set as active, use {@link startSpan}.\n *\n * Note that if you have not enabled tracing extensions via `addTracingExtensions`\n * or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans\n * and the `span` returned from the callback will be undefined.\n */\nexport function startInactiveSpan(spanContext: OpenTelemetrySpanContext): Span {\n const tracer = getTracer();\n\n const { name } = spanContext;\n\n const activeCtx = context.active();\n const shouldSkipSpan = spanContext.onlyIfParent && !trace.getSpan(activeCtx);\n const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;\n\n const span = tracer.startSpan(name, spanContext, ctx);\n\n _applySentryAttributesToSpan(span, spanContext);\n\n return span;\n}\n\nfunction getTracer(): Tracer {\n const client = getClient<Client & OpenTelemetryClient>();\n return (client && client.tracer) || trace.getTracer('@sentry/opentelemetry', SDK_VERSION);\n}\n\nfunction _applySentryAttributesToSpan(span: Span, spanContext: OpenTelemetrySpanContext): void {\n const { origin, op, source, metadata } = spanContext;\n\n if (origin) {\n span.setAttribute(InternalSentrySemanticAttributes.ORIGIN, origin);\n }\n\n if (op) {\n span.setAttribute(InternalSentrySemanticAttributes.OP, op);\n }\n\n if (source) {\n span.setAttribute(InternalSentrySemanticAttributes.SOURCE, source);\n }\n\n if (metadata) {\n setSpanMetadata(span, metadata);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAI,WAAW,EAA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,MAAA,IAAU,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAA;AAC3F,CAAA;AACA;AACA,SAAS,4BAA4B,CAAC,IAAI,EAAQ,WAAW,EAAkC;AAC/F,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAA,EAAW,GAAE,WAAW,CAAA;AACtD;AACA,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,IAAI,CAAC,YAAY,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACtE,GAAE;AACF;AACA,EAAE,IAAI,EAAE,EAAE;AACV,IAAI,IAAI,CAAC,YAAY,CAAC,gCAAgC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;AAC9D,GAAE;AACF;AACA,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,IAAI,CAAC,YAAY,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACtE,GAAE;AACF;AACA,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACnC,GAAE;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"trace.js","sources":["../../src/trace.ts"],"sourcesContent":["import type { Context, Span, SpanContext, SpanOptions, Tracer } from '@opentelemetry/api';\nimport { TraceFlags } from '@opentelemetry/api';\nimport { context } from '@opentelemetry/api';\nimport { SpanStatusCode, trace } from '@opentelemetry/api';\nimport { TraceState, suppressTracing } from '@opentelemetry/core';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n getClient,\n getCurrentScope,\n handleCallbackErrors,\n} from '@sentry/core';\nimport type { Client, Scope } from '@sentry/types';\nimport { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';\nimport { SENTRY_TRACE_STATE_DSC } from './constants';\n\nimport type { OpenTelemetryClient, OpenTelemetrySpanContext } from './types';\nimport { getContextFromScope } from './utils/contextData';\nimport { getDynamicSamplingContextFromSpan } from './utils/dynamicSamplingContext';\nimport { getRootSpan } from './utils/getActiveSpan';\nimport { setSpanMetadata } from './utils/spanData';\n\n/**\n * Wraps a function with a transaction/span and finishes the span after the function is done.\n * The created span is the active span and will be used as parent by other spans created inside the function\n * and can be accessed via `Sentry.getSpan()`, as long as the function is executed while the scope is active.\n *\n * If you want to create a span that is not set as active, use {@link startInactiveSpan}.\n *\n * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.\n */\nexport function startSpan<T>(options: OpenTelemetrySpanContext, callback: (span: Span) => T): T {\n const tracer = getTracer();\n\n const { name } = options;\n\n const activeCtx = getContext(options.scope, options.forceTransaction);\n const shouldSkipSpan = options.onlyIfParent && !trace.getSpan(activeCtx);\n const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;\n\n const spanContext = getSpanContext(options);\n\n return tracer.startActiveSpan(name, spanContext, ctx, span => {\n _applySentryAttributesToSpan(span, options);\n\n return handleCallbackErrors(\n () => callback(span),\n () => {\n span.setStatus({ code: SpanStatusCode.ERROR });\n },\n () => span.end(),\n );\n });\n}\n\n/**\n * Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span\n * after the function is done automatically. You'll have to call `span.end()` manually.\n *\n * The created span is the active span and will be used as parent by other spans created inside the function\n * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.\n *\n * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.\n */\nexport function startSpanManual<T>(options: OpenTelemetrySpanContext, callback: (span: Span) => T): T {\n const tracer = getTracer();\n\n const { name } = options;\n\n const activeCtx = getContext(options.scope, options.forceTransaction);\n const shouldSkipSpan = options.onlyIfParent && !trace.getSpan(activeCtx);\n const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;\n\n const spanContext = getSpanContext(options);\n\n return tracer.startActiveSpan(name, spanContext, ctx, span => {\n _applySentryAttributesToSpan(span, options);\n\n return handleCallbackErrors(\n () => callback(span),\n () => {\n span.setStatus({ code: SpanStatusCode.ERROR });\n },\n );\n });\n}\n\n/**\n * @deprecated Use {@link startSpan} instead.\n */\nexport const startActiveSpan = startSpan;\n\n/**\n * Creates a span. This span is not set as active, so will not get automatic instrumentation spans\n * as children or be able to be accessed via `Sentry.getSpan()`.\n *\n * If you want to create a span that is set as active, use {@link startSpan}.\n *\n * Note that if you have not enabled tracing extensions via `addTracingExtensions`\n * or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans\n * and the `span` returned from the callback will be undefined.\n */\nexport function startInactiveSpan(options: OpenTelemetrySpanContext): Span {\n const tracer = getTracer();\n\n const { name } = options;\n\n const activeCtx = getContext(options.scope, options.forceTransaction);\n const shouldSkipSpan = options.onlyIfParent && !trace.getSpan(activeCtx);\n const ctx = shouldSkipSpan ? suppressTracing(activeCtx) : activeCtx;\n\n const spanContext = getSpanContext(options);\n\n const span = tracer.startSpan(name, spanContext, ctx);\n\n _applySentryAttributesToSpan(span, options);\n\n return span;\n}\n\n/**\n * Forks the current scope and sets the provided span as active span in the context of the provided callback. Can be\n * passed `null` to start an entirely new span tree.\n *\n * @param span Spans started in the context of the provided callback will be children of this span. If `null` is passed,\n * spans started within the callback will not be attached to a parent span.\n * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.\n * @returns the value returned from the provided callback function.\n */\nexport function withActiveSpan<T>(span: Span | null, callback: (scope: Scope) => T): T {\n const newContextWithActiveSpan = span ? trace.setSpan(context.active(), span) : trace.deleteSpan(context.active());\n return context.with(newContextWithActiveSpan, () => callback(getCurrentScope()));\n}\n\nfunction getTracer(): Tracer {\n const client = getClient<Client & OpenTelemetryClient>();\n return (client && client.tracer) || trace.getTracer('@sentry/opentelemetry', SDK_VERSION);\n}\n\nfunction _applySentryAttributesToSpan(span: Span, options: OpenTelemetrySpanContext): void {\n // eslint-disable-next-line deprecation/deprecation\n const { origin, op, source, metadata } = options;\n\n if (origin) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);\n }\n\n if (op) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, op);\n }\n\n if (source) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n }\n\n if (metadata) {\n setSpanMetadata(span, metadata);\n }\n}\n\nfunction getSpanContext(options: OpenTelemetrySpanContext): SpanOptions {\n const { startTime, attributes, kind } = options;\n\n // OTEL expects timestamps in ms, not seconds\n const fixedStartTime = typeof startTime === 'number' ? ensureTimestampInMilliseconds(startTime) : startTime;\n\n return {\n attributes,\n kind,\n startTime: fixedStartTime,\n };\n}\n\nfunction ensureTimestampInMilliseconds(timestamp: number): number {\n const isMs = timestamp < 9999999999;\n return isMs ? timestamp * 1000 : timestamp;\n}\n\nfunction getContext(scope: Scope | undefined, forceTransaction: boolean | undefined): Context {\n const ctx = getContextForScope(scope);\n\n if (!forceTransaction) {\n return ctx;\n }\n\n // Else we need to \"fix\" the context to have no parent span\n const parentSpan = trace.getSpan(ctx);\n\n // If there is no parent span, all good, nothing to do!\n if (!parentSpan) {\n return ctx;\n }\n\n // Else, we need to do two things:\n // 1. Unset the parent span from the context, so we'll create a new root span\n // 2. Ensure the propagation context is correct, so we'll continue from the parent span\n const ctxWithoutSpan = trace.deleteSpan(ctx);\n\n const { spanId, traceId, traceFlags } = parentSpan.spanContext();\n // eslint-disable-next-line no-bitwise\n const sampled = Boolean(traceFlags & TraceFlags.SAMPLED);\n\n const rootSpan = getRootSpan(parentSpan);\n const dsc = getDynamicSamplingContextFromSpan(rootSpan);\n const dscString = dynamicSamplingContextToSentryBaggageHeader(dsc);\n\n const traceState = dscString ? new TraceState().set(SENTRY_TRACE_STATE_DSC, dscString) : undefined;\n\n const spanContext: SpanContext = {\n traceId,\n spanId,\n isRemote: true,\n traceFlags: sampled ? TraceFlags.SAMPLED : TraceFlags.NONE,\n traceState,\n };\n\n const ctxWithSpanContext = trace.setSpanContext(ctxWithoutSpan, spanContext);\n\n return ctxWithSpanContext;\n}\n\nfunction getContextForScope(scope?: Scope): Context {\n if (scope) {\n const ctx = getContextFromScope(scope);\n if (ctx) {\n return ctx;\n }\n }\n\n return context.active();\n}\n"],"names":[],"mappings":";;;;;;;;;;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAI,OAAO,EAA4B,QAAQ,EAAwB;AAChG,EAAE,MAAM,MAAA,GAAS,SAAS,EAAE,CAAA;AAC5B;AACA,EAAE,MAAM,EAAE,IAAK,EAAA,GAAI,OAAO,CAAA;AAC1B;AACA,EAAE,MAAM,SAAA,GAAY,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;AACvE,EAAE,MAAM,cAAA,GAAiB,OAAO,CAAC,YAAA,IAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AAC1E,EAAE,MAAM,GAAI,GAAE,cAAe,GAAE,eAAe,CAAC,SAAS,CAAE,GAAE,SAAS,CAAA;AACrE;AACA,EAAE,MAAM,WAAY,GAAE,cAAc,CAAC,OAAO,CAAC,CAAA;AAC7C;AACA,EAAE,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAA,IAAQ;AAChE,IAAI,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC/C;AACA,IAAI,OAAO,oBAAoB;AAC/B,MAAM,MAAM,QAAQ,CAAC,IAAI,CAAC;AAC1B,MAAM,MAAM;AACZ,QAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAM,EAAC,CAAC,CAAA;AACtD,OAAO;AACP,MAAM,MAAM,IAAI,CAAC,GAAG,EAAE;AACtB,KAAK,CAAA;AACL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,mBAAmB,CAAC,KAAK,CAAC,CAAA;AAC1C,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,OAAO,GAAG,CAAA;AAChB,KAAI;AACJ,GAAE;AACF;AACA,EAAE,OAAO,OAAO,CAAC,MAAM,EAAE,CAAA;AACzB;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
2
|
|
|
3
3
|
/** Adds an origin to an OTEL Span. */
|
|
4
4
|
function addOriginToSpan(span, origin) {
|
|
5
|
-
span.setAttribute(
|
|
5
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { addOriginToSpan };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addOriginToSpan.js","sources":["../../../src/utils/addOriginToSpan.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport
|
|
1
|
+
{"version":3,"file":"addOriginToSpan.js","sources":["../../../src/utils/addOriginToSpan.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport type { SpanOrigin } from '@sentry/types';\n\n/** Adds an origin to an OTEL Span. */\nexport function addOriginToSpan(span: Span, origin: SpanOrigin): void {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);\n}\n"],"names":[],"mappings":";;AAIA;AACO,SAAS,eAAe,CAAC,IAAI,EAAQ,MAAM,EAAoB;AACtE,EAAE,IAAI,CAAC,YAAY,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAAA;AAC7D;;;;"}
|
package/esm/utils/contextData.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, SENTRY_HUB_CONTEXT_KEY } from '../constants.js';
|
|
1
|
+
import { SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, SENTRY_SCOPES_CONTEXT_KEY, SENTRY_HUB_CONTEXT_KEY } from '../constants.js';
|
|
2
|
+
|
|
3
|
+
const SCOPE_CONTEXT_MAP = new WeakMap();
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Try to get the Propagation Context from the given OTEL context.
|
|
@@ -32,5 +34,37 @@ function setHubOnContext(context, hub) {
|
|
|
32
34
|
return context.setValue(SENTRY_HUB_CONTEXT_KEY, hub);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Try to get the current scopes from the given OTEL context.
|
|
39
|
+
* This requires a Context Manager that was wrapped with getWrappedContextManager.
|
|
40
|
+
*/
|
|
41
|
+
function getScopesFromContext(context) {
|
|
42
|
+
return context.getValue(SENTRY_SCOPES_CONTEXT_KEY) ;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Set the current scopes on an OTEL context.
|
|
47
|
+
* This will return a forked context with the Propagation Context set.
|
|
48
|
+
*/
|
|
49
|
+
function setScopesOnContext(context, scopes) {
|
|
50
|
+
return context.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Set the context on the scope so we can later look it up.
|
|
55
|
+
* We need this to get the context from the scope in the `trace` functions.
|
|
56
|
+
*/
|
|
57
|
+
function setContextOnScope(scope, context) {
|
|
58
|
+
SCOPE_CONTEXT_MAP.set(scope, context);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the context related to a scope.
|
|
63
|
+
* TODO v8: Use this for the `trace` functions.
|
|
64
|
+
* */
|
|
65
|
+
function getContextFromScope(scope) {
|
|
66
|
+
return SCOPE_CONTEXT_MAP.get(scope);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { getContextFromScope, getHubFromContext, getPropagationContextFromContext, getScopesFromContext, setContextOnScope, setHubOnContext, setPropagationContextOnContext, setScopesOnContext };
|
|
36
70
|
//# sourceMappingURL=contextData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextData.js","sources":["../../../src/utils/contextData.ts"],"sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport type { Hub, PropagationContext } from '@sentry/types';\n\nimport {
|
|
1
|
+
{"version":3,"file":"contextData.js","sources":["../../../src/utils/contextData.ts"],"sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport type { Hub, PropagationContext, Scope } from '@sentry/types';\n\nimport {\n SENTRY_HUB_CONTEXT_KEY,\n SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY,\n SENTRY_SCOPES_CONTEXT_KEY,\n} from '../constants';\nimport type { CurrentScopes } from '../types';\n\nconst SCOPE_CONTEXT_MAP = new WeakMap<Scope, Context>();\n\n/**\n * Try to get the Propagation Context from the given OTEL context.\n * This requires the SentryPropagator to be registered.\n */\nexport function getPropagationContextFromContext(context: Context): PropagationContext | undefined {\n return context.getValue(SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY) as PropagationContext | undefined;\n}\n\n/**\n * Set a Propagation Context on an OTEL context..\n * This will return a forked context with the Propagation Context set.\n */\nexport function setPropagationContextOnContext(context: Context, propagationContext: PropagationContext): Context {\n return context.setValue(SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, propagationContext);\n}\n\n/**\n * Try to get the Hub from the given OTEL context.\n * This requires a Context Manager that was wrapped with getWrappedContextManager.\n */\nexport function getHubFromContext(context: Context): Hub | undefined {\n return context.getValue(SENTRY_HUB_CONTEXT_KEY) as Hub | undefined;\n}\n\n/**\n * Set a Hub on an OTEL context..\n * This will return a forked context with the Propagation Context set.\n */\nexport function setHubOnContext(context: Context, hub: Hub): Context {\n return context.setValue(SENTRY_HUB_CONTEXT_KEY, hub);\n}\n\n/**\n * Try to get the current scopes from the given OTEL context.\n * This requires a Context Manager that was wrapped with getWrappedContextManager.\n */\nexport function getScopesFromContext(context: Context): CurrentScopes | undefined {\n return context.getValue(SENTRY_SCOPES_CONTEXT_KEY) as CurrentScopes | undefined;\n}\n\n/**\n * Set the current scopes on an OTEL context.\n * This will return a forked context with the Propagation Context set.\n */\nexport function setScopesOnContext(context: Context, scopes: CurrentScopes): Context {\n return context.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);\n}\n\n/**\n * Set the context on the scope so we can later look it up.\n * We need this to get the context from the scope in the `trace` functions.\n */\nexport function setContextOnScope(scope: Scope, context: Context): void {\n SCOPE_CONTEXT_MAP.set(scope, context);\n}\n\n/**\n * Get the context related to a scope.\n * TODO v8: Use this for the `trace` functions.\n * */\nexport function getContextFromScope(scope: Scope): Context | undefined {\n return SCOPE_CONTEXT_MAP.get(scope);\n}\n"],"names":[],"mappings":";;AAUA,MAAM,iBAAkB,GAAE,IAAI,OAAO,EAAkB,CAAA;AACvD;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA2C;AACnG,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sCAAsC,CAAE,EAAA;AAClE,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,OAAO,EAAW,kBAAkB,EAA+B;AAClH,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sCAAsC,EAAE,kBAAkB,CAAC,CAAA;AACrF,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAA4B;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;AACtD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,OAAO,EAAsC;AAClF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAE,EAAA;AACrD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,OAAO,EAAW,MAAM,EAA0B;AACrF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAA;AAC5D,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,KAAK,EAAS,OAAO,EAAiB;AACxE,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,KAAK,EAA8B;AACvE,EAAE,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACrC;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { _optionalChain } from '@sentry/utils';
|
|
2
|
+
import { TraceFlags } from '@opentelemetry/api';
|
|
3
|
+
import { getClient, getDynamicSamplingContextFromClient, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
|
|
4
|
+
import { baggageHeaderToDynamicSamplingContext } from '@sentry/utils';
|
|
5
|
+
import { SENTRY_TRACE_STATE_DSC } from '../constants.js';
|
|
6
|
+
import { spanHasAttributes, spanHasName } from './spanTypes.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a dynamic sampling context from a span (and client and scope)
|
|
10
|
+
*
|
|
11
|
+
* @param span the span from which a few values like the root span name and sample rate are extracted.
|
|
12
|
+
*
|
|
13
|
+
* @returns a dynamic sampling context
|
|
14
|
+
*/
|
|
15
|
+
function getDynamicSamplingContextFromSpan(span) {
|
|
16
|
+
const client = getClient();
|
|
17
|
+
if (!client) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const traceState = span.spanContext().traceState;
|
|
22
|
+
const traceStateDsc = _optionalChain([traceState, 'optionalAccess', _ => _.get, 'call', _2 => _2(SENTRY_TRACE_STATE_DSC)]);
|
|
23
|
+
|
|
24
|
+
// If the span has a DSC, we want it to take precedence
|
|
25
|
+
const dscOnSpan = traceStateDsc ? baggageHeaderToDynamicSamplingContext(traceStateDsc) : undefined;
|
|
26
|
+
|
|
27
|
+
if (dscOnSpan) {
|
|
28
|
+
return dscOnSpan;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const dsc = getDynamicSamplingContextFromClient(span.spanContext().traceId, client);
|
|
32
|
+
|
|
33
|
+
const attributes = spanHasAttributes(span) ? span.attributes : {};
|
|
34
|
+
|
|
35
|
+
const sampleRate = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];
|
|
36
|
+
if (sampleRate != null) {
|
|
37
|
+
dsc.sample_rate = `${sampleRate}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
|
|
41
|
+
const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
42
|
+
const name = spanHasName(span) ? span.name : '';
|
|
43
|
+
|
|
44
|
+
if (source !== 'url' && name) {
|
|
45
|
+
dsc.transaction = name;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// TODO: Once we aligned span types, use spanIsSampled() from core instead
|
|
49
|
+
// eslint-disable-next-line no-bitwise
|
|
50
|
+
const sampled = Boolean(span.spanContext().traceFlags & TraceFlags.SAMPLED);
|
|
51
|
+
dsc.sampled = String(sampled);
|
|
52
|
+
|
|
53
|
+
client.emit('createDsc', dsc);
|
|
54
|
+
|
|
55
|
+
return dsc;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { getDynamicSamplingContextFromSpan };
|
|
59
|
+
//# sourceMappingURL=dynamicSamplingContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamicSamplingContext.js","sources":["../../../src/utils/dynamicSamplingContext.ts"],"sourcesContent":["import { TraceFlags } from '@opentelemetry/api';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n getClient,\n getDynamicSamplingContextFromClient,\n} from '@sentry/core';\nimport type { DynamicSamplingContext } from '@sentry/types';\nimport { baggageHeaderToDynamicSamplingContext } from '@sentry/utils';\nimport { SENTRY_TRACE_STATE_DSC } from '../constants';\nimport type { AbstractSpan } from '../types';\nimport { spanHasAttributes, spanHasName } from './spanTypes';\n\n/**\n * Creates a dynamic sampling context from a span (and client and scope)\n *\n * @param span the span from which a few values like the root span name and sample rate are extracted.\n *\n * @returns a dynamic sampling context\n */\nexport function getDynamicSamplingContextFromSpan(span: AbstractSpan): Readonly<Partial<DynamicSamplingContext>> {\n const client = getClient();\n if (!client) {\n return {};\n }\n\n const traceState = span.spanContext().traceState;\n const traceStateDsc = traceState?.get(SENTRY_TRACE_STATE_DSC);\n\n // If the span has a DSC, we want it to take precedence\n const dscOnSpan = traceStateDsc ? baggageHeaderToDynamicSamplingContext(traceStateDsc) : undefined;\n\n if (dscOnSpan) {\n return dscOnSpan;\n }\n\n const dsc = getDynamicSamplingContextFromClient(span.spanContext().traceId, client);\n\n const attributes = spanHasAttributes(span) ? span.attributes : {};\n\n const sampleRate = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];\n if (sampleRate != null) {\n dsc.sample_rate = `${sampleRate}`;\n }\n\n // We don't want to have a transaction name in the DSC if the source is \"url\" because URLs might contain PII\n const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];\n const name = spanHasName(span) ? span.name : '';\n\n if (source !== 'url' && name) {\n dsc.transaction = name;\n }\n\n // TODO: Once we aligned span types, use spanIsSampled() from core instead\n // eslint-disable-next-line no-bitwise\n const sampled = Boolean(span.spanContext().traceFlags &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store the parent span, scopes & metadata in separate weakmaps, so we can access them for a given span
|
|
2
2
|
// This way we can enhance the data that an OTEL Span natively gives us
|
|
3
3
|
// and since we are using weakmaps, we do not need to clean up after ourselves
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const SpanScopes = new WeakMap
|
|
5
|
+
|
|
6
|
+
();
|
|
6
7
|
const SpanHub = new WeakMap();
|
|
7
8
|
const SpanParent = new WeakMap();
|
|
8
9
|
const SpanMetadata = new WeakMap();
|
|
9
10
|
|
|
10
|
-
/** Set the Sentry scope on an OTEL span. */
|
|
11
|
-
function setSpanScope(span, scope) {
|
|
12
|
-
SpanScope.set(span, scope);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** Get the Sentry scope of an OTEL span. */
|
|
16
|
-
function getSpanScope(span) {
|
|
17
|
-
return SpanScope.get(span);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
11
|
/** Set the Sentry hub on an OTEL span. */
|
|
21
12
|
function setSpanHub(span, hub) {
|
|
22
13
|
SpanHub.set(span, hub);
|
|
@@ -47,15 +38,26 @@ function getSpanMetadata(span) {
|
|
|
47
38
|
return SpanMetadata.get(span);
|
|
48
39
|
}
|
|
49
40
|
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Set the Sentry scope to be used for finishing a given OTEL span.
|
|
43
|
+
* This is different from `setCapturedScopesOnSpan`, as that works on _sentry_ spans,
|
|
44
|
+
* while here we are basically "caching" this on the otel spans.
|
|
45
|
+
*/
|
|
46
|
+
function setSpanScopes(
|
|
47
|
+
span,
|
|
48
|
+
scopes
|
|
49
|
+
|
|
50
|
+
,
|
|
51
|
+
) {
|
|
52
|
+
SpanScopes.set(span, scopes);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/** Get the Sentry
|
|
56
|
-
function
|
|
57
|
-
|
|
55
|
+
/** Get the Sentry scopes to use for finishing an OTEL span. */
|
|
56
|
+
function getSpanScopes(span)
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
return SpanScopes.get(span);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
export {
|
|
62
|
+
export { getSpanHub, getSpanMetadata, getSpanParent, getSpanScopes, setSpanHub, setSpanMetadata, setSpanParent, setSpanScopes };
|
|
61
63
|
//# sourceMappingURL=spanData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spanData.js","sources":["../../../src/utils/spanData.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Hub, Scope, TransactionMetadata } from '@sentry/types';\n\nimport type { AbstractSpan } from '../types';\n\n// We store the parent span,
|
|
1
|
+
{"version":3,"file":"spanData.js","sources":["../../../src/utils/spanData.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Hub, Scope, TransactionMetadata } from '@sentry/types';\n\nimport type { AbstractSpan } from '../types';\n\n// We store the parent span, scopes & metadata in separate weakmaps, so we can access them for a given span\n// This way we can enhance the data that an OTEL Span natively gives us\n// and since we are using weakmaps, we do not need to clean up after ourselves\nconst SpanScopes = new WeakMap<\n AbstractSpan,\n {\n scope: Scope;\n isolationScope: Scope;\n }\n>();\nconst SpanHub = new WeakMap<AbstractSpan, Hub>();\nconst SpanParent = new WeakMap<AbstractSpan, Span>();\nconst SpanMetadata = new WeakMap<AbstractSpan, Partial<TransactionMetadata>>();\n\n/** Set the Sentry hub on an OTEL span. */\nexport function setSpanHub(span: AbstractSpan, hub: Hub): void {\n SpanHub.set(span, hub);\n}\n\n/** Get the Sentry hub of an OTEL span. */\nexport function getSpanHub(span: AbstractSpan): Hub | undefined {\n return SpanHub.get(span);\n}\n\n/** Set the parent OTEL span on an OTEL span. */\nexport function setSpanParent(span: AbstractSpan, parentSpan: Span): void {\n SpanParent.set(span, parentSpan);\n}\n\n/** Get the parent OTEL span of an OTEL span. */\nexport function getSpanParent(span: AbstractSpan): Span | undefined {\n return SpanParent.get(span);\n}\n\n/** Set metadata for an OTEL span. */\nexport function setSpanMetadata(span: AbstractSpan, metadata: Partial<TransactionMetadata>): void {\n SpanMetadata.set(span, metadata);\n}\n\n/** Get metadata for an OTEL span. */\nexport function getSpanMetadata(span: AbstractSpan): Partial<TransactionMetadata> | undefined {\n return SpanMetadata.get(span);\n}\n\n/**\n * Set the Sentry scope to be used for finishing a given OTEL span.\n * This is different from `setCapturedScopesOnSpan`, as that works on _sentry_ spans,\n * while here we are basically \"caching\" this on the otel spans.\n */\nexport function setSpanScopes(\n span: AbstractSpan,\n scopes: {\n scope: Scope;\n isolationScope: Scope;\n },\n): void {\n SpanScopes.set(span, scopes);\n}\n\n/** Get the Sentry scopes to use for finishing an OTEL span. */\nexport function getSpanScopes(span: AbstractSpan):\n | {\n scope: Scope;\n isolationScope: Scope;\n }\n | undefined {\n return SpanScopes.get(span);\n}\n"],"names":[],"mappings":"AAKA;AACA;AACA;AACA,MAAM,UAAA,GAAa,IAAI,OAAO;;AAM9B,EAAG,CAAA;AACH,MAAM,OAAQ,GAAE,IAAI,OAAO,EAAqB,CAAA;AAChD,MAAM,UAAW,GAAE,IAAI,OAAO,EAAsB,CAAA;AACpD,MAAM,YAAa,GAAE,IAAI,OAAO,EAA8C,CAAA;AAC9E;AACA;AACO,SAAS,UAAU,CAAC,IAAI,EAAgB,GAAG,EAAa;AAC/D,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AACxB,CAAA;AACA;AACA;AACO,SAAS,UAAU,CAAC,IAAI,EAAiC;AAChE,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI,EAAgB,UAAU,EAAc;AAC1E,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI,EAAkC;AACpE,EAAE,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAAgB,QAAQ,EAAsC;AAClG,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,eAAe,CAAC,IAAI,EAA0D;AAC9F,EAAE,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,IAAI;AACN,EAAE,MAAM;;AAGN;AACF,EAAQ;AACR,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC9B,CAAA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI;;AAKhC,CAAY;AACd,EAAE,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC7B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/opentelemetry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.1",
|
|
4
4
|
"description": "Official Sentry utilities for OpenTelemetry",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/opentelemetry",
|
|
7
7
|
"author": "Sentry",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=14"
|
|
10
|
+
"node": ">=14.8"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"cjs",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sentry/core": "
|
|
33
|
-
"@sentry/types": "
|
|
34
|
-
"@sentry/utils": "
|
|
32
|
+
"@sentry/core": "8.0.0-alpha.1",
|
|
33
|
+
"@sentry/types": "8.0.0-alpha.1",
|
|
34
|
+
"@sentry/utils": "8.0.0-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@opentelemetry/api": "^1.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncContextStrategy.d.ts","sourceRoot":"","sources":["../../src/asyncContextStrategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asyncContextStrategy.d.ts","sourceRoot":"","sources":["../../src/asyncContextStrategy.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAgB,2CAA2C,IAAI,IAAI,CAkGlE"}
|
package/types/constants.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export declare const SENTRY_TRACE_HEADER = "sentry-trace";
|
|
2
2
|
export declare const SENTRY_BAGGAGE_HEADER = "baggage";
|
|
3
|
+
export declare const SENTRY_TRACE_STATE_DSC = "sentry.trace";
|
|
3
4
|
/** Context Key to hold a PropagationContext. */
|
|
4
5
|
export declare const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY: symbol;
|
|
5
6
|
/** Context Key to hold a Hub. */
|
|
6
7
|
export declare const SENTRY_HUB_CONTEXT_KEY: symbol;
|
|
8
|
+
export declare const SENTRY_SCOPES_CONTEXT_KEY: symbol;
|
|
9
|
+
export declare const SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY: symbol;
|
|
10
|
+
export declare const SENTRY_FORK_SET_SCOPE_CONTEXT_KEY: symbol;
|
|
11
|
+
export declare const SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY: symbol;
|
|
7
12
|
//# sourceMappingURL=constants.d.ts.map
|
package/types/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,qBAAqB,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,gDAAgD;AAChD,eAAO,MAAM,sCAAsC,QAA6D,CAAC;AAEjH,iCAAiC;AACjC,eAAO,MAAM,sBAAsB,QAAiC,CAAC;AAErE,eAAO,MAAM,yBAAyB,QAAoC,CAAC;AAE3E,eAAO,MAAM,uCAAuC,QAAkD,CAAC;AAEvG,eAAO,MAAM,iCAAiC,QAA4C,CAAC;AAE3F,eAAO,MAAM,2CAA2C,QAAsD,CAAC"}
|
|
@@ -7,5 +7,5 @@ import type { ContextManager } from '@opentelemetry/api';
|
|
|
7
7
|
* const SentryContextManager = wrapContextManagerClass(AsyncLocalStorageContextManager);
|
|
8
8
|
* const contextManager = new SentryContextManager();
|
|
9
9
|
*/
|
|
10
|
-
export declare function wrapContextManagerClass<ContextManagerInstance extends ContextManager>(ContextManagerClass: new (...args:
|
|
10
|
+
export declare function wrapContextManagerClass<ContextManagerInstance extends ContextManager>(ContextManagerClass: new (...args: unknown[]) => ContextManagerInstance): typeof ContextManagerClass;
|
|
11
11
|
//# sourceMappingURL=contextManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextManager.d.ts","sourceRoot":"","sources":["../../src/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"contextManager.d.ts","sourceRoot":"","sources":["../../src/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAYlE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,sBAAsB,SAAS,cAAc,EACnF,mBAAmB,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,sBAAsB,GACtE,OAAO,mBAAmB,CAyD5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/custom/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/custom/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,mBAAmB,IAAI,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAMpF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,gBAAgB,SAAS,KACvB,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EAC7B,uBAAuB,SAAS,KAC9B,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,4BAA4B,EAC5D,WAAW,EAAE,gBAAgB,GAAG,uBAAuB,CAuCxD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Hub } from '@sentry/types';
|
|
2
|
+
/**
|
|
3
|
+
* This is for legacy reasons, and returns a proxy object instead of a hub to be used.
|
|
4
|
+
* @deprecated Use the methods directly.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCurrentHub(): Hub;
|
|
7
|
+
//# sourceMappingURL=getCurrentHub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrentHub.d.ts","sourceRoot":"","sources":["../../../src/custom/getCurrentHub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,GAAG,EAMJ,MAAM,eAAe,CAAC;AAmBvB;;;GAGG;AACH,wBAAgB,aAAa,IAAI,GAAG,CA6EnC"}
|