@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.
Files changed (130) hide show
  1. package/README.md +8 -14
  2. package/cjs/asyncContextStrategy.js +87 -19
  3. package/cjs/asyncContextStrategy.js.map +1 -1
  4. package/cjs/constants.js +14 -0
  5. package/cjs/constants.js.map +1 -1
  6. package/cjs/contextManager.js +37 -15
  7. package/cjs/contextManager.js.map +1 -1
  8. package/cjs/custom/client.js +0 -28
  9. package/cjs/custom/client.js.map +1 -1
  10. package/cjs/custom/getCurrentHub.js +106 -0
  11. package/cjs/custom/getCurrentHub.js.map +1 -0
  12. package/cjs/custom/hub.js +3 -136
  13. package/cjs/custom/hub.js.map +1 -1
  14. package/cjs/custom/transaction.js +3 -32
  15. package/cjs/custom/transaction.js.map +1 -1
  16. package/cjs/index.js +7 -7
  17. package/cjs/index.js.map +1 -1
  18. package/cjs/propagator.js +39 -12
  19. package/cjs/propagator.js.map +1 -1
  20. package/cjs/sampler.js +0 -1
  21. package/cjs/sampler.js.map +1 -1
  22. package/cjs/semanticAttributes.js +0 -9
  23. package/cjs/semanticAttributes.js.map +1 -1
  24. package/cjs/setupEventContextTrace.js +12 -7
  25. package/cjs/setupEventContextTrace.js.map +1 -1
  26. package/cjs/spanExporter.js +69 -58
  27. package/cjs/spanExporter.js.map +1 -1
  28. package/cjs/spanProcessor.js +14 -19
  29. package/cjs/spanProcessor.js.map +1 -1
  30. package/cjs/trace.js +120 -23
  31. package/cjs/trace.js.map +1 -1
  32. package/cjs/utils/addOriginToSpan.js +2 -2
  33. package/cjs/utils/addOriginToSpan.js.map +1 -1
  34. package/cjs/utils/contextData.js +38 -0
  35. package/cjs/utils/contextData.js.map +1 -1
  36. package/cjs/utils/dynamicSamplingContext.js +64 -0
  37. package/cjs/utils/dynamicSamplingContext.js.map +1 -0
  38. package/cjs/utils/spanData.js +23 -23
  39. package/cjs/utils/spanData.js.map +1 -1
  40. package/esm/asyncContextStrategy.js +89 -18
  41. package/esm/asyncContextStrategy.js.map +1 -1
  42. package/esm/constants.js +10 -1
  43. package/esm/constants.js.map +1 -1
  44. package/esm/contextManager.js +36 -17
  45. package/esm/contextManager.js.map +1 -1
  46. package/esm/custom/client.js +0 -28
  47. package/esm/custom/client.js.map +1 -1
  48. package/esm/custom/getCurrentHub.js +101 -0
  49. package/esm/custom/getCurrentHub.js.map +1 -0
  50. package/esm/custom/hub.js +4 -133
  51. package/esm/custom/hub.js.map +1 -1
  52. package/esm/custom/transaction.js +4 -32
  53. package/esm/custom/transaction.js.map +1 -1
  54. package/esm/index.js +6 -5
  55. package/esm/index.js.map +1 -1
  56. package/esm/propagator.js +42 -15
  57. package/esm/propagator.js.map +1 -1
  58. package/esm/sampler.js +0 -1
  59. package/esm/sampler.js.map +1 -1
  60. package/esm/semanticAttributes.js +0 -9
  61. package/esm/semanticAttributes.js.map +1 -1
  62. package/esm/setupEventContextTrace.js +14 -9
  63. package/esm/setupEventContextTrace.js.map +1 -1
  64. package/esm/spanExporter.js +70 -59
  65. package/esm/spanExporter.js.map +1 -1
  66. package/esm/spanProcessor.js +10 -15
  67. package/esm/spanProcessor.js.map +1 -1
  68. package/esm/trace.js +122 -26
  69. package/esm/trace.js.map +1 -1
  70. package/esm/utils/addOriginToSpan.js +2 -2
  71. package/esm/utils/addOriginToSpan.js.map +1 -1
  72. package/esm/utils/contextData.js +36 -2
  73. package/esm/utils/contextData.js.map +1 -1
  74. package/esm/utils/dynamicSamplingContext.js +59 -0
  75. package/esm/utils/dynamicSamplingContext.js.map +1 -0
  76. package/esm/utils/spanData.js +22 -20
  77. package/esm/utils/spanData.js.map +1 -1
  78. package/package.json +5 -5
  79. package/types/asyncContextStrategy.d.ts.map +1 -1
  80. package/types/constants.d.ts +5 -0
  81. package/types/constants.d.ts.map +1 -1
  82. package/types/contextManager.d.ts +1 -1
  83. package/types/contextManager.d.ts.map +1 -1
  84. package/types/custom/client.d.ts.map +1 -1
  85. package/types/custom/getCurrentHub.d.ts +7 -0
  86. package/types/custom/getCurrentHub.d.ts.map +1 -0
  87. package/types/custom/hub.d.ts +2 -33
  88. package/types/custom/hub.d.ts.map +1 -1
  89. package/types/custom/transaction.d.ts +1 -10
  90. package/types/custom/transaction.d.ts.map +1 -1
  91. package/types/index.d.ts +6 -5
  92. package/types/index.d.ts.map +1 -1
  93. package/types/propagator.d.ts.map +1 -1
  94. package/types/semanticAttributes.d.ts +0 -9
  95. package/types/semanticAttributes.d.ts.map +1 -1
  96. package/types/setupEventContextTrace.d.ts.map +1 -1
  97. package/types/spanExporter.d.ts.map +1 -1
  98. package/types/spanProcessor.d.ts +1 -5
  99. package/types/spanProcessor.d.ts.map +1 -1
  100. package/types/trace.d.ts +14 -3
  101. package/types/trace.d.ts.map +1 -1
  102. package/types/types.d.ts +7 -12
  103. package/types/types.d.ts.map +1 -1
  104. package/types/utils/addOriginToSpan.d.ts.map +1 -1
  105. package/types/utils/contextData.d.ts +22 -1
  106. package/types/utils/contextData.d.ts.map +1 -1
  107. package/types/utils/dynamicSamplingContext.d.ts +11 -0
  108. package/types/utils/dynamicSamplingContext.d.ts.map +1 -0
  109. package/types/utils/spanData.d.ts +14 -8
  110. package/types/utils/spanData.d.ts.map +1 -1
  111. package/types-ts3.8/constants.d.ts +5 -0
  112. package/types-ts3.8/contextManager.d.ts +1 -1
  113. package/types-ts3.8/custom/getCurrentHub.d.ts +7 -0
  114. package/types-ts3.8/custom/hub.d.ts +2 -33
  115. package/types-ts3.8/custom/transaction.d.ts +1 -10
  116. package/types-ts3.8/index.d.ts +6 -5
  117. package/types-ts3.8/semanticAttributes.d.ts +0 -9
  118. package/types-ts3.8/spanProcessor.d.ts +1 -5
  119. package/types-ts3.8/trace.d.ts +14 -3
  120. package/types-ts3.8/types.d.ts +7 -12
  121. package/types-ts3.8/utils/contextData.d.ts +22 -1
  122. package/types-ts3.8/utils/dynamicSamplingContext.d.ts +11 -0
  123. package/types-ts3.8/utils/spanData.d.ts +14 -8
  124. package/cjs/custom/scope.js +0 -202
  125. package/cjs/custom/scope.js.map +0 -1
  126. package/esm/custom/scope.js +0 -200
  127. package/esm/custom/scope.js.map +0 -1
  128. package/types/custom/scope.d.ts +0 -42
  129. package/types/custom/scope.d.ts.map +0 -1
  130. package/types-ts3.8/custom/scope.d.ts +0 -42
package/cjs/trace.js CHANGED
@@ -3,8 +3,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  const api = require('@opentelemetry/api');
4
4
  const core = require('@opentelemetry/core');
5
5
  const core$1 = require('@sentry/core');
6
- const hub = require('./custom/hub.js');
7
- const semanticAttributes = require('./semanticAttributes.js');
6
+ const utils = require('@sentry/utils');
7
+ const constants = require('./constants.js');
8
+ const contextData = require('./utils/contextData.js');
9
+ const dynamicSamplingContext = require('./utils/dynamicSamplingContext.js');
10
+ const getActiveSpan = require('./utils/getActiveSpan.js');
8
11
  const spanData = require('./utils/spanData.js');
9
12
 
10
13
  /**
@@ -16,17 +19,19 @@ const spanData = require('./utils/spanData.js');
16
19
  *
17
20
  * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
18
21
  */
19
- function startSpan(spanContext, callback) {
22
+ function startSpan(options, callback) {
20
23
  const tracer = getTracer();
21
24
 
22
- const { name } = spanContext;
25
+ const { name } = options;
23
26
 
24
- const activeCtx = api.context.active();
25
- const shouldSkipSpan = spanContext.onlyIfParent && !api.trace.getSpan(activeCtx);
27
+ const activeCtx = getContext(options.scope, options.forceTransaction);
28
+ const shouldSkipSpan = options.onlyIfParent && !api.trace.getSpan(activeCtx);
26
29
  const ctx = shouldSkipSpan ? core.suppressTracing(activeCtx) : activeCtx;
27
30
 
31
+ const spanContext = getSpanContext(options);
32
+
28
33
  return tracer.startActiveSpan(name, spanContext, ctx, span => {
29
- _applySentryAttributesToSpan(span, spanContext);
34
+ _applySentryAttributesToSpan(span, options);
30
35
 
31
36
  return core$1.handleCallbackErrors(
32
37
  () => callback(span),
@@ -47,17 +52,19 @@ function startSpan(spanContext, callback) {
47
52
  *
48
53
  * Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
49
54
  */
50
- function startSpanManual(spanContext, callback) {
55
+ function startSpanManual(options, callback) {
51
56
  const tracer = getTracer();
52
57
 
53
- const { name } = spanContext;
58
+ const { name } = options;
54
59
 
55
- const activeCtx = api.context.active();
56
- const shouldSkipSpan = spanContext.onlyIfParent && !api.trace.getSpan(activeCtx);
60
+ const activeCtx = getContext(options.scope, options.forceTransaction);
61
+ const shouldSkipSpan = options.onlyIfParent && !api.trace.getSpan(activeCtx);
57
62
  const ctx = shouldSkipSpan ? core.suppressTracing(activeCtx) : activeCtx;
58
63
 
64
+ const spanContext = getSpanContext(options);
65
+
59
66
  return tracer.startActiveSpan(name, spanContext, ctx, span => {
60
- _applySentryAttributesToSpan(span, spanContext);
67
+ _applySentryAttributesToSpan(span, options);
61
68
 
62
69
  return core$1.handleCallbackErrors(
63
70
  () => callback(span),
@@ -78,40 +85,57 @@ function startSpanManual(spanContext, callback) {
78
85
  * or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans
79
86
  * and the `span` returned from the callback will be undefined.
80
87
  */
81
- function startInactiveSpan(spanContext) {
88
+ function startInactiveSpan(options) {
82
89
  const tracer = getTracer();
83
90
 
84
- const { name } = spanContext;
91
+ const { name } = options;
85
92
 
86
- const activeCtx = api.context.active();
87
- const shouldSkipSpan = spanContext.onlyIfParent && !api.trace.getSpan(activeCtx);
93
+ const activeCtx = getContext(options.scope, options.forceTransaction);
94
+ const shouldSkipSpan = options.onlyIfParent && !api.trace.getSpan(activeCtx);
88
95
  const ctx = shouldSkipSpan ? core.suppressTracing(activeCtx) : activeCtx;
89
96
 
97
+ const spanContext = getSpanContext(options);
98
+
90
99
  const span = tracer.startSpan(name, spanContext, ctx);
91
100
 
92
- _applySentryAttributesToSpan(span, spanContext);
101
+ _applySentryAttributesToSpan(span, options);
93
102
 
94
103
  return span;
95
104
  }
96
105
 
106
+ /**
107
+ * Forks the current scope and sets the provided span as active span in the context of the provided callback. Can be
108
+ * passed `null` to start an entirely new span tree.
109
+ *
110
+ * @param span Spans started in the context of the provided callback will be children of this span. If `null` is passed,
111
+ * spans started within the callback will not be attached to a parent span.
112
+ * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.
113
+ * @returns the value returned from the provided callback function.
114
+ */
115
+ function withActiveSpan(span, callback) {
116
+ const newContextWithActiveSpan = span ? api.trace.setSpan(api.context.active(), span) : api.trace.deleteSpan(api.context.active());
117
+ return api.context.with(newContextWithActiveSpan, () => callback(core$1.getCurrentScope()));
118
+ }
119
+
97
120
  function getTracer() {
98
- const client = hub.getClient();
121
+ const client = core$1.getClient();
99
122
  return (client && client.tracer) || api.trace.getTracer('@sentry/opentelemetry', core$1.SDK_VERSION);
100
123
  }
101
124
 
102
- function _applySentryAttributesToSpan(span, spanContext) {
103
- const { origin, op, source, metadata } = spanContext;
125
+ function _applySentryAttributesToSpan(span, options) {
126
+ // eslint-disable-next-line deprecation/deprecation
127
+ const { origin, op, source, metadata } = options;
104
128
 
105
129
  if (origin) {
106
- span.setAttribute(semanticAttributes.InternalSentrySemanticAttributes.ORIGIN, origin);
130
+ span.setAttribute(core$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
107
131
  }
108
132
 
109
133
  if (op) {
110
- span.setAttribute(semanticAttributes.InternalSentrySemanticAttributes.OP, op);
134
+ span.setAttribute(core$1.SEMANTIC_ATTRIBUTE_SENTRY_OP, op);
111
135
  }
112
136
 
113
137
  if (source) {
114
- span.setAttribute(semanticAttributes.InternalSentrySemanticAttributes.SOURCE, source);
138
+ span.setAttribute(core$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
115
139
  }
116
140
 
117
141
  if (metadata) {
@@ -119,7 +143,80 @@ function _applySentryAttributesToSpan(span, spanContext) {
119
143
  }
120
144
  }
121
145
 
146
+ function getSpanContext(options) {
147
+ const { startTime, attributes, kind } = options;
148
+
149
+ // OTEL expects timestamps in ms, not seconds
150
+ const fixedStartTime = typeof startTime === 'number' ? ensureTimestampInMilliseconds(startTime) : startTime;
151
+
152
+ return {
153
+ attributes,
154
+ kind,
155
+ startTime: fixedStartTime,
156
+ };
157
+ }
158
+
159
+ function ensureTimestampInMilliseconds(timestamp) {
160
+ const isMs = timestamp < 9999999999;
161
+ return isMs ? timestamp * 1000 : timestamp;
162
+ }
163
+
164
+ function getContext(scope, forceTransaction) {
165
+ const ctx = getContextForScope(scope);
166
+
167
+ if (!forceTransaction) {
168
+ return ctx;
169
+ }
170
+
171
+ // Else we need to "fix" the context to have no parent span
172
+ const parentSpan = api.trace.getSpan(ctx);
173
+
174
+ // If there is no parent span, all good, nothing to do!
175
+ if (!parentSpan) {
176
+ return ctx;
177
+ }
178
+
179
+ // Else, we need to do two things:
180
+ // 1. Unset the parent span from the context, so we'll create a new root span
181
+ // 2. Ensure the propagation context is correct, so we'll continue from the parent span
182
+ const ctxWithoutSpan = api.trace.deleteSpan(ctx);
183
+
184
+ const { spanId, traceId, traceFlags } = parentSpan.spanContext();
185
+ // eslint-disable-next-line no-bitwise
186
+ const sampled = Boolean(traceFlags & api.TraceFlags.SAMPLED);
187
+
188
+ const rootSpan = getActiveSpan.getRootSpan(parentSpan);
189
+ const dsc = dynamicSamplingContext.getDynamicSamplingContextFromSpan(rootSpan);
190
+ const dscString = utils.dynamicSamplingContextToSentryBaggageHeader(dsc);
191
+
192
+ const traceState = dscString ? new core.TraceState().set(constants.SENTRY_TRACE_STATE_DSC, dscString) : undefined;
193
+
194
+ const spanContext = {
195
+ traceId,
196
+ spanId,
197
+ isRemote: true,
198
+ traceFlags: sampled ? api.TraceFlags.SAMPLED : api.TraceFlags.NONE,
199
+ traceState,
200
+ };
201
+
202
+ const ctxWithSpanContext = api.trace.setSpanContext(ctxWithoutSpan, spanContext);
203
+
204
+ return ctxWithSpanContext;
205
+ }
206
+
207
+ function getContextForScope(scope) {
208
+ if (scope) {
209
+ const ctx = contextData.getContextFromScope(scope);
210
+ if (ctx) {
211
+ return ctx;
212
+ }
213
+ }
214
+
215
+ return api.context.active();
216
+ }
217
+
122
218
  exports.startInactiveSpan = startInactiveSpan;
123
219
  exports.startSpan = startSpan;
124
220
  exports.startSpanManual = startSpanManual;
221
+ exports.withActiveSpan = withActiveSpan;
125
222
  //# sourceMappingURL=trace.js.map
package/cjs/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":["context","trace","suppressTracing","handleCallbackErrors","SpanStatusCode","getClient","SDK_VERSION","InternalSentrySemanticAttributes","setSpanMetadata"],"mappings":";;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAI,WAAW,EAA4B,QAAQ,EAAwB;AACpG,EAAE,MAAM,MAAA,GAAS,SAAS,EAAE,CAAA;AAC5B;AACA,EAAE,MAAM,EAAE,IAAK,EAAA,GAAI,WAAW,CAAA;AAC9B;AACA,EAAE,MAAM,SAAU,GAAEA,WAAO,CAAC,MAAM,EAAE,CAAA;AACpC,EAAE,MAAM,cAAA,GAAiB,WAAW,CAAC,YAAA,IAAgB,CAACC,SAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AAC9E,EAAE,MAAM,GAAI,GAAE,cAAe,GAAEC,oBAAe,CAAC,SAAS,CAAE,GAAE,SAAS,CAAA;AACrE;AACA,EAAE,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAA,IAAQ;AAChE,IAAI,4BAA4B,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AACnD;AACA,IAAI,OAAOC,2BAAoB;AAC/B,MAAM,MAAM,QAAQ,CAAC,IAAI,CAAC;AAC1B,MAAM,MAAM;AACZ,QAAQ,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAEC,kBAAc,CAAC,KAAM,EAAC,CAAC,CAAA;AACtD,OAAO;AACP,MAAM,MAAM,IAAI,CAAC,GAAG,EAAE;AACtB,KAAK,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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":["trace","suppressTracing","handleCallbackErrors","SpanStatusCode","context","getCurrentScope","getClient","SDK_VERSION","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","setSpanMetadata","TraceFlags","getRootSpan","getDynamicSamplingContextFromSpan","dynamicSamplingContextToSentryBaggageHeader","TraceState","SENTRY_TRACE_STATE_DSC","getContextFromScope"],"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,G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;AACA,EAAE,MAAM,QAAS,GAAEC,yBAAW,CAAC,UAAU,CAAC,CAAA;AAC1C,EAAE,MAAM,GAAI,GAAEC,wDAAiC,CAAC,QAAQ,CAAC,CAAA;AACzD,EAAE,MAAM,SAAU,GAAEC,iDAA2C,CAAC,GAAG,CAAC,CAAA;AACpE;AACA,EAAE,MAAM,UAAW,GAAE,SAAU,GAAE,IAAIC,eAAU,EAAE,CAAC,GAAG,CAACC,gCAAsB,EAAE,SAAS,CAAA,GAAI,SAAS,CAAA;AACpG;AACA,EAAE,MAAM,WAAW,GAAgB;AACnC,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,QAAQ,EAAE,IAAI;AAClB,IAAI,UAAU,EAAE,OAAA,GAAUL,cAAU,CAAC,OAAQ,GAAEA,cAAU,CAAC,IAAI;AAC9D,IAAI,UAAU;AACd,GAAG,CAAA;AACH;AACA,EAAE,MAAM,kBAAmB,GAAEZ,SAAK,CAAC,cAAc,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;AAC9E;AACA,EAAE,OAAO,kBAAkB,CAAA;AAC3B,CAAA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAmB;AACpD,EAAE,IAAI,KAAK,EAAE;AACb,IAAI,MAAM,GAAI,GAAEkB,+BAAmB,CAAC,KAAK,CAAC,CAAA;AAC1C,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,OAAO,GAAG,CAAA;AAChB,KAAI;AACJ,GAAE;AACF;AACA,EAAE,OAAOd,WAAO,CAAC,MAAM,EAAE,CAAA;AACzB;;;;;;;"}
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
- const semanticAttributes = require('../semanticAttributes.js');
3
+ const core = require('@sentry/core');
4
4
 
5
5
  /** Adds an origin to an OTEL Span. */
6
6
  function addOriginToSpan(span, origin) {
7
- span.setAttribute(semanticAttributes.InternalSentrySemanticAttributes.ORIGIN, origin);
7
+ span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
8
8
  }
9
9
 
10
10
  exports.addOriginToSpan = addOriginToSpan;
@@ -1 +1 @@
1
- {"version":3,"file":"addOriginToSpan.js","sources":["../../../src/utils/addOriginToSpan.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { SpanOrigin } from '@sentry/types';\n\nimport { InternalSentrySemanticAttributes } from '../semanticAttributes';\n\n/** Adds an origin to an OTEL Span. */\nexport function addOriginToSpan(span: Span, origin: SpanOrigin): void {\n span.setAttribute(InternalSentrySemanticAttributes.ORIGIN, origin);\n}\n"],"names":["InternalSentrySemanticAttributes"],"mappings":";;;;AAKA;AACO,SAAS,eAAe,CAAC,IAAI,EAAQ,MAAM,EAAoB;AACtE,EAAE,IAAI,CAAC,YAAY,CAACA,mDAAgC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACpE;;;;"}
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":["SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;AAIA;AACO,SAAS,eAAe,CAAC,IAAI,EAAQ,MAAM,EAAoB;AACtE,EAAE,IAAI,CAAC,YAAY,CAACA,qCAAgC,EAAE,MAAM,CAAC,CAAA;AAC7D;;;;"}
@@ -2,6 +2,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
3
  const constants = require('../constants.js');
4
4
 
5
+ const SCOPE_CONTEXT_MAP = new WeakMap();
6
+
5
7
  /**
6
8
  * Try to get the Propagation Context from the given OTEL context.
7
9
  * This requires the SentryPropagator to be registered.
@@ -34,8 +36,44 @@ function setHubOnContext(context, hub) {
34
36
  return context.setValue(constants.SENTRY_HUB_CONTEXT_KEY, hub);
35
37
  }
36
38
 
39
+ /**
40
+ * Try to get the current scopes from the given OTEL context.
41
+ * This requires a Context Manager that was wrapped with getWrappedContextManager.
42
+ */
43
+ function getScopesFromContext(context) {
44
+ return context.getValue(constants.SENTRY_SCOPES_CONTEXT_KEY) ;
45
+ }
46
+
47
+ /**
48
+ * Set the current scopes on an OTEL context.
49
+ * This will return a forked context with the Propagation Context set.
50
+ */
51
+ function setScopesOnContext(context, scopes) {
52
+ return context.setValue(constants.SENTRY_SCOPES_CONTEXT_KEY, scopes);
53
+ }
54
+
55
+ /**
56
+ * Set the context on the scope so we can later look it up.
57
+ * We need this to get the context from the scope in the `trace` functions.
58
+ */
59
+ function setContextOnScope(scope, context) {
60
+ SCOPE_CONTEXT_MAP.set(scope, context);
61
+ }
62
+
63
+ /**
64
+ * Get the context related to a scope.
65
+ * TODO v8: Use this for the `trace` functions.
66
+ * */
67
+ function getContextFromScope(scope) {
68
+ return SCOPE_CONTEXT_MAP.get(scope);
69
+ }
70
+
71
+ exports.getContextFromScope = getContextFromScope;
37
72
  exports.getHubFromContext = getHubFromContext;
38
73
  exports.getPropagationContextFromContext = getPropagationContextFromContext;
74
+ exports.getScopesFromContext = getScopesFromContext;
75
+ exports.setContextOnScope = setContextOnScope;
39
76
  exports.setHubOnContext = setHubOnContext;
40
77
  exports.setPropagationContextOnContext = setPropagationContextOnContext;
78
+ exports.setScopesOnContext = setScopesOnContext;
41
79
  //# 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 { SENTRY_HUB_CONTEXT_KEY, SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY } from '../constants';\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"],"names":["SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY","SENTRY_HUB_CONTEXT_KEY"],"mappings":";;;;AAKA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA2C;AACnG,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gDAAsC,CAAE,EAAA;AAClE,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,OAAO,EAAW,kBAAkB,EAA+B;AAClH,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gDAAsC,EAAE,kBAAkB,CAAC,CAAA;AACrF,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAA4B;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACC,gCAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gCAAsB,EAAE,GAAG,CAAC,CAAA;AACtD;;;;;;;"}
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":["SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY","SENTRY_HUB_CONTEXT_KEY","SENTRY_SCOPES_CONTEXT_KEY"],"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,CAACA,gDAAsC,CAAE,EAAA;AAClE,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,OAAO,EAAW,kBAAkB,EAA+B;AAClH,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gDAAsC,EAAE,kBAAkB,CAAC,CAAA;AACrF,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAA4B;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACC,gCAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gCAAsB,EAAE,GAAG,CAAC,CAAA;AACtD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,OAAO,EAAsC;AAClF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACC,mCAAyB,CAAE,EAAA;AACrD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,OAAO,EAAW,MAAM,EAA0B;AACrF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,mCAAyB,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,64 @@
1
+ var {
2
+ _optionalChain
3
+ } = require('@sentry/utils');
4
+
5
+ Object.defineProperty(exports, '__esModule', { value: true });
6
+
7
+ const api = require('@opentelemetry/api');
8
+ const core = require('@sentry/core');
9
+ const utils = require('@sentry/utils');
10
+ const constants = require('../constants.js');
11
+ const spanTypes = require('./spanTypes.js');
12
+
13
+ /**
14
+ * Creates a dynamic sampling context from a span (and client and scope)
15
+ *
16
+ * @param span the span from which a few values like the root span name and sample rate are extracted.
17
+ *
18
+ * @returns a dynamic sampling context
19
+ */
20
+ function getDynamicSamplingContextFromSpan(span) {
21
+ const client = core.getClient();
22
+ if (!client) {
23
+ return {};
24
+ }
25
+
26
+ const traceState = span.spanContext().traceState;
27
+ const traceStateDsc = _optionalChain([traceState, 'optionalAccess', _ => _.get, 'call', _2 => _2(constants.SENTRY_TRACE_STATE_DSC)]);
28
+
29
+ // If the span has a DSC, we want it to take precedence
30
+ const dscOnSpan = traceStateDsc ? utils.baggageHeaderToDynamicSamplingContext(traceStateDsc) : undefined;
31
+
32
+ if (dscOnSpan) {
33
+ return dscOnSpan;
34
+ }
35
+
36
+ const dsc = core.getDynamicSamplingContextFromClient(span.spanContext().traceId, client);
37
+
38
+ const attributes = spanTypes.spanHasAttributes(span) ? span.attributes : {};
39
+
40
+ const sampleRate = attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];
41
+ if (sampleRate != null) {
42
+ dsc.sample_rate = `${sampleRate}`;
43
+ }
44
+
45
+ // We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
46
+ const source = attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
47
+ const name = spanTypes.spanHasName(span) ? span.name : '';
48
+
49
+ if (source !== 'url' && name) {
50
+ dsc.transaction = name;
51
+ }
52
+
53
+ // TODO: Once we aligned span types, use spanIsSampled() from core instead
54
+ // eslint-disable-next-line no-bitwise
55
+ const sampled = Boolean(span.spanContext().traceFlags & api.TraceFlags.SAMPLED);
56
+ dsc.sampled = String(sampled);
57
+
58
+ client.emit('createDsc', dsc);
59
+
60
+ return dsc;
61
+ }
62
+
63
+ exports.getDynamicSamplingContextFromSpan = getDynamicSamplingContextFromSpan;
64
+ //# 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 & TraceFlags.SAMPLED);\n dsc.sampled = String(sampled);\n\n client.emit('createDsc', dsc);\n\n return dsc;\n}\n"],"names":["getClient","SENTRY_TRACE_STATE_DSC","baggageHeaderToDynamicSamplingContext","getDynamicSamplingContextFromClient","spanHasAttributes","SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","spanHasName","TraceFlags"],"mappings":";;;;;;;;;;;;AAaA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,E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,CAAA,CAAA,CAAA;;EAEA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA;AACA;;"}
@@ -1,24 +1,15 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
- // We store the parent span, scope & metadata in separate weakmaps, so we can access them for a given span
3
+ // We store the parent span, scopes & metadata in separate weakmaps, so we can access them for a given span
4
4
  // This way we can enhance the data that an OTEL Span natively gives us
5
5
  // and since we are using weakmaps, we do not need to clean up after ourselves
6
- const SpanScope = new WeakMap();
7
- const SpanFinishScope = new WeakMap();
6
+ const SpanScopes = new WeakMap
7
+
8
+ ();
8
9
  const SpanHub = new WeakMap();
9
10
  const SpanParent = new WeakMap();
10
11
  const SpanMetadata = new WeakMap();
11
12
 
12
- /** Set the Sentry scope on an OTEL span. */
13
- function setSpanScope(span, scope) {
14
- SpanScope.set(span, scope);
15
- }
16
-
17
- /** Get the Sentry scope of an OTEL span. */
18
- function getSpanScope(span) {
19
- return SpanScope.get(span);
20
- }
21
-
22
13
  /** Set the Sentry hub on an OTEL span. */
23
14
  function setSpanHub(span, hub) {
24
15
  SpanHub.set(span, hub);
@@ -49,24 +40,33 @@ function getSpanMetadata(span) {
49
40
  return SpanMetadata.get(span);
50
41
  }
51
42
 
52
- /** Set the Sentry scope to be used for finishing a given OTEL span. */
53
- function setSpanFinishScope(span, scope) {
54
- SpanFinishScope.set(span, scope);
43
+ /**
44
+ * Set the Sentry scope to be used for finishing a given OTEL span.
45
+ * This is different from `setCapturedScopesOnSpan`, as that works on _sentry_ spans,
46
+ * while here we are basically "caching" this on the otel spans.
47
+ */
48
+ function setSpanScopes(
49
+ span,
50
+ scopes
51
+
52
+ ,
53
+ ) {
54
+ SpanScopes.set(span, scopes);
55
55
  }
56
56
 
57
- /** Get the Sentry scope to use for finishing an OTEL span. */
58
- function getSpanFinishScope(span) {
59
- return SpanFinishScope.get(span);
57
+ /** Get the Sentry scopes to use for finishing an OTEL span. */
58
+ function getSpanScopes(span)
59
+
60
+ {
61
+ return SpanScopes.get(span);
60
62
  }
61
63
 
62
- exports.getSpanFinishScope = getSpanFinishScope;
63
64
  exports.getSpanHub = getSpanHub;
64
65
  exports.getSpanMetadata = getSpanMetadata;
65
66
  exports.getSpanParent = getSpanParent;
66
- exports.getSpanScope = getSpanScope;
67
- exports.setSpanFinishScope = setSpanFinishScope;
67
+ exports.getSpanScopes = getSpanScopes;
68
68
  exports.setSpanHub = setSpanHub;
69
69
  exports.setSpanMetadata = setSpanMetadata;
70
70
  exports.setSpanParent = setSpanParent;
71
- exports.setSpanScope = setSpanScope;
71
+ exports.setSpanScopes = setSpanScopes;
72
72
  //# 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, scope & 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 SpanScope = new WeakMap<AbstractSpan, Scope>();\nconst SpanFinishScope = new WeakMap<AbstractSpan, Scope>();\nconst SpanHub = new WeakMap<AbstractSpan, Hub>();\nconst SpanParent = new WeakMap<AbstractSpan, Span>();\nconst SpanMetadata = new WeakMap<AbstractSpan, Partial<TransactionMetadata>>();\n\n/** Set the Sentry scope on an OTEL span. */\nexport function setSpanScope(span: AbstractSpan, scope: Scope): void {\n SpanScope.set(span, scope);\n}\n\n/** Get the Sentry scope of an OTEL span. */\nexport function getSpanScope(span: AbstractSpan): Scope | undefined {\n return SpanScope.get(span);\n}\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/** Set the Sentry scope to be used for finishing a given OTEL span. */\nexport function setSpanFinishScope(span: AbstractSpan, scope: Scope): void {\n SpanFinishScope.set(span, scope);\n}\n\n/** Get the Sentry scope to use for finishing an OTEL span. */\nexport function getSpanFinishScope(span: AbstractSpan): Scope | undefined {\n return SpanFinishScope.get(span);\n}\n"],"names":[],"mappings":";;AAKA;AACA;AACA;AACA,MAAM,SAAU,GAAE,IAAI,OAAO,EAAuB,CAAA;AACpD,MAAM,eAAgB,GAAE,IAAI,OAAO,EAAuB,CAAA;AAC1D,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,YAAY,CAAC,IAAI,EAAgB,KAAK,EAAe;AACrE,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AAC5B,CAAA;AACA;AACA;AACO,SAAS,YAAY,CAAC,IAAI,EAAmC;AACpE,EAAE,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAA;AACA;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;AACO,SAAS,kBAAkB,CAAC,IAAI,EAAgB,KAAK,EAAe;AAC3E,EAAE,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,IAAI,EAAmC;AAC1E,EAAE,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAClC;;;;;;;;;;;;;"}
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,G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