@sentry-internal/tracing
Advanced tools
Comparing version 7.93.0 to 7.94.0
@@ -20,9 +20,9 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const { op, status } = core.spanToJSON(activeTransaction); | ||
debugBuild.DEBUG_BUILD && | ||
utils.logger.log( | ||
`[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${activeTransaction.op}`, | ||
); | ||
utils.logger.log(`[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${op}`); | ||
// We should not set status if it is already set, this prevent important statuses like | ||
// error or data loss from being overwritten on transaction. | ||
if (!activeTransaction.status) { | ||
if (!status) { | ||
activeTransaction.setStatus(statusType); | ||
@@ -29,0 +29,0 @@ } |
@@ -95,2 +95,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const hub = getCurrentHub(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const client = hub.getClient(); | ||
@@ -233,4 +234,18 @@ const clientOptions = client && client.getOptions(); | ||
heartbeatInterval, | ||
isPageloadTransaction, // should wait for finish signal if it's a pageload transaction | ||
); | ||
if (isPageloadTransaction) { | ||
types.WINDOW.document.addEventListener('readystatechange', () => { | ||
if (['interactive', 'complete'].includes(types.WINDOW.document.readyState)) { | ||
idleTransaction.sendAutoFinishSignal(); | ||
} | ||
}); | ||
if (['interactive', 'complete'].includes(types.WINDOW.document.readyState)) { | ||
idleTransaction.sendAutoFinishSignal(); | ||
} | ||
} | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = hub.getScope(); | ||
@@ -237,0 +252,0 @@ |
@@ -180,2 +180,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const { op, start_timestamp: transactionStartTime } = core.spanToJSON(transaction); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -186,3 +188,4 @@ performanceEntries.slice(_performanceCursor).forEach((entry) => { | ||
if (transaction.op === 'navigation' && timeOrigin + startTime < transaction.startTimestamp) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (transaction.op === 'navigation' && transactionStartTime && timeOrigin + startTime < transactionStartTime) { | ||
return; | ||
@@ -219,4 +222,3 @@ } | ||
case 'resource': { | ||
const resourceName = (entry.name ).replace(types.WINDOW.location.origin, ''); | ||
_addResourceSpans(transaction, entry, resourceName, startTime, duration, timeOrigin); | ||
_addResourceSpans(transaction, entry, entry.name , startTime, duration, timeOrigin); | ||
break; | ||
@@ -233,9 +235,9 @@ } | ||
// Measurements are only available for pageload transactions | ||
if (transaction.op === 'pageload') { | ||
if (op === 'pageload') { | ||
// Generate TTFB (Time to First Byte), which measured as the time between the beginning of the transaction and the | ||
// start of the response in milliseconds | ||
if (typeof responseStartTimestamp === 'number') { | ||
if (typeof responseStartTimestamp === 'number' && transactionStartTime) { | ||
debugBuild.DEBUG_BUILD && utils.logger.log('[Measurements] Adding TTFB'); | ||
_measurements['ttfb'] = { | ||
value: (responseStartTimestamp - transaction.startTimestamp) * 1000, | ||
value: (responseStartTimestamp - transactionStartTime) * 1000, | ||
unit: 'millisecond', | ||
@@ -255,3 +257,3 @@ }; | ||
['fcp', 'fp', 'lcp'].forEach(name => { | ||
if (!_measurements[name] || timeOrigin >= transaction.startTimestamp) { | ||
if (!_measurements[name] || !transactionStartTime || timeOrigin >= transactionStartTime) { | ||
return; | ||
@@ -266,3 +268,3 @@ } | ||
// normalizedValue should be in milliseconds | ||
const normalizedValue = Math.abs((measurementTimestamp - transaction.startTimestamp) * 1000); | ||
const normalizedValue = Math.abs((measurementTimestamp - transactionStartTime) * 1000); | ||
const delta = normalizedValue - oldValue; | ||
@@ -296,7 +298,3 @@ | ||
Object.keys(_measurements).forEach(measurementName => { | ||
transaction.setMeasurement( | ||
measurementName, | ||
_measurements[measurementName].value, | ||
_measurements[measurementName].unit, | ||
); | ||
core.setMeasurement(measurementName, _measurements[measurementName].value, _measurements[measurementName].unit); | ||
}); | ||
@@ -374,17 +372,23 @@ | ||
function _addRequest(transaction, entry, timeOrigin) { | ||
utils$1._startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'request', | ||
startTimestamp: timeOrigin + msToSec(entry.requestStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
if (entry.responseEnd) { | ||
// It is possible that we are collecting these metrics when the page hasn't finished loading yet, for example when the HTML slowly streams in. | ||
// In this case, ie. when the document request hasn't finished yet, `entry.responseEnd` will be 0. | ||
// In order not to produce faulty spans, where the end timestamp is before the start timestamp, we will only collect | ||
// these spans when the responseEnd value is available. The backend (Relay) would drop the entire transaction if it contained faulty spans. | ||
utils$1._startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'request', | ||
startTimestamp: timeOrigin + msToSec(entry.requestStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
utils$1._startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'response', | ||
startTimestamp: timeOrigin + msToSec(entry.responseStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
utils$1._startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'response', | ||
startTimestamp: timeOrigin + msToSec(entry.responseStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
} | ||
} | ||
@@ -396,3 +400,3 @@ | ||
entry, | ||
resourceName, | ||
resourceUrl, | ||
startTime, | ||
@@ -408,2 +412,4 @@ duration, | ||
const parsedUrl = utils.parseUrl(resourceUrl); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -414,6 +420,16 @@ const data = {}; | ||
setResourceEntrySizeData(data, entry, 'decodedBodySize', 'http.decoded_response_content_length'); | ||
if ('renderBlockingStatus' in entry) { | ||
data['resource.render_blocking_status'] = entry.renderBlockingStatus; | ||
} | ||
if (parsedUrl.protocol) { | ||
data['url.scheme'] = parsedUrl.protocol.split(':').pop(); // the protocol returned by parseUrl includes a :, but OTEL spec does not, so we remove it. | ||
} | ||
if (parsedUrl.host) { | ||
data['server.address'] = parsedUrl.host; | ||
} | ||
data['url.same_origin'] = resourceUrl.includes(types.WINDOW.location.origin); | ||
const startTimestamp = timeOrigin + startTime; | ||
@@ -423,3 +439,3 @@ const endTimestamp = startTimestamp + duration; | ||
utils$1._startChild(transaction, { | ||
description: resourceName, | ||
description: resourceUrl.replace(types.WINDOW.location.origin, ''), | ||
endTimestamp, | ||
@@ -426,0 +442,0 @@ op: entry.initiatorType ? `resource.${entry.initiatorType}` : 'resource.other', |
@@ -14,5 +14,10 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
* start timestamp. | ||
* | ||
* Note: this will not be possible anymore in v8, | ||
* unless we do some special handling for browser here... | ||
*/ | ||
function _startChild(transaction, { startTimestamp, ...ctx }) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (startTimestamp && transaction.startTimestamp > startTimestamp) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.startTimestamp = startTimestamp; | ||
@@ -19,0 +24,0 @@ } |
@@ -236,3 +236,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
if (span) { | ||
const transaction = span && span.transaction; | ||
const transaction = span && core.getRootSpan(span); | ||
const dynamicSamplingContext = transaction && core.getDynamicSamplingContextFromSpan(transaction); | ||
@@ -239,0 +239,0 @@ const sentryBaggageHeader = utils.dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext); |
@@ -110,3 +110,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const transaction = span && span.transaction; | ||
const transaction = span && core.getRootSpan(span); | ||
@@ -125,3 +125,4 @@ const { traceId, sampled, dsc } = scope.getPropagationContext(); | ||
const headers = | ||
typeof Request !== 'undefined' && utils.isInstanceOf(request, Request) ? (request ).headers : options.headers; | ||
options.headers || | ||
(typeof Request !== 'undefined' && utils.isInstanceOf(request, Request) ? (request ).headers : undefined); | ||
@@ -128,0 +129,0 @@ if (!headers) { |
@@ -160,2 +160,3 @@ var { | ||
return function ( ...args) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -162,0 +163,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -49,2 +49,3 @@ var { | ||
return function ( ...args) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -51,0 +52,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -151,6 +151,13 @@ var { | ||
const lastArg = args[args.length - 1]; | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const hub = getCurrentHub(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = hub.getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const client = hub.getClient(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
const sendDefaultPii = _optionalChain([client, 'optionalAccess', _2 => _2.getOptions, 'call', _3 => _3(), 'access', _4 => _4.sendDefaultPii]); | ||
// Check if the operation was passed a callback. (mapReduce requires a different check, as | ||
@@ -160,3 +167,3 @@ // its (non-callback) arguments can also be functions.) | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3(getSpanContext(this, operation, args))]); | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _5 => _5.startChild, 'call', _6 => _6(getSpanContext(this, operation, args, sendDefaultPii))]); | ||
const maybePromiseOrCursor = orig.call(this, ...args); | ||
@@ -166,3 +173,3 @@ | ||
return maybePromiseOrCursor.then((res) => { | ||
_optionalChain([span, 'optionalAccess', _4 => _4.end, 'call', _5 => _5()]); | ||
_optionalChain([span, 'optionalAccess', _7 => _7.end, 'call', _8 => _8()]); | ||
return res; | ||
@@ -178,3 +185,3 @@ }); | ||
cursor.once('close', () => { | ||
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]); | ||
_optionalChain([span, 'optionalAccess', _9 => _9.end, 'call', _10 => _10()]); | ||
}); | ||
@@ -184,3 +191,3 @@ } catch (e) { | ||
// finish the span immediately. | ||
_optionalChain([span, 'optionalAccess', _8 => _8.end, 'call', _9 => _9()]); | ||
_optionalChain([span, 'optionalAccess', _11 => _11.end, 'call', _12 => _12()]); | ||
} | ||
@@ -190,3 +197,3 @@ | ||
} else { | ||
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11()]); | ||
_optionalChain([span, 'optionalAccess', _13 => _13.end, 'call', _14 => _14()]); | ||
return maybePromiseOrCursor; | ||
@@ -197,6 +204,6 @@ } | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _12 => _12.startChild, 'call', _13 => _13(getSpanContext(this, operation, args.slice(0, -1)))]); | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _15 => _15.startChild, 'call', _16 => _16(getSpanContext(this, operation, args.slice(0, -1)))]); | ||
return orig.call(this, ...args.slice(0, -1), function (err, result) { | ||
_optionalChain([span, 'optionalAccess', _14 => _14.end, 'call', _15 => _15()]); | ||
_optionalChain([span, 'optionalAccess', _17 => _17.end, 'call', _18 => _18()]); | ||
lastArg(err, result); | ||
@@ -215,2 +222,3 @@ }); | ||
args, | ||
sendDefaultPii = false, | ||
) { | ||
@@ -238,3 +246,3 @@ const data = { | ||
if (!signature || !shouldDescribe) { | ||
if (!signature || !shouldDescribe || !sendDefaultPii) { | ||
return spanContext; | ||
@@ -241,0 +249,0 @@ } |
@@ -74,3 +74,3 @@ var { | ||
function finishSpan(span) { | ||
if (!span || span.endTimestamp) { | ||
if (!span) { | ||
return; | ||
@@ -93,2 +93,3 @@ } | ||
return function ( options, values, callback) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -95,0 +96,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -65,2 +65,3 @@ var { | ||
return function ( config, values, callback) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -67,0 +68,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -55,2 +55,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
options.client.$use((params, next) => { | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (nodeUtils.shouldDisableAutoInstrumentation(core.getCurrentHub)) { | ||
@@ -57,0 +58,0 @@ return next(params); |
@@ -14,2 +14,3 @@ var { | ||
function shouldDisableAutoInstrumentation(getCurrentHub) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const clientOptions = _optionalChain([getCurrentHub, 'call', _ => _(), 'access', _2 => _2.getClient, 'call', _3 => _3(), 'optionalAccess', _4 => _4.getOptions, 'call', _5 => _5()]); | ||
@@ -16,0 +17,0 @@ const instrumenter = _optionalChain([clientOptions, 'optionalAccess', _6 => _6.instrumenter]) || 'sentry'; |
@@ -1,2 +0,2 @@ | ||
import { getActiveTransaction } from '@sentry/core'; | ||
import { getActiveTransaction, spanToJSON } from '@sentry/core'; | ||
import { logger } from '@sentry/utils'; | ||
@@ -18,9 +18,9 @@ import { DEBUG_BUILD } from '../common/debug-build.js'; | ||
const { op, status } = spanToJSON(activeTransaction); | ||
DEBUG_BUILD && | ||
logger.log( | ||
`[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${activeTransaction.op}`, | ||
); | ||
logger.log(`[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${op}`); | ||
// We should not set status if it is already set, this prevent important statuses like | ||
// error or data loss from being overwritten on transaction. | ||
if (!activeTransaction.status) { | ||
if (!status) { | ||
activeTransaction.setStatus(statusType); | ||
@@ -27,0 +27,0 @@ } |
@@ -93,2 +93,3 @@ import { TRACING_DEFAULTS, addTracingExtensions, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startIdleTransaction, spanIsSampled, getActiveTransaction } from '@sentry/core'; | ||
const hub = getCurrentHub(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const client = hub.getClient(); | ||
@@ -231,4 +232,18 @@ const clientOptions = client && client.getOptions(); | ||
heartbeatInterval, | ||
isPageloadTransaction, // should wait for finish signal if it's a pageload transaction | ||
); | ||
if (isPageloadTransaction) { | ||
WINDOW.document.addEventListener('readystatechange', () => { | ||
if (['interactive', 'complete'].includes(WINDOW.document.readyState)) { | ||
idleTransaction.sendAutoFinishSignal(); | ||
} | ||
}); | ||
if (['interactive', 'complete'].includes(WINDOW.document.readyState)) { | ||
idleTransaction.sendAutoFinishSignal(); | ||
} | ||
} | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = hub.getScope(); | ||
@@ -235,0 +250,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { getActiveTransaction } from '@sentry/core'; | ||
import { browserPerformanceTimeOrigin, htmlTreeAsString, getComponentName, logger } from '@sentry/utils'; | ||
import { getActiveTransaction, spanToJSON, setMeasurement } from '@sentry/core'; | ||
import { browserPerformanceTimeOrigin, htmlTreeAsString, getComponentName, logger, parseUrl } from '@sentry/utils'; | ||
import { DEBUG_BUILD } from '../../common/debug-build.js'; | ||
@@ -178,2 +178,4 @@ import { addPerformanceInstrumentationHandler, addClsInstrumentationHandler, addLcpInstrumentationHandler, addFidInstrumentationHandler } from '../instrument.js'; | ||
const { op, start_timestamp: transactionStartTime } = spanToJSON(transaction); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -184,3 +186,4 @@ performanceEntries.slice(_performanceCursor).forEach((entry) => { | ||
if (transaction.op === 'navigation' && timeOrigin + startTime < transaction.startTimestamp) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (transaction.op === 'navigation' && transactionStartTime && timeOrigin + startTime < transactionStartTime) { | ||
return; | ||
@@ -217,4 +220,3 @@ } | ||
case 'resource': { | ||
const resourceName = (entry.name ).replace(WINDOW.location.origin, ''); | ||
_addResourceSpans(transaction, entry, resourceName, startTime, duration, timeOrigin); | ||
_addResourceSpans(transaction, entry, entry.name , startTime, duration, timeOrigin); | ||
break; | ||
@@ -231,9 +233,9 @@ } | ||
// Measurements are only available for pageload transactions | ||
if (transaction.op === 'pageload') { | ||
if (op === 'pageload') { | ||
// Generate TTFB (Time to First Byte), which measured as the time between the beginning of the transaction and the | ||
// start of the response in milliseconds | ||
if (typeof responseStartTimestamp === 'number') { | ||
if (typeof responseStartTimestamp === 'number' && transactionStartTime) { | ||
DEBUG_BUILD && logger.log('[Measurements] Adding TTFB'); | ||
_measurements['ttfb'] = { | ||
value: (responseStartTimestamp - transaction.startTimestamp) * 1000, | ||
value: (responseStartTimestamp - transactionStartTime) * 1000, | ||
unit: 'millisecond', | ||
@@ -253,3 +255,3 @@ }; | ||
['fcp', 'fp', 'lcp'].forEach(name => { | ||
if (!_measurements[name] || timeOrigin >= transaction.startTimestamp) { | ||
if (!_measurements[name] || !transactionStartTime || timeOrigin >= transactionStartTime) { | ||
return; | ||
@@ -264,3 +266,3 @@ } | ||
// normalizedValue should be in milliseconds | ||
const normalizedValue = Math.abs((measurementTimestamp - transaction.startTimestamp) * 1000); | ||
const normalizedValue = Math.abs((measurementTimestamp - transactionStartTime) * 1000); | ||
const delta = normalizedValue - oldValue; | ||
@@ -294,7 +296,3 @@ | ||
Object.keys(_measurements).forEach(measurementName => { | ||
transaction.setMeasurement( | ||
measurementName, | ||
_measurements[measurementName].value, | ||
_measurements[measurementName].unit, | ||
); | ||
setMeasurement(measurementName, _measurements[measurementName].value, _measurements[measurementName].unit); | ||
}); | ||
@@ -372,17 +370,23 @@ | ||
function _addRequest(transaction, entry, timeOrigin) { | ||
_startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'request', | ||
startTimestamp: timeOrigin + msToSec(entry.requestStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
if (entry.responseEnd) { | ||
// It is possible that we are collecting these metrics when the page hasn't finished loading yet, for example when the HTML slowly streams in. | ||
// In this case, ie. when the document request hasn't finished yet, `entry.responseEnd` will be 0. | ||
// In order not to produce faulty spans, where the end timestamp is before the start timestamp, we will only collect | ||
// these spans when the responseEnd value is available. The backend (Relay) would drop the entire transaction if it contained faulty spans. | ||
_startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'request', | ||
startTimestamp: timeOrigin + msToSec(entry.requestStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
_startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'response', | ||
startTimestamp: timeOrigin + msToSec(entry.responseStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
_startChild(transaction, { | ||
op: 'browser', | ||
origin: 'auto.browser.browser.metrics', | ||
description: 'response', | ||
startTimestamp: timeOrigin + msToSec(entry.responseStart ), | ||
endTimestamp: timeOrigin + msToSec(entry.responseEnd ), | ||
}); | ||
} | ||
} | ||
@@ -394,3 +398,3 @@ | ||
entry, | ||
resourceName, | ||
resourceUrl, | ||
startTime, | ||
@@ -406,2 +410,4 @@ duration, | ||
const parsedUrl = parseUrl(resourceUrl); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -412,6 +418,16 @@ const data = {}; | ||
setResourceEntrySizeData(data, entry, 'decodedBodySize', 'http.decoded_response_content_length'); | ||
if ('renderBlockingStatus' in entry) { | ||
data['resource.render_blocking_status'] = entry.renderBlockingStatus; | ||
} | ||
if (parsedUrl.protocol) { | ||
data['url.scheme'] = parsedUrl.protocol.split(':').pop(); // the protocol returned by parseUrl includes a :, but OTEL spec does not, so we remove it. | ||
} | ||
if (parsedUrl.host) { | ||
data['server.address'] = parsedUrl.host; | ||
} | ||
data['url.same_origin'] = resourceUrl.includes(WINDOW.location.origin); | ||
const startTimestamp = timeOrigin + startTime; | ||
@@ -421,3 +437,3 @@ const endTimestamp = startTimestamp + duration; | ||
_startChild(transaction, { | ||
description: resourceName, | ||
description: resourceUrl.replace(WINDOW.location.origin, ''), | ||
endTimestamp, | ||
@@ -424,0 +440,0 @@ op: entry.initiatorType ? `resource.${entry.initiatorType}` : 'resource.other', |
@@ -12,5 +12,10 @@ /** | ||
* start timestamp. | ||
* | ||
* Note: this will not be possible anymore in v8, | ||
* unless we do some special handling for browser here... | ||
*/ | ||
function _startChild(transaction, { startTimestamp, ...ctx }) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (startTimestamp && transaction.startTimestamp > startTimestamp) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
transaction.startTimestamp = startTimestamp; | ||
@@ -17,0 +22,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { spanToJSON, hasTracingEnabled, getCurrentScope, getActiveSpan, getDynamicSamplingContextFromSpan, spanToTraceHeader, getClient, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { spanToJSON, hasTracingEnabled, getCurrentScope, getActiveSpan, getRootSpan, getDynamicSamplingContextFromSpan, spanToTraceHeader, getClient, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { addFetchInstrumentationHandler, addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY, dynamicSamplingContextToSentryBaggageHeader, generateSentryTraceHeader, BAGGAGE_HEADER_NAME, browserPerformanceTimeOrigin, stringMatchesSomePattern } from '@sentry/utils'; | ||
@@ -234,3 +234,3 @@ import { instrumentFetchRequest } from '../common/fetch.js'; | ||
if (span) { | ||
const transaction = span && span.transaction; | ||
const transaction = span && getRootSpan(span); | ||
const dynamicSamplingContext = transaction && getDynamicSamplingContextFromSpan(transaction); | ||
@@ -237,0 +237,0 @@ const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext); |
@@ -1,2 +0,2 @@ | ||
import { hasTracingEnabled, getCurrentScope, getClient, getActiveSpan, spanToTraceHeader, getDynamicSamplingContextFromSpan, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { hasTracingEnabled, getCurrentScope, getClient, getActiveSpan, getRootSpan, spanToTraceHeader, getDynamicSamplingContextFromSpan, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { generateSentryTraceHeader, dynamicSamplingContextToSentryBaggageHeader, isInstanceOf, BAGGAGE_HEADER_NAME } from '@sentry/utils'; | ||
@@ -108,3 +108,3 @@ | ||
const transaction = span && span.transaction; | ||
const transaction = span && getRootSpan(span); | ||
@@ -123,3 +123,4 @@ const { traceId, sampled, dsc } = scope.getPropagationContext(); | ||
const headers = | ||
typeof Request !== 'undefined' && isInstanceOf(request, Request) ? (request ).headers : options.headers; | ||
options.headers || | ||
(typeof Request !== 'undefined' && isInstanceOf(request, Request) ? (request ).headers : undefined); | ||
@@ -126,0 +127,0 @@ if (!headers) { |
@@ -155,2 +155,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
return function ( ...args) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -157,0 +158,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -44,2 +44,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
return function ( ...args) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -46,0 +47,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -146,6 +146,13 @@ import { _optionalChain } from '@sentry/utils'; | ||
const lastArg = args[args.length - 1]; | ||
const scope = getCurrentHub().getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const hub = getCurrentHub(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = hub.getScope(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const client = hub.getClient(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
const parentSpan = scope.getSpan(); | ||
const sendDefaultPii = _optionalChain([client, 'optionalAccess', _2 => _2.getOptions, 'call', _3 => _3(), 'access', _4 => _4.sendDefaultPii]); | ||
// Check if the operation was passed a callback. (mapReduce requires a different check, as | ||
@@ -155,3 +162,3 @@ // its (non-callback) arguments can also be functions.) | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3(getSpanContext(this, operation, args))]); | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _5 => _5.startChild, 'call', _6 => _6(getSpanContext(this, operation, args, sendDefaultPii))]); | ||
const maybePromiseOrCursor = orig.call(this, ...args); | ||
@@ -161,3 +168,3 @@ | ||
return maybePromiseOrCursor.then((res) => { | ||
_optionalChain([span, 'optionalAccess', _4 => _4.end, 'call', _5 => _5()]); | ||
_optionalChain([span, 'optionalAccess', _7 => _7.end, 'call', _8 => _8()]); | ||
return res; | ||
@@ -173,3 +180,3 @@ }); | ||
cursor.once('close', () => { | ||
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]); | ||
_optionalChain([span, 'optionalAccess', _9 => _9.end, 'call', _10 => _10()]); | ||
}); | ||
@@ -179,3 +186,3 @@ } catch (e) { | ||
// finish the span immediately. | ||
_optionalChain([span, 'optionalAccess', _8 => _8.end, 'call', _9 => _9()]); | ||
_optionalChain([span, 'optionalAccess', _11 => _11.end, 'call', _12 => _12()]); | ||
} | ||
@@ -185,3 +192,3 @@ | ||
} else { | ||
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11()]); | ||
_optionalChain([span, 'optionalAccess', _13 => _13.end, 'call', _14 => _14()]); | ||
return maybePromiseOrCursor; | ||
@@ -192,6 +199,6 @@ } | ||
// eslint-disable-next-line deprecation/deprecation | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _12 => _12.startChild, 'call', _13 => _13(getSpanContext(this, operation, args.slice(0, -1)))]); | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _15 => _15.startChild, 'call', _16 => _16(getSpanContext(this, operation, args.slice(0, -1)))]); | ||
return orig.call(this, ...args.slice(0, -1), function (err, result) { | ||
_optionalChain([span, 'optionalAccess', _14 => _14.end, 'call', _15 => _15()]); | ||
_optionalChain([span, 'optionalAccess', _17 => _17.end, 'call', _18 => _18()]); | ||
lastArg(err, result); | ||
@@ -210,2 +217,3 @@ }); | ||
args, | ||
sendDefaultPii = false, | ||
) { | ||
@@ -233,3 +241,3 @@ const data = { | ||
if (!signature || !shouldDescribe) { | ||
if (!signature || !shouldDescribe || !sendDefaultPii) { | ||
return spanContext; | ||
@@ -236,0 +244,0 @@ } |
@@ -69,3 +69,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
function finishSpan(span) { | ||
if (!span || span.endTimestamp) { | ||
if (!span) { | ||
return; | ||
@@ -88,2 +88,3 @@ } | ||
return function ( options, values, callback) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -90,0 +91,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -60,2 +60,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
return function ( config, values, callback) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const scope = getCurrentHub().getScope(); | ||
@@ -62,0 +63,0 @@ // eslint-disable-next-line deprecation/deprecation |
@@ -53,2 +53,3 @@ import { startSpan, getCurrentHub } from '@sentry/core'; | ||
options.client.$use((params, next) => { | ||
// eslint-disable-next-line deprecation/deprecation | ||
if (shouldDisableAutoInstrumentation(getCurrentHub)) { | ||
@@ -55,0 +56,0 @@ return next(params); |
@@ -10,2 +10,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
function shouldDisableAutoInstrumentation(getCurrentHub) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
const clientOptions = _optionalChain([getCurrentHub, 'call', _ => _(), 'access', _2 => _2.getClient, 'call', _3 => _3(), 'optionalAccess', _4 => _4.getOptions, 'call', _5 => _5()]); | ||
@@ -12,0 +13,0 @@ const instrumenter = _optionalChain([clientOptions, 'optionalAccess', _6 => _6.instrumenter]) || 'sentry'; |
{ | ||
"name": "@sentry-internal/tracing", | ||
"version": "7.93.0", | ||
"version": "7.94.0", | ||
"description": "Sentry Internal Tracing Package", | ||
@@ -32,5 +32,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "7.93.0", | ||
"@sentry/types": "7.93.0", | ||
"@sentry/utils": "7.93.0" | ||
"@sentry/core": "7.94.0", | ||
"@sentry/types": "7.94.0", | ||
"@sentry/utils": "7.94.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "devDependencies": { |
@@ -28,3 +28,3 @@ import { Transaction } from '@sentry/core'; | ||
/** Create resource-related spans */ | ||
export declare function _addResourceSpans(transaction: Transaction, entry: ResourceEntry, resourceName: string, startTime: number, duration: number, timeOrigin: number): void; | ||
export declare function _addResourceSpans(transaction: Transaction, entry: ResourceEntry, resourceUrl: string, startTime: number, duration: number, timeOrigin: number): void; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,4 +11,7 @@ import { Transaction } from '@sentry/core'; | ||
* start timestamp. | ||
* | ||
* Note: this will not be possible anymore in v8, | ||
* unless we do some special handling for browser here... | ||
*/ | ||
export declare function _startChild(transaction: Transaction, { startTimestamp, ...ctx }: SpanContext): Span; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -28,3 +28,3 @@ import type { Transaction } from '@sentry/core'; | ||
/** Create resource-related spans */ | ||
export declare function _addResourceSpans(transaction: Transaction, entry: ResourceEntry, resourceName: string, startTime: number, duration: number, timeOrigin: number): void; | ||
export declare function _addResourceSpans(transaction: Transaction, entry: ResourceEntry, resourceUrl: string, startTime: number, duration: number, timeOrigin: number): void; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,4 +11,7 @@ import type { Transaction } from '@sentry/core'; | ||
* start timestamp. | ||
* | ||
* Note: this will not be possible anymore in v8, | ||
* unless we do some special handling for browser here... | ||
*/ | ||
export declare function _startChild(transaction: Transaction, { startTimestamp, ...ctx }: SpanContext): Span; | ||
//# sourceMappingURL=utils.d.ts.map |
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
Sorry, the diff of this file is not supported yet
1096660
9171
+ Added@sentry/core@7.94.0(transitive)
+ Added@sentry/types@7.94.0(transitive)
+ Added@sentry/utils@7.94.0(transitive)
- Removed@sentry/core@7.93.0(transitive)
- Removed@sentry/types@7.93.0(transitive)
- Removed@sentry/utils@7.93.0(transitive)
Updated@sentry/core@7.94.0
Updated@sentry/types@7.94.0
Updated@sentry/utils@7.94.0