@sentry/core
Advanced tools
Comparing version 8.9.2 to 8.10.0
@@ -96,3 +96,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
getStackTop() { | ||
return this._stack[this._stack.length - 1]; | ||
return this._stack[this._stack.length - 1] ; | ||
} | ||
@@ -99,0 +99,0 @@ |
@@ -325,4 +325,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// The following works because undefined + 1 === NaN and NaN is falsy | ||
this._outcomes[key] = this._outcomes[key] + 1 || 1; | ||
this._outcomes[key] = (this._outcomes[key] || 0) + 1; | ||
} | ||
@@ -350,4 +349,5 @@ } | ||
emit(hook, ...rest) { | ||
if (this._hooks[hook]) { | ||
this._hooks[hook].forEach(callback => callback(...rest)); | ||
const callbacks = this._hooks[hook]; | ||
if (callbacks) { | ||
callbacks.forEach(callback => callback(...rest)); | ||
} | ||
@@ -665,3 +665,3 @@ } | ||
this._outcomes = {}; | ||
return Object.keys(outcomes).map(key => { | ||
return Object.entries(outcomes).map(([key, quantity]) => { | ||
const [reason, category] = key.split(':') ; | ||
@@ -671,3 +671,3 @@ return { | ||
category, | ||
quantity: outcomes[key], | ||
quantity, | ||
}; | ||
@@ -674,0 +674,0 @@ }); |
@@ -10,7 +10,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
function captureFeedback( | ||
feedbackParams, | ||
params, | ||
hint = {}, | ||
scope = currentScopes.getCurrentScope(), | ||
) { | ||
const { message, name, email, url, source, associatedEventId } = feedbackParams; | ||
const { message, name, email, url, source, associatedEventId, tags } = params; | ||
@@ -30,2 +30,3 @@ const feedbackEvent = { | ||
level: 'info', | ||
tags, | ||
}; | ||
@@ -32,0 +33,0 @@ |
@@ -34,3 +34,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
return Object.keys(integrationsByName).map(k => integrationsByName[k]); | ||
return Object.values(integrationsByName); | ||
} | ||
@@ -64,5 +64,5 @@ | ||
// locate it and, assuming it exists, pop it out of its current spot and shove it onto the end of the array. | ||
const debugIndex = findIndex(finalIntegrations, integration => integration.name === 'Debug'); | ||
if (debugIndex !== -1) { | ||
const [debugInstance] = finalIntegrations.splice(debugIndex, 1); | ||
const debugIndex = finalIntegrations.findIndex(integration => integration.name === 'Debug'); | ||
if (debugIndex > -1) { | ||
const [debugInstance] = finalIntegrations.splice(debugIndex, 1) ; | ||
finalIntegrations.push(debugInstance); | ||
@@ -154,13 +154,2 @@ } | ||
// Polyfill for Array.findIndex(), which is not supported in ES5 | ||
function findIndex(arr, callback) { | ||
for (let i = 0; i < arr.length; i++) { | ||
if (callback(arr[i]) === true) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
/** | ||
@@ -167,0 +156,0 @@ * Define an integration function that can be used to create an integration instance. |
@@ -132,3 +132,5 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
for (let i = 0; i < previousFrames.length; i++) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const frameA = previousFrames[i]; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const frameB = currentFrames[i]; | ||
@@ -135,0 +137,0 @@ |
@@ -16,4 +16,5 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
name: INTEGRATION_NAME, | ||
processEvent(event, hint) { | ||
return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause); | ||
processEvent(event, hint, client) { | ||
const { maxValueLength = 250 } = client.getOptions(); | ||
return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause, maxValueLength); | ||
}, | ||
@@ -30,2 +31,3 @@ }; | ||
captureErrorCause, | ||
maxValueLength, | ||
) { | ||
@@ -37,3 +39,3 @@ if (!hint.originalException || !utils.isError(hint.originalException)) { | ||
const errorData = _extractErrorData(hint.originalException , captureErrorCause); | ||
const errorData = _extractErrorData(hint.originalException , captureErrorCause, maxValueLength); | ||
@@ -66,3 +68,7 @@ if (errorData) { | ||
*/ | ||
function _extractErrorData(error, captureErrorCause) { | ||
function _extractErrorData( | ||
error, | ||
captureErrorCause, | ||
maxValueLength, | ||
) { | ||
// We are trying to enhance already existing event, so no harm done if it won't succeed | ||
@@ -90,3 +96,3 @@ try { | ||
const value = error[key]; | ||
extraErrorInfo[key] = utils.isError(value) ? value.toString() : value; | ||
extraErrorInfo[key] = utils.isError(value) || typeof value === 'string' ? utils.truncate(`${value}`, maxValueLength) : value; | ||
} | ||
@@ -93,0 +99,0 @@ |
@@ -39,3 +39,5 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
for (const iss of zodError.issues) { | ||
if (iss.path) errorKeyMap.add(iss.path[0]); | ||
if (iss.path && iss.path[0]) { | ||
errorKeyMap.add(iss.path[0]); | ||
} | ||
} | ||
@@ -42,0 +44,0 @@ const errorKeys = Array.from(errorKeyMap); |
@@ -24,7 +24,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
for (const [, [exportKey, summary]] of storage) { | ||
if (!output[exportKey]) { | ||
output[exportKey] = []; | ||
} | ||
output[exportKey].push(utils.dropUndefinedKeys(summary)); | ||
const arr = output[exportKey] || (output[exportKey] = []); | ||
arr.push(utils.dropUndefinedKeys(summary)); | ||
} | ||
@@ -31,0 +28,0 @@ |
@@ -17,3 +17,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
this.flushTimeout = 60; | ||
this._pendingAggregates = {}; | ||
this._pendingAggregates = new Map(); | ||
this._isEnabled = true; | ||
@@ -37,3 +37,3 @@ | ||
} | ||
this._pendingAggregates = {}; | ||
this._pendingAggregates = new Map(); | ||
this._client.sendSession(sessionAggregates); | ||
@@ -44,5 +44,3 @@ } | ||
getSessionAggregates() { | ||
const aggregates = Object.keys(this._pendingAggregates).map((key) => { | ||
return this._pendingAggregates[parseInt(key)]; | ||
}); | ||
const aggregates = Array.from(this._pendingAggregates.values()); | ||
@@ -91,9 +89,9 @@ const sessionAggregates = { | ||
const sessionStartedTrunc = new Date(date).setSeconds(0, 0); | ||
this._pendingAggregates[sessionStartedTrunc] = this._pendingAggregates[sessionStartedTrunc] || {}; | ||
// corresponds to aggregated sessions in one specific minute bucket | ||
// for example, {"started":"2021-03-16T08:00:00.000Z","exited":4, "errored": 1} | ||
const aggregationCounts = this._pendingAggregates[sessionStartedTrunc]; | ||
if (!aggregationCounts.started) { | ||
aggregationCounts.started = new Date(sessionStartedTrunc).toISOString(); | ||
let aggregationCounts = this._pendingAggregates.get(sessionStartedTrunc); | ||
if (!aggregationCounts) { | ||
aggregationCounts = { started: new Date(sessionStartedTrunc).toISOString() }; | ||
this._pendingAggregates.set(sessionStartedTrunc, aggregationCounts); | ||
} | ||
@@ -100,0 +98,0 @@ |
@@ -61,6 +61,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const rootSpan = spanUtils.getRootSpan(span); | ||
if (!rootSpan) { | ||
return dsc; | ||
} | ||
// For core implementation, we freeze the DSC onto the span as a non-enumerable property | ||
const frozenDsc = (rootSpan )[FROZEN_DSC_FIELD]; | ||
@@ -71,2 +69,14 @@ if (frozenDsc) { | ||
// For OpenTelemetry, we freeze the DSC on the trace state | ||
const traceState = rootSpan.spanContext().traceState; | ||
const traceStateDsc = traceState && traceState.get('sentry.dsc'); | ||
// If the span has a DSC, we want it to take precedence | ||
const dscOnTraceState = traceStateDsc && utils.baggageHeaderToDynamicSamplingContext(traceStateDsc); | ||
if (dscOnTraceState) { | ||
return dscOnTraceState; | ||
} | ||
// Else, we generate it from the span | ||
const jsonSpan = spanUtils.spanToJSON(rootSpan); | ||
@@ -84,4 +94,5 @@ const attributes = jsonSpan.data || {}; | ||
// after JSON conversion, txn.name becomes jsonSpan.description | ||
if (source && source !== 'url') { | ||
dsc.transaction = jsonSpan.description; | ||
const name = jsonSpan.description; | ||
if (source !== 'url' && name) { | ||
dsc.transaction = name; | ||
} | ||
@@ -91,3 +102,3 @@ | ||
client.emit('createDsc', dsc); | ||
client.emit('createDsc', dsc, rootSpan); | ||
@@ -94,0 +105,0 @@ return dsc; |
@@ -228,3 +228,11 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
if (this._isStandaloneSpan) { | ||
sendSpanEnvelope(envelope.createSpanEnvelope([this], client)); | ||
if (this._sampled) { | ||
sendSpanEnvelope(envelope.createSpanEnvelope([this], client)); | ||
} else { | ||
debugBuild.DEBUG_BUILD && | ||
utils.logger.log('[Tracing] Discarding standalone span because its trace was not chosen to be sampled.'); | ||
if (client) { | ||
client.recordDroppedEvent('sample_rate', 'span'); | ||
} | ||
} | ||
return; | ||
@@ -231,0 +239,0 @@ } |
@@ -114,10 +114,8 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// If we have no transports to send to, use the fallback transport | ||
if (transports.length === 0) { | ||
// Don't override the DSN in the header for the fallback transport. '' is falsy | ||
transports.push(['', fallbackTransport]); | ||
} | ||
// Don't override the DSN in the header for the fallback transport. '' is falsy | ||
const transportsWithFallback = transports.length ? transports : [['', fallbackTransport]]; | ||
const results = await Promise.all( | ||
transports.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))), | ||
); | ||
const results = (await Promise.all( | ||
transportsWithFallback.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))), | ||
)) ; | ||
@@ -124,0 +122,0 @@ return results[0]; |
@@ -169,21 +169,25 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// Build a map of filename -> debug_id | ||
const filenameDebugIdMap = Object.keys(debugIdMap).reduce((acc, debugIdStackTrace) => { | ||
let parsedStack; | ||
const cachedParsedStack = debugIdStackFramesCache.get(debugIdStackTrace); | ||
if (cachedParsedStack) { | ||
parsedStack = cachedParsedStack; | ||
} else { | ||
parsedStack = stackParser(debugIdStackTrace); | ||
debugIdStackFramesCache.set(debugIdStackTrace, parsedStack); | ||
} | ||
const filenameDebugIdMap = Object.entries(debugIdMap).reduce( | ||
(acc, [debugIdStackTrace, debugIdValue]) => { | ||
let parsedStack; | ||
const cachedParsedStack = debugIdStackFramesCache.get(debugIdStackTrace); | ||
if (cachedParsedStack) { | ||
parsedStack = cachedParsedStack; | ||
} else { | ||
parsedStack = stackParser(debugIdStackTrace); | ||
debugIdStackFramesCache.set(debugIdStackTrace, parsedStack); | ||
} | ||
for (let i = parsedStack.length - 1; i >= 0; i--) { | ||
const stackFrame = parsedStack[i]; | ||
if (stackFrame.filename) { | ||
acc[stackFrame.filename] = debugIdMap[debugIdStackTrace]; | ||
break; | ||
for (let i = parsedStack.length - 1; i >= 0; i--) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const stackFrame = parsedStack[i]; | ||
if (stackFrame.filename) { | ||
acc[stackFrame.filename] = debugIdValue; | ||
break; | ||
} | ||
} | ||
} | ||
return acc; | ||
}, {}); | ||
return acc; | ||
}, | ||
{}, | ||
); | ||
@@ -238,7 +242,7 @@ try { | ||
const images = event.debug_meta.images; | ||
Object.keys(filenameDebugIdMap).forEach(filename => { | ||
Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => { | ||
images.push({ | ||
type: 'sourcemap', | ||
code_file: filename, | ||
debug_id: filenameDebugIdMap[filename], | ||
debug_id, | ||
}); | ||
@@ -245,0 +249,0 @@ }); |
@@ -94,3 +94,3 @@ import { isThenable } from '@sentry/utils'; | ||
getStackTop() { | ||
return this._stack[this._stack.length - 1]; | ||
return this._stack[this._stack.length - 1] ; | ||
} | ||
@@ -97,0 +97,0 @@ |
@@ -323,4 +323,3 @@ import { makeDsn, logger, uuid4, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, dropUndefinedKeys, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils'; | ||
// The following works because undefined + 1 === NaN and NaN is falsy | ||
this._outcomes[key] = this._outcomes[key] + 1 || 1; | ||
this._outcomes[key] = (this._outcomes[key] || 0) + 1; | ||
} | ||
@@ -348,4 +347,5 @@ } | ||
emit(hook, ...rest) { | ||
if (this._hooks[hook]) { | ||
this._hooks[hook].forEach(callback => callback(...rest)); | ||
const callbacks = this._hooks[hook]; | ||
if (callbacks) { | ||
callbacks.forEach(callback => callback(...rest)); | ||
} | ||
@@ -663,3 +663,3 @@ } | ||
this._outcomes = {}; | ||
return Object.keys(outcomes).map(key => { | ||
return Object.entries(outcomes).map(([key, quantity]) => { | ||
const [reason, category] = key.split(':') ; | ||
@@ -669,3 +669,3 @@ return { | ||
category, | ||
quantity: outcomes[key], | ||
quantity, | ||
}; | ||
@@ -672,0 +672,0 @@ }); |
@@ -8,7 +8,7 @@ import { dropUndefinedKeys } from '@sentry/utils'; | ||
function captureFeedback( | ||
feedbackParams, | ||
params, | ||
hint = {}, | ||
scope = getCurrentScope(), | ||
) { | ||
const { message, name, email, url, source, associatedEventId } = feedbackParams; | ||
const { message, name, email, url, source, associatedEventId, tags } = params; | ||
@@ -28,2 +28,3 @@ const feedbackEvent = { | ||
level: 'info', | ||
tags, | ||
}; | ||
@@ -30,0 +31,0 @@ |
@@ -32,3 +32,3 @@ import { arrayify, logger } from '@sentry/utils'; | ||
return Object.keys(integrationsByName).map(k => integrationsByName[k]); | ||
return Object.values(integrationsByName); | ||
} | ||
@@ -62,5 +62,5 @@ | ||
// locate it and, assuming it exists, pop it out of its current spot and shove it onto the end of the array. | ||
const debugIndex = findIndex(finalIntegrations, integration => integration.name === 'Debug'); | ||
if (debugIndex !== -1) { | ||
const [debugInstance] = finalIntegrations.splice(debugIndex, 1); | ||
const debugIndex = finalIntegrations.findIndex(integration => integration.name === 'Debug'); | ||
if (debugIndex > -1) { | ||
const [debugInstance] = finalIntegrations.splice(debugIndex, 1) ; | ||
finalIntegrations.push(debugInstance); | ||
@@ -152,13 +152,2 @@ } | ||
// Polyfill for Array.findIndex(), which is not supported in ES5 | ||
function findIndex(arr, callback) { | ||
for (let i = 0; i < arr.length; i++) { | ||
if (callback(arr[i]) === true) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
/** | ||
@@ -165,0 +154,0 @@ * Define an integration function that can be used to create an integration instance. |
@@ -130,3 +130,5 @@ import { logger, getFramesFromEvent } from '@sentry/utils'; | ||
for (let i = 0; i < previousFrames.length; i++) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const frameA = previousFrames[i]; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const frameB = currentFrames[i]; | ||
@@ -133,0 +135,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { isError, normalize, isPlainObject, addNonEnumerableProperty, logger } from '@sentry/utils'; | ||
import { isError, normalize, isPlainObject, addNonEnumerableProperty, truncate, logger } from '@sentry/utils'; | ||
import { defineIntegration } from '../integration.js'; | ||
@@ -14,4 +14,5 @@ import { DEBUG_BUILD } from '../debug-build.js'; | ||
name: INTEGRATION_NAME, | ||
processEvent(event, hint) { | ||
return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause); | ||
processEvent(event, hint, client) { | ||
const { maxValueLength = 250 } = client.getOptions(); | ||
return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause, maxValueLength); | ||
}, | ||
@@ -28,2 +29,3 @@ }; | ||
captureErrorCause, | ||
maxValueLength, | ||
) { | ||
@@ -35,3 +37,3 @@ if (!hint.originalException || !isError(hint.originalException)) { | ||
const errorData = _extractErrorData(hint.originalException , captureErrorCause); | ||
const errorData = _extractErrorData(hint.originalException , captureErrorCause, maxValueLength); | ||
@@ -64,3 +66,7 @@ if (errorData) { | ||
*/ | ||
function _extractErrorData(error, captureErrorCause) { | ||
function _extractErrorData( | ||
error, | ||
captureErrorCause, | ||
maxValueLength, | ||
) { | ||
// We are trying to enhance already existing event, so no harm done if it won't succeed | ||
@@ -88,3 +94,3 @@ try { | ||
const value = error[key]; | ||
extraErrorInfo[key] = isError(value) ? value.toString() : value; | ||
extraErrorInfo[key] = isError(value) || typeof value === 'string' ? truncate(`${value}`, maxValueLength) : value; | ||
} | ||
@@ -91,0 +97,0 @@ |
@@ -37,3 +37,5 @@ import { isError, truncate } from '@sentry/utils'; | ||
for (const iss of zodError.issues) { | ||
if (iss.path) errorKeyMap.add(iss.path[0]); | ||
if (iss.path && iss.path[0]) { | ||
errorKeyMap.add(iss.path[0]); | ||
} | ||
} | ||
@@ -40,0 +42,0 @@ const errorKeys = Array.from(errorKeyMap); |
@@ -22,7 +22,4 @@ import { dropUndefinedKeys } from '@sentry/utils'; | ||
for (const [, [exportKey, summary]] of storage) { | ||
if (!output[exportKey]) { | ||
output[exportKey] = []; | ||
} | ||
output[exportKey].push(dropUndefinedKeys(summary)); | ||
const arr = output[exportKey] || (output[exportKey] = []); | ||
arr.push(dropUndefinedKeys(summary)); | ||
} | ||
@@ -29,0 +26,0 @@ |
@@ -15,3 +15,3 @@ import { dropUndefinedKeys } from '@sentry/utils'; | ||
this.flushTimeout = 60; | ||
this._pendingAggregates = {}; | ||
this._pendingAggregates = new Map(); | ||
this._isEnabled = true; | ||
@@ -35,3 +35,3 @@ | ||
} | ||
this._pendingAggregates = {}; | ||
this._pendingAggregates = new Map(); | ||
this._client.sendSession(sessionAggregates); | ||
@@ -42,5 +42,3 @@ } | ||
getSessionAggregates() { | ||
const aggregates = Object.keys(this._pendingAggregates).map((key) => { | ||
return this._pendingAggregates[parseInt(key)]; | ||
}); | ||
const aggregates = Array.from(this._pendingAggregates.values()); | ||
@@ -89,9 +87,9 @@ const sessionAggregates = { | ||
const sessionStartedTrunc = new Date(date).setSeconds(0, 0); | ||
this._pendingAggregates[sessionStartedTrunc] = this._pendingAggregates[sessionStartedTrunc] || {}; | ||
// corresponds to aggregated sessions in one specific minute bucket | ||
// for example, {"started":"2021-03-16T08:00:00.000Z","exited":4, "errored": 1} | ||
const aggregationCounts = this._pendingAggregates[sessionStartedTrunc]; | ||
if (!aggregationCounts.started) { | ||
aggregationCounts.started = new Date(sessionStartedTrunc).toISOString(); | ||
let aggregationCounts = this._pendingAggregates.get(sessionStartedTrunc); | ||
if (!aggregationCounts) { | ||
aggregationCounts = { started: new Date(sessionStartedTrunc).toISOString() }; | ||
this._pendingAggregates.set(sessionStartedTrunc, aggregationCounts); | ||
} | ||
@@ -98,0 +96,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { dropUndefinedKeys, dynamicSamplingContextToSentryBaggageHeader, addNonEnumerableProperty } from '@sentry/utils'; | ||
import { dropUndefinedKeys, baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader, addNonEnumerableProperty } from '@sentry/utils'; | ||
import { DEFAULT_ENVIRONMENT } from '../constants.js'; | ||
@@ -59,6 +59,4 @@ import { getClient } from '../currentScopes.js'; | ||
const rootSpan = getRootSpan(span); | ||
if (!rootSpan) { | ||
return dsc; | ||
} | ||
// For core implementation, we freeze the DSC onto the span as a non-enumerable property | ||
const frozenDsc = (rootSpan )[FROZEN_DSC_FIELD]; | ||
@@ -69,2 +67,14 @@ if (frozenDsc) { | ||
// For OpenTelemetry, we freeze the DSC on the trace state | ||
const traceState = rootSpan.spanContext().traceState; | ||
const traceStateDsc = traceState && traceState.get('sentry.dsc'); | ||
// If the span has a DSC, we want it to take precedence | ||
const dscOnTraceState = traceStateDsc && baggageHeaderToDynamicSamplingContext(traceStateDsc); | ||
if (dscOnTraceState) { | ||
return dscOnTraceState; | ||
} | ||
// Else, we generate it from the span | ||
const jsonSpan = spanToJSON(rootSpan); | ||
@@ -82,4 +92,5 @@ const attributes = jsonSpan.data || {}; | ||
// after JSON conversion, txn.name becomes jsonSpan.description | ||
if (source && source !== 'url') { | ||
dsc.transaction = jsonSpan.description; | ||
const name = jsonSpan.description; | ||
if (source !== 'url' && name) { | ||
dsc.transaction = name; | ||
} | ||
@@ -89,3 +100,3 @@ | ||
client.emit('createDsc', dsc); | ||
client.emit('createDsc', dsc, rootSpan); | ||
@@ -92,0 +103,0 @@ return dsc; |
@@ -226,3 +226,11 @@ import { uuid4, timestampInSeconds, dropUndefinedKeys, logger } from '@sentry/utils'; | ||
if (this._isStandaloneSpan) { | ||
sendSpanEnvelope(createSpanEnvelope([this], client)); | ||
if (this._sampled) { | ||
sendSpanEnvelope(createSpanEnvelope([this], client)); | ||
} else { | ||
DEBUG_BUILD && | ||
logger.log('[Tracing] Discarding standalone span because its trace was not chosen to be sampled.'); | ||
if (client) { | ||
client.recordDroppedEvent('sample_rate', 'span'); | ||
} | ||
} | ||
return; | ||
@@ -229,0 +237,0 @@ } |
@@ -112,10 +112,8 @@ import { createEnvelope, dsnFromString, forEachEnvelopeItem } from '@sentry/utils'; | ||
// If we have no transports to send to, use the fallback transport | ||
if (transports.length === 0) { | ||
// Don't override the DSN in the header for the fallback transport. '' is falsy | ||
transports.push(['', fallbackTransport]); | ||
} | ||
// Don't override the DSN in the header for the fallback transport. '' is falsy | ||
const transportsWithFallback = transports.length ? transports : [['', fallbackTransport]]; | ||
const results = await Promise.all( | ||
transports.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))), | ||
); | ||
const results = (await Promise.all( | ||
transportsWithFallback.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))), | ||
)) ; | ||
@@ -122,0 +120,0 @@ return results[0]; |
@@ -167,21 +167,25 @@ import { uuid4, dateTimestampInSeconds, addExceptionMechanism, truncate, GLOBAL_OBJ, normalize } from '@sentry/utils'; | ||
// Build a map of filename -> debug_id | ||
const filenameDebugIdMap = Object.keys(debugIdMap).reduce((acc, debugIdStackTrace) => { | ||
let parsedStack; | ||
const cachedParsedStack = debugIdStackFramesCache.get(debugIdStackTrace); | ||
if (cachedParsedStack) { | ||
parsedStack = cachedParsedStack; | ||
} else { | ||
parsedStack = stackParser(debugIdStackTrace); | ||
debugIdStackFramesCache.set(debugIdStackTrace, parsedStack); | ||
} | ||
const filenameDebugIdMap = Object.entries(debugIdMap).reduce( | ||
(acc, [debugIdStackTrace, debugIdValue]) => { | ||
let parsedStack; | ||
const cachedParsedStack = debugIdStackFramesCache.get(debugIdStackTrace); | ||
if (cachedParsedStack) { | ||
parsedStack = cachedParsedStack; | ||
} else { | ||
parsedStack = stackParser(debugIdStackTrace); | ||
debugIdStackFramesCache.set(debugIdStackTrace, parsedStack); | ||
} | ||
for (let i = parsedStack.length - 1; i >= 0; i--) { | ||
const stackFrame = parsedStack[i]; | ||
if (stackFrame.filename) { | ||
acc[stackFrame.filename] = debugIdMap[debugIdStackTrace]; | ||
break; | ||
for (let i = parsedStack.length - 1; i >= 0; i--) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const stackFrame = parsedStack[i]; | ||
if (stackFrame.filename) { | ||
acc[stackFrame.filename] = debugIdValue; | ||
break; | ||
} | ||
} | ||
} | ||
return acc; | ||
}, {}); | ||
return acc; | ||
}, | ||
{}, | ||
); | ||
@@ -236,7 +240,7 @@ try { | ||
const images = event.debug_meta.images; | ||
Object.keys(filenameDebugIdMap).forEach(filename => { | ||
Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => { | ||
images.push({ | ||
type: 'sourcemap', | ||
code_file: filename, | ||
debug_id: filenameDebugIdMap[filename], | ||
debug_id, | ||
}); | ||
@@ -243,0 +247,0 @@ }); |
{ | ||
"name": "@sentry/core", | ||
"version": "8.9.2", | ||
"version": "8.10.0", | ||
"description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -45,6 +45,6 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "8.9.2", | ||
"@sentry/utils": "8.9.2" | ||
"@sentry/types": "8.10.0", | ||
"@sentry/utils": "8.10.0" | ||
}, | ||
"sideEffects": false | ||
} |
@@ -142,3 +142,3 @@ import { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, Outcome, ParameterizedString, SdkMetadata, Session, SessionAggregates, SeverityLevel, Span, SpanAttributes, SpanContextData, StartSpanOptions, Transport, TransportMakeRequestResponse } from '@sentry/types'; | ||
/** @inheritdoc */ | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext) => void): void; | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): void; | ||
/** @inheritdoc */ | ||
@@ -192,3 +192,3 @@ on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: { | ||
/** @inheritdoc */ | ||
emit(hook: 'createDsc', dsc: DynamicSamplingContext): void; | ||
emit(hook: 'createDsc', dsc: DynamicSamplingContext, rootSpan?: Span): void; | ||
/** @inheritdoc */ | ||
@@ -195,0 +195,0 @@ emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { |
@@ -14,3 +14,6 @@ import { Client, DsnComponents, Event, EventEnvelope, SdkMetadata, Session, SessionAggregates, SessionEnvelope, SpanEnvelope } from '@sentry/types'; | ||
*/ | ||
export declare function createSpanEnvelope(spans: SentrySpan[], client?: Client): SpanEnvelope; | ||
export declare function createSpanEnvelope(spans: [ | ||
SentrySpan, | ||
...SentrySpan[] | ||
], client?: Client): SpanEnvelope; | ||
//# sourceMappingURL=envelope.d.ts.map |
@@ -5,5 +5,5 @@ import { EventHint, SendFeedbackParams } from '@sentry/types'; | ||
*/ | ||
export declare function captureFeedback(feedbackParams: SendFeedbackParams, hint?: EventHint & { | ||
export declare function captureFeedback(params: SendFeedbackParams, hint?: EventHint & { | ||
includeReplay?: boolean; | ||
}, scope?: import("@sentry/types").Scope): string; | ||
//# sourceMappingURL=feedback.d.ts.map |
@@ -142,3 +142,3 @@ import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, Outcome, ParameterizedString, SdkMetadata, Session, SessionAggregates, SeverityLevel, Span, SpanAttributes, SpanContextData, StartSpanOptions, Transport, TransportMakeRequestResponse } from '@sentry/types'; | ||
/** @inheritdoc */ | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext) => void): void; | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): void; | ||
/** @inheritdoc */ | ||
@@ -192,3 +192,3 @@ on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: { | ||
/** @inheritdoc */ | ||
emit(hook: 'createDsc', dsc: DynamicSamplingContext): void; | ||
emit(hook: 'createDsc', dsc: DynamicSamplingContext, rootSpan?: Span): void; | ||
/** @inheritdoc */ | ||
@@ -195,0 +195,0 @@ emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { |
@@ -14,3 +14,3 @@ import type { Client, DsnComponents, Event, EventEnvelope, SdkMetadata, Session, SessionAggregates, SessionEnvelope, SpanEnvelope } from '@sentry/types'; | ||
*/ | ||
export declare function createSpanEnvelope(spans: SentrySpan[], client?: Client): SpanEnvelope; | ||
export declare function createSpanEnvelope(spans: [SentrySpan, ...SentrySpan[]], client?: Client): SpanEnvelope; | ||
//# sourceMappingURL=envelope.d.ts.map |
@@ -5,5 +5,5 @@ import type { EventHint, SendFeedbackParams } from '@sentry/types'; | ||
*/ | ||
export declare function captureFeedback(feedbackParams: SendFeedbackParams, hint?: EventHint & { | ||
export declare function captureFeedback(params: SendFeedbackParams, hint?: EventHint & { | ||
includeReplay?: boolean; | ||
}, scope?: import("@sentry/types").Scope): string; | ||
//# sourceMappingURL=feedback.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
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
1860189
20146
+ Added@sentry/types@8.10.0(transitive)
+ Added@sentry/utils@8.10.0(transitive)
- Removed@sentry/types@8.9.2(transitive)
- Removed@sentry/utils@8.9.2(transitive)
Updated@sentry/types@8.10.0
Updated@sentry/utils@8.10.0