@sentry/utils
Advanced tools
Comparing version 7.99.0 to 7.100.0
@@ -167,2 +167,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.generateSentryTraceHeader = tracing.generateSentryTraceHeader; | ||
exports.propagationContextFromHeaders = tracing.propagationContextFromHeaders; | ||
exports.tracingContextFromHeaders = tracing.tracingContextFromHeaders; | ||
@@ -169,0 +170,0 @@ exports.getSDKSource = env.getSDKSource; |
@@ -48,3 +48,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
* Create tracing context from incoming headers. | ||
* | ||
* @deprecated Use `propagationContextFromHeaders` instead. | ||
*/ | ||
// TODO(v8): Remove this function | ||
function tracingContextFromHeaders( | ||
@@ -86,2 +89,30 @@ sentryTrace, | ||
/** | ||
* Create a propagation context from incoming headers. | ||
*/ | ||
function propagationContextFromHeaders( | ||
sentryTrace, | ||
baggage$1, | ||
) { | ||
const traceparentData = extractTraceparentData(sentryTrace); | ||
const dynamicSamplingContext = baggage.baggageHeaderToDynamicSamplingContext(baggage$1); | ||
const { traceId, parentSpanId, parentSampled } = traceparentData || {}; | ||
if (!traceparentData) { | ||
return { | ||
traceId: traceId || misc.uuid4(), | ||
spanId: misc.uuid4().substring(16), | ||
}; | ||
} else { | ||
return { | ||
traceId: traceId || misc.uuid4(), | ||
parentSpanId: parentSpanId || misc.uuid4().substring(16), | ||
spanId: misc.uuid4().substring(16), | ||
sampled: parentSampled, | ||
dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it | ||
}; | ||
} | ||
} | ||
/** | ||
* Create sentry-trace header from span context values. | ||
@@ -104,3 +135,4 @@ */ | ||
exports.generateSentryTraceHeader = generateSentryTraceHeader; | ||
exports.propagationContextFromHeaders = propagationContextFromHeaders; | ||
exports.tracingContextFromHeaders = tracingContextFromHeaders; | ||
//# sourceMappingURL=tracing.js.map |
@@ -24,3 +24,3 @@ export { applyAggregateErrorsToEvent } from './aggregate-errors.js'; | ||
export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs } from './time.js'; | ||
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, tracingContextFromHeaders } from './tracing.js'; | ||
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, tracingContextFromHeaders } from './tracing.js'; | ||
export { getSDKSource, isBrowserBundle } from './env.js'; | ||
@@ -27,0 +27,0 @@ export { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope } from './envelope.js'; |
@@ -46,3 +46,6 @@ import { baggageHeaderToDynamicSamplingContext } from './baggage.js'; | ||
* Create tracing context from incoming headers. | ||
* | ||
* @deprecated Use `propagationContextFromHeaders` instead. | ||
*/ | ||
// TODO(v8): Remove this function | ||
function tracingContextFromHeaders( | ||
@@ -84,2 +87,30 @@ sentryTrace, | ||
/** | ||
* Create a propagation context from incoming headers. | ||
*/ | ||
function propagationContextFromHeaders( | ||
sentryTrace, | ||
baggage, | ||
) { | ||
const traceparentData = extractTraceparentData(sentryTrace); | ||
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage); | ||
const { traceId, parentSpanId, parentSampled } = traceparentData || {}; | ||
if (!traceparentData) { | ||
return { | ||
traceId: traceId || uuid4(), | ||
spanId: uuid4().substring(16), | ||
}; | ||
} else { | ||
return { | ||
traceId: traceId || uuid4(), | ||
parentSpanId: parentSpanId || uuid4().substring(16), | ||
spanId: uuid4().substring(16), | ||
sampled: parentSampled, | ||
dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it | ||
}; | ||
} | ||
} | ||
/** | ||
* Create sentry-trace header from span context values. | ||
@@ -99,3 +130,3 @@ */ | ||
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, tracingContextFromHeaders }; | ||
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, tracingContextFromHeaders }; | ||
//# sourceMappingURL=tracing.js.map |
{ | ||
"name": "@sentry/utils", | ||
"version": "7.99.0", | ||
"version": "7.100.0", | ||
"description": "Utilities for all Sentry JavaScript SDKs", | ||
@@ -32,3 +32,3 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "7.99.0" | ||
"@sentry/types": "7.100.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -14,2 +14,4 @@ import { PropagationContext, TraceparentData } from '@sentry/types'; | ||
* Create tracing context from incoming headers. | ||
* | ||
* @deprecated Use `propagationContextFromHeaders` instead. | ||
*/ | ||
@@ -22,2 +24,6 @@ export declare function tracingContextFromHeaders(sentryTrace: Parameters<typeof extractTraceparentData>[0], baggage: Parameters<typeof baggageHeaderToDynamicSamplingContext>[0]): { | ||
/** | ||
* Create a propagation context from incoming headers. | ||
*/ | ||
export declare function propagationContextFromHeaders(sentryTrace: string | undefined, baggage: string | number | boolean | string[] | null | undefined): PropagationContext; | ||
/** | ||
* Create sentry-trace header from span context values. | ||
@@ -24,0 +30,0 @@ */ |
@@ -14,2 +14,4 @@ import type { PropagationContext, TraceparentData } from '@sentry/types'; | ||
* Create tracing context from incoming headers. | ||
* | ||
* @deprecated Use `propagationContextFromHeaders` instead. | ||
*/ | ||
@@ -22,2 +24,6 @@ export declare function tracingContextFromHeaders(sentryTrace: Parameters<typeof extractTraceparentData>[0], baggage: Parameters<typeof baggageHeaderToDynamicSamplingContext>[0]): { | ||
/** | ||
* Create a propagation context from incoming headers. | ||
*/ | ||
export declare function propagationContextFromHeaders(sentryTrace: string | undefined, baggage: string | number | boolean | string[] | null | undefined): PropagationContext; | ||
/** | ||
* Create sentry-trace header from span context values. | ||
@@ -24,0 +30,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1274891
13761
+ Added@sentry/types@7.100.0(transitive)
- Removed@sentry/types@7.99.0(transitive)
Updated@sentry/types@7.100.0