@sentry/core
Advanced tools
Comparing version 8.17.0 to 8.18.0
@@ -336,12 +336,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
on(hook, callback) { | ||
// Note that the code below, with nullish coalescing assignment, | ||
// may reduce the code, so it may be switched to when Node 14 support | ||
// is dropped (the `??=` operator is supported since Node 15). | ||
// (this._hooks[hook] ??= []).push(callback); | ||
if (!this._hooks[hook]) { | ||
this._hooks[hook] = []; | ||
} | ||
const hooks = (this._hooks[hook] = this._hooks[hook] || []); | ||
// @ts-expect-error We assue the types are correct | ||
this._hooks[hook].push(callback); | ||
hooks.push(callback); | ||
@@ -353,7 +347,5 @@ // This function returns a callback execution handler that, when invoked, | ||
return () => { | ||
const hooks = this._hooks[hook]; | ||
if (hooks) { | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
if (cbIndex > -1) { | ||
hooks.splice(cbIndex, 1); | ||
@@ -360,0 +352,0 @@ } |
@@ -36,3 +36,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// Only apply stack frame metadata to error events | ||
if (event.type !== undefined) { | ||
if (event.type) { | ||
return; | ||
@@ -39,0 +39,0 @@ } |
@@ -31,3 +31,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// Only apply stack frame metadata to error events | ||
if (event.type !== undefined) { | ||
if (event.type) { | ||
return; | ||
@@ -34,0 +34,0 @@ } |
@@ -44,2 +44,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const _cleanupHooks = []; | ||
const { | ||
@@ -177,2 +179,4 @@ idleTimeout = TRACING_DEFAULTS.idleTimeout, | ||
_cleanupHooks.forEach(cleanup => cleanup()); | ||
spanOnScope._setSpanForScope(scope, previousActiveSpan); | ||
@@ -236,37 +240,43 @@ | ||
client.on('spanStart', startedSpan => { | ||
// If we already finished the idle span, | ||
// or if this is the idle span itself being started, | ||
// or if the started span has already been closed, | ||
// we don't care about it for activity | ||
if (_finished || startedSpan === span || !!spanUtils.spanToJSON(startedSpan).timestamp) { | ||
return; | ||
} | ||
_cleanupHooks.push( | ||
client.on('spanStart', startedSpan => { | ||
// If we already finished the idle span, | ||
// or if this is the idle span itself being started, | ||
// or if the started span has already been closed, | ||
// we don't care about it for activity | ||
if (_finished || startedSpan === span || !!spanUtils.spanToJSON(startedSpan).timestamp) { | ||
return; | ||
} | ||
const allSpans = spanUtils.getSpanDescendants(span); | ||
const allSpans = spanUtils.getSpanDescendants(span); | ||
// If the span that was just started is a child of the idle span, we should track it | ||
if (allSpans.includes(startedSpan)) { | ||
_pushActivity(startedSpan.spanContext().spanId); | ||
} | ||
}); | ||
// If the span that was just started is a child of the idle span, we should track it | ||
if (allSpans.includes(startedSpan)) { | ||
_pushActivity(startedSpan.spanContext().spanId); | ||
} | ||
}), | ||
); | ||
client.on('spanEnd', endedSpan => { | ||
if (_finished) { | ||
return; | ||
} | ||
_cleanupHooks.push( | ||
client.on('spanEnd', endedSpan => { | ||
if (_finished) { | ||
return; | ||
} | ||
_popActivity(endedSpan.spanContext().spanId); | ||
}); | ||
_popActivity(endedSpan.spanContext().spanId); | ||
}), | ||
); | ||
client.on('idleSpanEnableAutoFinish', spanToAllowAutoFinish => { | ||
if (spanToAllowAutoFinish === span) { | ||
_autoFinishAllowed = true; | ||
_restartIdleTimeout(); | ||
_cleanupHooks.push( | ||
client.on('idleSpanEnableAutoFinish', spanToAllowAutoFinish => { | ||
if (spanToAllowAutoFinish === span) { | ||
_autoFinishAllowed = true; | ||
_restartIdleTimeout(); | ||
if (activities.size) { | ||
_restartChildSpanTimeout(); | ||
if (activities.size) { | ||
_restartChildSpanTimeout(); | ||
} | ||
} | ||
} | ||
}); | ||
}), | ||
); | ||
@@ -273,0 +283,0 @@ // We only start the initial idle timeout if we are not delaying the auto finish |
@@ -156,3 +156,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
? (callback) => currentScopes.withScope(options.scope, callback) | ||
: customParentSpan | ||
: customParentSpan !== undefined | ||
? (callback) => withActiveSpan(customParentSpan, callback) | ||
@@ -442,3 +442,3 @@ : (callback) => callback(); | ||
function getActiveSpanWrapper(parentSpan) { | ||
return parentSpan | ||
return parentSpan !== undefined | ||
? (callback) => { | ||
@@ -445,0 +445,0 @@ return withActiveSpan(parentSpan, callback); |
@@ -20,2 +20,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const options = maybeOptions || getClientOptions(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
return !!options && (options.enableTracing || 'tracesSampleRate' in options || 'tracesSampler' in options); | ||
@@ -22,0 +23,0 @@ } |
@@ -334,12 +334,6 @@ import { makeDsn, logger, uuid4, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, dropUndefinedKeys, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils'; | ||
on(hook, callback) { | ||
// Note that the code below, with nullish coalescing assignment, | ||
// may reduce the code, so it may be switched to when Node 14 support | ||
// is dropped (the `??=` operator is supported since Node 15). | ||
// (this._hooks[hook] ??= []).push(callback); | ||
if (!this._hooks[hook]) { | ||
this._hooks[hook] = []; | ||
} | ||
const hooks = (this._hooks[hook] = this._hooks[hook] || []); | ||
// @ts-expect-error We assue the types are correct | ||
this._hooks[hook].push(callback); | ||
hooks.push(callback); | ||
@@ -351,7 +345,5 @@ // This function returns a callback execution handler that, when invoked, | ||
return () => { | ||
const hooks = this._hooks[hook]; | ||
if (hooks) { | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
if (cbIndex > -1) { | ||
hooks.splice(cbIndex, 1); | ||
@@ -358,0 +350,0 @@ } |
@@ -34,3 +34,3 @@ import { forEachEnvelopeItem } from '@sentry/utils'; | ||
// Only apply stack frame metadata to error events | ||
if (event.type !== undefined) { | ||
if (event.type) { | ||
return; | ||
@@ -37,0 +37,0 @@ } |
@@ -29,3 +29,3 @@ import { forEachEnvelopeItem, getFramesFromEvent } from '@sentry/utils'; | ||
// Only apply stack frame metadata to error events | ||
if (event.type !== undefined) { | ||
if (event.type) { | ||
return; | ||
@@ -32,0 +32,0 @@ } |
@@ -42,2 +42,4 @@ import { timestampInSeconds, logger } from '@sentry/utils'; | ||
const _cleanupHooks = []; | ||
const { | ||
@@ -175,2 +177,4 @@ idleTimeout = TRACING_DEFAULTS.idleTimeout, | ||
_cleanupHooks.forEach(cleanup => cleanup()); | ||
_setSpanForScope(scope, previousActiveSpan); | ||
@@ -234,37 +238,43 @@ | ||
client.on('spanStart', startedSpan => { | ||
// If we already finished the idle span, | ||
// or if this is the idle span itself being started, | ||
// or if the started span has already been closed, | ||
// we don't care about it for activity | ||
if (_finished || startedSpan === span || !!spanToJSON(startedSpan).timestamp) { | ||
return; | ||
} | ||
_cleanupHooks.push( | ||
client.on('spanStart', startedSpan => { | ||
// If we already finished the idle span, | ||
// or if this is the idle span itself being started, | ||
// or if the started span has already been closed, | ||
// we don't care about it for activity | ||
if (_finished || startedSpan === span || !!spanToJSON(startedSpan).timestamp) { | ||
return; | ||
} | ||
const allSpans = getSpanDescendants(span); | ||
const allSpans = getSpanDescendants(span); | ||
// If the span that was just started is a child of the idle span, we should track it | ||
if (allSpans.includes(startedSpan)) { | ||
_pushActivity(startedSpan.spanContext().spanId); | ||
} | ||
}); | ||
// If the span that was just started is a child of the idle span, we should track it | ||
if (allSpans.includes(startedSpan)) { | ||
_pushActivity(startedSpan.spanContext().spanId); | ||
} | ||
}), | ||
); | ||
client.on('spanEnd', endedSpan => { | ||
if (_finished) { | ||
return; | ||
} | ||
_cleanupHooks.push( | ||
client.on('spanEnd', endedSpan => { | ||
if (_finished) { | ||
return; | ||
} | ||
_popActivity(endedSpan.spanContext().spanId); | ||
}); | ||
_popActivity(endedSpan.spanContext().spanId); | ||
}), | ||
); | ||
client.on('idleSpanEnableAutoFinish', spanToAllowAutoFinish => { | ||
if (spanToAllowAutoFinish === span) { | ||
_autoFinishAllowed = true; | ||
_restartIdleTimeout(); | ||
_cleanupHooks.push( | ||
client.on('idleSpanEnableAutoFinish', spanToAllowAutoFinish => { | ||
if (spanToAllowAutoFinish === span) { | ||
_autoFinishAllowed = true; | ||
_restartIdleTimeout(); | ||
if (activities.size) { | ||
_restartChildSpanTimeout(); | ||
if (activities.size) { | ||
_restartChildSpanTimeout(); | ||
} | ||
} | ||
} | ||
}); | ||
}), | ||
); | ||
@@ -271,0 +281,0 @@ // We only start the initial idle timeout if we are not delaying the auto finish |
@@ -154,3 +154,3 @@ import { propagationContextFromHeaders, generatePropagationContext, logger } from '@sentry/utils'; | ||
? (callback) => withScope(options.scope, callback) | ||
: customParentSpan | ||
: customParentSpan !== undefined | ||
? (callback) => withActiveSpan(customParentSpan, callback) | ||
@@ -440,3 +440,3 @@ : (callback) => callback(); | ||
function getActiveSpanWrapper(parentSpan) { | ||
return parentSpan | ||
return parentSpan !== undefined | ||
? (callback) => { | ||
@@ -443,0 +443,0 @@ return withActiveSpan(parentSpan, callback); |
@@ -18,2 +18,3 @@ import { getClient } from '../currentScopes.js'; | ||
const options = maybeOptions || getClientOptions(); | ||
// eslint-disable-next-line deprecation/deprecation | ||
return !!options && (options.enableTracing || 'tracesSampleRate' in options || 'tracesSampler' in options); | ||
@@ -20,0 +21,0 @@ } |
{ | ||
"name": "@sentry/core", | ||
"version": "8.17.0", | ||
"version": "8.18.0", | ||
"description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -42,4 +42,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "8.17.0", | ||
"@sentry/utils": "8.17.0" | ||
"@sentry/types": "8.18.0", | ||
"@sentry/utils": "8.18.0" | ||
}, | ||
@@ -46,0 +46,0 @@ "scripts": { |
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
1876798
20265
+ Added@sentry/types@8.18.0(transitive)
+ Added@sentry/utils@8.18.0(transitive)
- Removed@sentry/types@8.17.0(transitive)
- Removed@sentry/utils@8.17.0(transitive)
Updated@sentry/types@8.18.0
Updated@sentry/utils@8.18.0