@sentry/core 10.50.0-alpha.0 → 10.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/client.js +0 -9
- package/build/cjs/client.js.map +1 -1
- package/build/cjs/instrument/console.js +1 -2
- package/build/cjs/instrument/console.js.map +1 -1
- package/build/cjs/tracing/ai/utils.js +4 -4
- package/build/cjs/tracing/ai/utils.js.map +1 -1
- package/build/cjs/tracing/sentrySpan.js +0 -5
- package/build/cjs/tracing/sentrySpan.js.map +1 -1
- package/build/cjs/tracing/vercel-ai/index.js +0 -9
- package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
- package/build/cjs/utils/version.js +1 -1
- package/build/cjs/utils/version.js.map +1 -1
- package/build/esm/client.js +0 -9
- package/build/esm/client.js.map +1 -1
- package/build/esm/instrument/console.js +1 -2
- package/build/esm/instrument/console.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/tracing/ai/utils.js +4 -4
- package/build/esm/tracing/ai/utils.js.map +1 -1
- package/build/esm/tracing/sentrySpan.js +0 -5
- package/build/esm/tracing/sentrySpan.js.map +1 -1
- package/build/esm/tracing/vercel-ai/index.js +0 -9
- package/build/esm/tracing/vercel-ai/index.js.map +1 -1
- package/build/esm/utils/version.js +1 -1
- package/build/esm/utils/version.js.map +1 -1
- package/build/types/client.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/tracing/ai/utils.d.ts +1 -3
- package/build/types/tracing/ai/utils.d.ts.map +1 -1
- package/build/types/tracing/google-genai/types.d.ts +5 -2
- package/build/types/tracing/google-genai/types.d.ts.map +1 -1
- package/build/types/tracing/sentrySpan.d.ts.map +1 -1
- package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
- package/build/types/types-hoist/envelope.d.ts +1 -1
- package/build/types/types-hoist/envelope.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -1
- package/build/types-ts3.8/tracing/ai/utils.d.ts +1 -3
- package/build/types-ts3.8/tracing/google-genai/types.d.ts +5 -2
- package/build/types-ts3.8/types-hoist/envelope.d.ts +1 -1
- package/package.json +1 -1
- package/build/cjs/tracing/spans/extractGenAiSpans.js +0 -50
- package/build/cjs/tracing/spans/extractGenAiSpans.js.map +0 -1
- package/build/cjs/tracing/spans/spanJsonToStreamedSpan.js +0 -26
- package/build/cjs/tracing/spans/spanJsonToStreamedSpan.js.map +0 -1
- package/build/esm/tracing/spans/extractGenAiSpans.js +0 -48
- package/build/esm/tracing/spans/extractGenAiSpans.js.map +0 -1
- package/build/esm/tracing/spans/spanJsonToStreamedSpan.js +0 -24
- package/build/esm/tracing/spans/spanJsonToStreamedSpan.js.map +0 -1
- package/build/types/tracing/spans/extractGenAiSpans.d.ts +0 -15
- package/build/types/tracing/spans/extractGenAiSpans.d.ts.map +0 -1
- package/build/types/tracing/spans/spanJsonToStreamedSpan.d.ts +0 -6
- package/build/types/tracing/spans/spanJsonToStreamedSpan.d.ts.map +0 -1
- package/build/types-ts3.8/tracing/spans/extractGenAiSpans.d.ts +0 -15
- package/build/types-ts3.8/tracing/spans/spanJsonToStreamedSpan.d.ts +0 -6
package/build/cjs/client.js
CHANGED
|
@@ -11,7 +11,6 @@ const internal$1 = require('./metrics/internal.js');
|
|
|
11
11
|
const session = require('./session.js');
|
|
12
12
|
const dynamicSamplingContext = require('./tracing/dynamicSamplingContext.js');
|
|
13
13
|
const beforeSendSpan = require('./tracing/spans/beforeSendSpan.js');
|
|
14
|
-
const extractGenAiSpans = require('./tracing/spans/extractGenAiSpans.js');
|
|
15
14
|
const base = require('./transports/base.js');
|
|
16
15
|
const clientreport = require('./utils/clientreport.js');
|
|
17
16
|
const debugLogger = require('./utils/debug-logger.js');
|
|
@@ -477,20 +476,12 @@ class Client {
|
|
|
477
476
|
sendEvent(event, hint = {}) {
|
|
478
477
|
this.emit('beforeSendEvent', event, hint);
|
|
479
478
|
|
|
480
|
-
// Extract gen_ai spans from transaction and convert to span v2 format.
|
|
481
|
-
// This mutates event.spans to remove the extracted spans.
|
|
482
|
-
const genAiSpanItem = extractGenAiSpans.extractGenAiSpansFromEvent(event, this);
|
|
483
|
-
|
|
484
479
|
let env = envelope.createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
|
|
485
480
|
|
|
486
481
|
for (const attachment of hint.attachments || []) {
|
|
487
482
|
env = envelope$1.addItemToEnvelope(env, envelope$1.createAttachmentEnvelopeItem(attachment));
|
|
488
483
|
}
|
|
489
484
|
|
|
490
|
-
if (genAiSpanItem) {
|
|
491
|
-
env = envelope$1.addItemToEnvelope(env, genAiSpanItem);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
485
|
// sendEnvelope should not throw
|
|
495
486
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
496
487
|
this.sendEnvelope(env).then(sendResponse => this.emit('afterSendEvent', event, sendResponse));
|
package/build/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../src/client.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api';\nimport { DEFAULT_ENVIRONMENT } from './constants';\nimport { getCurrentScope, getIsolationScope, getTraceContextFromScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope';\nimport type { IntegrationIndex } from './integration';\nimport { afterSetupIntegrations, setupIntegration, setupIntegrations } from './integration';\nimport { _INTERNAL_flushLogsBuffer } from './logs/internal';\nimport { _INTERNAL_flushMetricsBuffer } from './metrics/internal';\nimport type { Scope } from './scope';\nimport { updateSession } from './session';\nimport { getDynamicSamplingContextFromScope } from './tracing/dynamicSamplingContext';\nimport { isStreamedBeforeSendSpanCallback } from './tracing/spans/beforeSendSpan';\nimport { extractGenAiSpansFromEvent } from './tracing/spans/extractGenAiSpans';\nimport { DEFAULT_TRANSPORT_BUFFER_SIZE } from './transports/base';\nimport type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbHint, XhrBreadcrumbHint } from './types-hoist/breadcrumb';\nimport type { CheckIn, MonitorConfig } from './types-hoist/checkin';\nimport type { EventDropReason, Outcome } from './types-hoist/clientreport';\nimport type { DataCategory } from './types-hoist/datacategory';\nimport type { DsnComponents } from './types-hoist/dsn';\nimport type { DynamicSamplingContext, Envelope } from './types-hoist/envelope';\nimport type { ErrorEvent, Event, EventHint, EventType, TransactionEvent } from './types-hoist/event';\nimport type { EventProcessor } from './types-hoist/eventprocessor';\nimport type { FeedbackEvent } from './types-hoist/feedback';\nimport type { Integration } from './types-hoist/integration';\nimport type { Log } from './types-hoist/log';\nimport type { Metric } from './types-hoist/metric';\nimport type { Primitive } from './types-hoist/misc';\nimport type { ClientOptions } from './types-hoist/options';\nimport type { ParameterizedString } from './types-hoist/parameterize';\nimport type { ReplayEndEvent, ReplayStartEvent } from './types-hoist/replay';\nimport type { RequestEventData } from './types-hoist/request';\nimport type { SdkMetadata } from './types-hoist/sdkmetadata';\nimport type { Session, SessionAggregates } from './types-hoist/session';\nimport type { SeverityLevel } from './types-hoist/severity';\nimport type { Span, SpanAttributes, SpanContextData, SpanJSON, StreamedSpanJSON } from './types-hoist/span';\nimport type { StartSpanOptions } from './types-hoist/startSpanOptions';\nimport type { Transport, TransportMakeRequestResponse } from './types-hoist/transport';\nimport { createClientReportEnvelope } from './utils/clientreport';\nimport { debug } from './utils/debug-logger';\nimport { dsnToString, makeDsn } from './utils/dsn';\nimport { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils/envelope';\nimport { getPossibleEventMessages } from './utils/eventUtils';\nimport { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils/is';\nimport { merge } from './utils/merge';\nimport { checkOrSetAlreadyCaught, uuid4 } from './utils/misc';\nimport { parseSampleRate } from './utils/parseSampleRate';\nimport { prepareEvent } from './utils/prepareEvent';\nimport { makePromiseBuffer, type PromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { reparentChildSpans, shouldIgnoreSpan } from './utils/should-ignore-span';\nimport { showSpanDropWarning } from './utils/spanUtils';\nimport { rejectedSyncPromise } from './utils/syncpromise';\nimport { safeUnref } from './utils/timer';\nimport { convertSpanJsonToTransactionEvent, convertTransactionEventToSpanJson } from './utils/transactionEvent';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\nconst MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release';\n\nconst INTERNAL_ERROR_SYMBOL = Symbol.for('SentryInternalError');\nconst DO_NOT_SEND_EVENT_SYMBOL = Symbol.for('SentryDoNotSendEventError');\n\n// Default interval for flushing logs and metrics (5 seconds)\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\ninterface InternalError {\n message: string;\n [INTERNAL_ERROR_SYMBOL]: true;\n}\n\ninterface DoNotSendEventError {\n message: string;\n [DO_NOT_SEND_EVENT_SYMBOL]: true;\n}\n\nfunction _makeInternalError(message: string): InternalError {\n return {\n message,\n [INTERNAL_ERROR_SYMBOL]: true,\n };\n}\n\nfunction _makeDoNotSendEventError(message: string): DoNotSendEventError {\n return {\n message,\n [DO_NOT_SEND_EVENT_SYMBOL]: true,\n };\n}\n\nfunction _isInternalError(error: unknown): error is InternalError {\n return !!error && typeof error === 'object' && INTERNAL_ERROR_SYMBOL in error;\n}\n\nfunction _isDoNotSendEventError(error: unknown): error is DoNotSendEventError {\n return !!error && typeof error === 'object' && DO_NOT_SEND_EVENT_SYMBOL in error;\n}\n\n/**\n * Sets up weight-based flushing for logs or metrics.\n * This helper function encapsulates the common pattern of:\n * 1. Tracking accumulated weight of items\n * 2. Flushing when weight exceeds threshold (800KB)\n * 3. Flushing after timeout period from the first item\n *\n * Uses closure variables to track weight and timeout state.\n */\nfunction setupWeightBasedFlushing<\n T,\n AfterCaptureHook extends 'afterCaptureLog' | 'afterCaptureMetric',\n FlushHook extends 'flushLogs' | 'flushMetrics',\n>(\n client: Client,\n afterCaptureHook: AfterCaptureHook,\n flushHook: FlushHook,\n estimateSizeFn: (item: T) => number,\n flushFn: (client: Client) => void,\n): void {\n // Track weight and timeout in closure variables\n let weight = 0;\n let flushTimeout: ReturnType<typeof setTimeout> | undefined;\n let isTimerActive = false;\n\n // @ts-expect-error - TypeScript can't narrow generic hook types to match specific overloads, but we know this is type-safe\n client.on(flushHook, () => {\n weight = 0;\n clearTimeout(flushTimeout);\n isTimerActive = false;\n });\n\n // @ts-expect-error - TypeScript can't narrow generic hook types to match specific overloads, but we know this is type-safe\n client.on(afterCaptureHook, (item: T) => {\n weight += estimateSizeFn(item);\n\n // We flush the buffer if it exceeds 0.8 MB\n // The weight is a rough estimate, so we flush way before the payload gets too big.\n if (weight >= 800_000) {\n flushFn(client);\n } else if (!isTimerActive) {\n // Only start timer if one isn't already running.\n // This prevents flushing being delayed by items that arrive close to the timeout limit\n // and thus resetting the flushing timeout and delaying items being flushed.\n isTimerActive = true;\n // Use safeUnref so the timer doesn't prevent the process from exiting\n flushTimeout = safeUnref(\n setTimeout(() => {\n flushFn(client);\n // Note: isTimerActive is reset by the flushHook handler above, not here,\n // to avoid race conditions when new items arrive during the flush.\n }, DEFAULT_FLUSH_INTERVAL),\n );\n }\n });\n\n client.on('flush', () => {\n flushFn(client);\n });\n}\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link Client._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends Client<NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nexport abstract class Client<O extends ClientOptions = ClientOptions> {\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n protected readonly _dsn?: DsnComponents;\n\n protected readonly _transport?: Transport;\n\n /** Array of set up integrations. */\n protected _integrations: IntegrationIndex;\n\n /** Number of calls being processed */\n protected _numProcessing: number;\n\n protected _eventProcessors: EventProcessor[];\n\n /** Holds flushable */\n protected _outcomes: { [key: string]: number };\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected _hooks: Record<string, Set<Function>>;\n\n protected _promiseBuffer: PromiseBuffer<unknown>;\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n protected constructor(options: O) {\n this._options = options;\n this._integrations = {};\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n this._promiseBuffer = makePromiseBuffer(options.transportOptions?.bufferSize ?? DEFAULT_TRANSPORT_BUFFER_SIZE);\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && debug.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(\n this._dsn,\n options.tunnel,\n options._metadata ? options._metadata.sdk : undefined,\n );\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n\n // Backfill enableLogs option from _experiments.enableLogs\n // TODO(v11): Remove or change default value\n // eslint-disable-next-line deprecation/deprecation\n this._options.enableLogs = this._options.enableLogs ?? this._options._experiments?.enableLogs;\n\n // Setup log flushing with weight and timeout tracking\n if (this._options.enableLogs) {\n setupWeightBasedFlushing(this, 'afterCaptureLog', 'flushLogs', estimateLogSizeInBytes, _INTERNAL_flushLogsBuffer);\n }\n\n // todo(v11): Remove the experimental flag\n // eslint-disable-next-line deprecation/deprecation\n const enableMetrics = this._options.enableMetrics ?? this._options._experiments?.enableMetrics ?? true;\n\n // Setup metric flushing with weight and timeout tracking\n if (enableMetrics) {\n setupWeightBasedFlushing(\n this,\n 'afterCaptureMetric',\n 'flushMetrics',\n estimateMetricSizeInBytes,\n _INTERNAL_flushMetricsBuffer,\n );\n }\n }\n\n /**\n * Captures an exception event and sends it to Sentry.\n *\n * Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureException(exception: unknown, hint?: EventHint, scope?: Scope): string {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n this._process(\n () =>\n this.eventFromException(exception, hintWithEventId)\n .then(event => this._captureEvent(event, hintWithEventId, scope))\n .then(res => res),\n 'error',\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a message event and sends it to Sentry.\n *\n * Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureMessage(\n message: ParameterizedString,\n level?: SeverityLevel,\n hint?: EventHint,\n currentScope?: Scope,\n ): string {\n const hintWithEventId = {\n event_id: uuid4(),\n ...hint,\n };\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n const isMessage = isPrimitive(message);\n const promisedEvent = isMessage\n ? this.eventFromMessage(eventMessage, level, hintWithEventId)\n : this.eventFromException(message, hintWithEventId);\n\n this._process(\n () => promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)),\n isMessage ? 'unknown' : 'error',\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a manually created event and sends it to Sentry.\n *\n * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope: Scope | undefined = sdkProcessingMetadata.capturedSpanScope;\n const capturedSpanIsolationScope: Scope | undefined = sdkProcessingMetadata.capturedSpanIsolationScope;\n const dataCategory = getDataCategoryByType(event.type);\n\n this._process(\n () => this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope),\n dataCategory,\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a session.\n */\n public captureSession(session: Session): void {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n\n /**\n * Create a cron monitor check in and send it to Sentry. This method is not available on all clients.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n * @param scope An optional scope containing event metadata.\n * @returns A string representing the id of the check in.\n */\n public captureCheckIn?(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;\n\n /**\n * Get the current Dsn.\n */\n public getDsn(): DsnComponents | undefined {\n return this._dsn;\n }\n\n /**\n * Get the current options.\n */\n public getOptions(): O {\n return this._options;\n }\n\n /**\n * Get the SDK metadata.\n * @see SdkMetadata\n */\n public getSdkMetadata(): SdkMetadata | undefined {\n return this._options._metadata;\n }\n\n /**\n * Returns the transport that is used by the client.\n * Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.\n */\n public getTransport(): Transport | undefined {\n return this._transport;\n }\n\n /**\n * Wait for all events to be sent or the timeout to expire, whichever comes first.\n *\n * @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will\n * cause the client to wait until all events are sent before resolving the promise.\n * @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are\n * still events in the queue when the timeout is reached.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async flush(timeout?: number): PromiseLike<boolean> {\n const transport = this._transport;\n if (!transport) {\n return true;\n }\n\n this.emit('flush');\n\n const clientFinished = await this._isClientDoneProcessing(timeout);\n const transportFlushed = await transport.flush(timeout);\n\n return clientFinished && transportFlushed;\n }\n\n /**\n * Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.\n *\n * @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause\n * the client to wait until all events are sent before disabling itself.\n * @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if\n * it doesn't.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async close(timeout?: number): PromiseLike<boolean> {\n _INTERNAL_flushLogsBuffer(this);\n const result = await this.flush(timeout);\n this.getOptions().enabled = false;\n this.emit('close');\n return result;\n }\n\n /**\n * Get all installed event processors.\n */\n public getEventProcessors(): EventProcessor[] {\n return this._eventProcessors;\n }\n\n /**\n * Adds an event processor that applies to any event processed by this client.\n */\n public addEventProcessor(eventProcessor: EventProcessor): void {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * Initialize this client.\n * Call this after the client was set on a scope.\n */\n public init(): void {\n if (\n this._isEnabled() ||\n // Force integrations to be setup even if no DSN was set when we have\n // Spotlight enabled. This is particularly important for browser as we\n // don't support the `spotlight` option there and rely on the users\n // adding the `spotlightBrowserIntegration()` to their integrations which\n // wouldn't get initialized with the check below when there's no DSN set.\n this._options.integrations.some(({ name }) => name.startsWith('Spotlight'))\n ) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.\n */\n public getIntegrationByName<T extends Integration = Integration>(integrationName: string): T | undefined {\n return this._integrations[integrationName] as T | undefined;\n }\n\n /**\n * Add an integration to the client.\n * This can be used to e.g. lazy load integrations.\n * In most cases, this should not be necessary,\n * and you're better off just passing the integrations via `integrations: []` at initialization time.\n * However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.\n */\n public addIntegration(integration: Integration): void {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n if (!isAlreadyInstalled && integration.beforeSetup) {\n integration.beforeSetup(this);\n }\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * Send a fully prepared event to Sentry.\n */\n public sendEvent(event: Event, hint: EventHint = {}): void {\n this.emit('beforeSendEvent', event, hint);\n\n // Extract gen_ai spans from transaction and convert to span v2 format.\n // This mutates event.spans to remove the extracted spans.\n const genAiSpanItem = extractGenAiSpansFromEvent(event, this);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));\n }\n\n if (genAiSpanItem) {\n env = addItemToEnvelope(env, genAiSpanItem);\n }\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env).then(sendResponse => this.emit('afterSendEvent', event, sendResponse));\n }\n\n /**\n * Send a session or session aggregrates to Sentry.\n */\n public sendSession(session: Session | SessionAggregates): void {\n // Backfill release and environment on session\n const { release: clientReleaseOption, environment: clientEnvironmentOption = DEFAULT_ENVIRONMENT } = this._options;\n if ('aggregates' in session) {\n const sessionAttrs = session.attrs || {};\n if (!sessionAttrs.release && !clientReleaseOption) {\n DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);\n return;\n }\n sessionAttrs.release = sessionAttrs.release || clientReleaseOption;\n sessionAttrs.environment = sessionAttrs.environment || clientEnvironmentOption;\n session.attrs = sessionAttrs;\n } else {\n if (!session.release && !clientReleaseOption) {\n DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);\n return;\n }\n session.release = session.release || clientReleaseOption;\n session.environment = session.environment || clientEnvironmentOption;\n }\n\n this.emit('beforeSendSession', session);\n\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env);\n }\n\n /**\n * Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).\n */\n public recordDroppedEvent(reason: EventDropReason, category: DataCategory, count: number = 1): void {\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && debug.log(`Recording outcome: \"${key}\"${count > 1 ? ` (${count} times)` : ''}`);\n this._outcomes[key] = (this._outcomes[key] || 0) + count;\n }\n }\n\n /* eslint-disable @typescript-eslint/unified-signatures */\n /**\n * Register a callback for whenever a span is started.\n * Receives the span as argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'spanStart', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback before span sampling runs. Receives a `samplingDecision` object argument with a `decision`\n * property that can be used to make a sampling decision that will be enforced, before any span sampling runs.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeSampling',\n callback: (\n samplingData: {\n spanAttributes: SpanAttributes;\n spanName: string;\n parentSampled?: boolean;\n parentSampleRate?: number;\n parentContext?: SpanContextData;\n },\n samplingDecision: { decision: boolean },\n ) => void,\n ): void;\n\n /**\n * Register a callback for after a span is ended.\n * NOTE: The span cannot be mutated anymore in this callback.\n * Receives the span as argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'spanEnd', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback for after a span is ended and the `spanEnd` hook has run.\n * NOTE: The span cannot be mutated anymore in this callback.\n */\n public on(hook: 'afterSpanEnd', callback: (immutableSegmentSpan: Readonly<Span>) => void): () => void;\n\n /**\n * Register a callback for after a segment span is ended and the `segmentSpanEnd` hook has run.\n * NOTE: The segment span cannot be mutated anymore in this callback.\n */\n public on(hook: 'afterSegmentSpanEnd', callback: (immutableSegmentSpan: Readonly<Span>) => void): () => void;\n\n /**\n * Register a callback for when a span JSON is processed, to add some data to the span JSON.\n */\n public on(hook: 'processSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;\n\n /**\n * Register a callback for when a segment span JSON is processed, to add some data to the segment span JSON.\n */\n public on(hook: 'processSegmentSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;\n\n /**\n * Register a callback for when an idle span is allowed to auto-finish.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback for transaction start and finish.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): () => void;\n\n /**\n * Register a callback that runs when stack frame metadata should be applied to an event.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'applyFrameMetadata', callback: (event: Event) => void): () => void;\n\n /**\n * Register a callback for before sending an event.\n * This is called right before an event is sent and should not be used to mutate the event.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for before sending a session or session aggregrates..\n * Receives the session/aggregate as second argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeSendSession', callback: (session: Session | SessionAggregates) => void): () => void;\n\n /**\n * Register a callback for preprocessing an event,\n * before it is passed to (global) event processors.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for postprocessing an event,\n * after it was passed to (global) event processors, before it is being sent.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'postprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for when an event has been sent.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'afterSendEvent',\n callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void,\n ): () => void;\n\n /**\n * Register a callback before a breadcrumb is added.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): () => void;\n\n /**\n * Register a callback when a DSC (Dynamic Sampling Context) is created.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): () => void;\n\n /**\n * Register a callback when a Feedback event has been prepared.\n * This should be used to mutate the event. The options argument can hint\n * about what kind of mutation it expects.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeSendFeedback',\n callback: (feedback: FeedbackEvent, options?: { includeReplay?: boolean }) => void,\n ): () => void;\n\n /**\n * Register a callback when the feedback widget is opened in a user's browser\n */\n public on(hook: 'openFeedbackWidget', callback: () => void): () => void;\n\n /**\n * A hook that is called when a replay session starts recording (either session or buffer mode).\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'replayStart', callback: (event: ReplayStartEvent) => void): () => void;\n\n /**\n * A hook that is called when a replay session stops recording, either manually or due to an\n * internal condition such as `maxReplayDuration` expiry, send failure, or mutation limit.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'replayEnd', callback: (event: ReplayEndEvent) => void): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger a span start for a page load.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'startPageLoadSpan',\n callback: (\n options: StartSpanOptions,\n traceOptions?: { sentryTrace?: string | undefined; baggage?: string | undefined },\n ) => void,\n ): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger the end of a page load span.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'endPageloadSpan', callback: () => void): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger after the pageload span was started.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterStartPageLoadSpan', callback: (span: Span) => void): () => void;\n\n /**\n * A hook for triggering right before a navigation span is started.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeStartNavigationSpan',\n callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,\n ): () => void;\n\n /**\n * A hook for browser tracing integrations to trigger a span for a navigation.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'startNavigationSpan',\n callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,\n ): () => void;\n\n /**\n * A hook for GraphQL client integration to enhance a span with request data.\n * @returns A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeOutgoingRequestSpan',\n callback: (span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void,\n ): () => void;\n\n /**\n * A hook for GraphQL client integration to enhance a breadcrumb with request data.\n * @returns A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeOutgoingRequestBreadcrumb',\n callback: (breadcrumb: Breadcrumb, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void,\n ): () => void;\n\n /**\n * A hook that is called when the client is flushing\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flush', callback: () => void): () => void;\n\n /**\n * A hook that is called when the client is closing\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'close', callback: () => void): () => void;\n\n /**\n * A hook that is called before a log is captured. This hooks runs before `beforeSendLog` is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeCaptureLog', callback: (log: Log) => void): () => void;\n\n /**\n * A hook that is called after a log is captured\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterCaptureLog', callback: (log: Log) => void): () => void;\n\n /**\n * A hook that is called when the client is flushing logs\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flushLogs', callback: () => void): () => void;\n\n /**\n * A hook that is called after capturing a metric. This hooks runs after `beforeSendMetric` is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterCaptureMetric', callback: (metric: Metric) => void): () => void;\n\n /**\n * A hook that is called when the client is flushing metrics\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flushMetrics', callback: () => void): () => void;\n\n /**\n * A hook that is called when a metric is processed before it is captured and before the `beforeSendMetric` callback is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'processMetric', callback: (metric: Metric) => void): () => void;\n\n /**\n * A hook that is called when a http server request is started.\n * This hook is called after request isolation, but before the request is processed.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'httpServerRequest',\n callback: (request: unknown, response: unknown, normalizedRequest: RequestEventData) => void,\n ): () => void;\n\n /**\n * A hook that is called when the UI Profiler should start profiling.\n *\n * This hook is called when running `Sentry.uiProfiler.startProfiler()`.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'startUIProfiler', callback: () => void): () => void;\n\n /**\n * A hook that is called when the UI Profiler should stop profiling.\n *\n * This hook is called when running `Sentry.uiProfiler.stopProfiler()`.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'stopUIProfiler', callback: () => void): () => void;\n\n /**\n * Register a hook on this client.\n */\n public on(hook: string, callback: unknown): () => void {\n const hookCallbacks = (this._hooks[hook] = this._hooks[hook] || new Set());\n\n // Wrap the callback in a function so that registering the same callback instance multiple\n // times results in the callback being called multiple times.\n // @ts-expect-error - The `callback` type is correct and must be a function due to the\n // individual, specific overloads of this function.\n // eslint-disable-next-line @typescript-eslint/ban-types\n const uniqueCallback: Function = (...args: unknown[]) => callback(...args);\n\n hookCallbacks.add(uniqueCallback);\n\n // This function returns a callback execution handler that, when invoked,\n // deregisters a callback. This is crucial for managing instances where callbacks\n // need to be unregistered to prevent self-referencing in callback closures,\n // ensuring proper garbage collection.\n return () => {\n hookCallbacks.delete(uniqueCallback);\n };\n }\n\n /** Fire a hook whenever a span starts. */\n public emit(hook: 'spanStart', span: Span): void;\n\n /** A hook that is called every time before a span is sampled. */\n public emit(\n hook: 'beforeSampling',\n samplingData: {\n spanAttributes: SpanAttributes;\n spanName: string;\n parentSampled?: boolean;\n parentSampleRate?: number;\n parentContext?: SpanContextData;\n },\n samplingDecision: { decision: boolean },\n ): void;\n\n /** Fire a hook whenever a span ends. */\n public emit(hook: 'spanEnd', span: Span): void;\n\n /**\n * Fire a hook event after a span ends and the `spanEnd` hook has run.\n */\n public emit(hook: 'afterSpanEnd', immutableSpan: Readonly<Span>): void;\n\n /**\n * Fire a hook event after a segment span ends and the `spanEnd` hook has run.\n */\n public emit(hook: 'afterSegmentSpanEnd', immutableSegmentSpan: Readonly<Span>): void;\n\n /**\n * Fire a hook event when a span JSON is processed, to add some data to the span JSON.\n */\n public emit(hook: 'processSpan', streamedSpanJSON: StreamedSpanJSON): void;\n\n /**\n * Fire a hook event for when a segment span JSON is processed, to add some data to the segment span JSON.\n */\n public emit(hook: 'processSegmentSpan', streamedSpanJSON: StreamedSpanJSON): void;\n\n /**\n * Fire a hook indicating that an idle span is allowed to auto finish.\n */\n public emit(hook: 'idleSpanEnableAutoFinish', span: Span): void;\n\n /**\n * Fire a hook event for envelope creation and sending. Expects to be given an envelope as the\n * second argument.\n */\n public emit(hook: 'beforeEnvelope', envelope: Envelope): void;\n\n /**\n * Fire a hook indicating that stack frame metadata should be applied to the event passed to the hook.\n */\n public emit(hook: 'applyFrameMetadata', event: Event): void;\n\n /**\n * Fire a hook event before sending an event.\n * This is called right before an event is sent and should not be used to mutate the event.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event before sending a session/aggregates.\n * Expects to be given the prepared session/aggregates as second argument.\n */\n public emit(hook: 'beforeSendSession', session: Session | SessionAggregates): void;\n\n /**\n * Fire a hook event to process events before they are passed to (global) event processors.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event to process a user on an event before it is sent to Sentry, after all other processors have run.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'postprocessEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event after sending an event. Expects to be given an Event as the\n * second argument.\n */\n public emit(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse): void;\n\n /**\n * Fire a hook for when a breadcrumb is added. Expects the breadcrumb as second argument.\n */\n public emit(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;\n\n /**\n * Fire a hook for when a DSC (Dynamic Sampling Context) is created. Expects the DSC as second argument.\n */\n public emit(hook: 'createDsc', dsc: DynamicSamplingContext, rootSpan?: Span): void;\n\n /**\n * Fire a hook event for after preparing a feedback event. Events to be given\n * a feedback event as the second argument, and an optional options object as\n * third argument.\n */\n public emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { includeReplay?: boolean }): void;\n\n /**\n * Fire a hook event for when the feedback widget is opened in a user's browser\n */\n public emit(hook: 'openFeedbackWidget'): void;\n\n /**\n * Fire a hook event when a replay session starts recording.\n */\n public emit(hook: 'replayStart', event: ReplayStartEvent): void;\n\n /**\n * Fire a hook event when a replay session stops recording.\n */\n public emit(hook: 'replayEnd', event: ReplayEndEvent): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger a span start for a page load.\n */\n public emit(\n hook: 'startPageLoadSpan',\n options: StartSpanOptions,\n traceOptions?: { sentryTrace?: string | undefined; baggage?: string | undefined },\n ): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger the end of a page load span.\n */\n public emit(hook: 'endPageloadSpan'): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger aafter the pageload span was started.\n */\n public emit(hook: 'afterStartPageLoadSpan', span: Span): void;\n\n /**\n * Emit a hook event for triggering right before a navigation span is started.\n */\n public emit(\n hook: 'beforeStartNavigationSpan',\n options: StartSpanOptions,\n navigationOptions?: { isRedirect?: boolean },\n ): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger a span for a navigation.\n */\n public emit(\n hook: 'startNavigationSpan',\n options: StartSpanOptions,\n navigationOptions?: { isRedirect?: boolean },\n ): void;\n\n /**\n * Emit a hook event for GraphQL client integration to enhance a span with request data.\n */\n public emit(hook: 'beforeOutgoingRequestSpan', span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint): void;\n\n /**\n * Emit a hook event for GraphQL client integration to enhance a breadcrumb with request data.\n */\n public emit(\n hook: 'beforeOutgoingRequestBreadcrumb',\n breadcrumb: Breadcrumb,\n hint: XhrBreadcrumbHint | FetchBreadcrumbHint,\n ): void;\n\n /**\n * Emit a hook event for client flush\n */\n public emit(hook: 'flush'): void;\n\n /**\n * Emit a hook event for client close\n */\n public emit(hook: 'close'): void;\n\n /**\n * Emit a hook event for client before capturing a log. This hooks runs before `beforeSendLog` is fired.\n */\n public emit(hook: 'beforeCaptureLog', log: Log): void;\n\n /**\n * Emit a hook event for client after capturing a log.\n */\n public emit(hook: 'afterCaptureLog', log: Log): void;\n\n /**\n * Emit a hook event for client flush logs\n */\n public emit(hook: 'flushLogs'): void;\n\n /**\n * Emit a hook event for client after capturing a metric.\n */\n public emit(hook: 'afterCaptureMetric', metric: Metric): void;\n\n /**\n * Emit a hook event for client flush metrics\n */\n public emit(hook: 'flushMetrics'): void;\n\n /**\n *\n * Emit a hook event for client to process a metric before it is captured.\n * This hook is called before the `beforeSendMetric` callback is fired.\n */\n public emit(hook: 'processMetric', metric: Metric): void;\n\n /**\n * Emit a hook event for client when a http server request is started.\n * This hook is called after request isolation, but before the request is processed.\n */\n public emit(\n hook: 'httpServerRequest',\n request: unknown,\n response: unknown,\n normalizedRequest: RequestEventData,\n ): void;\n\n /**\n * Emit a hook event for starting the UI Profiler.\n */\n public emit(hook: 'startUIProfiler'): void;\n\n /**\n * Emit a hook event for stopping the UI Profiler.\n */\n public emit(hook: 'stopUIProfiler'): void;\n\n /**\n * Emit a hook that was previously registered via `on()`.\n */\n public emit(hook: string, ...rest: unknown[]): void {\n const callbacks = this._hooks[hook];\n if (callbacks) {\n callbacks.forEach(callback => callback(...rest));\n }\n }\n\n /**\n * Send an envelope to Sentry.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n try {\n return await this._transport.send(envelope);\n } catch (reason) {\n DEBUG_BUILD && debug.error('Error while sending envelope:', reason);\n return {};\n }\n }\n\n DEBUG_BUILD && debug.error('Transport disabled');\n return {};\n }\n\n /**\n * Disposes of the client and releases all resources.\n *\n * Subclasses should override this method to clean up their own resources.\n * After calling dispose(), the client should not be used anymore.\n */\n public dispose(): void {\n // Base class has no cleanup logic - subclasses implement their own\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n protected _setupIntegrations(): void {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n }\n\n /** Updates existing session based on the provided event */\n protected _updateSessionFromEvent(session: Session, event: Event): void {\n // initially, set `crashed` based on the event level and update from exceptions if there are any later on\n let crashed = event.level === 'fatal';\n let errored = false;\n const exceptions = event.exception?.values;\n\n if (exceptions) {\n errored = true;\n // reset crashed to false if there are exceptions, to ensure `mechanism.handled` is respected.\n crashed = false;\n\n for (const ex of exceptions) {\n if (ex.mechanism?.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n protected async _isClientDoneProcessing(timeout?: number): Promise<boolean> {\n let ticked = 0;\n\n while (!timeout || ticked < timeout) {\n await new Promise(resolve => setTimeout(resolve, 1));\n\n if (!this._numProcessing) {\n return true;\n }\n ticked++;\n }\n\n return false;\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n protected _isEnabled(): boolean {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A new event with more information.\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event | null> {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations?.length) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n if (!event.type) {\n isolationScope.setLastEventId(event.event_id || hint.event_id);\n }\n\n return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n this.emit('postprocessEvent', evt, hint);\n\n evt.contexts = {\n trace: { ...evt.contexts?.trace, ...getTraceContextFromScope(currentScope) },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n protected _captureEvent(\n event: Event,\n hint: EventHint = {},\n currentScope = getCurrentScope(),\n isolationScope = getIsolationScope(),\n ): PromiseLike<string | undefined> {\n if (DEBUG_BUILD && isErrorEvent(event)) {\n debug.log(`Captured error event \\`${getPossibleEventMessages(event)[0] || '<unknown>'}\\``);\n }\n\n return this._processEvent(event, hint, currentScope, isolationScope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n if (_isDoNotSendEventError(reason)) {\n debug.log(reason.message);\n } else if (_isInternalError(reason)) {\n debug.warn(reason.message);\n } else {\n debug.warn(reason);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n protected _processEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event> {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate(sampleRate);\n if (isError && typeof parsedSampleRate === 'number' && safeMathRandom() > parsedSampleRate) {\n this.recordDroppedEvent('sample_rate', 'error');\n return rejectedSyncPromise(\n _makeDoNotSendEventError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n ),\n );\n }\n\n const dataCategory = getDataCategoryByType(event.type);\n\n return this._prepareEvent(event, hint, currentScope, isolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory);\n throw _makeDoNotSendEventError('An event processor returned `null`, will not send event.');\n }\n\n const isInternalException = (hint.data as { __sentry__: boolean })?.__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(this, options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory);\n if (isTransaction) {\n const spans = event.spans || [];\n // the transaction itself counts as one span, plus all the child spans that are added\n const spanCount = 1 + spans.length;\n this.recordDroppedEvent('before_send', 'span', spanCount);\n }\n throw _makeDoNotSendEventError(`${beforeSendLabel} returned \\`null\\`, will not send event.`);\n }\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (isError && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n if (isTransaction) {\n const spanCountBefore = processedEvent.sdkProcessingMetadata?.spanCountBeforeProcessing || 0;\n const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0;\n\n const droppedSpanCount = spanCountBefore - spanCountAfter;\n if (droppedSpanCount > 0) {\n this.recordDroppedEvent('before_send', 'span', droppedSpanCount);\n }\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (_isDoNotSendEventError(reason) || _isInternalError(reason)) {\n throw reason;\n }\n\n this.captureException(reason, {\n mechanism: {\n handled: false,\n type: 'internal',\n },\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw _makeInternalError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n protected _process<T>(taskProducer: () => PromiseLike<T>, dataCategory: DataCategory): void {\n this._numProcessing++;\n\n void this._promiseBuffer.add(taskProducer).then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n\n if (reason === SENTRY_BUFFER_FULL_ERROR) {\n this.recordDroppedEvent('queue_overflow', dataCategory);\n }\n\n return reason;\n },\n );\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n protected _clearOutcomes(): Outcome[] {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.entries(outcomes).map(([key, quantity]) => {\n const [reason, category] = key.split(':') as [EventDropReason, DataCategory];\n return {\n reason,\n category,\n quantity,\n };\n });\n }\n\n /**\n * Sends client reports as an envelope.\n */\n protected _flushOutcomes(): void {\n DEBUG_BUILD && debug.log('Flushing outcomes...');\n\n const outcomes = this._clearOutcomes();\n\n if (outcomes.length === 0) {\n DEBUG_BUILD && debug.log('No outcomes to send');\n return;\n }\n\n // This is really the only place where we want to check for a DSN and only send outcomes then\n if (!this._dsn) {\n DEBUG_BUILD && debug.log('No dsn provided, will not send outcomes');\n return;\n }\n\n DEBUG_BUILD && debug.log('Sending outcomes:', outcomes);\n\n const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n */\n public abstract eventFromException(_exception: unknown, _hint?: EventHint): PromiseLike<Event>;\n\n /**\n * Creates an {@link Event} from primitive inputs to `captureMessage`.\n */\n public abstract eventFromMessage(\n _message: ParameterizedString,\n _level?: SeverityLevel,\n _hint?: EventHint,\n ): PromiseLike<Event>;\n}\n\nfunction getDataCategoryByType(type: EventType | 'replay_event' | undefined): DataCategory {\n return type === 'replay_event' ? 'replay' : type || 'error';\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult: PromiseLike<Event | null> | Event | null,\n beforeSendLabel: string,\n): PromiseLike<Event | null> | Event | null {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw _makeInternalError(invalidValueError);\n }\n return event;\n },\n e => {\n throw _makeInternalError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw _makeInternalError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n client: Client,\n options: ClientOptions,\n event: Event,\n hint: EventHint,\n): PromiseLike<Event | null> | Event | null {\n const { beforeSend, beforeSendTransaction, ignoreSpans } = options;\n const beforeSendSpan = !isStreamedBeforeSendSpanCallback(options.beforeSendSpan) && options.beforeSendSpan;\n\n let processedEvent = event;\n\n if (isErrorEvent(processedEvent) && beforeSend) {\n return beforeSend(processedEvent, hint);\n }\n\n if (isTransactionEvent(processedEvent)) {\n // Avoid processing if we don't have to\n if (beforeSendSpan || ignoreSpans) {\n // 1. Process root span\n const rootSpanJson = convertTransactionEventToSpanJson(processedEvent);\n\n // 1.1 If the root span should be ignored, drop the whole transaction\n if (ignoreSpans?.length && shouldIgnoreSpan(rootSpanJson, ignoreSpans)) {\n // dropping the whole transaction!\n return null;\n }\n\n // 1.2 If a `beforeSendSpan` callback is defined, process the root span\n if (beforeSendSpan) {\n const processedRootSpanJson = beforeSendSpan(rootSpanJson);\n if (!processedRootSpanJson) {\n showSpanDropWarning();\n } else {\n // update event with processed root span values\n processedEvent = merge(event, convertSpanJsonToTransactionEvent(processedRootSpanJson));\n }\n }\n\n // 2. Process child spans\n if (processedEvent.spans) {\n const processedSpans: SpanJSON[] = [];\n\n const initialSpans = processedEvent.spans;\n\n for (const span of initialSpans) {\n // 2.a If the child span should be ignored, reparent it to the root span\n if (ignoreSpans?.length && shouldIgnoreSpan(span, ignoreSpans)) {\n reparentChildSpans(initialSpans, span);\n continue;\n }\n\n // 2.b If a `beforeSendSpan` callback is defined, process the child span\n if (beforeSendSpan) {\n const processedSpan = beforeSendSpan(span);\n if (!processedSpan) {\n showSpanDropWarning();\n processedSpans.push(span);\n } else {\n processedSpans.push(processedSpan);\n }\n } else {\n processedSpans.push(span);\n }\n }\n\n const droppedSpans = processedEvent.spans.length - processedSpans.length;\n if (droppedSpans) {\n client.recordDroppedEvent('before_send', 'span', droppedSpans);\n }\n\n processedEvent.spans = processedSpans;\n }\n }\n\n if (beforeSendTransaction) {\n if (processedEvent.spans) {\n // We store the # of spans before processing in SDK metadata,\n // so we can compare it afterwards to determine how many spans were dropped\n const spanCountBefore = processedEvent.spans.length;\n processedEvent.sdkProcessingMetadata = {\n ...event.sdkProcessingMetadata,\n spanCountBeforeProcessing: spanCountBefore,\n };\n }\n return beforeSendTransaction(processedEvent as TransactionEvent, hint);\n }\n }\n\n return processedEvent;\n}\n\nfunction isErrorEvent(event: Event): event is ErrorEvent {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event: Event): event is TransactionEvent {\n return event.type === 'transaction';\n}\n\n/**\n * Estimate the size of a metric in bytes.\n *\n * @param metric - The metric to estimate the size of.\n * @returns The estimated size of the metric in bytes.\n */\nfunction estimateMetricSizeInBytes(metric: Metric): number {\n let weight = 0;\n\n // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.\n if (metric.name) {\n weight += metric.name.length * 2;\n }\n\n // Add weight for number\n weight += 8;\n\n return weight + estimateAttributesSizeInBytes(metric.attributes);\n}\n\n/**\n * Estimate the size of a log in bytes.\n *\n * @param log - The log to estimate the size of.\n * @returns The estimated size of the log in bytes.\n */\nfunction estimateLogSizeInBytes(log: Log): number {\n let weight = 0;\n\n // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.\n if (log.message) {\n weight += log.message.length * 2;\n }\n\n return weight + estimateAttributesSizeInBytes(log.attributes);\n}\n\n/**\n * Estimate the size of attributes in bytes.\n *\n * @param attributes - The attributes object to estimate the size of.\n * @returns The estimated size of the attributes in bytes.\n */\nfunction estimateAttributesSizeInBytes(attributes: Record<string, unknown> | undefined): number {\n if (!attributes) {\n return 0;\n }\n\n let weight = 0;\n\n Object.values(attributes).forEach(value => {\n if (Array.isArray(value)) {\n weight += value.length * estimatePrimitiveSizeInBytes(value[0]);\n } else if (isPrimitive(value)) {\n weight += estimatePrimitiveSizeInBytes(value);\n } else {\n // For objects values, we estimate the size of the object as 100 bytes\n weight += 100;\n }\n });\n\n return weight;\n}\n\nfunction estimatePrimitiveSizeInBytes(value: Primitive): number {\n if (typeof value === 'string') {\n return value.length * 2;\n } else if (typeof value === 'number') {\n return 8;\n } else if (typeof value === 'boolean') {\n return 4;\n }\n\n return 0;\n}\n"],"names":["safeUnref","makePromiseBuffer","DEFAULT_TRANSPORT_BUFFER_SIZE","makeDsn","DEBUG_BUILD","debug","getEnvelopeEndpointWithUrlEncodedAuth","_INTERNAL_flushLogsBuffer","_INTERNAL_flushMetricsBuffer","uuid4","checkOrSetAlreadyCaught","isParameterizedString","isPrimitive","session","updateSession","integration","setupIntegration","afterSetupIntegrations","extractGenAiSpansFromEvent","createEventEnvelope","addItemToEnvelope","createAttachmentEnvelopeItem","DEFAULT_ENVIRONMENT","createSessionEnvelope","setupIntegrations","prepareEvent","getTraceContextFromScope","dynamicSamplingContext","getDynamicSamplingContextFromScope","getCurrentScope","getIsolationScope","getPossibleEventMessages","parseSampleRate","safeMathRandom","rejectedSyncPromise","SENTRY_BUFFER_FULL_ERROR","createClientReportEnvelope","dsnToString","isThenable","isPlainObject","beforeSendSpan","isStreamedBeforeSendSpanCallback","convertTransactionEventToSpanJson","shouldIgnoreSpan","showSpanDropWarning","merge","convertSpanJsonToTransactionEvent","reparentChildSpans"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAyDA,MAAM,kBAAA,GAAqB,6DAA6D;AACxF,MAAM,iCAAA,GAAoC,4DAA4D;;AAEtG,MAAM,wBAAwB,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC;AAC/D,MAAM,2BAA2B,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC;;AAExE;AACA,MAAM,sBAAA,GAAyB,IAAI;;AAYnC,SAAS,kBAAkB,CAAC,OAAO,EAAyB;AAC5D,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,CAAC,qBAAqB,GAAG,IAAI;AACjC,GAAG;AACH;;AAEA,SAAS,wBAAwB,CAAC,OAAO,EAA+B;AACxE,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,CAAC,wBAAwB,GAAG,IAAI;AACpC,GAAG;AACH;;AAEA,SAAS,gB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A;AACA;AACA;AACA;AACA;AACA,SAAA,6BAAA,CAAA,UAAA,EAAA;AACA,EAAA,IAAA,CAAA,UAAA,EAAA;AACA,IAAA,OAAA,CAAA;AACA,EAAA;;AAEA,EAAA,IAAA,MAAA,GAAA,CAAA;;AAEA,EAAA,MAAA,CAAA,MAAA,CAAA,UAAA,CAAA,CAAA,OAAA,CAAA,KAAA,IAAA;AACA,IAAA,IAAA,KAAA,CAAA,OAAA,CAAA,KAAA,CAAA,EAAA;AACA,MAAA,MAAA,IAAA,KAAA,CAAA,MAAA,GAAA,4BAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,CAAA,MAAA,IAAAhC,cAAA,CAAA,KAAA,CAAA,EAAA;AACA,MAAA,MAAA,IAAA,4BAAA,CAAA,KAAA,CAAA;AACA,IAAA,CAAA,MAAA;AACA;AACA,MAAA,MAAA,IAAA,GAAA;AACA,IAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,MAAA;AACA;;AAEA,SAAA,4BAAA,CAAA,KAAA,EAAA;AACA,EAAA,IAAA,OAAA,KAAA,KAAA,QAAA,EAAA;AACA,IAAA,OAAA,KAAA,CAAA,MAAA,GAAA,CAAA;AACA,EAAA,CAAA,MAAA,IAAA,OAAA,KAAA,KAAA,QAAA,EAAA;AACA,IAAA,OAAA,CAAA;AACA,EAAA,CAAA,MAAA,IAAA,OAAA,KAAA,KAAA,SAAA,EAAA;AACA,IAAA,OAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,CAAA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../../src/client.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api';\nimport { DEFAULT_ENVIRONMENT } from './constants';\nimport { getCurrentScope, getIsolationScope, getTraceContextFromScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope';\nimport type { IntegrationIndex } from './integration';\nimport { afterSetupIntegrations, setupIntegration, setupIntegrations } from './integration';\nimport { _INTERNAL_flushLogsBuffer } from './logs/internal';\nimport { _INTERNAL_flushMetricsBuffer } from './metrics/internal';\nimport type { Scope } from './scope';\nimport { updateSession } from './session';\nimport { getDynamicSamplingContextFromScope } from './tracing/dynamicSamplingContext';\nimport { isStreamedBeforeSendSpanCallback } from './tracing/spans/beforeSendSpan';\nimport { DEFAULT_TRANSPORT_BUFFER_SIZE } from './transports/base';\nimport type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbHint, XhrBreadcrumbHint } from './types-hoist/breadcrumb';\nimport type { CheckIn, MonitorConfig } from './types-hoist/checkin';\nimport type { EventDropReason, Outcome } from './types-hoist/clientreport';\nimport type { DataCategory } from './types-hoist/datacategory';\nimport type { DsnComponents } from './types-hoist/dsn';\nimport type { DynamicSamplingContext, Envelope } from './types-hoist/envelope';\nimport type { ErrorEvent, Event, EventHint, EventType, TransactionEvent } from './types-hoist/event';\nimport type { EventProcessor } from './types-hoist/eventprocessor';\nimport type { FeedbackEvent } from './types-hoist/feedback';\nimport type { Integration } from './types-hoist/integration';\nimport type { Log } from './types-hoist/log';\nimport type { Metric } from './types-hoist/metric';\nimport type { Primitive } from './types-hoist/misc';\nimport type { ClientOptions } from './types-hoist/options';\nimport type { ParameterizedString } from './types-hoist/parameterize';\nimport type { ReplayEndEvent, ReplayStartEvent } from './types-hoist/replay';\nimport type { RequestEventData } from './types-hoist/request';\nimport type { SdkMetadata } from './types-hoist/sdkmetadata';\nimport type { Session, SessionAggregates } from './types-hoist/session';\nimport type { SeverityLevel } from './types-hoist/severity';\nimport type { Span, SpanAttributes, SpanContextData, SpanJSON, StreamedSpanJSON } from './types-hoist/span';\nimport type { StartSpanOptions } from './types-hoist/startSpanOptions';\nimport type { Transport, TransportMakeRequestResponse } from './types-hoist/transport';\nimport { createClientReportEnvelope } from './utils/clientreport';\nimport { debug } from './utils/debug-logger';\nimport { dsnToString, makeDsn } from './utils/dsn';\nimport { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils/envelope';\nimport { getPossibleEventMessages } from './utils/eventUtils';\nimport { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils/is';\nimport { merge } from './utils/merge';\nimport { checkOrSetAlreadyCaught, uuid4 } from './utils/misc';\nimport { parseSampleRate } from './utils/parseSampleRate';\nimport { prepareEvent } from './utils/prepareEvent';\nimport { makePromiseBuffer, type PromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { reparentChildSpans, shouldIgnoreSpan } from './utils/should-ignore-span';\nimport { showSpanDropWarning } from './utils/spanUtils';\nimport { rejectedSyncPromise } from './utils/syncpromise';\nimport { safeUnref } from './utils/timer';\nimport { convertSpanJsonToTransactionEvent, convertTransactionEventToSpanJson } from './utils/transactionEvent';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\nconst MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release';\n\nconst INTERNAL_ERROR_SYMBOL = Symbol.for('SentryInternalError');\nconst DO_NOT_SEND_EVENT_SYMBOL = Symbol.for('SentryDoNotSendEventError');\n\n// Default interval for flushing logs and metrics (5 seconds)\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\ninterface InternalError {\n message: string;\n [INTERNAL_ERROR_SYMBOL]: true;\n}\n\ninterface DoNotSendEventError {\n message: string;\n [DO_NOT_SEND_EVENT_SYMBOL]: true;\n}\n\nfunction _makeInternalError(message: string): InternalError {\n return {\n message,\n [INTERNAL_ERROR_SYMBOL]: true,\n };\n}\n\nfunction _makeDoNotSendEventError(message: string): DoNotSendEventError {\n return {\n message,\n [DO_NOT_SEND_EVENT_SYMBOL]: true,\n };\n}\n\nfunction _isInternalError(error: unknown): error is InternalError {\n return !!error && typeof error === 'object' && INTERNAL_ERROR_SYMBOL in error;\n}\n\nfunction _isDoNotSendEventError(error: unknown): error is DoNotSendEventError {\n return !!error && typeof error === 'object' && DO_NOT_SEND_EVENT_SYMBOL in error;\n}\n\n/**\n * Sets up weight-based flushing for logs or metrics.\n * This helper function encapsulates the common pattern of:\n * 1. Tracking accumulated weight of items\n * 2. Flushing when weight exceeds threshold (800KB)\n * 3. Flushing after timeout period from the first item\n *\n * Uses closure variables to track weight and timeout state.\n */\nfunction setupWeightBasedFlushing<\n T,\n AfterCaptureHook extends 'afterCaptureLog' | 'afterCaptureMetric',\n FlushHook extends 'flushLogs' | 'flushMetrics',\n>(\n client: Client,\n afterCaptureHook: AfterCaptureHook,\n flushHook: FlushHook,\n estimateSizeFn: (item: T) => number,\n flushFn: (client: Client) => void,\n): void {\n // Track weight and timeout in closure variables\n let weight = 0;\n let flushTimeout: ReturnType<typeof setTimeout> | undefined;\n let isTimerActive = false;\n\n // @ts-expect-error - TypeScript can't narrow generic hook types to match specific overloads, but we know this is type-safe\n client.on(flushHook, () => {\n weight = 0;\n clearTimeout(flushTimeout);\n isTimerActive = false;\n });\n\n // @ts-expect-error - TypeScript can't narrow generic hook types to match specific overloads, but we know this is type-safe\n client.on(afterCaptureHook, (item: T) => {\n weight += estimateSizeFn(item);\n\n // We flush the buffer if it exceeds 0.8 MB\n // The weight is a rough estimate, so we flush way before the payload gets too big.\n if (weight >= 800_000) {\n flushFn(client);\n } else if (!isTimerActive) {\n // Only start timer if one isn't already running.\n // This prevents flushing being delayed by items that arrive close to the timeout limit\n // and thus resetting the flushing timeout and delaying items being flushed.\n isTimerActive = true;\n // Use safeUnref so the timer doesn't prevent the process from exiting\n flushTimeout = safeUnref(\n setTimeout(() => {\n flushFn(client);\n // Note: isTimerActive is reset by the flushHook handler above, not here,\n // to avoid race conditions when new items arrive during the flush.\n }, DEFAULT_FLUSH_INTERVAL),\n );\n }\n });\n\n client.on('flush', () => {\n flushFn(client);\n });\n}\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link Client._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends Client<NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nexport abstract class Client<O extends ClientOptions = ClientOptions> {\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n protected readonly _dsn?: DsnComponents;\n\n protected readonly _transport?: Transport;\n\n /** Array of set up integrations. */\n protected _integrations: IntegrationIndex;\n\n /** Number of calls being processed */\n protected _numProcessing: number;\n\n protected _eventProcessors: EventProcessor[];\n\n /** Holds flushable */\n protected _outcomes: { [key: string]: number };\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected _hooks: Record<string, Set<Function>>;\n\n protected _promiseBuffer: PromiseBuffer<unknown>;\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n protected constructor(options: O) {\n this._options = options;\n this._integrations = {};\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n this._promiseBuffer = makePromiseBuffer(options.transportOptions?.bufferSize ?? DEFAULT_TRANSPORT_BUFFER_SIZE);\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && debug.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(\n this._dsn,\n options.tunnel,\n options._metadata ? options._metadata.sdk : undefined,\n );\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n\n // Backfill enableLogs option from _experiments.enableLogs\n // TODO(v11): Remove or change default value\n // eslint-disable-next-line deprecation/deprecation\n this._options.enableLogs = this._options.enableLogs ?? this._options._experiments?.enableLogs;\n\n // Setup log flushing with weight and timeout tracking\n if (this._options.enableLogs) {\n setupWeightBasedFlushing(this, 'afterCaptureLog', 'flushLogs', estimateLogSizeInBytes, _INTERNAL_flushLogsBuffer);\n }\n\n // todo(v11): Remove the experimental flag\n // eslint-disable-next-line deprecation/deprecation\n const enableMetrics = this._options.enableMetrics ?? this._options._experiments?.enableMetrics ?? true;\n\n // Setup metric flushing with weight and timeout tracking\n if (enableMetrics) {\n setupWeightBasedFlushing(\n this,\n 'afterCaptureMetric',\n 'flushMetrics',\n estimateMetricSizeInBytes,\n _INTERNAL_flushMetricsBuffer,\n );\n }\n }\n\n /**\n * Captures an exception event and sends it to Sentry.\n *\n * Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureException(exception: unknown, hint?: EventHint, scope?: Scope): string {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n this._process(\n () =>\n this.eventFromException(exception, hintWithEventId)\n .then(event => this._captureEvent(event, hintWithEventId, scope))\n .then(res => res),\n 'error',\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a message event and sends it to Sentry.\n *\n * Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureMessage(\n message: ParameterizedString,\n level?: SeverityLevel,\n hint?: EventHint,\n currentScope?: Scope,\n ): string {\n const hintWithEventId = {\n event_id: uuid4(),\n ...hint,\n };\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n const isMessage = isPrimitive(message);\n const promisedEvent = isMessage\n ? this.eventFromMessage(eventMessage, level, hintWithEventId)\n : this.eventFromException(message, hintWithEventId);\n\n this._process(\n () => promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)),\n isMessage ? 'unknown' : 'error',\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a manually created event and sends it to Sentry.\n *\n * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope: Scope | undefined = sdkProcessingMetadata.capturedSpanScope;\n const capturedSpanIsolationScope: Scope | undefined = sdkProcessingMetadata.capturedSpanIsolationScope;\n const dataCategory = getDataCategoryByType(event.type);\n\n this._process(\n () => this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope),\n dataCategory,\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a session.\n */\n public captureSession(session: Session): void {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n\n /**\n * Create a cron monitor check in and send it to Sentry. This method is not available on all clients.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n * @param scope An optional scope containing event metadata.\n * @returns A string representing the id of the check in.\n */\n public captureCheckIn?(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;\n\n /**\n * Get the current Dsn.\n */\n public getDsn(): DsnComponents | undefined {\n return this._dsn;\n }\n\n /**\n * Get the current options.\n */\n public getOptions(): O {\n return this._options;\n }\n\n /**\n * Get the SDK metadata.\n * @see SdkMetadata\n */\n public getSdkMetadata(): SdkMetadata | undefined {\n return this._options._metadata;\n }\n\n /**\n * Returns the transport that is used by the client.\n * Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.\n */\n public getTransport(): Transport | undefined {\n return this._transport;\n }\n\n /**\n * Wait for all events to be sent or the timeout to expire, whichever comes first.\n *\n * @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will\n * cause the client to wait until all events are sent before resolving the promise.\n * @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are\n * still events in the queue when the timeout is reached.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async flush(timeout?: number): PromiseLike<boolean> {\n const transport = this._transport;\n if (!transport) {\n return true;\n }\n\n this.emit('flush');\n\n const clientFinished = await this._isClientDoneProcessing(timeout);\n const transportFlushed = await transport.flush(timeout);\n\n return clientFinished && transportFlushed;\n }\n\n /**\n * Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.\n *\n * @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause\n * the client to wait until all events are sent before disabling itself.\n * @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if\n * it doesn't.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async close(timeout?: number): PromiseLike<boolean> {\n _INTERNAL_flushLogsBuffer(this);\n const result = await this.flush(timeout);\n this.getOptions().enabled = false;\n this.emit('close');\n return result;\n }\n\n /**\n * Get all installed event processors.\n */\n public getEventProcessors(): EventProcessor[] {\n return this._eventProcessors;\n }\n\n /**\n * Adds an event processor that applies to any event processed by this client.\n */\n public addEventProcessor(eventProcessor: EventProcessor): void {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * Initialize this client.\n * Call this after the client was set on a scope.\n */\n public init(): void {\n if (\n this._isEnabled() ||\n // Force integrations to be setup even if no DSN was set when we have\n // Spotlight enabled. This is particularly important for browser as we\n // don't support the `spotlight` option there and rely on the users\n // adding the `spotlightBrowserIntegration()` to their integrations which\n // wouldn't get initialized with the check below when there's no DSN set.\n this._options.integrations.some(({ name }) => name.startsWith('Spotlight'))\n ) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.\n */\n public getIntegrationByName<T extends Integration = Integration>(integrationName: string): T | undefined {\n return this._integrations[integrationName] as T | undefined;\n }\n\n /**\n * Add an integration to the client.\n * This can be used to e.g. lazy load integrations.\n * In most cases, this should not be necessary,\n * and you're better off just passing the integrations via `integrations: []` at initialization time.\n * However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.\n */\n public addIntegration(integration: Integration): void {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n if (!isAlreadyInstalled && integration.beforeSetup) {\n integration.beforeSetup(this);\n }\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * Send a fully prepared event to Sentry.\n */\n public sendEvent(event: Event, hint: EventHint = {}): void {\n this.emit('beforeSendEvent', event, hint);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));\n }\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env).then(sendResponse => this.emit('afterSendEvent', event, sendResponse));\n }\n\n /**\n * Send a session or session aggregrates to Sentry.\n */\n public sendSession(session: Session | SessionAggregates): void {\n // Backfill release and environment on session\n const { release: clientReleaseOption, environment: clientEnvironmentOption = DEFAULT_ENVIRONMENT } = this._options;\n if ('aggregates' in session) {\n const sessionAttrs = session.attrs || {};\n if (!sessionAttrs.release && !clientReleaseOption) {\n DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);\n return;\n }\n sessionAttrs.release = sessionAttrs.release || clientReleaseOption;\n sessionAttrs.environment = sessionAttrs.environment || clientEnvironmentOption;\n session.attrs = sessionAttrs;\n } else {\n if (!session.release && !clientReleaseOption) {\n DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);\n return;\n }\n session.release = session.release || clientReleaseOption;\n session.environment = session.environment || clientEnvironmentOption;\n }\n\n this.emit('beforeSendSession', session);\n\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env);\n }\n\n /**\n * Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).\n */\n public recordDroppedEvent(reason: EventDropReason, category: DataCategory, count: number = 1): void {\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && debug.log(`Recording outcome: \"${key}\"${count > 1 ? ` (${count} times)` : ''}`);\n this._outcomes[key] = (this._outcomes[key] || 0) + count;\n }\n }\n\n /* eslint-disable @typescript-eslint/unified-signatures */\n /**\n * Register a callback for whenever a span is started.\n * Receives the span as argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'spanStart', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback before span sampling runs. Receives a `samplingDecision` object argument with a `decision`\n * property that can be used to make a sampling decision that will be enforced, before any span sampling runs.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeSampling',\n callback: (\n samplingData: {\n spanAttributes: SpanAttributes;\n spanName: string;\n parentSampled?: boolean;\n parentSampleRate?: number;\n parentContext?: SpanContextData;\n },\n samplingDecision: { decision: boolean },\n ) => void,\n ): void;\n\n /**\n * Register a callback for after a span is ended.\n * NOTE: The span cannot be mutated anymore in this callback.\n * Receives the span as argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'spanEnd', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback for after a span is ended and the `spanEnd` hook has run.\n * NOTE: The span cannot be mutated anymore in this callback.\n */\n public on(hook: 'afterSpanEnd', callback: (immutableSegmentSpan: Readonly<Span>) => void): () => void;\n\n /**\n * Register a callback for after a segment span is ended and the `segmentSpanEnd` hook has run.\n * NOTE: The segment span cannot be mutated anymore in this callback.\n */\n public on(hook: 'afterSegmentSpanEnd', callback: (immutableSegmentSpan: Readonly<Span>) => void): () => void;\n\n /**\n * Register a callback for when a span JSON is processed, to add some data to the span JSON.\n */\n public on(hook: 'processSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;\n\n /**\n * Register a callback for when a segment span JSON is processed, to add some data to the segment span JSON.\n */\n public on(hook: 'processSegmentSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;\n\n /**\n * Register a callback for when an idle span is allowed to auto-finish.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback for transaction start and finish.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): () => void;\n\n /**\n * Register a callback that runs when stack frame metadata should be applied to an event.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'applyFrameMetadata', callback: (event: Event) => void): () => void;\n\n /**\n * Register a callback for before sending an event.\n * This is called right before an event is sent and should not be used to mutate the event.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for before sending a session or session aggregrates..\n * Receives the session/aggregate as second argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeSendSession', callback: (session: Session | SessionAggregates) => void): () => void;\n\n /**\n * Register a callback for preprocessing an event,\n * before it is passed to (global) event processors.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for postprocessing an event,\n * after it was passed to (global) event processors, before it is being sent.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'postprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for when an event has been sent.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'afterSendEvent',\n callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void,\n ): () => void;\n\n /**\n * Register a callback before a breadcrumb is added.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): () => void;\n\n /**\n * Register a callback when a DSC (Dynamic Sampling Context) is created.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): () => void;\n\n /**\n * Register a callback when a Feedback event has been prepared.\n * This should be used to mutate the event. The options argument can hint\n * about what kind of mutation it expects.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeSendFeedback',\n callback: (feedback: FeedbackEvent, options?: { includeReplay?: boolean }) => void,\n ): () => void;\n\n /**\n * Register a callback when the feedback widget is opened in a user's browser\n */\n public on(hook: 'openFeedbackWidget', callback: () => void): () => void;\n\n /**\n * A hook that is called when a replay session starts recording (either session or buffer mode).\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'replayStart', callback: (event: ReplayStartEvent) => void): () => void;\n\n /**\n * A hook that is called when a replay session stops recording, either manually or due to an\n * internal condition such as `maxReplayDuration` expiry, send failure, or mutation limit.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'replayEnd', callback: (event: ReplayEndEvent) => void): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger a span start for a page load.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'startPageLoadSpan',\n callback: (\n options: StartSpanOptions,\n traceOptions?: { sentryTrace?: string | undefined; baggage?: string | undefined },\n ) => void,\n ): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger the end of a page load span.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'endPageloadSpan', callback: () => void): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger after the pageload span was started.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterStartPageLoadSpan', callback: (span: Span) => void): () => void;\n\n /**\n * A hook for triggering right before a navigation span is started.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeStartNavigationSpan',\n callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,\n ): () => void;\n\n /**\n * A hook for browser tracing integrations to trigger a span for a navigation.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'startNavigationSpan',\n callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,\n ): () => void;\n\n /**\n * A hook for GraphQL client integration to enhance a span with request data.\n * @returns A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeOutgoingRequestSpan',\n callback: (span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void,\n ): () => void;\n\n /**\n * A hook for GraphQL client integration to enhance a breadcrumb with request data.\n * @returns A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeOutgoingRequestBreadcrumb',\n callback: (breadcrumb: Breadcrumb, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void,\n ): () => void;\n\n /**\n * A hook that is called when the client is flushing\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flush', callback: () => void): () => void;\n\n /**\n * A hook that is called when the client is closing\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'close', callback: () => void): () => void;\n\n /**\n * A hook that is called before a log is captured. This hooks runs before `beforeSendLog` is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeCaptureLog', callback: (log: Log) => void): () => void;\n\n /**\n * A hook that is called after a log is captured\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterCaptureLog', callback: (log: Log) => void): () => void;\n\n /**\n * A hook that is called when the client is flushing logs\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flushLogs', callback: () => void): () => void;\n\n /**\n * A hook that is called after capturing a metric. This hooks runs after `beforeSendMetric` is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterCaptureMetric', callback: (metric: Metric) => void): () => void;\n\n /**\n * A hook that is called when the client is flushing metrics\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flushMetrics', callback: () => void): () => void;\n\n /**\n * A hook that is called when a metric is processed before it is captured and before the `beforeSendMetric` callback is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'processMetric', callback: (metric: Metric) => void): () => void;\n\n /**\n * A hook that is called when a http server request is started.\n * This hook is called after request isolation, but before the request is processed.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'httpServerRequest',\n callback: (request: unknown, response: unknown, normalizedRequest: RequestEventData) => void,\n ): () => void;\n\n /**\n * A hook that is called when the UI Profiler should start profiling.\n *\n * This hook is called when running `Sentry.uiProfiler.startProfiler()`.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'startUIProfiler', callback: () => void): () => void;\n\n /**\n * A hook that is called when the UI Profiler should stop profiling.\n *\n * This hook is called when running `Sentry.uiProfiler.stopProfiler()`.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'stopUIProfiler', callback: () => void): () => void;\n\n /**\n * Register a hook on this client.\n */\n public on(hook: string, callback: unknown): () => void {\n const hookCallbacks = (this._hooks[hook] = this._hooks[hook] || new Set());\n\n // Wrap the callback in a function so that registering the same callback instance multiple\n // times results in the callback being called multiple times.\n // @ts-expect-error - The `callback` type is correct and must be a function due to the\n // individual, specific overloads of this function.\n // eslint-disable-next-line @typescript-eslint/ban-types\n const uniqueCallback: Function = (...args: unknown[]) => callback(...args);\n\n hookCallbacks.add(uniqueCallback);\n\n // This function returns a callback execution handler that, when invoked,\n // deregisters a callback. This is crucial for managing instances where callbacks\n // need to be unregistered to prevent self-referencing in callback closures,\n // ensuring proper garbage collection.\n return () => {\n hookCallbacks.delete(uniqueCallback);\n };\n }\n\n /** Fire a hook whenever a span starts. */\n public emit(hook: 'spanStart', span: Span): void;\n\n /** A hook that is called every time before a span is sampled. */\n public emit(\n hook: 'beforeSampling',\n samplingData: {\n spanAttributes: SpanAttributes;\n spanName: string;\n parentSampled?: boolean;\n parentSampleRate?: number;\n parentContext?: SpanContextData;\n },\n samplingDecision: { decision: boolean },\n ): void;\n\n /** Fire a hook whenever a span ends. */\n public emit(hook: 'spanEnd', span: Span): void;\n\n /**\n * Fire a hook event after a span ends and the `spanEnd` hook has run.\n */\n public emit(hook: 'afterSpanEnd', immutableSpan: Readonly<Span>): void;\n\n /**\n * Fire a hook event after a segment span ends and the `spanEnd` hook has run.\n */\n public emit(hook: 'afterSegmentSpanEnd', immutableSegmentSpan: Readonly<Span>): void;\n\n /**\n * Fire a hook event when a span JSON is processed, to add some data to the span JSON.\n */\n public emit(hook: 'processSpan', streamedSpanJSON: StreamedSpanJSON): void;\n\n /**\n * Fire a hook event for when a segment span JSON is processed, to add some data to the segment span JSON.\n */\n public emit(hook: 'processSegmentSpan', streamedSpanJSON: StreamedSpanJSON): void;\n\n /**\n * Fire a hook indicating that an idle span is allowed to auto finish.\n */\n public emit(hook: 'idleSpanEnableAutoFinish', span: Span): void;\n\n /**\n * Fire a hook event for envelope creation and sending. Expects to be given an envelope as the\n * second argument.\n */\n public emit(hook: 'beforeEnvelope', envelope: Envelope): void;\n\n /**\n * Fire a hook indicating that stack frame metadata should be applied to the event passed to the hook.\n */\n public emit(hook: 'applyFrameMetadata', event: Event): void;\n\n /**\n * Fire a hook event before sending an event.\n * This is called right before an event is sent and should not be used to mutate the event.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event before sending a session/aggregates.\n * Expects to be given the prepared session/aggregates as second argument.\n */\n public emit(hook: 'beforeSendSession', session: Session | SessionAggregates): void;\n\n /**\n * Fire a hook event to process events before they are passed to (global) event processors.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event to process a user on an event before it is sent to Sentry, after all other processors have run.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'postprocessEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event after sending an event. Expects to be given an Event as the\n * second argument.\n */\n public emit(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse): void;\n\n /**\n * Fire a hook for when a breadcrumb is added. Expects the breadcrumb as second argument.\n */\n public emit(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;\n\n /**\n * Fire a hook for when a DSC (Dynamic Sampling Context) is created. Expects the DSC as second argument.\n */\n public emit(hook: 'createDsc', dsc: DynamicSamplingContext, rootSpan?: Span): void;\n\n /**\n * Fire a hook event for after preparing a feedback event. Events to be given\n * a feedback event as the second argument, and an optional options object as\n * third argument.\n */\n public emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { includeReplay?: boolean }): void;\n\n /**\n * Fire a hook event for when the feedback widget is opened in a user's browser\n */\n public emit(hook: 'openFeedbackWidget'): void;\n\n /**\n * Fire a hook event when a replay session starts recording.\n */\n public emit(hook: 'replayStart', event: ReplayStartEvent): void;\n\n /**\n * Fire a hook event when a replay session stops recording.\n */\n public emit(hook: 'replayEnd', event: ReplayEndEvent): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger a span start for a page load.\n */\n public emit(\n hook: 'startPageLoadSpan',\n options: StartSpanOptions,\n traceOptions?: { sentryTrace?: string | undefined; baggage?: string | undefined },\n ): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger the end of a page load span.\n */\n public emit(hook: 'endPageloadSpan'): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger aafter the pageload span was started.\n */\n public emit(hook: 'afterStartPageLoadSpan', span: Span): void;\n\n /**\n * Emit a hook event for triggering right before a navigation span is started.\n */\n public emit(\n hook: 'beforeStartNavigationSpan',\n options: StartSpanOptions,\n navigationOptions?: { isRedirect?: boolean },\n ): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger a span for a navigation.\n */\n public emit(\n hook: 'startNavigationSpan',\n options: StartSpanOptions,\n navigationOptions?: { isRedirect?: boolean },\n ): void;\n\n /**\n * Emit a hook event for GraphQL client integration to enhance a span with request data.\n */\n public emit(hook: 'beforeOutgoingRequestSpan', span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint): void;\n\n /**\n * Emit a hook event for GraphQL client integration to enhance a breadcrumb with request data.\n */\n public emit(\n hook: 'beforeOutgoingRequestBreadcrumb',\n breadcrumb: Breadcrumb,\n hint: XhrBreadcrumbHint | FetchBreadcrumbHint,\n ): void;\n\n /**\n * Emit a hook event for client flush\n */\n public emit(hook: 'flush'): void;\n\n /**\n * Emit a hook event for client close\n */\n public emit(hook: 'close'): void;\n\n /**\n * Emit a hook event for client before capturing a log. This hooks runs before `beforeSendLog` is fired.\n */\n public emit(hook: 'beforeCaptureLog', log: Log): void;\n\n /**\n * Emit a hook event for client after capturing a log.\n */\n public emit(hook: 'afterCaptureLog', log: Log): void;\n\n /**\n * Emit a hook event for client flush logs\n */\n public emit(hook: 'flushLogs'): void;\n\n /**\n * Emit a hook event for client after capturing a metric.\n */\n public emit(hook: 'afterCaptureMetric', metric: Metric): void;\n\n /**\n * Emit a hook event for client flush metrics\n */\n public emit(hook: 'flushMetrics'): void;\n\n /**\n *\n * Emit a hook event for client to process a metric before it is captured.\n * This hook is called before the `beforeSendMetric` callback is fired.\n */\n public emit(hook: 'processMetric', metric: Metric): void;\n\n /**\n * Emit a hook event for client when a http server request is started.\n * This hook is called after request isolation, but before the request is processed.\n */\n public emit(\n hook: 'httpServerRequest',\n request: unknown,\n response: unknown,\n normalizedRequest: RequestEventData,\n ): void;\n\n /**\n * Emit a hook event for starting the UI Profiler.\n */\n public emit(hook: 'startUIProfiler'): void;\n\n /**\n * Emit a hook event for stopping the UI Profiler.\n */\n public emit(hook: 'stopUIProfiler'): void;\n\n /**\n * Emit a hook that was previously registered via `on()`.\n */\n public emit(hook: string, ...rest: unknown[]): void {\n const callbacks = this._hooks[hook];\n if (callbacks) {\n callbacks.forEach(callback => callback(...rest));\n }\n }\n\n /**\n * Send an envelope to Sentry.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n try {\n return await this._transport.send(envelope);\n } catch (reason) {\n DEBUG_BUILD && debug.error('Error while sending envelope:', reason);\n return {};\n }\n }\n\n DEBUG_BUILD && debug.error('Transport disabled');\n return {};\n }\n\n /**\n * Disposes of the client and releases all resources.\n *\n * Subclasses should override this method to clean up their own resources.\n * After calling dispose(), the client should not be used anymore.\n */\n public dispose(): void {\n // Base class has no cleanup logic - subclasses implement their own\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n protected _setupIntegrations(): void {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n }\n\n /** Updates existing session based on the provided event */\n protected _updateSessionFromEvent(session: Session, event: Event): void {\n // initially, set `crashed` based on the event level and update from exceptions if there are any later on\n let crashed = event.level === 'fatal';\n let errored = false;\n const exceptions = event.exception?.values;\n\n if (exceptions) {\n errored = true;\n // reset crashed to false if there are exceptions, to ensure `mechanism.handled` is respected.\n crashed = false;\n\n for (const ex of exceptions) {\n if (ex.mechanism?.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n protected async _isClientDoneProcessing(timeout?: number): Promise<boolean> {\n let ticked = 0;\n\n while (!timeout || ticked < timeout) {\n await new Promise(resolve => setTimeout(resolve, 1));\n\n if (!this._numProcessing) {\n return true;\n }\n ticked++;\n }\n\n return false;\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n protected _isEnabled(): boolean {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A new event with more information.\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event | null> {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations?.length) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n if (!event.type) {\n isolationScope.setLastEventId(event.event_id || hint.event_id);\n }\n\n return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n this.emit('postprocessEvent', evt, hint);\n\n evt.contexts = {\n trace: { ...evt.contexts?.trace, ...getTraceContextFromScope(currentScope) },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n protected _captureEvent(\n event: Event,\n hint: EventHint = {},\n currentScope = getCurrentScope(),\n isolationScope = getIsolationScope(),\n ): PromiseLike<string | undefined> {\n if (DEBUG_BUILD && isErrorEvent(event)) {\n debug.log(`Captured error event \\`${getPossibleEventMessages(event)[0] || '<unknown>'}\\``);\n }\n\n return this._processEvent(event, hint, currentScope, isolationScope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n if (_isDoNotSendEventError(reason)) {\n debug.log(reason.message);\n } else if (_isInternalError(reason)) {\n debug.warn(reason.message);\n } else {\n debug.warn(reason);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n protected _processEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event> {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate(sampleRate);\n if (isError && typeof parsedSampleRate === 'number' && safeMathRandom() > parsedSampleRate) {\n this.recordDroppedEvent('sample_rate', 'error');\n return rejectedSyncPromise(\n _makeDoNotSendEventError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n ),\n );\n }\n\n const dataCategory = getDataCategoryByType(event.type);\n\n return this._prepareEvent(event, hint, currentScope, isolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory);\n throw _makeDoNotSendEventError('An event processor returned `null`, will not send event.');\n }\n\n const isInternalException = (hint.data as { __sentry__: boolean })?.__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(this, options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory);\n if (isTransaction) {\n const spans = event.spans || [];\n // the transaction itself counts as one span, plus all the child spans that are added\n const spanCount = 1 + spans.length;\n this.recordDroppedEvent('before_send', 'span', spanCount);\n }\n throw _makeDoNotSendEventError(`${beforeSendLabel} returned \\`null\\`, will not send event.`);\n }\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (isError && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n if (isTransaction) {\n const spanCountBefore = processedEvent.sdkProcessingMetadata?.spanCountBeforeProcessing || 0;\n const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0;\n\n const droppedSpanCount = spanCountBefore - spanCountAfter;\n if (droppedSpanCount > 0) {\n this.recordDroppedEvent('before_send', 'span', droppedSpanCount);\n }\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (_isDoNotSendEventError(reason) || _isInternalError(reason)) {\n throw reason;\n }\n\n this.captureException(reason, {\n mechanism: {\n handled: false,\n type: 'internal',\n },\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw _makeInternalError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n protected _process<T>(taskProducer: () => PromiseLike<T>, dataCategory: DataCategory): void {\n this._numProcessing++;\n\n void this._promiseBuffer.add(taskProducer).then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n\n if (reason === SENTRY_BUFFER_FULL_ERROR) {\n this.recordDroppedEvent('queue_overflow', dataCategory);\n }\n\n return reason;\n },\n );\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n protected _clearOutcomes(): Outcome[] {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.entries(outcomes).map(([key, quantity]) => {\n const [reason, category] = key.split(':') as [EventDropReason, DataCategory];\n return {\n reason,\n category,\n quantity,\n };\n });\n }\n\n /**\n * Sends client reports as an envelope.\n */\n protected _flushOutcomes(): void {\n DEBUG_BUILD && debug.log('Flushing outcomes...');\n\n const outcomes = this._clearOutcomes();\n\n if (outcomes.length === 0) {\n DEBUG_BUILD && debug.log('No outcomes to send');\n return;\n }\n\n // This is really the only place where we want to check for a DSN and only send outcomes then\n if (!this._dsn) {\n DEBUG_BUILD && debug.log('No dsn provided, will not send outcomes');\n return;\n }\n\n DEBUG_BUILD && debug.log('Sending outcomes:', outcomes);\n\n const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n */\n public abstract eventFromException(_exception: unknown, _hint?: EventHint): PromiseLike<Event>;\n\n /**\n * Creates an {@link Event} from primitive inputs to `captureMessage`.\n */\n public abstract eventFromMessage(\n _message: ParameterizedString,\n _level?: SeverityLevel,\n _hint?: EventHint,\n ): PromiseLike<Event>;\n}\n\nfunction getDataCategoryByType(type: EventType | 'replay_event' | undefined): DataCategory {\n return type === 'replay_event' ? 'replay' : type || 'error';\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult: PromiseLike<Event | null> | Event | null,\n beforeSendLabel: string,\n): PromiseLike<Event | null> | Event | null {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw _makeInternalError(invalidValueError);\n }\n return event;\n },\n e => {\n throw _makeInternalError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw _makeInternalError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n client: Client,\n options: ClientOptions,\n event: Event,\n hint: EventHint,\n): PromiseLike<Event | null> | Event | null {\n const { beforeSend, beforeSendTransaction, ignoreSpans } = options;\n const beforeSendSpan = !isStreamedBeforeSendSpanCallback(options.beforeSendSpan) && options.beforeSendSpan;\n\n let processedEvent = event;\n\n if (isErrorEvent(processedEvent) && beforeSend) {\n return beforeSend(processedEvent, hint);\n }\n\n if (isTransactionEvent(processedEvent)) {\n // Avoid processing if we don't have to\n if (beforeSendSpan || ignoreSpans) {\n // 1. Process root span\n const rootSpanJson = convertTransactionEventToSpanJson(processedEvent);\n\n // 1.1 If the root span should be ignored, drop the whole transaction\n if (ignoreSpans?.length && shouldIgnoreSpan(rootSpanJson, ignoreSpans)) {\n // dropping the whole transaction!\n return null;\n }\n\n // 1.2 If a `beforeSendSpan` callback is defined, process the root span\n if (beforeSendSpan) {\n const processedRootSpanJson = beforeSendSpan(rootSpanJson);\n if (!processedRootSpanJson) {\n showSpanDropWarning();\n } else {\n // update event with processed root span values\n processedEvent = merge(event, convertSpanJsonToTransactionEvent(processedRootSpanJson));\n }\n }\n\n // 2. Process child spans\n if (processedEvent.spans) {\n const processedSpans: SpanJSON[] = [];\n\n const initialSpans = processedEvent.spans;\n\n for (const span of initialSpans) {\n // 2.a If the child span should be ignored, reparent it to the root span\n if (ignoreSpans?.length && shouldIgnoreSpan(span, ignoreSpans)) {\n reparentChildSpans(initialSpans, span);\n continue;\n }\n\n // 2.b If a `beforeSendSpan` callback is defined, process the child span\n if (beforeSendSpan) {\n const processedSpan = beforeSendSpan(span);\n if (!processedSpan) {\n showSpanDropWarning();\n processedSpans.push(span);\n } else {\n processedSpans.push(processedSpan);\n }\n } else {\n processedSpans.push(span);\n }\n }\n\n const droppedSpans = processedEvent.spans.length - processedSpans.length;\n if (droppedSpans) {\n client.recordDroppedEvent('before_send', 'span', droppedSpans);\n }\n\n processedEvent.spans = processedSpans;\n }\n }\n\n if (beforeSendTransaction) {\n if (processedEvent.spans) {\n // We store the # of spans before processing in SDK metadata,\n // so we can compare it afterwards to determine how many spans were dropped\n const spanCountBefore = processedEvent.spans.length;\n processedEvent.sdkProcessingMetadata = {\n ...event.sdkProcessingMetadata,\n spanCountBeforeProcessing: spanCountBefore,\n };\n }\n return beforeSendTransaction(processedEvent as TransactionEvent, hint);\n }\n }\n\n return processedEvent;\n}\n\nfunction isErrorEvent(event: Event): event is ErrorEvent {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event: Event): event is TransactionEvent {\n return event.type === 'transaction';\n}\n\n/**\n * Estimate the size of a metric in bytes.\n *\n * @param metric - The metric to estimate the size of.\n * @returns The estimated size of the metric in bytes.\n */\nfunction estimateMetricSizeInBytes(metric: Metric): number {\n let weight = 0;\n\n // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.\n if (metric.name) {\n weight += metric.name.length * 2;\n }\n\n // Add weight for number\n weight += 8;\n\n return weight + estimateAttributesSizeInBytes(metric.attributes);\n}\n\n/**\n * Estimate the size of a log in bytes.\n *\n * @param log - The log to estimate the size of.\n * @returns The estimated size of the log in bytes.\n */\nfunction estimateLogSizeInBytes(log: Log): number {\n let weight = 0;\n\n // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.\n if (log.message) {\n weight += log.message.length * 2;\n }\n\n return weight + estimateAttributesSizeInBytes(log.attributes);\n}\n\n/**\n * Estimate the size of attributes in bytes.\n *\n * @param attributes - The attributes object to estimate the size of.\n * @returns The estimated size of the attributes in bytes.\n */\nfunction estimateAttributesSizeInBytes(attributes: Record<string, unknown> | undefined): number {\n if (!attributes) {\n return 0;\n }\n\n let weight = 0;\n\n Object.values(attributes).forEach(value => {\n if (Array.isArray(value)) {\n weight += value.length * estimatePrimitiveSizeInBytes(value[0]);\n } else if (isPrimitive(value)) {\n weight += estimatePrimitiveSizeInBytes(value);\n } else {\n // For objects values, we estimate the size of the object as 100 bytes\n weight += 100;\n }\n });\n\n return weight;\n}\n\nfunction estimatePrimitiveSizeInBytes(value: Primitive): number {\n if (typeof value === 'string') {\n return value.length * 2;\n } else if (typeof value === 'number') {\n return 8;\n } else if (typeof value === 'boolean') {\n return 4;\n }\n\n return 0;\n}\n"],"names":["safeUnref","makePromiseBuffer","DEFAULT_TRANSPORT_BUFFER_SIZE","makeDsn","DEBUG_BUILD","debug","getEnvelopeEndpointWithUrlEncodedAuth","_INTERNAL_flushLogsBuffer","_INTERNAL_flushMetricsBuffer","uuid4","checkOrSetAlreadyCaught","isParameterizedString","isPrimitive","session","updateSession","integration","setupIntegration","afterSetupIntegrations","createEventEnvelope","addItemToEnvelope","createAttachmentEnvelopeItem","DEFAULT_ENVIRONMENT","createSessionEnvelope","setupIntegrations","prepareEvent","getTraceContextFromScope","dynamicSamplingContext","getDynamicSamplingContextFromScope","getCurrentScope","getIsolationScope","getPossibleEventMessages","parseSampleRate","safeMathRandom","rejectedSyncPromise","SENTRY_BUFFER_FULL_ERROR","createClientReportEnvelope","dsnToString","isThenable","isPlainObject","beforeSendSpan","isStreamedBeforeSendSpanCallback","convertTransactionEventToSpanJson","shouldIgnoreSpan","showSpanDropWarning","merge","convertSpanJsonToTransactionEvent","reparentChildSpans"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAwDA,MAAM,kBAAA,GAAqB,6DAA6D;AACxF,MAAM,iCAAA,GAAoC,4DAA4D;;AAEtG,MAAM,wBAAwB,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC;AAC/D,MAAM,2BAA2B,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC;;AAExE;AACA,MAAM,sBAAA,GAAyB,IAAI;;AAYnC,SAAS,kBAAkB,CAAC,OAAO,EAAyB;AAC5D,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,CAAC,qBAAqB,GAAG,IAAI;AACjC,GAAG;AACH;;AAEA,SAAS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AAA,EAAA;AACA,EAAA,IAAA,CAAA,UAAA,EAAA;AACA,IAAA,OAAA,CAAA;AACA,EAAA;;AAEA,EAAA,IAAA,MAAA,GAAA,CAAA;;AAEA,EAAA,MAAA,CAAA,MAAA,CAAA,UAAA,CAAA,CAAA,OAAA,CAAA,KAAA,IAAA;AACA,IAAA,IAAA,KAAA,CAAA,OAAA,CAAA,KAAA,CAAA,EAAA;AACA,MAAA,MAAA,IAAA,KAAA,CAAA,MAAA,GAAA,4BAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,CAAA,MAAA,IAAA/B,cAAA,CAAA,KAAA,CAAA,EAAA;AACA,MAAA,MAAA,IAAA,4BAAA,CAAA,KAAA,CAAA;AACA,IAAA,CAAA,MAAA;AACA;AACA,MAAA,MAAA,IAAA,GAAA;AACA,IAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,MAAA;AACA;;AAEA,SAAA,4BAAA,CAAA,KAAA,EAAA;AACA,EAAA,IAAA,OAAA,KAAA,KAAA,QAAA,EAAA;AACA,IAAA,OAAA,KAAA,CAAA,MAAA,GAAA,CAAA;AACA,EAAA,CAAA,MAAA,IAAA,OAAA,KAAA,KAAA,QAAA,EAAA;AACA,IAAA,OAAA,CAAA;AACA,EAAA,CAAA,MAAA,IAAA,OAAA,KAAA,KAAA,SAAA,EAAA;AACA,IAAA,OAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,CAAA;AACA;;;;"}
|
|
@@ -31,8 +31,7 @@ function instrumentConsole() {
|
|
|
31
31
|
debugLogger.originalConsoleMethods[level] = originalConsoleMethod;
|
|
32
32
|
|
|
33
33
|
return function (...args) {
|
|
34
|
-
|
|
35
|
-
handlers.triggerHandlers('console', handlerData);
|
|
34
|
+
handlers.triggerHandlers('console', { args, level } );
|
|
36
35
|
|
|
37
36
|
const log = debugLogger.originalConsoleMethods[level];
|
|
38
37
|
log?.apply(worldwide.GLOBAL_OBJ.console, args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger';\nimport { fill } from '../utils/object';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): void {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n
|
|
1
|
+
{"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger';\nimport { fill } from '../utils/object';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): void {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n triggerHandlers('console', { args, level } as HandlerDataConsole);\n\n const log = originalConsoleMethods[level];\n log?.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n"],"names":["addHandler","maybeInstrument","GLOBAL_OBJ","CONSOLE_LEVELS","fill","originalConsoleMethods","triggerHandlers"],"mappings":";;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA4C;AACpG,EAAE,MAAM,IAAA,GAAO,SAAS;AACxB,EAAEA,mBAAU,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,EAAEC,wBAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC1C;;AAEA,SAAS,iBAAiB,GAAS;AACnC,EAAE,IAAI,EAAE,aAAaC,oBAAU,CAAC,EAAE;AAClC,IAAI;AACJ,EAAE;;AAEF,EAAEC,0BAAc,CAAC,OAAO,CAAC,UAAU,KAAK,EAAsB;AAC9D,IAAI,IAAI,EAAE,KAAA,IAASD,oBAAU,CAAC,OAAO,CAAC,EAAE;AACxC,MAAM;AACN,IAAI;;AAEJ,IAAIE,WAAI,CAACF,oBAAU,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,qBAAqB,EAAuB;AAC1F,MAAMG,kCAAsB,CAAC,KAAK,CAAA,GAAI,qBAAqB;;AAE3D,MAAM,OAAO,UAAU,GAAG,IAAI,EAAe;AAC7C,QAAQC,wBAAe,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,KAAA,EAAM,EAAwB;;AAEzE,QAAQ,MAAM,GAAA,GAAMD,kCAAsB,CAAC,KAAK,CAAC;AACjD,QAAQ,GAAG,EAAE,KAAK,CAACH,oBAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAC5C,MAAM,CAAC;AACP,IAAI,CAAC,CAAC;AACN,EAAE,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const _exports = require('../../exports.js');
|
|
4
4
|
const currentScopes = require('../../currentScopes.js');
|
|
5
|
+
const hasSpanStreamingEnabled = require('../spans/hasSpanStreamingEnabled.js');
|
|
5
6
|
const is = require('../../utils/is.js');
|
|
6
7
|
const genAiAttributes = require('./gen-ai-attributes.js');
|
|
7
8
|
const messageTruncation = require('./messageTruncation.js');
|
|
@@ -26,12 +27,11 @@ function resolveAIRecordingOptions(options) {
|
|
|
26
27
|
/**
|
|
27
28
|
* Resolves whether truncation should be enabled.
|
|
28
29
|
* If the user explicitly set `enableTruncation`, that value is used.
|
|
29
|
-
* Otherwise, truncation
|
|
30
|
-
* spans (either via span streaming or extraction from the legacy transaction),
|
|
31
|
-
* so the legacy transaction size cap that motivated truncation no longer applies.
|
|
30
|
+
* Otherwise, truncation is disabled when span streaming is active.
|
|
32
31
|
*/
|
|
33
32
|
function shouldEnableTruncation(enableTruncation) {
|
|
34
|
-
|
|
33
|
+
const client = currentScopes.getClient();
|
|
34
|
+
return enableTruncation ?? !(client && hasSpanStreamingEnabled.hasSpanStreamingEnabled(client));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|