@sentry/opentelemetry 10.30.0 → 10.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +14 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +15 -4
- package/build/esm/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/propagator.d.ts.map +1 -1
- package/build/types/utils/getTraceData.d.ts +2 -1
- package/build/types/utils/getTraceData.d.ts.map +1 -1
- package/build/types-ts3.8/utils/getTraceData.d.ts +2 -1
- package/package.json +2 -2
package/build/cjs/index.js
CHANGED
|
@@ -696,7 +696,7 @@ class SentryPropagator extends core$1.W3CBaggagePropagator {
|
|
|
696
696
|
const activeSpan = api.trace.getSpan(context);
|
|
697
697
|
const url = activeSpan && getCurrentURL(activeSpan);
|
|
698
698
|
|
|
699
|
-
const tracePropagationTargets = core.getClient()?.getOptions()
|
|
699
|
+
const { tracePropagationTargets, propagateTraceparent } = core.getClient()?.getOptions() || {};
|
|
700
700
|
if (!shouldPropagateTraceForUrl(url, tracePropagationTargets, this._urlMatchesTargetsMap)) {
|
|
701
701
|
DEBUG_BUILD &&
|
|
702
702
|
core.debug.log('[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:', url);
|
|
@@ -730,6 +730,10 @@ class SentryPropagator extends core$1.W3CBaggagePropagator {
|
|
|
730
730
|
// We also want to avoid setting the default OTEL trace ID, if we get that for whatever reason
|
|
731
731
|
if (traceId && traceId !== api.INVALID_TRACEID) {
|
|
732
732
|
setter.set(carrier, SENTRY_TRACE_HEADER, core.generateSentryTraceHeader(traceId, spanId, sampled));
|
|
733
|
+
|
|
734
|
+
if (propagateTraceparent) {
|
|
735
|
+
setter.set(carrier, 'traceparent', core.generateTraceparentHeader(traceId, spanId, sampled));
|
|
736
|
+
}
|
|
733
737
|
}
|
|
734
738
|
|
|
735
739
|
super.inject(api.propagation.setBaggage(context, baggage), carrier, setter);
|
|
@@ -757,7 +761,7 @@ class SentryPropagator extends core$1.W3CBaggagePropagator {
|
|
|
757
761
|
* @inheritDoc
|
|
758
762
|
*/
|
|
759
763
|
fields() {
|
|
760
|
-
return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER];
|
|
764
|
+
return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER, 'traceparent'];
|
|
761
765
|
}
|
|
762
766
|
}
|
|
763
767
|
|
|
@@ -1276,6 +1280,7 @@ function getTraceData({
|
|
|
1276
1280
|
span,
|
|
1277
1281
|
scope,
|
|
1278
1282
|
client,
|
|
1283
|
+
propagateTraceparent,
|
|
1279
1284
|
} = {}) {
|
|
1280
1285
|
let ctx = (scope && getContextFromScope(scope)) ?? api.context.active();
|
|
1281
1286
|
|
|
@@ -1287,10 +1292,16 @@ function getTraceData({
|
|
|
1287
1292
|
|
|
1288
1293
|
const { traceId, spanId, sampled, dynamicSamplingContext } = getInjectionData(ctx, { scope, client });
|
|
1289
1294
|
|
|
1290
|
-
|
|
1295
|
+
const traceData = {
|
|
1291
1296
|
'sentry-trace': core.generateSentryTraceHeader(traceId, spanId, sampled),
|
|
1292
1297
|
baggage: core.dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext),
|
|
1293
1298
|
};
|
|
1299
|
+
|
|
1300
|
+
if (propagateTraceparent) {
|
|
1301
|
+
traceData.traceparent = core.generateTraceparentHeader(traceId, spanId, sampled);
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
return traceData;
|
|
1294
1305
|
}
|
|
1295
1306
|
|
|
1296
1307
|
/**
|