@sentry/opentelemetry 10.63.0 → 10.65.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.
Files changed (50) hide show
  1. package/README.md +29 -0
  2. package/build/cjs/{asyncContextStrategy-CvLbRw2N.js → asyncContextStrategy-DP1H8zYV.js} +220 -29
  3. package/build/cjs/asyncContextStrategy-DP1H8zYV.js.map +1 -0
  4. package/build/cjs/index.browser.js +5 -1
  5. package/build/cjs/index.browser.js.map +1 -1
  6. package/build/cjs/index.js +5 -1
  7. package/build/cjs/index.js.map +1 -1
  8. package/build/esm/{asyncContextStrategy-DfM95hx5.js → asyncContextStrategy-CDufUmpa.js} +220 -32
  9. package/build/esm/asyncContextStrategy-CDufUmpa.js.map +1 -0
  10. package/build/esm/index.browser.js +1 -1
  11. package/build/esm/index.js +3 -3
  12. package/build/esm/package.json +1 -1
  13. package/build/types/applyOtelSpanData.d.ts +18 -0
  14. package/build/types/applyOtelSpanData.d.ts.map +1 -0
  15. package/build/types/custom/client.d.ts.map +1 -1
  16. package/build/types/exports.d.ts +5 -1
  17. package/build/types/exports.d.ts.map +1 -1
  18. package/build/types/spanProcessor.d.ts.map +1 -1
  19. package/build/types/tracer.d.ts +13 -0
  20. package/build/types/tracer.d.ts.map +1 -0
  21. package/build/types/tracerProvider.d.ts +23 -0
  22. package/build/types/tracerProvider.d.ts.map +1 -0
  23. package/build/types/types.d.ts +6 -2
  24. package/build/types/types.d.ts.map +1 -1
  25. package/build/types/utils/backfillStreamedSpanData.d.ts +16 -0
  26. package/build/types/utils/backfillStreamedSpanData.d.ts.map +1 -0
  27. package/build/types/utils/enhanceDscWithOpenTelemetryRootSpanName.d.ts.map +1 -1
  28. package/build/types/utils/getSamplingDecision.d.ts +17 -0
  29. package/build/types/utils/getSamplingDecision.d.ts.map +1 -1
  30. package/build/types/utils/mapStatus.d.ts +3 -1
  31. package/build/types/utils/mapStatus.d.ts.map +1 -1
  32. package/build/types/utils/parseSpanDescription.d.ts.map +1 -1
  33. package/build/types/utils/setupCheck.d.ts +1 -1
  34. package/build/types/utils/setupCheck.d.ts.map +1 -1
  35. package/build/types/utils/spanTypes.d.ts.map +1 -1
  36. package/build/types-ts3.8/applyOtelSpanData.d.ts +18 -0
  37. package/build/types-ts3.8/exports.d.ts +5 -1
  38. package/build/types-ts3.8/tracer.d.ts +13 -0
  39. package/build/types-ts3.8/tracerProvider.d.ts +23 -0
  40. package/build/types-ts3.8/types.d.ts +6 -2
  41. package/build/types-ts3.8/utils/backfillStreamedSpanData.d.ts +16 -0
  42. package/build/types-ts3.8/utils/getSamplingDecision.d.ts +17 -0
  43. package/build/types-ts3.8/utils/mapStatus.d.ts +3 -1
  44. package/build/types-ts3.8/utils/setupCheck.d.ts +1 -1
  45. package/package.json +20 -27
  46. package/build/cjs/asyncContextStrategy-CvLbRw2N.js.map +0 -1
  47. package/build/esm/asyncContextStrategy-DfM95hx5.js.map +0 -1
  48. package/build/types/utils/addOriginToSpan.d.ts +0 -5
  49. package/build/types/utils/addOriginToSpan.d.ts.map +0 -1
  50. package/build/types-ts3.8/utils/addOriginToSpan.d.ts +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/asyncLocalStorageContextManager.ts","../../src/nodeAsyncContextStrategy.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * NOTICE from the Sentry authors:\n * This implementation follows the behavior of OpenTelemetry’s `@opentelemetry/context-async-hooks`\n * package, combining logic that upstream splits across:\n * - https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts\n * - https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-context-async-hooks/src/AsyncLocalStorageContextManager.ts\n * It is a single-class re-implementation for Sentry (not a verbatim copy of those files).\n */\n\nimport type { Context, ContextManager } from '@opentelemetry/api';\nimport { ROOT_CONTEXT } from '@opentelemetry/api';\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { EventEmitter } from 'node:events';\nimport type { AsyncLocalStorageLookup } from './contextManager';\nimport { SENTRY_SCOPES_CONTEXT_KEY } from './constants';\nimport { buildContextWithSentryScopes } from './utils/buildContextWithSentryScopes';\nimport { setIsSetup } from './utils/setupCheck';\nimport { getAsyncContextStrategy, getMainCarrier } from '@sentry/core';\n\ntype ListenerFn = (...args: unknown[]) => unknown;\n\n/**\n * Per-event map from user listeners to context-bound listeners.\n */\ntype PatchMap = Record<string, WeakMap<ListenerFn, ListenerFn>>;\n\nconst ADD_LISTENER_METHODS = ['addListener', 'on', 'once', 'prependListener', 'prependOnceListener'] as const;\n\n/**\n * OpenTelemetry-compatible context manager using Node.js `AsyncLocalStorage`.\n * Semantics match `@opentelemetry/context-async-hooks` (function `bind` + `EventEmitter` patching).\n */\nexport class SentryAsyncLocalStorageContextManager implements ContextManager {\n protected readonly _asyncLocalStorage: AsyncLocalStorage<Context>;\n\n private readonly _kOtListeners = Symbol('OtListeners');\n private _wrapped = false;\n\n public constructor() {\n setIsSetup('SentryContextManager');\n // Pick the instance from the async context strategy\n // this should normally always be there, but if it is not for whatever reason, we fall back to a new instance\n this._asyncLocalStorage =\n (getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.()\n ?.asyncLocalStorage as AsyncLocalStorage<Context>) ?? new AsyncLocalStorage<Context>();\n }\n\n public active(): Context {\n return this._asyncLocalStorage.getStore() ?? ROOT_CONTEXT;\n }\n\n public with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F> {\n const ctx2 = buildContextWithSentryScopes(context, this.active());\n const cb = thisArg == null ? fn : fn.bind(thisArg);\n return this._asyncLocalStorage.run(ctx2, cb as never, ...args);\n }\n\n public enable(): this {\n return this;\n }\n\n public disable(): this {\n this._asyncLocalStorage.disable();\n return this;\n }\n\n public bind<T>(context: Context, target: T): T {\n if (target instanceof EventEmitter) {\n return this._bindEventEmitter(context, target);\n }\n if (typeof target === 'function') {\n return this._bindFunction(context, target as unknown as ListenerFn) as T;\n }\n return target;\n }\n\n /**\n * Gets underlying AsyncLocalStorage and symbol to allow lookup of scope.\n * This is Sentry-specific.\n */\n public getAsyncLocalStorageLookup(): AsyncLocalStorageLookup {\n return {\n asyncLocalStorage: this._asyncLocalStorage,\n contextSymbol: SENTRY_SCOPES_CONTEXT_KEY,\n };\n }\n\n private _bindFunction(context: Context, target: ListenerFn): ListenerFn {\n const managerWith = this.with.bind(this);\n const contextWrapper = function (this: never, ...args: unknown[]) {\n return managerWith(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper;\n }\n\n private _bindEventEmitter<T extends EventEmitter>(context: Context, ee: T): T {\n if (this._getPatchMap(ee) !== undefined) {\n return ee;\n }\n this._createPatchMap(ee);\n\n for (const methodName of ADD_LISTENER_METHODS) {\n if (ee[methodName] === undefined) continue;\n ee[methodName] = this._patchAddListener(\n ee,\n ee[methodName] as unknown as (...args: unknown[]) => unknown,\n context,\n );\n }\n if (typeof ee.removeListener === 'function') {\n // oxlint-disable-next-line @typescript-eslint/unbound-method -- patched like upstream OTel context manager\n ee.removeListener = this._patchRemoveListener(ee, ee.removeListener as (...args: unknown[]) => unknown);\n }\n if (typeof ee.off === 'function') {\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n ee.off = this._patchRemoveListener(ee, ee.off as (...args: unknown[]) => unknown);\n }\n if (typeof ee.removeAllListeners === 'function') {\n ee.removeAllListeners = this._patchRemoveAllListeners(\n ee,\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n ee.removeAllListeners as (...args: unknown[]) => unknown,\n );\n }\n return ee;\n }\n\n private _patchRemoveListener(ee: EventEmitter, original: (...args: unknown[]) => unknown) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const contextManager = this;\n return function (this: unknown, event: string, listener: ListenerFn) {\n const events = contextManager._getPatchMap(ee)?.[event];\n if (events === undefined) {\n return original.call(this, event, listener);\n }\n const patchedListener = events.get(listener);\n return original.call(this, event, patchedListener || listener);\n };\n }\n\n private _patchRemoveAllListeners(ee: EventEmitter, original: (...args: unknown[]) => unknown) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const contextManager = this;\n return function (this: unknown, event?: string) {\n const map = contextManager._getPatchMap(ee);\n if (map !== undefined) {\n if (arguments.length === 0) {\n contextManager._createPatchMap(ee);\n } else if (event !== undefined && map[event] !== undefined) {\n // oxlint-disable-next-line @typescript-eslint/no-dynamic-delete -- event-keyed listener map\n delete map[event];\n }\n }\n return original.apply(this, arguments);\n };\n }\n\n private _patchAddListener(ee: EventEmitter, original: (...args: unknown[]) => unknown, context: Context) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const contextManager = this;\n return function (this: unknown, event: string, listener: ListenerFn) {\n if (contextManager._wrapped) {\n return original.call(this, event, listener);\n }\n let map = contextManager._getPatchMap(ee);\n if (map === undefined) {\n map = contextManager._createPatchMap(ee);\n }\n let listeners = map[event];\n if (listeners === undefined) {\n listeners = new WeakMap();\n map[event] = listeners;\n }\n const patchedListener = contextManager.bind(context, listener);\n listeners.set(listener, patchedListener);\n\n contextManager._wrapped = true;\n try {\n return original.call(this, event, patchedListener);\n } finally {\n contextManager._wrapped = false;\n }\n };\n }\n\n private _createPatchMap(ee: EventEmitter): PatchMap {\n const map = Object.create(null) as PatchMap;\n (ee as unknown as Record<symbol, PatchMap>)[this._kOtListeners] = map;\n return map;\n }\n\n private _getPatchMap(ee: EventEmitter): PatchMap | undefined {\n return (ee as unknown as Record<symbol, PatchMap | undefined>)[this._kOtListeners];\n }\n}\n","import * as api from '@opentelemetry/api';\nimport { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrategy';\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport type { TracingChannelBinding } from '@sentry/core';\n\ninterface ContextApi {\n _getContextManager():\n | undefined\n | {\n getAsyncLocalStorageLookup(): {\n asyncLocalStorage: unknown;\n };\n };\n}\n\nexport function setNodeOpenTelemetryContextAsyncContextStrategy(options?: { skipOpenTelemetrySetup?: boolean }): void {\n setOpenTelemetryContextAsyncContextStrategy({\n getTracingChannelBinding: !options?.skipOpenTelemetrySetup\n ? getDefaultAsyncLocalStorageFactory()\n : getCustomAsyncLocalStorageFactory(),\n });\n}\n\n/**\n * In the default case, we build the local storage instance ourselves here.\n * The default asyncLocalStorageContextManager will then use this internally.\n */\nfunction getDefaultAsyncLocalStorageFactory(): () => TracingChannelBinding {\n const defaultAsyncLocalStorage = new AsyncLocalStorage<api.Context>();\n\n return () => {\n return {\n asyncLocalStorage: defaultAsyncLocalStorage,\n getStoreWithActiveSpan: span => api.trace.setSpan(api.context.active(), span),\n } satisfies TracingChannelBinding;\n };\n}\n\n/**\n * If we have a custom context manager, we need to access it via the context manager\n * this may not be available yet, if this is called before the Otel ContextManager was setup\n * in this case, we need to return undefined and retry later, hoping that the setup works by then\n */\nfunction getCustomAsyncLocalStorageFactory(): () => TracingChannelBinding | undefined {\n return () => {\n try {\n const contextManager = (api.context as unknown as ContextApi)._getContextManager();\n const asyncLocalStorage = contextManager?.getAsyncLocalStorageLookup().asyncLocalStorage;\n\n return asyncLocalStorage\n ? ({\n asyncLocalStorage,\n getStoreWithActiveSpan: span => api.trace.setSpan(api.context.active(), span as api.Span),\n } satisfies TracingChannelBinding)\n : undefined;\n } catch {\n return undefined;\n }\n };\n}\n"],"names":["setIsSetup","getAsyncContextStrategy","getMainCarrier","AsyncLocalStorage","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AoB,cAAA,EAAgB,0BAAA,EAA2B,CAAE,iBAAA;AAEvE,MAAA,OAAO,iBAAA,GACF;AAAA,QACC,iBAAA;AAAA,QACA,sBAAA,EAAwB,UAAQ,GAAA,CAAI,KAAA,CAAM,QAAQ,GAAA,CAAI,OAAA,CAAQ,MAAA,EAAO,EAAG,IAAgB;AAAA,OAC1F,GACA,KAAA,CAAA;AAAA,IACN,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,MAAA;AAAA,IACT;AAAA,EACF,CAAA;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/asyncLocalStorageContextManager.ts","../../src/nodeAsyncContextStrategy.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * NOTICE from the Sentry authors:\n * This implementation follows the behavior of OpenTelemetry’s `@opentelemetry/context-async-hooks`\n * package, combining logic that upstream splits across:\n * - https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts\n * - https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-context-async-hooks/src/AsyncLocalStorageContextManager.ts\n * It is a single-class re-implementation for Sentry (not a verbatim copy of those files).\n */\n\nimport type { Context, ContextManager } from '@opentelemetry/api';\nimport { ROOT_CONTEXT } from '@opentelemetry/api';\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { EventEmitter } from 'node:events';\nimport type { AsyncLocalStorageLookup } from './contextManager';\nimport { SENTRY_SCOPES_CONTEXT_KEY } from './constants';\nimport { buildContextWithSentryScopes } from './utils/buildContextWithSentryScopes';\nimport { setIsSetup } from './utils/setupCheck';\nimport { getAsyncContextStrategy, getMainCarrier } from '@sentry/core';\n\ntype ListenerFn = (...args: unknown[]) => unknown;\n\n/**\n * Per-event map from user listeners to context-bound listeners.\n */\ntype PatchMap = Record<string, WeakMap<ListenerFn, ListenerFn>>;\n\nconst ADD_LISTENER_METHODS = ['addListener', 'on', 'once', 'prependListener', 'prependOnceListener'] as const;\n\n/**\n * OpenTelemetry-compatible context manager using Node.js `AsyncLocalStorage`.\n * Semantics match `@opentelemetry/context-async-hooks` (function `bind` + `EventEmitter` patching).\n */\nexport class SentryAsyncLocalStorageContextManager implements ContextManager {\n protected readonly _asyncLocalStorage: AsyncLocalStorage<Context>;\n\n private readonly _kOtListeners = Symbol('OtListeners');\n private _wrapped = false;\n\n public constructor() {\n setIsSetup('SentryContextManager');\n // Pick the instance from the async context strategy\n // this should normally always be there, but if it is not for whatever reason, we fall back to a new instance\n this._asyncLocalStorage =\n (getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.()\n ?.asyncLocalStorage as AsyncLocalStorage<Context>) ?? new AsyncLocalStorage<Context>();\n }\n\n public active(): Context {\n return this._asyncLocalStorage.getStore() ?? ROOT_CONTEXT;\n }\n\n public with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F> {\n const ctx2 = buildContextWithSentryScopes(context, this.active());\n const cb = thisArg == null ? fn : fn.bind(thisArg);\n return this._asyncLocalStorage.run(ctx2, cb as never, ...args);\n }\n\n public enable(): this {\n return this;\n }\n\n public disable(): this {\n this._asyncLocalStorage.disable();\n return this;\n }\n\n public bind<T>(context: Context, target: T): T {\n if (target instanceof EventEmitter) {\n return this._bindEventEmitter(context, target);\n }\n if (typeof target === 'function') {\n return this._bindFunction(context, target as unknown as ListenerFn) as T;\n }\n return target;\n }\n\n /**\n * Gets underlying AsyncLocalStorage and symbol to allow lookup of scope.\n * This is Sentry-specific.\n */\n public getAsyncLocalStorageLookup(): AsyncLocalStorageLookup {\n return {\n asyncLocalStorage: this._asyncLocalStorage,\n contextSymbol: SENTRY_SCOPES_CONTEXT_KEY,\n };\n }\n\n private _bindFunction(context: Context, target: ListenerFn): ListenerFn {\n const managerWith = this.with.bind(this);\n const contextWrapper = function (this: never, ...args: unknown[]) {\n return managerWith(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper;\n }\n\n private _bindEventEmitter<T extends EventEmitter>(context: Context, ee: T): T {\n if (this._getPatchMap(ee) !== undefined) {\n return ee;\n }\n this._createPatchMap(ee);\n\n for (const methodName of ADD_LISTENER_METHODS) {\n if (ee[methodName] === undefined) continue;\n ee[methodName] = this._patchAddListener(\n ee,\n ee[methodName] as unknown as (...args: unknown[]) => unknown,\n context,\n );\n }\n if (typeof ee.removeListener === 'function') {\n // oxlint-disable-next-line @typescript-eslint/unbound-method -- patched like upstream OTel context manager\n ee.removeListener = this._patchRemoveListener(ee, ee.removeListener as (...args: unknown[]) => unknown);\n }\n if (typeof ee.off === 'function') {\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n ee.off = this._patchRemoveListener(ee, ee.off as (...args: unknown[]) => unknown);\n }\n if (typeof ee.removeAllListeners === 'function') {\n ee.removeAllListeners = this._patchRemoveAllListeners(\n ee,\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n ee.removeAllListeners as (...args: unknown[]) => unknown,\n );\n }\n return ee;\n }\n\n private _patchRemoveListener(ee: EventEmitter, original: (...args: unknown[]) => unknown) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const contextManager = this;\n return function (this: unknown, event: string, listener: ListenerFn) {\n const events = contextManager._getPatchMap(ee)?.[event];\n if (events === undefined) {\n return original.call(this, event, listener);\n }\n const patchedListener = events.get(listener);\n return original.call(this, event, patchedListener || listener);\n };\n }\n\n private _patchRemoveAllListeners(ee: EventEmitter, original: (...args: unknown[]) => unknown) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const contextManager = this;\n return function (this: unknown, event?: string) {\n const map = contextManager._getPatchMap(ee);\n if (map !== undefined) {\n if (arguments.length === 0) {\n contextManager._createPatchMap(ee);\n } else if (event !== undefined && map[event] !== undefined) {\n // oxlint-disable-next-line @typescript-eslint/no-dynamic-delete -- event-keyed listener map\n delete map[event];\n }\n }\n return original.apply(this, arguments);\n };\n }\n\n private _patchAddListener(ee: EventEmitter, original: (...args: unknown[]) => unknown, context: Context) {\n // oxlint-disable-next-line @typescript-eslint/no-this-alias\n const contextManager = this;\n return function (this: unknown, event: string, listener: ListenerFn) {\n if (contextManager._wrapped) {\n return original.call(this, event, listener);\n }\n let map = contextManager._getPatchMap(ee);\n if (map === undefined) {\n map = contextManager._createPatchMap(ee);\n }\n let listeners = map[event];\n if (listeners === undefined) {\n listeners = new WeakMap();\n map[event] = listeners;\n }\n const patchedListener = contextManager.bind(context, listener);\n listeners.set(listener, patchedListener);\n\n contextManager._wrapped = true;\n try {\n return original.call(this, event, patchedListener);\n } finally {\n contextManager._wrapped = false;\n }\n };\n }\n\n private _createPatchMap(ee: EventEmitter): PatchMap {\n const map = Object.create(null) as PatchMap;\n (ee as unknown as Record<symbol, PatchMap>)[this._kOtListeners] = map;\n return map;\n }\n\n private _getPatchMap(ee: EventEmitter): PatchMap | undefined {\n return (ee as unknown as Record<symbol, PatchMap | undefined>)[this._kOtListeners];\n }\n}\n","import * as api from '@opentelemetry/api';\nimport { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrategy';\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport type { TracingChannelBinding } from '@sentry/core';\n\ninterface ContextApi {\n _getContextManager():\n | undefined\n | {\n getAsyncLocalStorageLookup(): {\n asyncLocalStorage: unknown;\n };\n };\n}\n\nexport function setNodeOpenTelemetryContextAsyncContextStrategy(options?: { skipOpenTelemetrySetup?: boolean }): void {\n setOpenTelemetryContextAsyncContextStrategy({\n getTracingChannelBinding: !options?.skipOpenTelemetrySetup\n ? getDefaultAsyncLocalStorageFactory()\n : getCustomAsyncLocalStorageFactory(),\n });\n}\n\n/**\n * In the default case, we build the local storage instance ourselves here.\n * The default asyncLocalStorageContextManager will then use this internally.\n */\nfunction getDefaultAsyncLocalStorageFactory(): () => TracingChannelBinding {\n const defaultAsyncLocalStorage = new AsyncLocalStorage<api.Context>();\n\n return () => {\n return {\n asyncLocalStorage: defaultAsyncLocalStorage,\n getStoreWithActiveSpan: span => api.trace.setSpan(api.context.active(), span),\n } satisfies TracingChannelBinding;\n };\n}\n\n/**\n * If we have a custom context manager, we need to access it via the context manager\n * this may not be available yet, if this is called before the Otel ContextManager was setup\n * in this case, we need to return undefined and retry later, hoping that the setup works by then\n */\nfunction getCustomAsyncLocalStorageFactory(): () => TracingChannelBinding | undefined {\n return () => {\n try {\n const contextManager = (api.context as unknown as ContextApi)._getContextManager();\n const asyncLocalStorage = contextManager?.getAsyncLocalStorageLookup().asyncLocalStorage;\n\n return asyncLocalStorage\n ? ({\n asyncLocalStorage,\n getStoreWithActiveSpan: span => api.trace.setSpan(api.context.active(), span as api.Span),\n } satisfies TracingChannelBinding)\n : undefined;\n } catch {\n return undefined;\n }\n };\n}\n"],"names":["setIsSetup","getAsyncContextStrategy","getMainCarrier","AsyncLocalStorage","ROOT_CONTEXT","buildContextWithSentryScopes","EventEmitter","SENTRY_SCOPES_CONTEXT_KEY","setOpenTelemetryContextAsyncContextStrategy"],"mappings":";;;;;;;;AAwCA,MAAM,uBAAuB,CAAC,aAAA,EAAe,IAAA,EAAM,MAAA,EAAQ,mBAAmB,qBAAqB,CAAA;AAM5F,MAAM,qCAAA,CAAgE;AAAA,EAMpE,WAAA,GAAc;AAHrB,IAAA,IAAA,CAAiB,aAAA,0BAAuB,aAAa,CAAA;AACrD,IAAA,IAAA,CAAQ,QAAA,GAAW,KAAA;AAGjB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;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as api from '@opentelemetry/api';
2
2
  import { trace, SpanKind, createContextKey, TraceFlags, propagation, INVALID_TRACEID, context, SpanStatusCode, ROOT_CONTEXT, isSpanContextValid } from '@opentelemetry/api';
3
- import { parseUrl, getSanitizedUrlString, SDK_VERSION, derefWeakRef, addNonEnumerableProperty, makeWeakRef, isSentryRequestUrl, getClient, baggageHeaderToDynamicSamplingContext, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, stripUrlQueryAndFragment, spanToJSON, hasSpansEnabled, dynamicSamplingContextToSentryBaggageHeader, LRUMap, debug, shouldPropagateTraceForUrl, parseBaggageHeader, SENTRY_BAGGAGE_KEY_PREFIX, generateSentryTraceHeader, generateTraceparentHeader, getDynamicSamplingContextFromSpan, getCurrentScope, getDynamicSamplingContextFromScope, getIsolationScope, propagationContextFromHeaders, shouldContinueTrace, spanToTraceContext, getTraceContextFromScope, getRootSpan, handleCallbackErrors, generateTraceId, generateSpanId, _INTERNAL_safeMathRandom, SPAN_STATUS_OK, SPAN_STATUS_ERROR, getSpanStatusFromHttpCode, _INTERNAL_safeDateNow, debounce, timedEventsToMeasurements, captureEvent, getCapturedScopesOnSpan, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, convertSpanLinksForEnvelope, getStatusMessage, spanTimeInputToSeconds, hasSpanStreamingEnabled, addChildSpanToSpan, getDefaultIsolationScope, getDefaultCurrentScope, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, SPAN_KIND, safeSetSpanJSONAttributes, spanKindToName, shouldIgnoreSpan, parseSampleRate, sampleSpan, setAsyncContextStrategy } from '@sentry/core';
4
- import { URL_FULL, HTTP_URL, HTTP_REQUEST_METHOD, HTTP_METHOD, DB_SYSTEM_NAME, DB_SYSTEM, RPC_SERVICE, MESSAGING_SYSTEM, FAAS_TRIGGER, DB_STATEMENT, HTTP_TARGET, HTTP_ROUTE, HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE, RPC_GRPC_STATUS_CODE, SERVICE_VERSION, SERVICE_NAME } from '@sentry/conventions/attributes';
3
+ import { isObjectLike, parseUrl, getSanitizedUrlString, SDK_VERSION, derefWeakRef, addNonEnumerableProperty, makeWeakRef, isSentryRequestUrl, getClient, hasSpansEnabled, spanIsSentrySpan, getRootSpan, spanIsSampled, baggageHeaderToDynamicSamplingContext, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, stripUrlQueryAndFragment, dynamicSamplingContextToSentryBaggageHeader, LRUMap, debug, shouldPropagateTraceForUrl, parseBaggageHeader, SENTRY_BAGGAGE_KEY_PREFIX, generateSentryTraceHeader, generateTraceparentHeader, getDynamicSamplingContextFromSpan, getCurrentScope, getDynamicSamplingContextFromScope, getIsolationScope, propagationContextFromHeaders, shouldContinueTrace, spanToTraceContext, getTraceContextFromScope, handleCallbackErrors, generateTraceId, generateSpanId, _INTERNAL_safeMathRandom, getSpanStatusFromHttpCode, SPAN_STATUS_ERROR, SPAN_STATUS_OK, _INTERNAL_safeDateNow, debounce, timedEventsToMeasurements, captureEvent, getCapturedScopesOnSpan, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, convertSpanLinksForEnvelope, getStatusMessage, spanTimeInputToSeconds, SPAN_KIND, safeSetSpanJSONAttributes, spanKindToName, hasSpanStreamingEnabled, addChildSpanToSpan, getDefaultIsolationScope, getDefaultCurrentScope, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, shouldIgnoreSpan, parseSampleRate, sampleSpan, spanShouldInferOtelSource, spanSourceWasExplicitlySet, markSpanAsTracerProviderSpan, markSpanForOtelSourceInference, spanIsIgnored, _INTERNAL_setSpanForScope, startNewTrace as startNewTrace$1, _INTERNAL_startInactiveSpan, withScope, SentryNonRecordingSpan, setAsyncContextStrategy } from '@sentry/core';
4
+ import { URL_FULL, HTTP_URL, HTTP_REQUEST_METHOD, HTTP_METHOD, DB_SYSTEM_NAME, DB_SYSTEM, RPC_SERVICE, MESSAGING_SYSTEM, FAAS_TRIGGER, DB_STATEMENT, HTTP_TARGET, HTTP_ROUTE, HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE, RPC_GRPC_STATUS_CODE, SENTRY_ORIGIN, SERVICE_VERSION, SERVICE_NAME } from '@sentry/conventions/attributes';
5
5
  import { SamplingDecision } from '@opentelemetry/sdk-trace-base';
6
6
  import { W3CBaggagePropagator, isTracingSuppressed as isTracingSuppressed$1, suppressTracing as suppressTracing$1, SDK_INFO } from '@opentelemetry/core';
7
7
 
@@ -19,7 +19,7 @@ function getParentSpanId(span) {
19
19
 
20
20
  function spanHasAttributes(span) {
21
21
  const castSpan = span;
22
- return !!castSpan.attributes && typeof castSpan.attributes === "object";
22
+ return isObjectLike(castSpan.attributes);
23
23
  }
24
24
  function spanHasKind(span) {
25
25
  const castSpan = span;
@@ -165,6 +165,17 @@ function getSamplingDecision(spanContext) {
165
165
  }
166
166
  return void 0;
167
167
  }
168
+ function getSampledForPropagation(span, client) {
169
+ const spanContext = span.spanContext();
170
+ const samplingDecision = getSamplingDecision(spanContext);
171
+ if (samplingDecision !== void 0) {
172
+ return samplingDecision;
173
+ }
174
+ if (!hasSpansEnabled(client?.getOptions()) || spanContext.isRemote || !spanIsSentrySpan(getRootSpan(span))) {
175
+ return void 0;
176
+ }
177
+ return spanIsSampled(span);
178
+ }
168
179
 
169
180
  function inferSpanData(spanName, attributes, kind) {
170
181
  const httpMethod = attributes[HTTP_REQUEST_METHOD] || attributes[HTTP_METHOD];
@@ -201,8 +212,16 @@ function inferSpanData(spanName, attributes, kind) {
201
212
  return { op: void 0, description: spanName, source: "custom" };
202
213
  }
203
214
  function parseSpanDescription(span) {
204
- const attributes = spanHasAttributes(span) ? span.attributes : {};
205
- const name = spanHasName(span) ? span.name : "<unknown>";
215
+ let attributes;
216
+ let name;
217
+ if (spanHasAttributes(span)) {
218
+ attributes = span.attributes;
219
+ name = spanHasName(span) ? span.name : "<unknown>";
220
+ } else {
221
+ const json = typeof span.spanContext === "function" ? spanToJSON(span) : void 0;
222
+ attributes = json?.data || {};
223
+ name = spanHasName(span) ? span.name : json?.description || "<unknown>";
224
+ }
206
225
  const kind = getSpanKind(span);
207
226
  return inferSpanData(name, attributes, kind);
208
227
  }
@@ -320,12 +339,16 @@ function enhanceDscWithOpenTelemetryRootSpanName(client) {
320
339
  const jsonSpan = spanToJSON(rootSpan);
321
340
  const attributes = jsonSpan.data;
322
341
  const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
323
- const { description } = spanHasName(rootSpan) ? parseSpanDescription(rootSpan) : { description: void 0 };
324
- if (source !== "url" && description) {
325
- dsc.transaction = description;
342
+ const sampled = getSampledForPropagation(rootSpan, client);
343
+ if (sampled === false) {
344
+ delete dsc.transaction;
345
+ } else if (jsonSpan.description) {
346
+ const { description } = parseSpanDescription(rootSpan);
347
+ if (source !== "url" && description) {
348
+ dsc.transaction = description;
349
+ }
326
350
  }
327
351
  if (hasSpansEnabled()) {
328
- const sampled = getSamplingDecision(rootSpan.spanContext());
329
352
  dsc.sampled = sampled == void 0 ? void 0 : String(sampled);
330
353
  }
331
354
  });
@@ -477,8 +500,7 @@ function getInjectionData(context2, options = {}) {
477
500
  dynamicSamplingContext: dynamicSamplingContext2,
478
501
  traceId: spanContext.traceId,
479
502
  spanId: spanContext.spanId,
480
- sampled: getSamplingDecision(spanContext)
481
- // TODO: Do we need to change something here?
503
+ sampled: getSampledForPropagation(span, options.client)
482
504
  };
483
505
  }
484
506
  const scope = options.scope || getScopesFromContext(context2)?.scope || getCurrentScope();
@@ -1222,6 +1244,28 @@ function getData(span) {
1222
1244
  return data;
1223
1245
  }
1224
1246
 
1247
+ function backfillStreamedSpanDataFromOtel(spanJSON, hint) {
1248
+ const attributes = spanJSON.attributes ?? {};
1249
+ const kind = hint?.spanKind ?? SPAN_KIND.INTERNAL;
1250
+ const { op, description, source, data } = inferSpanData(spanJSON.name, attributes, kind);
1251
+ spanJSON.name = description;
1252
+ safeSetSpanJSONAttributes(spanJSON, {
1253
+ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
1254
+ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
1255
+ // If nothing in the chain previously set an origin, we now default it to 'manual'
1256
+ // For transactions, this is done in the SpanExporter.
1257
+ // TODO (v11): Remove this again once we fully moved away from OTel's TracerProvider.
1258
+ // at this point, we use `SentrySpan` everywhere, which defaults its origin to 'manual'.
1259
+ [SENTRY_ORIGIN]: "manual",
1260
+ ...data
1261
+ });
1262
+ if (kind !== SPAN_KIND.INTERNAL) {
1263
+ safeSetSpanJSONAttributes(spanJSON, {
1264
+ "otel.kind": spanKindToName(kind)
1265
+ });
1266
+ }
1267
+ }
1268
+
1225
1269
  class SentrySpanProcessor {
1226
1270
  constructor(options) {
1227
1271
  this._unsubscribePreprocessSpan = void 0;
@@ -1280,25 +1324,6 @@ class SentrySpanProcessor {
1280
1324
  }
1281
1325
  }
1282
1326
  }
1283
- function backfillStreamedSpanDataFromOtel(spanJSON, hint) {
1284
- const attributes = spanJSON.attributes;
1285
- if (!attributes) {
1286
- return;
1287
- }
1288
- const kind = hint?.spanKind ?? SPAN_KIND.INTERNAL;
1289
- const { op, description, source, data } = inferSpanData(spanJSON.name, attributes, kind);
1290
- spanJSON.name = description;
1291
- safeSetSpanJSONAttributes(spanJSON, {
1292
- [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
1293
- [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
1294
- ...data
1295
- });
1296
- if (kind !== SPAN_KIND.INTERNAL) {
1297
- safeSetSpanJSONAttributes(spanJSON, {
1298
- "otel.kind": spanKindToName(kind)
1299
- });
1300
- }
1301
- }
1302
1327
 
1303
1328
  class SentrySampler {
1304
1329
  constructor(client) {
@@ -1510,6 +1535,169 @@ function getValidSpan(context) {
1510
1535
  return span && isSpanContextValid(span.spanContext()) ? span : void 0;
1511
1536
  }
1512
1537
 
1538
+ function applyOtelSpanData(span, options = {}) {
1539
+ const spanJSON = spanToJSON(span);
1540
+ const attributes = spanJSON.data;
1541
+ const kind = span.kind ?? SpanKind.INTERNAL;
1542
+ const mayInferSource = spanShouldInferOtelSource(span);
1543
+ const hasCustomSpanName = attributes[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME] !== void 0;
1544
+ const canInferSource = mayInferSource && !hasCustomSpanName && !spanSourceWasExplicitlySet(span);
1545
+ const attributesForInference = canInferSource && attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom" ? { ...attributes, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: void 0 } : attributes;
1546
+ const inferred = inferSpanData(spanJSON.description || "<unknown>", attributesForInference, kind);
1547
+ if (kind !== SpanKind.INTERNAL && attributes["otel.kind"] === void 0) {
1548
+ span.setAttribute("otel.kind", SpanKind[kind]);
1549
+ }
1550
+ if (inferred.op && attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === void 0) {
1551
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, inferred.op);
1552
+ }
1553
+ const shouldApplyInferredSource = inferred.source !== void 0 && inferred.source !== "custom" && (options.finalizeStatus || inferred.source !== "url") && (spanJSON.parent_span_id === void 0 || kind === SpanKind.SERVER);
1554
+ if (shouldApplyInferredSource && (attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === void 0 || canInferSource)) {
1555
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, inferred.source);
1556
+ }
1557
+ if (inferred.data) {
1558
+ Object.entries(inferred.data).forEach(([key, value]) => {
1559
+ if (value !== void 0 && attributes[key] === void 0) {
1560
+ span.setAttribute(key, value);
1561
+ }
1562
+ });
1563
+ }
1564
+ if (options.finalizeStatus) {
1565
+ applyOtelCompatibilityAttributes(span, attributes);
1566
+ const client = getClient();
1567
+ applyOtelSpanStatus(span, attributes, spanJSON.status, !!client && hasSpanStreamingEnabled(client));
1568
+ }
1569
+ if (mayInferSource && inferred.description !== spanJSON.description && (attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== "custom" || canInferSource)) {
1570
+ span.updateName(inferred.description);
1571
+ }
1572
+ }
1573
+ function applyOtelSpanKind(span, kind) {
1574
+ addNonEnumerableProperty(span, "kind", kind ?? SpanKind.INTERNAL);
1575
+ }
1576
+ function applyOtelSpanStatus(span, attributes, status, spanStreamingEnabled) {
1577
+ if (status === void 0) {
1578
+ span.setStatus(inferStatusFromAttributes(attributes) || { code: SPAN_STATUS_OK });
1579
+ return;
1580
+ }
1581
+ if (!spanStreamingEnabled && status !== "ok" && !isStatusErrorMessageValid(status)) {
1582
+ span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
1583
+ }
1584
+ }
1585
+ function applyOtelCompatibilityAttributes(span, attributes) {
1586
+ const legacyHttpStatusCode = attributes[HTTP_STATUS_CODE];
1587
+ if (attributes[HTTP_RESPONSE_STATUS_CODE] === void 0 && legacyHttpStatusCode !== void 0) {
1588
+ span.setAttribute(HTTP_RESPONSE_STATUS_CODE, legacyHttpStatusCode);
1589
+ attributes[HTTP_RESPONSE_STATUS_CODE] = legacyHttpStatusCode;
1590
+ }
1591
+ }
1592
+
1593
+ class SentryTracer {
1594
+ /** @inheritdoc */
1595
+ startSpan(name, options = {}, ctx) {
1596
+ const parentContext = ctx || context.active();
1597
+ const parentSpan = options.root ? void 0 : trace.getSpan(parentContext);
1598
+ if (isTracingSuppressed$1(parentContext)) {
1599
+ return this._createNonRecordingSpan(parentSpan);
1600
+ }
1601
+ const span = this._startSentrySpan(name, options, parentSpan, ctx !== void 0);
1602
+ markSpanAsTracerProviderSpan(span);
1603
+ applyOtelSpanKind(span, options.kind);
1604
+ if (options.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === void 0) {
1605
+ markSpanForOtelSourceInference(span);
1606
+ }
1607
+ applyOtelSpanData(span);
1608
+ return span;
1609
+ }
1610
+ startActiveSpan(name, optionsOrFn, contextOrFn, fn) {
1611
+ const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
1612
+ const ctx = typeof contextOrFn === "function" || contextOrFn === void 0 ? context.active() : contextOrFn;
1613
+ const callback = typeof optionsOrFn === "function" ? optionsOrFn : typeof contextOrFn === "function" ? contextOrFn : fn;
1614
+ const span = this.startSpan(name, options, ctx);
1615
+ const capturedIsolationScope = getCapturedScopesOnSpan(span).isolationScope;
1616
+ const withCapturedIsolationScope = (contextToFork) => capturedIsolationScope ? contextToFork.setValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY, capturedIsolationScope) : contextToFork;
1617
+ if (spanIsIgnored(span) && trace.getSpan(ctx)) {
1618
+ return context.with(withCapturedIsolationScope(ctx), () => callback(span));
1619
+ }
1620
+ return context.with(withCapturedIsolationScope(trace.setSpan(ctx, span)), () => {
1621
+ _INTERNAL_setSpanForScope(getCurrentScope(), span);
1622
+ return callback(span);
1623
+ });
1624
+ }
1625
+ _startSentrySpan(name, options, parentSpan, hasExplicitContext) {
1626
+ const sentryOptions = {
1627
+ name,
1628
+ attributes: options.attributes,
1629
+ links: options.links,
1630
+ startTime: options.startTime
1631
+ };
1632
+ if (options.root) {
1633
+ return startNewTrace$1(() => _INTERNAL_startInactiveSpan({ ...sentryOptions, parentSpan: null }));
1634
+ }
1635
+ if (parentSpan?.spanContext().isRemote) {
1636
+ return this._startRootSpanWithRemoteParent(sentryOptions, parentSpan);
1637
+ }
1638
+ if (parentSpan) {
1639
+ return _INTERNAL_startInactiveSpan({ ...sentryOptions, parentSpan });
1640
+ }
1641
+ return startNewTrace$1(
1642
+ () => _INTERNAL_startInactiveSpan({
1643
+ ...sentryOptions,
1644
+ parentSpan: hasExplicitContext ? null : void 0
1645
+ })
1646
+ );
1647
+ }
1648
+ _startRootSpanWithRemoteParent(options, parentSpan) {
1649
+ const { spanId, traceId, traceState } = parentSpan.spanContext();
1650
+ const dsc = getDynamicSamplingContextFromSpan(parentSpan);
1651
+ const sampleRand = typeof dsc.sample_rand === "string" ? Number(dsc.sample_rand) : void 0;
1652
+ const hasIncomingDsc = !!traceState?.get(SENTRY_TRACE_STATE_DSC);
1653
+ return withScope((scope) => {
1654
+ scope.setPropagationContext({
1655
+ traceId,
1656
+ parentSpanId: spanId,
1657
+ sampled: getSamplingDecision(parentSpan.spanContext()),
1658
+ dsc: hasIncomingDsc ? dsc : void 0,
1659
+ sampleRand: typeof sampleRand === "number" && !Number.isNaN(sampleRand) ? sampleRand : _INTERNAL_safeMathRandom()
1660
+ });
1661
+ _INTERNAL_setSpanForScope(scope, void 0);
1662
+ return _INTERNAL_startInactiveSpan({ ...options, parentSpan: null });
1663
+ });
1664
+ }
1665
+ _createNonRecordingSpan(parentSpan) {
1666
+ const span = new SentryNonRecordingSpan({ traceId: parentSpan?.spanContext().traceId });
1667
+ if (parentSpan) {
1668
+ addChildSpanToSpan(parentSpan, span);
1669
+ }
1670
+ setCapturedScopesOnSpan(span, getCurrentScope(), getIsolationScope());
1671
+ return span;
1672
+ }
1673
+ }
1674
+
1675
+ class SentryTracerProvider {
1676
+ constructor(options = {}) {
1677
+ this._tracers = /* @__PURE__ */ new Map();
1678
+ this.resource = options.resource;
1679
+ }
1680
+ /** @inheritdoc */
1681
+ getTracer(name, version, options) {
1682
+ const key = JSON.stringify([name, version, options]);
1683
+ const cachedTracer = this._tracers.get(key);
1684
+ if (cachedTracer) {
1685
+ return cachedTracer;
1686
+ }
1687
+ const tracer = new SentryTracer();
1688
+ this._tracers.set(key, tracer);
1689
+ return tracer;
1690
+ }
1691
+ /** Compatibility with SDK tracer providers. */
1692
+ forceFlush() {
1693
+ return Promise.resolve();
1694
+ }
1695
+ /** Compatibility with SDK tracer providers. */
1696
+ shutdown() {
1697
+ return Promise.resolve();
1698
+ }
1699
+ }
1700
+
1513
1701
  const ATTR_TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language";
1514
1702
  const ATTR_TELEMETRY_SDK_NAME = "telemetry.sdk.name";
1515
1703
  const ATTR_TELEMETRY_SDK_VERSION = "telemetry.sdk.version";
@@ -1661,5 +1849,5 @@ function setOpenTelemetryContextAsyncContextStrategy(options) {
1661
1849
  });
1662
1850
  }
1663
1851
 
1664
- export { startSpanManual as A, suppressTracing as B, withActiveSpan as C, wrapClientClass as D, wrapContextManagerClass as E, wrapSamplingDecision as F, SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION as S, SENTRY_SCOPES_CONTEXT_KEY as a, SentryPropagator as b, SentrySampler as c, SentrySpanProcessor as d, buildContextWithSentryScopes as e, continueTrace as f, enhanceDscWithOpenTelemetryRootSpanName as g, getActiveSpan as h, getRequestSpanData as i, getScopesFromContext as j, getSentryResource as k, getSpanKind as l, getTraceContextForScope as m, isSentryRequestSpan as n, openTelemetrySetupCheck as o, setOpenTelemetryContextAsyncContextStrategy as p, setupEventContextTrace as q, spanHasAttributes as r, setIsSetup as s, spanHasEvents as t, spanHasKind as u, spanHasName as v, spanHasParentId as w, spanHasStatus as x, startInactiveSpan as y, startSpan as z };
1665
- //# sourceMappingURL=asyncContextStrategy-DfM95hx5.js.map
1852
+ export { spanHasStatus as A, startInactiveSpan as B, startSpan as C, startSpanManual as D, suppressTracing as E, withActiveSpan as F, wrapClientClass as G, wrapContextManagerClass as H, wrapSamplingDecision as I, SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION as S, SENTRY_SCOPES_CONTEXT_KEY as a, SentryPropagator as b, SentrySampler as c, SentrySpanProcessor as d, SentryTracerProvider as e, applyOtelSpanData as f, backfillStreamedSpanDataFromOtel as g, buildContextWithSentryScopes as h, continueTrace as i, enhanceDscWithOpenTelemetryRootSpanName as j, getActiveSpan as k, getRequestSpanData as l, getScopesFromContext as m, getSentryResource as n, getSpanKind as o, getTraceContextForScope as p, isSentryRequestSpan as q, openTelemetrySetupCheck as r, setIsSetup as s, setOpenTelemetryContextAsyncContextStrategy as t, setupEventContextTrace as u, spanHasAttributes as v, spanHasEvents as w, spanHasKind as x, spanHasName as y, spanHasParentId as z };
1853
+ //# sourceMappingURL=asyncContextStrategy-CDufUmpa.js.map