@sentry/core
Advanced tools
Comparing version 8.14.0 to 8.15.0
@@ -28,2 +28,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// scope stack for domains or the process | ||
this._stack = [{ scope: assignedScope }]; | ||
@@ -87,9 +88,2 @@ this._isolationScope = assignedIsolationScope; | ||
/** | ||
* Returns the scope stack for domains or the process. | ||
*/ | ||
getStack() { | ||
return this._stack; | ||
} | ||
/** | ||
* Returns the topmost scope layer in the order domain > local > process. | ||
@@ -107,3 +101,3 @@ */ | ||
const scope = this.getScope().clone(); | ||
this.getStack().push({ | ||
this._stack.push({ | ||
client: this.getClient(), | ||
@@ -119,4 +113,4 @@ scope, | ||
_popScope() { | ||
if (this.getStack().length <= 1) return false; | ||
return !!this.getStack().pop(); | ||
if (this._stack.length <= 1) return false; | ||
return !!this._stack.pop(); | ||
} | ||
@@ -123,0 +117,0 @@ } |
@@ -336,2 +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]) { | ||
@@ -343,2 +347,16 @@ this._hooks[hook] = []; | ||
this._hooks[hook].push(callback); | ||
// This function returns a callback execution handler that, when invoked, | ||
// deregisters a callback. This is crucial for managing instances where callbacks | ||
// need to be unregistered to prevent self-referencing in callback closures, | ||
// ensuring proper garbage collection. | ||
return () => { | ||
const hooks = this._hooks[hook]; | ||
if (hooks) { | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
hooks.splice(cbIndex, 1); | ||
} | ||
}; | ||
} | ||
@@ -596,3 +614,3 @@ | ||
const result = processBeforeSend(options, prepared, hint); | ||
const result = processBeforeSend(this, options, prepared, hint); | ||
return _validateBeforeSendResult(result, beforeSendLabel); | ||
@@ -603,2 +621,8 @@ }) | ||
this.recordDroppedEvent('before_send', dataCategory, event); | ||
if (isTransactionEvent(event)) { | ||
const spans = event.spans || []; | ||
// the transaction itself counts as one span, plus all the child spans that are added | ||
const spanCount = 1 + spans.length; | ||
this._outcomes['span'] = (this._outcomes['span'] || 0) + spanCount; | ||
} | ||
throw new utils.SentryError(`${beforeSendLabel} returned \`null\`, will not send event.`, 'log'); | ||
@@ -714,2 +738,3 @@ } | ||
function processBeforeSend( | ||
client, | ||
options, | ||
@@ -732,2 +757,4 @@ event, | ||
processedSpans.push(processedSpan); | ||
} else { | ||
client.recordDroppedEvent('before_send', 'span'); | ||
} | ||
@@ -734,0 +761,0 @@ } |
@@ -176,2 +176,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.spanIsSampled = spanUtils.spanIsSampled; | ||
exports.spanTimeInputToSeconds = spanUtils.spanTimeInputToSeconds; | ||
exports.spanToJSON = spanUtils.spanToJSON; | ||
@@ -178,0 +179,0 @@ exports.spanToTraceContext = spanUtils.spanToTraceContext; |
@@ -56,3 +56,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/** | ||
* Convert a span time input intp a timestamp in seconds. | ||
* Convert a span time input into a timestamp in seconds. | ||
*/ | ||
@@ -59,0 +59,0 @@ function spanTimeInputToSeconds(input) { |
@@ -26,2 +26,3 @@ import { isThenable } from '@sentry/utils'; | ||
// scope stack for domains or the process | ||
this._stack = [{ scope: assignedScope }]; | ||
@@ -85,9 +86,2 @@ this._isolationScope = assignedIsolationScope; | ||
/** | ||
* Returns the scope stack for domains or the process. | ||
*/ | ||
getStack() { | ||
return this._stack; | ||
} | ||
/** | ||
* Returns the topmost scope layer in the order domain > local > process. | ||
@@ -105,3 +99,3 @@ */ | ||
const scope = this.getScope().clone(); | ||
this.getStack().push({ | ||
this._stack.push({ | ||
client: this.getClient(), | ||
@@ -117,4 +111,4 @@ scope, | ||
_popScope() { | ||
if (this.getStack().length <= 1) return false; | ||
return !!this.getStack().pop(); | ||
if (this._stack.length <= 1) return false; | ||
return !!this._stack.pop(); | ||
} | ||
@@ -121,0 +115,0 @@ } |
@@ -334,2 +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]) { | ||
@@ -341,2 +345,16 @@ this._hooks[hook] = []; | ||
this._hooks[hook].push(callback); | ||
// This function returns a callback execution handler that, when invoked, | ||
// deregisters a callback. This is crucial for managing instances where callbacks | ||
// need to be unregistered to prevent self-referencing in callback closures, | ||
// ensuring proper garbage collection. | ||
return () => { | ||
const hooks = this._hooks[hook]; | ||
if (hooks) { | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
hooks.splice(cbIndex, 1); | ||
} | ||
}; | ||
} | ||
@@ -594,3 +612,3 @@ | ||
const result = processBeforeSend(options, prepared, hint); | ||
const result = processBeforeSend(this, options, prepared, hint); | ||
return _validateBeforeSendResult(result, beforeSendLabel); | ||
@@ -601,2 +619,8 @@ }) | ||
this.recordDroppedEvent('before_send', dataCategory, event); | ||
if (isTransactionEvent(event)) { | ||
const spans = event.spans || []; | ||
// the transaction itself counts as one span, plus all the child spans that are added | ||
const spanCount = 1 + spans.length; | ||
this._outcomes['span'] = (this._outcomes['span'] || 0) + spanCount; | ||
} | ||
throw new SentryError(`${beforeSendLabel} returned \`null\`, will not send event.`, 'log'); | ||
@@ -712,2 +736,3 @@ } | ||
function processBeforeSend( | ||
client, | ||
options, | ||
@@ -730,2 +755,4 @@ event, | ||
processedSpans.push(processedSpan); | ||
} else { | ||
client.recordDroppedEvent('before_send', 'span'); | ||
} | ||
@@ -732,0 +759,0 @@ } |
@@ -39,3 +39,3 @@ export { registerSpanErrorInstrumentation } from './tracing/errors.js'; | ||
export { parameterize } from './utils/parameterize.js'; | ||
export { addChildSpanToSpan, getActiveSpan, getRootSpan, getSpanDescendants, getStatusMessage, spanIsSampled, spanToJSON, spanToTraceContext, spanToTraceHeader } from './utils/spanUtils.js'; | ||
export { addChildSpanToSpan, getActiveSpan, getRootSpan, getSpanDescendants, getStatusMessage, spanIsSampled, spanTimeInputToSeconds, spanToJSON, spanToTraceContext, spanToTraceHeader } from './utils/spanUtils.js'; | ||
export { parseSampleRate } from './utils/parseSampleRate.js'; | ||
@@ -42,0 +42,0 @@ export { applySdkMetadata } from './utils/sdkMetadata.js'; |
@@ -1,2 +0,2 @@ | ||
import { dropUndefinedKeys, generateSentryTraceHeader, addNonEnumerableProperty, timestampInSeconds } from '@sentry/utils'; | ||
import { dropUndefinedKeys, generateSentryTraceHeader, timestampInSeconds, addNonEnumerableProperty } from '@sentry/utils'; | ||
import { getAsyncContextStrategy } from '../asyncContext/index.js'; | ||
@@ -54,3 +54,3 @@ import { getMainCarrier } from '../carrier.js'; | ||
/** | ||
* Convert a span time input intp a timestamp in seconds. | ||
* Convert a span time input into a timestamp in seconds. | ||
*/ | ||
@@ -57,0 +57,0 @@ function spanTimeInputToSeconds(input) { |
@@ -31,6 +31,2 @@ import { Client, Scope as ScopeInterface } from '@sentry/types'; | ||
/** | ||
* Returns the scope stack for domains or the process. | ||
*/ | ||
getStack(): Layer[]; | ||
/** | ||
* Returns the topmost scope layer in the order domain > local > process. | ||
@@ -37,0 +33,0 @@ */ |
@@ -126,23 +126,23 @@ 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: 'spanStart', callback: (span: Span) => void): void; | ||
on(hook: 'spanStart', callback: (span: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'spanEnd', callback: (span: Span) => void): void; | ||
on(hook: 'spanEnd', callback: (span: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): void; | ||
on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void; | ||
on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): void; | ||
on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): void; | ||
on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void): void; | ||
on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): void; | ||
on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): void; | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: { | ||
includeReplay: boolean; | ||
}) => void): void; | ||
}) => void): () => void; | ||
/** @inheritdoc */ | ||
@@ -161,7 +161,7 @@ on(hook: 'beforeSampling', callback: (samplingData: { | ||
baggage?: string | undefined; | ||
}) => void): void; | ||
}) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'startNavigationSpan', callback: (options: StartSpanOptions) => void): void; | ||
on(hook: 'flush', callback: () => void): void; | ||
on(hook: 'close', callback: () => void): void; | ||
on(hook: 'startNavigationSpan', callback: (options: StartSpanOptions) => void): () => void; | ||
on(hook: 'flush', callback: () => void): () => void; | ||
on(hook: 'close', callback: () => void): () => void; | ||
/** @inheritdoc */ | ||
@@ -168,0 +168,0 @@ emit(hook: 'beforeSampling', samplingData: { |
@@ -35,3 +35,3 @@ export { ClientClass } from './sdk'; | ||
export { parameterize } from './utils/parameterize'; | ||
export { spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, } from './utils/spanUtils'; | ||
export { spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, } from './utils/spanUtils'; | ||
export { parseSampleRate } from './utils/parseSampleRate'; | ||
@@ -38,0 +38,0 @@ export { applySdkMetadata } from './utils/sdkMetadata'; |
@@ -20,3 +20,3 @@ import { MeasurementUnit, Primitive, Span, SpanAttributes, SpanJSON, SpanStatus, SpanTimeInput, TraceContext } from '@sentry/types'; | ||
/** | ||
* Convert a span time input intp a timestamp in seconds. | ||
* Convert a span time input into a timestamp in seconds. | ||
*/ | ||
@@ -23,0 +23,0 @@ export declare function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number; |
@@ -31,6 +31,2 @@ import type { Client, Scope as ScopeInterface } from '@sentry/types'; | ||
/** | ||
* Returns the scope stack for domains or the process. | ||
*/ | ||
getStack(): Layer[]; | ||
/** | ||
* Returns the topmost scope layer in the order domain > local > process. | ||
@@ -37,0 +33,0 @@ */ |
@@ -126,23 +126,23 @@ 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: 'spanStart', callback: (span: Span) => void): void; | ||
on(hook: 'spanStart', callback: (span: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'spanEnd', callback: (span: Span) => void): void; | ||
on(hook: 'spanEnd', callback: (span: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): void; | ||
on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void; | ||
on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): void; | ||
on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): void; | ||
on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void): void; | ||
on(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): void; | ||
on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): void; | ||
on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: { | ||
includeReplay: boolean; | ||
}) => void): void; | ||
}) => void): () => void; | ||
/** @inheritdoc */ | ||
@@ -161,7 +161,7 @@ on(hook: 'beforeSampling', callback: (samplingData: { | ||
baggage?: string | undefined; | ||
}) => void): void; | ||
}) => void): () => void; | ||
/** @inheritdoc */ | ||
on(hook: 'startNavigationSpan', callback: (options: StartSpanOptions) => void): void; | ||
on(hook: 'flush', callback: () => void): void; | ||
on(hook: 'close', callback: () => void): void; | ||
on(hook: 'startNavigationSpan', callback: (options: StartSpanOptions) => void): () => void; | ||
on(hook: 'flush', callback: () => void): () => void; | ||
on(hook: 'close', callback: () => void): () => void; | ||
/** @inheritdoc */ | ||
@@ -168,0 +168,0 @@ emit(hook: 'beforeSampling', samplingData: { |
@@ -35,3 +35,3 @@ export type { ClientClass } from './sdk'; | ||
export { parameterize } from './utils/parameterize'; | ||
export { spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, } from './utils/spanUtils'; | ||
export { spanToTraceHeader, spanToJSON, spanIsSampled, spanToTraceContext, getSpanDescendants, getStatusMessage, getRootSpan, getActiveSpan, addChildSpanToSpan, spanTimeInputToSeconds, } from './utils/spanUtils'; | ||
export { parseSampleRate } from './utils/parseSampleRate'; | ||
@@ -38,0 +38,0 @@ export { applySdkMetadata } from './utils/sdkMetadata'; |
@@ -20,3 +20,3 @@ import type { MeasurementUnit, Primitive, Span, SpanAttributes, SpanJSON, SpanStatus, SpanTimeInput, TraceContext } from '@sentry/types'; | ||
/** | ||
* Convert a span time input intp a timestamp in seconds. | ||
* Convert a span time input into a timestamp in seconds. | ||
*/ | ||
@@ -23,0 +23,0 @@ export declare function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number; |
{ | ||
"name": "@sentry/core", | ||
"version": "8.14.0", | ||
"version": "8.15.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.14.0", | ||
"@sentry/utils": "8.14.0" | ||
"@sentry/types": "8.15.0", | ||
"@sentry/utils": "8.15.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
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
1874489
20235
+ Added@sentry/types@8.15.0(transitive)
+ Added@sentry/utils@8.15.0(transitive)
- Removed@sentry/types@8.14.0(transitive)
- Removed@sentry/utils@8.14.0(transitive)
Updated@sentry/types@8.15.0
Updated@sentry/utils@8.15.0