@sentry-internal/tracing
Advanced tools
Comparing version 7.92.0 to 7.93.0
@@ -15,2 +15,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
types.WINDOW.document.addEventListener('visibilitychange', () => { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const activeTransaction = core.getActiveTransaction() ; | ||
@@ -29,2 +30,4 @@ if (types.WINDOW.document.hidden && activeTransaction) { | ||
} | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
activeTransaction.setTag('visibilitychange', 'document.hidden'); | ||
@@ -31,0 +34,0 @@ activeTransaction.end(); |
@@ -184,2 +184,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
metadata: { | ||
// eslint-disable-next-line deprecation/deprecation | ||
...context.metadata, | ||
@@ -198,10 +199,20 @@ dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext, | ||
// If `beforeNavigate` set a custom name, record that fact | ||
// eslint-disable-next-line deprecation/deprecation | ||
finalContext.metadata = | ||
finalContext.name !== expandedContext.name | ||
? { ...finalContext.metadata, source: 'custom' } | ||
: finalContext.metadata; | ||
? // eslint-disable-next-line deprecation/deprecation | ||
{ ...finalContext.metadata, source: 'custom' } | ||
: // eslint-disable-next-line deprecation/deprecation | ||
finalContext.metadata; | ||
this._latestRouteName = finalContext.name; | ||
this._latestRouteSource = finalContext.metadata && finalContext.metadata.source; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const sourceFromData = context.data && context.data[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const sourceFromMetadata = finalContext.metadata && finalContext.metadata.source; | ||
this._latestRouteSource = sourceFromData || sourceFromMetadata; | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (finalContext.sampled === false) { | ||
@@ -235,6 +246,6 @@ debugBuild.DEBUG_BUILD && utils.logger.log(`[Tracing] Will not send ${finalContext.op} transaction because of beforeNavigate.`); | ||
scope.setPropagationContext({ | ||
traceId: idleTransaction.traceId, | ||
spanId: idleTransaction.spanId, | ||
traceId: idleTransaction.spanContext().traceId, | ||
spanId: idleTransaction.spanContext().spanId, | ||
parentSpanId: idleTransaction.parentSpanId, | ||
sampled: idleTransaction.sampled, | ||
sampled: core.spanIsSampled(idleTransaction), | ||
}); | ||
@@ -258,2 +269,3 @@ } | ||
// eslint-disable-next-line deprecation/deprecation | ||
const currentTransaction = core.getActiveTransaction(); | ||
@@ -291,4 +303,4 @@ if (currentTransaction && currentTransaction.op && ['navigation', 'pageload'].includes(currentTransaction.op)) { | ||
trimEnd: true, | ||
metadata: { | ||
source: this._latestRouteSource || 'url', | ||
data: { | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: this._latestRouteSource || 'url', | ||
}, | ||
@@ -295,0 +307,0 @@ }; |
@@ -64,2 +64,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
for (const entry of entries) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const transaction = core.getActiveTransaction() ; | ||
@@ -72,2 +73,3 @@ if (!transaction) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.startChild({ | ||
@@ -90,2 +92,3 @@ description: 'Main UI thread blocked', | ||
for (const entry of entries) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const transaction = core.getActiveTransaction() ; | ||
@@ -110,5 +113,6 @@ if (!transaction) { | ||
if (componentName) { | ||
span.data = { 'ui.component_name': componentName }; | ||
span.attributes = { 'ui.component_name': componentName }; | ||
} | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.startChild(span); | ||
@@ -434,2 +438,4 @@ } | ||
if (connection.effectiveType) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('effectiveConnectionType', connection.effectiveType); | ||
@@ -439,2 +445,4 @@ } | ||
if (connection.type) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('connectionType', connection.type); | ||
@@ -449,2 +457,4 @@ } | ||
if (utils$1.isMeasurementValue(navigator.deviceMemory)) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('deviceMemory', `${navigator.deviceMemory} GB`); | ||
@@ -454,2 +464,4 @@ } | ||
if (utils$1.isMeasurementValue(navigator.hardwareConcurrency)) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('hardwareConcurrency', String(navigator.hardwareConcurrency)); | ||
@@ -467,2 +479,4 @@ } | ||
if (_lcpEntry.element) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.element', utils.htmlTreeAsString(_lcpEntry.element)); | ||
@@ -472,2 +486,4 @@ } | ||
if (_lcpEntry.id) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.id', _lcpEntry.id); | ||
@@ -478,5 +494,9 @@ } | ||
// Trim URL to the first 200 characters. | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.url', _lcpEntry.url.trim().slice(0, 200)); | ||
} | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.size', _lcpEntry.size); | ||
@@ -489,2 +509,4 @@ } | ||
_clsEntry.sources.forEach((source, index) => | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag(`cls.source.${index + 1}`, utils.htmlTreeAsString(source.node)), | ||
@@ -491,0 +513,0 @@ ); |
@@ -20,2 +20,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// eslint-disable-next-line deprecation/deprecation | ||
return transaction.startChild({ | ||
@@ -22,0 +23,0 @@ startTimestamp, |
@@ -86,5 +86,5 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
function addHTTPTimings(span) { | ||
const url = span.data.url; | ||
const { url } = core.spanToJSON(span).data || {}; | ||
if (!url) { | ||
if (!url || typeof url !== 'string') { | ||
return; | ||
@@ -97,3 +97,3 @@ } | ||
const spanData = resourceTimingEntryToSpanData(entry); | ||
spanData.forEach(data => span.setData(...data)); | ||
spanData.forEach(data => span.setAttribute(...data)); | ||
// In the next tick, clean this handler up | ||
@@ -214,7 +214,8 @@ // We have to wait here because otherwise this cleans itself up before it is fully done | ||
const scope = core.getCurrentScope(); | ||
const parentSpan = scope.getSpan(); | ||
const parentSpan = core.getActiveSpan(); | ||
const span = | ||
shouldCreateSpanResult && parentSpan | ||
? parentSpan.startChild({ | ||
? // eslint-disable-next-line deprecation/deprecation | ||
parentSpan.startChild({ | ||
data: { | ||
@@ -232,3 +233,3 @@ type: 'xhr', | ||
if (span) { | ||
xhr.__sentry_xhr_span_id__ = span.spanId; | ||
xhr.__sentry_xhr_span_id__ = span.spanContext().spanId; | ||
spans[xhr.__sentry_xhr_span_id__] = span; | ||
@@ -240,3 +241,3 @@ } | ||
const transaction = span && span.transaction; | ||
const dynamicSamplingContext = transaction && transaction.getDynamicSamplingContext(); | ||
const dynamicSamplingContext = transaction && core.getDynamicSamplingContextFromSpan(transaction); | ||
const sentryBaggageHeader = utils.dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext); | ||
@@ -243,0 +244,0 @@ setHeaderOnXhr(xhr, core.spanToTraceHeader(span), sentryBaggageHeader); |
@@ -39,3 +39,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
if (contentLengthNum > 0) { | ||
span.setData('http.response_content_length', contentLengthNum); | ||
span.setAttribute('http.response_content_length', contentLengthNum); | ||
} | ||
@@ -56,3 +56,3 @@ } | ||
const client = core.getClient(); | ||
const parentSpan = scope.getSpan(); | ||
const parentSpan = core.getActiveSpan(); | ||
@@ -63,3 +63,4 @@ const { method, url } = handlerData.fetchData; | ||
shouldCreateSpanResult && parentSpan | ||
? parentSpan.startChild({ | ||
? // eslint-disable-next-line deprecation/deprecation | ||
parentSpan.startChild({ | ||
data: { | ||
@@ -77,4 +78,4 @@ url, | ||
if (span) { | ||
handlerData.fetchData.__span = span.spanId; | ||
spans[span.spanId] = span; | ||
handlerData.fetchData.__span = span.spanContext().spanId; | ||
spans[span.spanContext().spanId] = span; | ||
} | ||
@@ -110,2 +111,3 @@ | ||
) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = requestSpan || scope.getSpan(); | ||
@@ -119,3 +121,3 @@ | ||
const dynamicSamplingContext = transaction | ||
? transaction.getDynamicSamplingContext() | ||
? core.getDynamicSamplingContextFromSpan(transaction) | ||
: dsc | ||
@@ -122,0 +124,0 @@ ? dsc |
@@ -161,3 +161,5 @@ var { | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -164,0 +166,0 @@ description: `${resolverGroupName}.${resolverName}`, |
@@ -7,2 +7,3 @@ var { | ||
const core = require('@sentry/core'); | ||
const utils = require('@sentry/utils'); | ||
@@ -12,2 +13,4 @@ const debugBuild = require('../../common/debug-build.js'); | ||
/* eslint-disable max-lines */ | ||
/** | ||
@@ -83,2 +86,3 @@ * Express integration | ||
if (transaction) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = transaction.startChild({ | ||
@@ -104,2 +108,3 @@ description: fn.name, | ||
const transaction = res.__sentry_transaction; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([transaction, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -125,2 +130,3 @@ description: fn.name, | ||
const transaction = res.__sentry_transaction; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([transaction, 'optionalAccess', _6 => _6.startChild, 'call', _7 => _7({ | ||
@@ -300,3 +306,4 @@ description: fn.name, | ||
const transaction = res.__sentry_transaction; | ||
if (transaction && transaction.metadata.source !== 'custom') { | ||
const attributes = (transaction && core.spanToJSON(transaction).data) || {}; | ||
if (transaction && attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== 'custom') { | ||
// If the request URL is '/' or empty, the reconstructed route will be empty. | ||
@@ -308,3 +315,3 @@ // Therefore, we fall back to setting the final route to '/' in this case. | ||
transaction.updateName(name); | ||
transaction.setMetadata({ source }); | ||
transaction.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); | ||
} | ||
@@ -311,0 +318,0 @@ } |
@@ -50,4 +50,6 @@ var { | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -59,2 +61,3 @@ description: 'execute', | ||
// eslint-disable-next-line deprecation/deprecation | ||
_optionalChain([scope, 'optionalAccess', _4 => _4.setSpan, 'call', _5 => _5(span)]); | ||
@@ -67,2 +70,3 @@ | ||
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]); | ||
// eslint-disable-next-line deprecation/deprecation | ||
_optionalChain([scope, 'optionalAccess', _8 => _8.setSpan, 'call', _9 => _9(parentSpan)]); | ||
@@ -75,2 +79,3 @@ | ||
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11()]); | ||
// eslint-disable-next-line deprecation/deprecation | ||
_optionalChain([scope, 'optionalAccess', _12 => _12.setSpan, 'call', _13 => _13(parentSpan)]); | ||
@@ -77,0 +82,0 @@ return rv; |
@@ -152,2 +152,3 @@ var { | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
@@ -158,2 +159,3 @@ | ||
if (typeof lastArg !== 'function' || (operation === 'mapReduce' && args.length === 2)) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3(getSpanContext(this, operation, args))]); | ||
@@ -190,2 +192,3 @@ const maybePromiseOrCursor = orig.call(this, ...args); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _12 => _12.startChild, 'call', _13 => _13(getSpanContext(this, operation, args.slice(0, -1)))]); | ||
@@ -192,0 +195,0 @@ |
@@ -80,3 +80,3 @@ var { | ||
Object.keys(data).forEach(key => { | ||
span.setData(key, data[key]); | ||
span.setAttribute(key, data[key]); | ||
}); | ||
@@ -94,4 +94,6 @@ | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -98,0 +100,0 @@ description: typeof options === 'string' ? options : (options ).sql, |
@@ -66,2 +66,3 @@ var { | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
@@ -90,2 +91,3 @@ | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _4 => _4.startChild, 'call', _5 => _5({ | ||
@@ -92,0 +94,0 @@ description: typeof config === 'string' ? config : (config ).text, |
@@ -13,2 +13,3 @@ import { getActiveTransaction } from '@sentry/core'; | ||
WINDOW.document.addEventListener('visibilitychange', () => { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const activeTransaction = getActiveTransaction() ; | ||
@@ -27,2 +28,4 @@ if (WINDOW.document.hidden && activeTransaction) { | ||
} | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
activeTransaction.setTag('visibilitychange', 'document.hidden'); | ||
@@ -29,0 +32,0 @@ activeTransaction.end(); |
@@ -1,2 +0,2 @@ | ||
import { TRACING_DEFAULTS, addTracingExtensions, startIdleTransaction, getActiveTransaction } from '@sentry/core'; | ||
import { TRACING_DEFAULTS, addTracingExtensions, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startIdleTransaction, spanIsSampled, getActiveTransaction } from '@sentry/core'; | ||
import { logger, tracingContextFromHeaders, getDomElement } from '@sentry/utils'; | ||
@@ -182,2 +182,3 @@ import { DEBUG_BUILD } from '../common/debug-build.js'; | ||
metadata: { | ||
// eslint-disable-next-line deprecation/deprecation | ||
...context.metadata, | ||
@@ -196,10 +197,20 @@ dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext, | ||
// If `beforeNavigate` set a custom name, record that fact | ||
// eslint-disable-next-line deprecation/deprecation | ||
finalContext.metadata = | ||
finalContext.name !== expandedContext.name | ||
? { ...finalContext.metadata, source: 'custom' } | ||
: finalContext.metadata; | ||
? // eslint-disable-next-line deprecation/deprecation | ||
{ ...finalContext.metadata, source: 'custom' } | ||
: // eslint-disable-next-line deprecation/deprecation | ||
finalContext.metadata; | ||
this._latestRouteName = finalContext.name; | ||
this._latestRouteSource = finalContext.metadata && finalContext.metadata.source; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const sourceFromData = context.data && context.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const sourceFromMetadata = finalContext.metadata && finalContext.metadata.source; | ||
this._latestRouteSource = sourceFromData || sourceFromMetadata; | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (finalContext.sampled === false) { | ||
@@ -233,6 +244,6 @@ DEBUG_BUILD && logger.log(`[Tracing] Will not send ${finalContext.op} transaction because of beforeNavigate.`); | ||
scope.setPropagationContext({ | ||
traceId: idleTransaction.traceId, | ||
spanId: idleTransaction.spanId, | ||
traceId: idleTransaction.spanContext().traceId, | ||
spanId: idleTransaction.spanContext().spanId, | ||
parentSpanId: idleTransaction.parentSpanId, | ||
sampled: idleTransaction.sampled, | ||
sampled: spanIsSampled(idleTransaction), | ||
}); | ||
@@ -256,2 +267,3 @@ } | ||
// eslint-disable-next-line deprecation/deprecation | ||
const currentTransaction = getActiveTransaction(); | ||
@@ -289,4 +301,4 @@ if (currentTransaction && currentTransaction.op && ['navigation', 'pageload'].includes(currentTransaction.op)) { | ||
trimEnd: true, | ||
metadata: { | ||
source: this._latestRouteSource || 'url', | ||
data: { | ||
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: this._latestRouteSource || 'url', | ||
}, | ||
@@ -293,0 +305,0 @@ }; |
@@ -62,2 +62,3 @@ import { getActiveTransaction } from '@sentry/core'; | ||
for (const entry of entries) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const transaction = getActiveTransaction() ; | ||
@@ -70,2 +71,3 @@ if (!transaction) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.startChild({ | ||
@@ -88,2 +90,3 @@ description: 'Main UI thread blocked', | ||
for (const entry of entries) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const transaction = getActiveTransaction() ; | ||
@@ -108,5 +111,6 @@ if (!transaction) { | ||
if (componentName) { | ||
span.data = { 'ui.component_name': componentName }; | ||
span.attributes = { 'ui.component_name': componentName }; | ||
} | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.startChild(span); | ||
@@ -432,2 +436,4 @@ } | ||
if (connection.effectiveType) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('effectiveConnectionType', connection.effectiveType); | ||
@@ -437,2 +443,4 @@ } | ||
if (connection.type) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('connectionType', connection.type); | ||
@@ -447,2 +455,4 @@ } | ||
if (isMeasurementValue(navigator.deviceMemory)) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('deviceMemory', `${navigator.deviceMemory} GB`); | ||
@@ -452,2 +462,4 @@ } | ||
if (isMeasurementValue(navigator.hardwareConcurrency)) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('hardwareConcurrency', String(navigator.hardwareConcurrency)); | ||
@@ -465,2 +477,4 @@ } | ||
if (_lcpEntry.element) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.element', htmlTreeAsString(_lcpEntry.element)); | ||
@@ -470,2 +484,4 @@ } | ||
if (_lcpEntry.id) { | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.id', _lcpEntry.id); | ||
@@ -476,5 +492,9 @@ } | ||
// Trim URL to the first 200 characters. | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.url', _lcpEntry.url.trim().slice(0, 200)); | ||
} | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag('lcp.size', _lcpEntry.size); | ||
@@ -487,2 +507,4 @@ } | ||
_clsEntry.sources.forEach((source, index) => | ||
// TODO: Can we rewrite this to an attribute? | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.setTag(`cls.source.${index + 1}`, htmlTreeAsString(source.node)), | ||
@@ -489,0 +511,0 @@ ); |
@@ -18,2 +18,3 @@ /** | ||
// eslint-disable-next-line deprecation/deprecation | ||
return transaction.startChild({ | ||
@@ -20,0 +21,0 @@ startTimestamp, |
@@ -1,2 +0,2 @@ | ||
import { hasTracingEnabled, getCurrentScope, spanToTraceHeader, getClient, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { spanToJSON, hasTracingEnabled, getCurrentScope, getActiveSpan, getDynamicSamplingContextFromSpan, spanToTraceHeader, getClient, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { addFetchInstrumentationHandler, addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY, dynamicSamplingContextToSentryBaggageHeader, generateSentryTraceHeader, BAGGAGE_HEADER_NAME, browserPerformanceTimeOrigin, stringMatchesSomePattern } from '@sentry/utils'; | ||
@@ -84,5 +84,5 @@ import { instrumentFetchRequest } from '../common/fetch.js'; | ||
function addHTTPTimings(span) { | ||
const url = span.data.url; | ||
const { url } = spanToJSON(span).data || {}; | ||
if (!url) { | ||
if (!url || typeof url !== 'string') { | ||
return; | ||
@@ -95,3 +95,3 @@ } | ||
const spanData = resourceTimingEntryToSpanData(entry); | ||
spanData.forEach(data => span.setData(...data)); | ||
spanData.forEach(data => span.setAttribute(...data)); | ||
// In the next tick, clean this handler up | ||
@@ -212,7 +212,8 @@ // We have to wait here because otherwise this cleans itself up before it is fully done | ||
const scope = getCurrentScope(); | ||
const parentSpan = scope.getSpan(); | ||
const parentSpan = getActiveSpan(); | ||
const span = | ||
shouldCreateSpanResult && parentSpan | ||
? parentSpan.startChild({ | ||
? // eslint-disable-next-line deprecation/deprecation | ||
parentSpan.startChild({ | ||
data: { | ||
@@ -230,3 +231,3 @@ type: 'xhr', | ||
if (span) { | ||
xhr.__sentry_xhr_span_id__ = span.spanId; | ||
xhr.__sentry_xhr_span_id__ = span.spanContext().spanId; | ||
spans[xhr.__sentry_xhr_span_id__] = span; | ||
@@ -238,3 +239,3 @@ } | ||
const transaction = span && span.transaction; | ||
const dynamicSamplingContext = transaction && transaction.getDynamicSamplingContext(); | ||
const dynamicSamplingContext = transaction && getDynamicSamplingContextFromSpan(transaction); | ||
const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext); | ||
@@ -241,0 +242,0 @@ setHeaderOnXhr(xhr, spanToTraceHeader(span), sentryBaggageHeader); |
@@ -1,2 +0,2 @@ | ||
import { hasTracingEnabled, getCurrentScope, getClient, spanToTraceHeader, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { hasTracingEnabled, getCurrentScope, getClient, getActiveSpan, spanToTraceHeader, getDynamicSamplingContextFromSpan, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { generateSentryTraceHeader, dynamicSamplingContextToSentryBaggageHeader, isInstanceOf, BAGGAGE_HEADER_NAME } from '@sentry/utils'; | ||
@@ -37,3 +37,3 @@ | ||
if (contentLengthNum > 0) { | ||
span.setData('http.response_content_length', contentLengthNum); | ||
span.setAttribute('http.response_content_length', contentLengthNum); | ||
} | ||
@@ -54,3 +54,3 @@ } | ||
const client = getClient(); | ||
const parentSpan = scope.getSpan(); | ||
const parentSpan = getActiveSpan(); | ||
@@ -61,3 +61,4 @@ const { method, url } = handlerData.fetchData; | ||
shouldCreateSpanResult && parentSpan | ||
? parentSpan.startChild({ | ||
? // eslint-disable-next-line deprecation/deprecation | ||
parentSpan.startChild({ | ||
data: { | ||
@@ -75,4 +76,4 @@ url, | ||
if (span) { | ||
handlerData.fetchData.__span = span.spanId; | ||
spans[span.spanId] = span; | ||
handlerData.fetchData.__span = span.spanContext().spanId; | ||
spans[span.spanContext().spanId] = span; | ||
} | ||
@@ -108,2 +109,3 @@ | ||
) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = requestSpan || scope.getSpan(); | ||
@@ -117,3 +119,3 @@ | ||
const dynamicSamplingContext = transaction | ||
? transaction.getDynamicSamplingContext() | ||
? getDynamicSamplingContextFromSpan(transaction) | ||
: dsc | ||
@@ -120,0 +122,0 @@ ? dsc |
@@ -156,3 +156,5 @@ import { _optionalChain } from '@sentry/utils'; | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -159,0 +161,0 @@ description: `${resolverGroupName}.${resolverName}`, |
import { _optionalChain } from '@sentry/utils'; | ||
import { spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; | ||
import { logger, getNumberOfUrlSegments, stripUrlQueryAndFragment, extractPathForTransaction, isRegExp, GLOBAL_OBJ } from '@sentry/utils'; | ||
@@ -6,2 +7,4 @@ import { DEBUG_BUILD } from '../../common/debug-build.js'; | ||
/* eslint-disable max-lines */ | ||
/** | ||
@@ -77,2 +80,3 @@ * Express integration | ||
if (transaction) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = transaction.startChild({ | ||
@@ -98,2 +102,3 @@ description: fn.name, | ||
const transaction = res.__sentry_transaction; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([transaction, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -119,2 +124,3 @@ description: fn.name, | ||
const transaction = res.__sentry_transaction; | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([transaction, 'optionalAccess', _6 => _6.startChild, 'call', _7 => _7({ | ||
@@ -294,3 +300,4 @@ description: fn.name, | ||
const transaction = res.__sentry_transaction; | ||
if (transaction && transaction.metadata.source !== 'custom') { | ||
const attributes = (transaction && spanToJSON(transaction).data) || {}; | ||
if (transaction && attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== 'custom') { | ||
// If the request URL is '/' or empty, the reconstructed route will be empty. | ||
@@ -302,3 +309,3 @@ // Therefore, we fall back to setting the final route to '/' in this case. | ||
transaction.updateName(name); | ||
transaction.setMetadata({ source }); | ||
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); | ||
} | ||
@@ -305,0 +312,0 @@ } |
@@ -45,4 +45,6 @@ import { _optionalChain } from '@sentry/utils'; | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -54,2 +56,3 @@ description: 'execute', | ||
// eslint-disable-next-line deprecation/deprecation | ||
_optionalChain([scope, 'optionalAccess', _4 => _4.setSpan, 'call', _5 => _5(span)]); | ||
@@ -62,2 +65,3 @@ | ||
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]); | ||
// eslint-disable-next-line deprecation/deprecation | ||
_optionalChain([scope, 'optionalAccess', _8 => _8.setSpan, 'call', _9 => _9(parentSpan)]); | ||
@@ -70,2 +74,3 @@ | ||
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11()]); | ||
// eslint-disable-next-line deprecation/deprecation | ||
_optionalChain([scope, 'optionalAccess', _12 => _12.setSpan, 'call', _13 => _13(parentSpan)]); | ||
@@ -72,0 +77,0 @@ return rv; |
@@ -147,2 +147,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
@@ -153,2 +154,3 @@ | ||
if (typeof lastArg !== 'function' || (operation === 'mapReduce' && args.length === 2)) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3(getSpanContext(this, operation, args))]); | ||
@@ -185,2 +187,3 @@ const maybePromiseOrCursor = orig.call(this, ...args); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _12 => _12.startChild, 'call', _13 => _13(getSpanContext(this, operation, args.slice(0, -1)))]); | ||
@@ -187,0 +190,0 @@ |
@@ -75,3 +75,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
Object.keys(data).forEach(key => { | ||
span.setData(key, data[key]); | ||
span.setAttribute(key, data[key]); | ||
}); | ||
@@ -89,4 +89,6 @@ | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({ | ||
@@ -93,0 +95,0 @@ description: typeof options === 'string' ? options : (options ).sql, |
@@ -61,2 +61,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
@@ -85,2 +86,3 @@ | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _4 => _4.startChild, 'call', _5 => _5({ | ||
@@ -87,0 +89,0 @@ description: typeof config === 'string' ? config : (config ).text, |
{ | ||
"name": "@sentry-internal/tracing", | ||
"version": "7.92.0", | ||
"version": "7.93.0", | ||
"description": "Sentry Internal Tracing Package", | ||
@@ -32,5 +32,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "7.92.0", | ||
"@sentry/types": "7.92.0", | ||
"@sentry/utils": "7.92.0" | ||
"@sentry/core": "7.93.0", | ||
"@sentry/types": "7.93.0", | ||
"@sentry/utils": "7.93.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "devDependencies": { |
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
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
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
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
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
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1077095
9081
+ Added@sentry/core@7.93.0(transitive)
+ Added@sentry/types@7.93.0(transitive)
+ Added@sentry/utils@7.93.0(transitive)
- Removed@sentry/core@7.92.0(transitive)
- Removed@sentry/types@7.92.0(transitive)
- Removed@sentry/utils@7.92.0(transitive)
Updated@sentry/core@7.93.0
Updated@sentry/types@7.93.0
Updated@sentry/utils@7.93.0