@sentry/opentelemetry 8.0.0-alpha.1 → 8.0.0-alpha.2

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 (66) hide show
  1. package/cjs/constants.js +2 -4
  2. package/cjs/constants.js.map +1 -1
  3. package/cjs/contextManager.js +5 -0
  4. package/cjs/contextManager.js.map +1 -1
  5. package/cjs/index.js +2 -2
  6. package/cjs/index.js.map +1 -1
  7. package/cjs/propagator.js +119 -61
  8. package/cjs/propagator.js.map +1 -1
  9. package/cjs/sampler.js +7 -5
  10. package/cjs/sampler.js.map +1 -1
  11. package/cjs/setupEventContextTrace.js +2 -2
  12. package/cjs/setupEventContextTrace.js.map +1 -1
  13. package/cjs/spanExporter.js +1 -8
  14. package/cjs/spanExporter.js.map +1 -1
  15. package/cjs/spanProcessor.js +3 -0
  16. package/cjs/spanProcessor.js.map +1 -1
  17. package/cjs/utils/contextData.js +0 -18
  18. package/cjs/utils/contextData.js.map +1 -1
  19. package/cjs/utils/mapStatus.js +5 -4
  20. package/cjs/utils/mapStatus.js.map +1 -1
  21. package/cjs/utils/setupCheck.js +17 -0
  22. package/cjs/utils/setupCheck.js.map +1 -0
  23. package/esm/constants.js +2 -4
  24. package/esm/constants.js.map +1 -1
  25. package/esm/contextManager.js +5 -0
  26. package/esm/contextManager.js.map +1 -1
  27. package/esm/index.js +2 -1
  28. package/esm/index.js.map +1 -1
  29. package/esm/propagator.js +121 -65
  30. package/esm/propagator.js.map +1 -1
  31. package/esm/sampler.js +7 -5
  32. package/esm/sampler.js.map +1 -1
  33. package/esm/setupEventContextTrace.js +2 -2
  34. package/esm/setupEventContextTrace.js.map +1 -1
  35. package/esm/spanExporter.js +1 -8
  36. package/esm/spanExporter.js.map +1 -1
  37. package/esm/spanProcessor.js +3 -0
  38. package/esm/spanProcessor.js.map +1 -1
  39. package/esm/utils/contextData.js +2 -18
  40. package/esm/utils/contextData.js.map +1 -1
  41. package/esm/utils/mapStatus.js +5 -4
  42. package/esm/utils/mapStatus.js.map +1 -1
  43. package/esm/utils/setupCheck.js +14 -0
  44. package/esm/utils/setupCheck.js.map +1 -0
  45. package/package.json +4 -4
  46. package/types/constants.d.ts +1 -2
  47. package/types/constants.d.ts.map +1 -1
  48. package/types/contextManager.d.ts.map +1 -1
  49. package/types/index.d.ts +2 -1
  50. package/types/index.d.ts.map +1 -1
  51. package/types/propagator.d.ts +11 -2
  52. package/types/propagator.d.ts.map +1 -1
  53. package/types/sampler.d.ts.map +1 -1
  54. package/types/spanProcessor.d.ts.map +1 -1
  55. package/types/utils/contextData.d.ts +1 -11
  56. package/types/utils/contextData.d.ts.map +1 -1
  57. package/types/utils/mapStatus.d.ts +2 -2
  58. package/types/utils/mapStatus.d.ts.map +1 -1
  59. package/types/utils/setupCheck.d.ts +9 -0
  60. package/types/utils/setupCheck.d.ts.map +1 -0
  61. package/types-ts3.8/constants.d.ts +1 -2
  62. package/types-ts3.8/index.d.ts +2 -1
  63. package/types-ts3.8/propagator.d.ts +11 -2
  64. package/types-ts3.8/utils/contextData.d.ts +1 -11
  65. package/types-ts3.8/utils/mapStatus.d.ts +2 -2
  66. package/types-ts3.8/utils/setupCheck.d.ts +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sampler.js","sources":["../../src/sampler.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nimport type { Attributes, Context, SpanContext } from '@opentelemetry/api';\nimport { TraceFlags, isSpanContextValid, trace } from '@opentelemetry/api';\nimport type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base';\nimport { SamplingDecision } from '@opentelemetry/sdk-trace-base';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, hasTracingEnabled } from '@sentry/core';\nimport type { Client, ClientOptions, SamplingContext } from '@sentry/types';\nimport { isNaN, logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { InternalSentrySemanticAttributes } from './semanticAttributes';\nimport { getPropagationContextFromContext } from './utils/contextData';\n\n/**\n * A custom OTEL sampler that uses Sentry sampling rates to make it's decision\n */\nexport class SentrySampler implements Sampler {\n private _client: Client;\n\n public constructor(client: Client) {\n this._client = client;\n }\n\n /** @inheritDoc */\n public shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n _spanKind: unknown,\n spanAttributes: unknown,\n _links: unknown,\n ): SamplingResult {\n const options = this._client.getOptions();\n\n if (!hasTracingEnabled(options)) {\n return { decision: SamplingDecision.NOT_RECORD };\n }\n\n const parentContext = trace.getSpanContext(context);\n\n let parentSampled: boolean | undefined = undefined;\n\n // Only inherit sample rate if `traceId` is the same\n // Note for testing: `isSpanContextValid()` checks the format of the traceId/spanId, so we need to pass valid ones\n if (parentContext && isSpanContextValid(parentContext) && parentContext.traceId === traceId) {\n if (parentContext.isRemote) {\n parentSampled = getParentRemoteSampled(parentContext, context);\n DEBUG_BUILD &&\n logger.log(`[Tracing] Inheriting remote parent's sampled decision for ${spanName}: ${parentSampled}`);\n } else {\n parentSampled = Boolean(parentContext.traceFlags & TraceFlags.SAMPLED);\n DEBUG_BUILD && logger.log(`[Tracing] Inheriting parent's sampled decision for ${spanName}: ${parentSampled}`);\n }\n }\n\n const sampleRate = getSampleRate(options, {\n name: spanName,\n attributes: spanAttributes,\n transactionContext: {\n name: spanName,\n parentSampled,\n },\n parentSampled,\n });\n\n const attributes: Attributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: Number(sampleRate),\n };\n\n if (typeof parentSampled === 'boolean') {\n attributes[InternalSentrySemanticAttributes.PARENT_SAMPLED] = parentSampled;\n }\n\n // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The\n // only valid values are booleans or numbers between 0 and 1.)\n if (!isValidSampleRate(sampleRate)) {\n DEBUG_BUILD && logger.warn('[Tracing] Discarding span because of invalid sample rate.');\n\n return {\n decision: SamplingDecision.NOT_RECORD,\n attributes,\n };\n }\n\n // if the function returned 0 (or false), or if `tracesSampleRate` is 0, it's a sign the transaction should be dropped\n if (!sampleRate) {\n DEBUG_BUILD &&\n logger.log(\n `[Tracing] Discarding span because ${\n typeof options.tracesSampler === 'function'\n ? 'tracesSampler returned 0 or false'\n : 'a negative sampling decision was inherited or tracesSampleRate is set to 0'\n }`,\n );\n\n return {\n decision: SamplingDecision.NOT_RECORD,\n attributes,\n };\n }\n\n // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is\n // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.\n const isSampled = Math.random() < (sampleRate as number | boolean);\n\n // if we're not going to keep it, we're done\n if (!isSampled) {\n DEBUG_BUILD &&\n logger.log(\n `[Tracing] Discarding span because it's not included in the random sample (sampling rate = ${Number(\n sampleRate,\n )})`,\n );\n\n return {\n decision: SamplingDecision.NOT_RECORD,\n attributes,\n };\n }\n\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n attributes,\n };\n }\n\n /** Returns the sampler name or short description with the configuration. */\n public toString(): string {\n return 'SentrySampler';\n }\n}\n\nfunction getSampleRate(\n options: Pick<ClientOptions, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'>,\n samplingContext: SamplingContext,\n): number | boolean {\n if (typeof options.tracesSampler === 'function') {\n return options.tracesSampler(samplingContext);\n }\n\n if (samplingContext.parentSampled !== undefined) {\n return samplingContext.parentSampled;\n }\n\n if (typeof options.tracesSampleRate !== 'undefined') {\n return options.tracesSampleRate;\n }\n\n // When `enableTracing === true`, we use a sample rate of 100%\n if (options.enableTracing) {\n return 1;\n }\n\n return 0;\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nfunction isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if (isNaN(rate) || !(typeof rate === 'number' || typeof rate === 'boolean')) {\n DEBUG_BUILD &&\n logger.warn(\n `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD &&\n logger.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\nfunction getParentRemoteSampled(spanContext: SpanContext, context: Context): boolean | undefined {\n const traceId = spanContext.traceId;\n const traceparentData = getPropagationContextFromContext(context);\n\n // Only inherit sample rate if `traceId` is the same\n return traceparentData && traceId === traceparentData.traceId ? traceparentData.sampled : undefined;\n}\n"],"names":["hasTracingEnabled","SamplingDecision","trace","isSpanContextValid","DEBUG_BUILD","logger","TraceFlags","SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE","InternalSentrySemanticAttributes","isNaN","getPropagationContextFromContext"],"mappings":";;;;;;;;;;AAaA;AACA;AACA;AACO,MAAM,eAAiC;;AAG9C,GAAS,WAAW,CAAC,MAAM,EAAU;AACrC,IAAI,IAAI,CAAC,OAAQ,GAAE,MAAM,CAAA;AACzB,GAAE;AACF;AACA;AACA,GAAS,YAAY;AACrB,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,cAAc;AAClB,IAAI,MAAM;AACV,IAAoB;AACpB,IAAI,MAAM,UAAU,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAA;AAC7C;AACA,IAAI,IAAI,CAACA,sBAAiB,CAAC,OAAO,CAAC,EAAE;AACrC,MAAM,OAAO,EAAE,QAAQ,EAAEC,6BAAgB,CAAC,YAAY,CAAA;AACtD,KAAI;AACJ;AACA,IAAI,MAAM,gBAAgBC,SAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;AACvD;AACA,IAAI,IAAI,aAAa,GAAwB,SAAS,CAAA;AACtD;AACA;AACA;AACA,IAAI,IAAI,aAAc,IAAGC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AA,KAAA,eAAA,CAAA,OAAA,GAAA,eAAA,CAAA,OAAA,GAAA,SAAA,CAAA;AACA;;;;"}
1
+ {"version":3,"file":"sampler.js","sources":["../../src/sampler.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nimport type { Attributes, Context, SpanContext } from '@opentelemetry/api';\nimport { TraceFlags, isSpanContextValid, trace } from '@opentelemetry/api';\nimport type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base';\nimport { SamplingDecision } from '@opentelemetry/sdk-trace-base';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, hasTracingEnabled } from '@sentry/core';\nimport type { Client, ClientOptions, SamplingContext } from '@sentry/types';\nimport { isNaN, logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { getPropagationContextFromSpanContext } from './propagator';\nimport { InternalSentrySemanticAttributes } from './semanticAttributes';\nimport { setIsSetup } from './utils/setupCheck';\n\n/**\n * A custom OTEL sampler that uses Sentry sampling rates to make it's decision\n */\nexport class SentrySampler implements Sampler {\n private _client: Client;\n\n public constructor(client: Client) {\n this._client = client;\n setIsSetup('SentrySampler');\n }\n\n /** @inheritDoc */\n public shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n _spanKind: unknown,\n spanAttributes: unknown,\n _links: unknown,\n ): SamplingResult {\n const options = this._client.getOptions();\n\n if (!hasTracingEnabled(options)) {\n return { decision: SamplingDecision.NOT_RECORD };\n }\n\n const parentContext = trace.getSpanContext(context);\n\n let parentSampled: boolean | undefined = undefined;\n\n // Only inherit sample rate if `traceId` is the same\n // Note for testing: `isSpanContextValid()` checks the format of the traceId/spanId, so we need to pass valid ones\n if (parentContext && isSpanContextValid(parentContext) && parentContext.traceId === traceId) {\n if (parentContext.isRemote) {\n parentSampled = getParentRemoteSampled(parentContext);\n DEBUG_BUILD &&\n logger.log(`[Tracing] Inheriting remote parent's sampled decision for ${spanName}: ${parentSampled}`);\n } else {\n parentSampled = Boolean(parentContext.traceFlags & TraceFlags.SAMPLED);\n DEBUG_BUILD && logger.log(`[Tracing] Inheriting parent's sampled decision for ${spanName}: ${parentSampled}`);\n }\n }\n\n const sampleRate = getSampleRate(options, {\n name: spanName,\n attributes: spanAttributes,\n transactionContext: {\n name: spanName,\n parentSampled,\n },\n parentSampled,\n });\n\n const attributes: Attributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: Number(sampleRate),\n };\n\n if (typeof parentSampled === 'boolean') {\n attributes[InternalSentrySemanticAttributes.PARENT_SAMPLED] = parentSampled;\n }\n\n // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The\n // only valid values are booleans or numbers between 0 and 1.)\n if (!isValidSampleRate(sampleRate)) {\n DEBUG_BUILD && logger.warn('[Tracing] Discarding span because of invalid sample rate.');\n\n return {\n decision: SamplingDecision.NOT_RECORD,\n attributes,\n };\n }\n\n // if the function returned 0 (or false), or if `tracesSampleRate` is 0, it's a sign the transaction should be dropped\n if (!sampleRate) {\n DEBUG_BUILD &&\n logger.log(\n `[Tracing] Discarding span because ${\n typeof options.tracesSampler === 'function'\n ? 'tracesSampler returned 0 or false'\n : 'a negative sampling decision was inherited or tracesSampleRate is set to 0'\n }`,\n );\n\n return {\n decision: SamplingDecision.NOT_RECORD,\n attributes,\n };\n }\n\n // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is\n // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.\n const isSampled = Math.random() < (sampleRate as number | boolean);\n\n // if we're not going to keep it, we're done\n if (!isSampled) {\n DEBUG_BUILD &&\n logger.log(\n `[Tracing] Discarding span because it's not included in the random sample (sampling rate = ${Number(\n sampleRate,\n )})`,\n );\n\n return {\n decision: SamplingDecision.NOT_RECORD,\n attributes,\n };\n }\n\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n attributes,\n };\n }\n\n /** Returns the sampler name or short description with the configuration. */\n public toString(): string {\n return 'SentrySampler';\n }\n}\n\nfunction getSampleRate(\n options: Pick<ClientOptions, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'>,\n samplingContext: SamplingContext,\n): number | boolean {\n if (typeof options.tracesSampler === 'function') {\n return options.tracesSampler(samplingContext);\n }\n\n if (samplingContext.parentSampled !== undefined) {\n return samplingContext.parentSampled;\n }\n\n if (typeof options.tracesSampleRate !== 'undefined') {\n return options.tracesSampleRate;\n }\n\n // When `enableTracing === true`, we use a sample rate of 100%\n if (options.enableTracing) {\n return 1;\n }\n\n return 0;\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nfunction isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if (isNaN(rate) || !(typeof rate === 'number' || typeof rate === 'boolean')) {\n DEBUG_BUILD &&\n logger.warn(\n `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD &&\n logger.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\nfunction getParentRemoteSampled(spanContext: SpanContext): boolean | undefined {\n const traceId = spanContext.traceId;\n const traceparentData = getPropagationContextFromSpanContext(spanContext);\n\n // Only inherit sampled if `traceId` is the same\n return traceparentData && traceId === traceparentData.traceId ? traceparentData.sampled : undefined;\n}\n"],"names":["setIsSetup","hasTracingEnabled","SamplingDecision","trace","isSpanContextValid","DEBUG_BUILD","logger","TraceFlags","SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE","InternalSentrySemanticAttributes","isNaN","getPropagationContextFromSpanContext"],"mappings":";;;;;;;;;;;AAcA;AACA;AACA;AACO,MAAM,eAAiC;;AAG9C,GAAS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,SAAA;AACA,UAAA,IAAA;AACA,SAAA,CAAA,SAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AACA,OAAA,CAAA;AACA,IAAA,OAAA,KAAA,CAAA;AACA,GAAA;AACA;AACA;AACA,EAAA,IAAA,IAAA,GAAA,CAAA,IAAA,IAAA,GAAA,CAAA,EAAA;AACA,IAAAD,sBAAA;AACA,MAAAC,YAAA,CAAA,IAAA,CAAA,CAAA,iFAAA,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,OAAA,KAAA,CAAA;AACA,GAAA;AACA,EAAA,OAAA,IAAA,CAAA;AACA,CAAA;AACA;AACA,SAAA,sBAAA,CAAA,WAAA,EAAA;AACA,EAAA,MAAA,OAAA,GAAA,WAAA,CAAA,OAAA,CAAA;AACA,EAAA,MAAA,eAAA,GAAAK,+CAAA,CAAA,WAAA,CAAA,CAAA;AACA;AACA;AACA,EAAA,OAAA,eAAA,IAAA,OAAA,KAAA,eAAA,CAAA,OAAA,GAAA,eAAA,CAAA,OAAA,GAAA,SAAA,CAAA;AACA;;;;"}
@@ -28,8 +28,8 @@ function setupEventContextTrace(client) {
28
28
 
29
29
  const rootSpan = getActiveSpan.getRootSpan(span);
30
30
  const transactionName = spanTypes.spanHasName(rootSpan) ? rootSpan.name : undefined;
31
- if (transactionName) {
32
- event.tags = { transaction: transactionName, ...event.tags };
31
+ if (transactionName && !event.transaction) {
32
+ event.transaction = transactionName;
33
33
  }
34
34
 
35
35
  return event;
@@ -1 +1 @@
1
- {"version":3,"file":"setupEventContextTrace.js","sources":["../../src/setupEventContextTrace.ts"],"sourcesContent":["import type { Client } from '@sentry/types';\nimport { dropUndefinedKeys } from '@sentry/utils';\n\nimport { getActiveSpan, getRootSpan } from './utils/getActiveSpan';\nimport { spanHasName, spanHasParentId } from './utils/spanTypes';\n\n/** Ensure the `trace` context is set on all events. */\nexport function setupEventContextTrace(client: Client): void {\n client.addEventProcessor(event => {\n const span = getActiveSpan();\n // For transaction events, this is handled separately\n // Because the active span may not be the span that is actually the transaction event\n if (!span || event.type === 'transaction') {\n return event;\n }\n\n const spanContext = span.spanContext();\n\n // If event has already set `trace` context, use that one.\n event.contexts = {\n trace: dropUndefinedKeys({\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n parent_span_id: spanHasParentId(span) ? span.parentSpanId : undefined,\n }),\n ...event.contexts,\n };\n\n const rootSpan = getRootSpan(span);\n const transactionName = spanHasName(rootSpan) ? rootSpan.name : undefined;\n if (transactionName) {\n event.tags = { transaction: transactionName, ...event.tags };\n }\n\n return event;\n });\n}\n"],"names":["getActiveSpan","dropUndefinedKeys","spanHasParentId","getRootSpan","spanHasName"],"mappings":";;;;;;AAMA;AACO,SAAS,sBAAsB,CAAC,MAAM,EAAgB;AAC7D,EAAE,MAAM,CAAC,iBAAiB,CAAC,SAAS;AACpC,IAAI,MAAM,IAAA,GAAOA,2BAAa,EAAE,CAAA;AAChC;AACA;AACA,IAAI,IAAI,CAAC,IAAK,IAAG,KAAK,CAAC,IAAA,KAAS,aAAa,EAAE;AAC/C,MAAM,OAAO,KAAK,CAAA;AAClB,KAAI;AACJ;AACA,IAAI,MAAM,WAAY,GAAE,IAAI,CAAC,WAAW,EAAE,CAAA;AAC1C;AACA;AACA,IAAI,KAAK,CAAC,QAAA,GAAW;AACrB,MAAM,KAAK,EAAEC,uBAAiB,CAAC;AAC/B,QAAQ,QAAQ,EAAE,WAAW,CAAC,OAAO;AACrC,QAAQ,OAAO,EAAE,WAAW,CAAC,MAAM;AACnC,QAAQ,cAAc,EAAEC,yBAAe,CAAC,IAAI,CAAE,GAAE,IAAI,CAAC,YAAa,GAAE,SAAS;AAC7E,OAAO,CAAC;AACR,MAAM,GAAG,KAAK,CAAC,QAAQ;AACvB,KAAK,CAAA;AACL;AACA,IAAI,MAAM,QAAS,GAAEC,yBAAW,CAAC,IAAI,CAAC,CAAA;AACtC,IAAI,MAAM,eAAA,GAAkBC,qBAAW,CAAC,QAAQ,CAAE,GAAE,QAAQ,CAAC,IAAK,GAAE,SAAS,CAAA;AAC7E,IAAI,IAAI,eAAe,EAAE;AACzB,MAAM,KAAK,CAAC,IAAK,GAAE,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,MAAM,CAAA;AAClE,KAAI;AACJ;AACA,IAAI,OAAO,KAAK,CAAA;AAChB,GAAG,CAAC,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"setupEventContextTrace.js","sources":["../../src/setupEventContextTrace.ts"],"sourcesContent":["import type { Client } from '@sentry/types';\nimport { dropUndefinedKeys } from '@sentry/utils';\n\nimport { getActiveSpan, getRootSpan } from './utils/getActiveSpan';\nimport { spanHasName, spanHasParentId } from './utils/spanTypes';\n\n/** Ensure the `trace` context is set on all events. */\nexport function setupEventContextTrace(client: Client): void {\n client.addEventProcessor(event => {\n const span = getActiveSpan();\n // For transaction events, this is handled separately\n // Because the active span may not be the span that is actually the transaction event\n if (!span || event.type === 'transaction') {\n return event;\n }\n\n const spanContext = span.spanContext();\n\n // If event has already set `trace` context, use that one.\n event.contexts = {\n trace: dropUndefinedKeys({\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n parent_span_id: spanHasParentId(span) ? span.parentSpanId : undefined,\n }),\n ...event.contexts,\n };\n\n const rootSpan = getRootSpan(span);\n const transactionName = spanHasName(rootSpan) ? rootSpan.name : undefined;\n if (transactionName && !event.transaction) {\n event.transaction = transactionName;\n }\n\n return event;\n });\n}\n"],"names":["getActiveSpan","dropUndefinedKeys","spanHasParentId","getRootSpan","spanHasName"],"mappings":";;;;;;AAMA;AACO,SAAS,sBAAsB,CAAC,MAAM,EAAgB;AAC7D,EAAE,MAAM,CAAC,iBAAiB,CAAC,SAAS;AACpC,IAAI,MAAM,IAAA,GAAOA,2BAAa,EAAE,CAAA;AAChC;AACA;AACA,IAAI,IAAI,CAAC,IAAK,IAAG,KAAK,CAAC,IAAA,KAAS,aAAa,EAAE;AAC/C,MAAM,OAAO,KAAK,CAAA;AAClB,KAAI;AACJ;AACA,IAAI,MAAM,WAAY,GAAE,IAAI,CAAC,WAAW,EAAE,CAAA;AAC1C;AACA;AACA,IAAI,KAAK,CAAC,QAAA,GAAW;AACrB,MAAM,KAAK,EAAEC,uBAAiB,CAAC;AAC/B,QAAQ,QAAQ,EAAE,WAAW,CAAC,OAAO;AACrC,QAAQ,OAAO,EAAE,WAAW,CAAC,MAAM;AACnC,QAAQ,cAAc,EAAEC,yBAAe,CAAC,IAAI,CAAE,GAAE,IAAI,CAAC,YAAa,GAAE,SAAS;AAC7E,OAAO,CAAC;AACR,MAAM,GAAG,KAAK,CAAC,QAAQ;AACvB,KAAK,CAAA;AACL;AACA,IAAI,MAAM,QAAS,GAAEC,yBAAW,CAAC,IAAI,CAAC,CAAA;AACtC,IAAI,MAAM,eAAA,GAAkBC,qBAAW,CAAC,QAAQ,CAAE,GAAE,QAAQ,CAAC,IAAK,GAAE,SAAS,CAAA;AAC7E,IAAI,IAAI,eAAgB,IAAG,CAAC,KAAK,CAAC,WAAW,EAAE;AAC/C,MAAM,KAAK,CAAC,WAAY,GAAE,eAAe,CAAA;AACzC,KAAI;AACJ;AACA,IAAI,OAAO,KAAK,CAAA;AAChB,GAAG,CAAC,CAAA;AACJ;;;;"}
@@ -186,14 +186,7 @@ function createTransactionForOtelSpan(span) {
186
186
  });
187
187
 
188
188
  if (capturedSpanScopes) {
189
- // Ensure the `transaction` tag is correctly set on the transaction event
190
- const scope = capturedSpanScopes.scope.clone();
191
- scope.addEventProcessor(event => {
192
- event.tags = { transaction: description, ...event.tags };
193
- return event;
194
- });
195
-
196
- setCapturedScopesOnTransaction(transaction$1, scope, capturedSpanScopes.isolationScope);
189
+ setCapturedScopesOnTransaction(transaction$1, capturedSpanScopes.scope, capturedSpanScopes.isolationScope);
197
190
  }
198
191
 
199
192
  return transaction$1;
@@ -1 +1 @@
1
- {"version":3,"file":"spanExporter.js","sources":["../../src/spanExporter.ts"],"sourcesContent":["import { SpanKind } from '@opentelemetry/api';\nimport type { ExportResult } from '@opentelemetry/core';\nimport { ExportResultCode } from '@opentelemetry/core';\nimport type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type { SentrySpan, Transaction } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n getCurrentHub,\n} from '@sentry/core';\nimport type { Scope, SpanOrigin, TransactionSource } from '@sentry/types';\nimport { addNonEnumerableProperty, dropUndefinedKeys, logger } from '@sentry/utils';\nimport { startTransaction } from './custom/transaction';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { InternalSentrySemanticAttributes } from './semanticAttributes';\nimport { convertOtelTimeToSeconds } from './utils/convertOtelTimeToSeconds';\nimport { getDynamicSamplingContextFromSpan } from './utils/dynamicSamplingContext';\nimport { getRequestSpanData } from './utils/getRequestSpanData';\nimport type { SpanNode } from './utils/groupSpansWithParents';\nimport { groupSpansWithParents } from './utils/groupSpansWithParents';\nimport { mapStatus } from './utils/mapStatus';\nimport { parseSpanDescription } from './utils/parseSpanDescription';\nimport { getSpanHub, getSpanMetadata, getSpanScopes } from './utils/spanData';\n\ntype SpanNodeCompleted = SpanNode & { span: ReadableSpan };\n\n/**\n * A Sentry-specific exporter that converts OpenTelemetry Spans to Sentry Spans & Transactions.\n */\nexport class SentrySpanExporter implements SpanExporter {\n private _finishedSpans: ReadableSpan[];\n private _stopped: boolean;\n\n public constructor() {\n this._stopped = false;\n this._finishedSpans = [];\n }\n\n /** @inheritDoc */\n public export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void {\n if (this._stopped) {\n return resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been stopped'),\n });\n }\n\n const openSpanCount = this._finishedSpans.length;\n const newSpanCount = spans.length;\n\n this._finishedSpans.push(...spans);\n\n const remainingSpans = maybeSend(this._finishedSpans);\n\n const remainingOpenSpanCount = remainingSpans.length;\n const sentSpanCount = openSpanCount + newSpanCount - remainingOpenSpanCount;\n\n DEBUG_BUILD &&\n logger.log(`SpanExporter exported ${sentSpanCount} spans, ${remainingOpenSpanCount} unsent spans remaining`);\n\n this._finishedSpans = remainingSpans.filter(span => {\n const shouldDrop = shouldCleanupSpan(span, 5 * 60);\n DEBUG_BUILD &&\n shouldDrop &&\n logger.log(\n `SpanExporter dropping span ${span.name} (${\n span.spanContext().spanId\n }) because it is pending for more than 5 minutes.`,\n );\n return !shouldDrop;\n });\n\n resultCallback({ code: ExportResultCode.SUCCESS });\n }\n\n /** @inheritDoc */\n public shutdown(): Promise<void> {\n const forceFlush = this.forceFlush();\n this._stopped = true;\n this._finishedSpans = [];\n return forceFlush;\n }\n\n /** @inheritDoc */\n public forceFlush(): Promise<void> {\n return new Promise(resolve => {\n this.export(this._finishedSpans, () => resolve());\n });\n }\n}\n\n/**\n * Send the given spans, but only if they are part of a finished transaction.\n *\n * Returns the unsent spans.\n * Spans remain unsent when their parent span is not yet finished.\n * This will happen regularly, as child spans are generally finished before their parents.\n * But it _could_ also happen because, for whatever reason, a parent span was lost.\n * In this case, we'll eventually need to clean this up.\n */\nfunction maybeSend(spans: ReadableSpan[]): ReadableSpan[] {\n const grouped = groupSpansWithParents(spans);\n const remaining = new Set(grouped);\n\n const rootNodes = getCompletedRootNodes(grouped);\n\n rootNodes.forEach(root => {\n remaining.delete(root);\n const span = root.span;\n const transaction = createTransactionForOtelSpan(span);\n\n root.children.forEach(child => {\n createAndFinishSpanForOtelSpan(child, transaction, remaining);\n });\n\n transaction.end(span.endTime);\n });\n\n return Array.from(remaining)\n .map(node => node.span)\n .filter((span): span is ReadableSpan => !!span);\n}\n\nfunction getCompletedRootNodes(nodes: SpanNode[]): SpanNodeCompleted[] {\n return nodes.filter((node): node is SpanNodeCompleted => !!node.span && !node.parentNode);\n}\n\nfunction shouldCleanupSpan(span: ReadableSpan, maxStartTimeOffsetSeconds: number): boolean {\n const cutoff = Date.now() / 1000 - maxStartTimeOffsetSeconds;\n return convertOtelTimeToSeconds(span.startTime) < cutoff;\n}\n\nfunction parseSpan(span: ReadableSpan): { op?: string; origin?: SpanOrigin; source?: TransactionSource } {\n const attributes = span.attributes;\n\n const origin = attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined;\n const op = attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] as string | undefined;\n const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] as TransactionSource | undefined;\n\n return { origin, op, source };\n}\n\nfunction createTransactionForOtelSpan(span: ReadableSpan): Transaction {\n // eslint-disable-next-line deprecation/deprecation\n const hub = getSpanHub(span) || getCurrentHub();\n const spanContext = span.spanContext();\n const spanId = spanContext.spanId;\n const traceId = spanContext.traceId;\n const parentSpanId = span.parentSpanId;\n\n const parentSampled = span.attributes[InternalSentrySemanticAttributes.PARENT_SAMPLED] as boolean | undefined;\n\n const { op, description, data, origin, source } = getSpanData(span);\n const metadata = getSpanMetadata(span);\n const capturedSpanScopes = getSpanScopes(span);\n\n const sampleRate = span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] as number | undefined;\n\n const attributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: sampleRate,\n ...data,\n ...removeSentryAttributes(span.attributes),\n };\n\n const dynamicSamplingContext = getDynamicSamplingContextFromSpan(span);\n\n const transaction = startTransaction(hub, {\n spanId,\n traceId,\n parentSpanId,\n parentSampled,\n name: description,\n op,\n startTimestamp: convertOtelTimeToSeconds(span.startTime),\n metadata: {\n ...dropUndefinedKeys({\n dynamicSamplingContext,\n sampleRate,\n }),\n ...metadata,\n },\n attributes,\n origin,\n sampled: true,\n });\n\n transaction.setStatus(mapStatus(span));\n\n // We currently don't want to write this to the scope because it would mutate it.\n // In the future we will likely have some sort of transaction payload factory where we can pass this context in directly\n // eslint-disable-next-line deprecation/deprecation\n transaction.setContext('otel', {\n attributes: removeSentryAttributes(span.attributes),\n resource: span.resource.attributes,\n });\n\n if (capturedSpanScopes) {\n // Ensure the `transaction` tag is correctly set on the transaction event\n const scope = capturedSpanScopes.scope.clone();\n scope.addEventProcessor(event => {\n event.tags = { transaction: description, ...event.tags };\n return event;\n });\n\n setCapturedScopesOnTransaction(transaction, scope, capturedSpanScopes.isolationScope);\n }\n\n return transaction;\n}\n\nfunction createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: SentrySpan, remaining: Set<SpanNode>): void {\n remaining.delete(node);\n const span = node.span;\n\n const shouldDrop = !span;\n\n // If this span should be dropped, we still want to create spans for the children of this\n if (shouldDrop) {\n node.children.forEach(child => {\n createAndFinishSpanForOtelSpan(child, sentryParentSpan, remaining);\n });\n return;\n }\n\n const spanId = span.spanContext().spanId;\n const { attributes } = span;\n\n const { op, description, data, origin } = getSpanData(span);\n const allData = { ...removeSentryAttributes(attributes), ...data };\n\n // eslint-disable-next-line deprecation/deprecation\n const sentrySpan = sentryParentSpan.startChild({\n name: description,\n op,\n data: allData,\n startTimestamp: convertOtelTimeToSeconds(span.startTime),\n spanId,\n origin,\n }) as SentrySpan;\n sentrySpan.setStatus(mapStatus(span));\n\n node.children.forEach(child => {\n createAndFinishSpanForOtelSpan(child, sentrySpan, remaining);\n });\n\n sentrySpan.end(convertOtelTimeToSeconds(span.endTime));\n}\n\nfunction getSpanData(span: ReadableSpan): {\n data: Record<string, unknown>;\n op?: string;\n description: string;\n source?: TransactionSource;\n origin?: SpanOrigin;\n} {\n const { op: definedOp, source: definedSource, origin } = parseSpan(span);\n const { op: inferredOp, description, source: inferredSource, data: inferredData } = parseSpanDescription(span);\n\n const op = definedOp || inferredOp;\n const source = definedSource || inferredSource;\n\n const data = { ...inferredData, ...getData(span) };\n\n return {\n op,\n description,\n source,\n origin,\n data,\n };\n}\n\n/**\n * Remove custom `sentry.` attribtues we do not need to send.\n * These are more carrier attributes we use inside of the SDK, we do not need to send them to the API.\n */\nfunction removeSentryAttributes(data: Record<string, unknown>): Record<string, unknown> {\n const cleanedData = { ...data };\n\n /* eslint-disable @typescript-eslint/no-dynamic-delete */\n delete cleanedData[InternalSentrySemanticAttributes.PARENT_SAMPLED];\n delete cleanedData[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];\n /* eslint-enable @typescript-eslint/no-dynamic-delete */\n\n return cleanedData;\n}\n\nfunction getData(span: ReadableSpan): Record<string, unknown> {\n const attributes = span.attributes;\n const data: Record<string, unknown> = {\n 'otel.kind': SpanKind[span.kind],\n };\n\n if (attributes[SemanticAttributes.HTTP_STATUS_CODE]) {\n const statusCode = attributes[SemanticAttributes.HTTP_STATUS_CODE] as string;\n data['http.response.status_code'] = statusCode;\n }\n\n const requestData = getRequestSpanData(span);\n\n if (requestData.url) {\n data.url = requestData.url;\n }\n\n if (requestData['http.query']) {\n data['http.query'] = requestData['http.query'].slice(1);\n }\n if (requestData['http.fragment']) {\n data['http.fragment'] = requestData['http.fragment'].slice(1);\n }\n\n return data;\n}\n\nconst SCOPE_ON_START_SPAN_FIELD = '_sentryScope';\nconst ISOLATION_SCOPE_ON_START_SPAN_FIELD = '_sentryIsolationScope';\n\n/** Sets the scope and isolation scope to be used for when the transaction is finished. */\nfunction setCapturedScopesOnTransaction(span: Transaction, scope: Scope, isolationScope: Scope): void {\n if (span) {\n addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, isolationScope);\n addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope);\n }\n}\n"],"names":["ExportResultCode","DEBUG_BUILD","logger","groupSpansWithParents","convertOtelTimeToSeconds","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","getSpanHub","getCurrentHub","InternalSentrySemanticAttributes","getSpanMetadata","getSpanScopes","SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE","dynamicSamplingContext","getDynamicSamplingContextFromSpan","transaction","startTransaction","dropUndefinedKeys","mapStatus","parseSpanDescription","SpanKind","SemanticAttributes","getRequestSpanData","addNonEnumerableProperty"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA;AACA;AACA;AACO,MAAM,oBAA2C;;AAIxD,GAAS,WAAW,GAAG;AACvB,IAAI,IAAI,CAAC,QAAS,GAAE,KAAK,CAAA;AACzB,IAAI,IAAI,CAAC,cAAe,GAAE,EAAE,CAAA;AAC5B,GAAE;AACF;AACA;AACA,GAAS,MAAM,CAAC,KAAK,EAAkB,cAAc,EAAwC;AAC7F,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AACvB,MAAM,OAAO,cAAc,CAAC;AAC5B,QAAQ,IAAI,EAAEA,qBAAgB,CAAC,MAAM;AACrC,QAAQ,KAAK,EAAE,IAAI,KAAK,CAAC,2BAA2B,CAAC;AACrD,OAAO,CAAC,CAAA;AACR,KAAI;AACJ;AACA,IAAI,MAAM,aAAc,GAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAA;AACpD,IAAI,MAAM,YAAA,GAAe,KAAK,CAAC,MAAM,CAAA;AACrC;AACA,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;AACtC;AACA,IAAI,MAAM,iBAAiB,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;AACzD;AACA,IAAI,MAAM,sBAAA,GAAyB,cAAc,CAAC,MAAM,CAAA;AACxD,IAAI,MAAM,aAAc,GAAE,gBAAgB,YAAA,GAAe,sBAAsB,CAAA;AAC/E;AACA,IAAIC,sBAAY;AAChB,MAAMC,YAAM,CAAC,GAAG,CAAC,CAAC,sBAAsB,EAAE,aAAa,CAAC,QAA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,mCAAmC,EAAE,cAAc,CAAC,CAAA;AACvF,IAAIA,8BAAwB,CAAC,IAAI,EAAE,yBAAyB,EAAE,KAAK,CAAC,CAAA;AACpE,GAAE;AACF;;;;"}
1
+ {"version":3,"file":"spanExporter.js","sources":["../../src/spanExporter.ts"],"sourcesContent":["import { SpanKind } from '@opentelemetry/api';\nimport type { ExportResult } from '@opentelemetry/core';\nimport { ExportResultCode } from '@opentelemetry/core';\nimport type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type { SentrySpan, Transaction } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n getCurrentHub,\n} from '@sentry/core';\nimport type { Scope, SpanOrigin, TransactionSource } from '@sentry/types';\nimport { addNonEnumerableProperty, dropUndefinedKeys, logger } from '@sentry/utils';\nimport { startTransaction } from './custom/transaction';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { InternalSentrySemanticAttributes } from './semanticAttributes';\nimport { convertOtelTimeToSeconds } from './utils/convertOtelTimeToSeconds';\nimport { getDynamicSamplingContextFromSpan } from './utils/dynamicSamplingContext';\nimport { getRequestSpanData } from './utils/getRequestSpanData';\nimport type { SpanNode } from './utils/groupSpansWithParents';\nimport { groupSpansWithParents } from './utils/groupSpansWithParents';\nimport { mapStatus } from './utils/mapStatus';\nimport { parseSpanDescription } from './utils/parseSpanDescription';\nimport { getSpanHub, getSpanMetadata, getSpanScopes } from './utils/spanData';\n\ntype SpanNodeCompleted = SpanNode & { span: ReadableSpan };\n\n/**\n * A Sentry-specific exporter that converts OpenTelemetry Spans to Sentry Spans & Transactions.\n */\nexport class SentrySpanExporter implements SpanExporter {\n private _finishedSpans: ReadableSpan[];\n private _stopped: boolean;\n\n public constructor() {\n this._stopped = false;\n this._finishedSpans = [];\n }\n\n /** @inheritDoc */\n public export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void {\n if (this._stopped) {\n return resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been stopped'),\n });\n }\n\n const openSpanCount = this._finishedSpans.length;\n const newSpanCount = spans.length;\n\n this._finishedSpans.push(...spans);\n\n const remainingSpans = maybeSend(this._finishedSpans);\n\n const remainingOpenSpanCount = remainingSpans.length;\n const sentSpanCount = openSpanCount + newSpanCount - remainingOpenSpanCount;\n\n DEBUG_BUILD &&\n logger.log(`SpanExporter exported ${sentSpanCount} spans, ${remainingOpenSpanCount} unsent spans remaining`);\n\n this._finishedSpans = remainingSpans.filter(span => {\n const shouldDrop = shouldCleanupSpan(span, 5 * 60);\n DEBUG_BUILD &&\n shouldDrop &&\n logger.log(\n `SpanExporter dropping span ${span.name} (${\n span.spanContext().spanId\n }) because it is pending for more than 5 minutes.`,\n );\n return !shouldDrop;\n });\n\n resultCallback({ code: ExportResultCode.SUCCESS });\n }\n\n /** @inheritDoc */\n public shutdown(): Promise<void> {\n const forceFlush = this.forceFlush();\n this._stopped = true;\n this._finishedSpans = [];\n return forceFlush;\n }\n\n /** @inheritDoc */\n public forceFlush(): Promise<void> {\n return new Promise(resolve => {\n this.export(this._finishedSpans, () => resolve());\n });\n }\n}\n\n/**\n * Send the given spans, but only if they are part of a finished transaction.\n *\n * Returns the unsent spans.\n * Spans remain unsent when their parent span is not yet finished.\n * This will happen regularly, as child spans are generally finished before their parents.\n * But it _could_ also happen because, for whatever reason, a parent span was lost.\n * In this case, we'll eventually need to clean this up.\n */\nfunction maybeSend(spans: ReadableSpan[]): ReadableSpan[] {\n const grouped = groupSpansWithParents(spans);\n const remaining = new Set(grouped);\n\n const rootNodes = getCompletedRootNodes(grouped);\n\n rootNodes.forEach(root => {\n remaining.delete(root);\n const span = root.span;\n const transaction = createTransactionForOtelSpan(span);\n\n root.children.forEach(child => {\n createAndFinishSpanForOtelSpan(child, transaction, remaining);\n });\n\n transaction.end(span.endTime);\n });\n\n return Array.from(remaining)\n .map(node => node.span)\n .filter((span): span is ReadableSpan => !!span);\n}\n\nfunction getCompletedRootNodes(nodes: SpanNode[]): SpanNodeCompleted[] {\n return nodes.filter((node): node is SpanNodeCompleted => !!node.span && !node.parentNode);\n}\n\nfunction shouldCleanupSpan(span: ReadableSpan, maxStartTimeOffsetSeconds: number): boolean {\n const cutoff = Date.now() / 1000 - maxStartTimeOffsetSeconds;\n return convertOtelTimeToSeconds(span.startTime) < cutoff;\n}\n\nfunction parseSpan(span: ReadableSpan): { op?: string; origin?: SpanOrigin; source?: TransactionSource } {\n const attributes = span.attributes;\n\n const origin = attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined;\n const op = attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] as string | undefined;\n const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] as TransactionSource | undefined;\n\n return { origin, op, source };\n}\n\nfunction createTransactionForOtelSpan(span: ReadableSpan): Transaction {\n // eslint-disable-next-line deprecation/deprecation\n const hub = getSpanHub(span) || getCurrentHub();\n const spanContext = span.spanContext();\n const spanId = spanContext.spanId;\n const traceId = spanContext.traceId;\n const parentSpanId = span.parentSpanId;\n\n const parentSampled = span.attributes[InternalSentrySemanticAttributes.PARENT_SAMPLED] as boolean | undefined;\n\n const { op, description, data, origin, source } = getSpanData(span);\n const metadata = getSpanMetadata(span);\n const capturedSpanScopes = getSpanScopes(span);\n\n const sampleRate = span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] as number | undefined;\n\n const attributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: sampleRate,\n ...data,\n ...removeSentryAttributes(span.attributes),\n };\n\n const dynamicSamplingContext = getDynamicSamplingContextFromSpan(span);\n\n const transaction = startTransaction(hub, {\n spanId,\n traceId,\n parentSpanId,\n parentSampled,\n name: description,\n op,\n startTimestamp: convertOtelTimeToSeconds(span.startTime),\n metadata: {\n ...dropUndefinedKeys({\n dynamicSamplingContext,\n sampleRate,\n }),\n ...metadata,\n },\n attributes,\n origin,\n sampled: true,\n });\n\n transaction.setStatus(mapStatus(span));\n\n // We currently don't want to write this to the scope because it would mutate it.\n // In the future we will likely have some sort of transaction payload factory where we can pass this context in directly\n // eslint-disable-next-line deprecation/deprecation\n transaction.setContext('otel', {\n attributes: removeSentryAttributes(span.attributes),\n resource: span.resource.attributes,\n });\n\n if (capturedSpanScopes) {\n setCapturedScopesOnTransaction(transaction, capturedSpanScopes.scope, capturedSpanScopes.isolationScope);\n }\n\n return transaction;\n}\n\nfunction createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: SentrySpan, remaining: Set<SpanNode>): void {\n remaining.delete(node);\n const span = node.span;\n\n const shouldDrop = !span;\n\n // If this span should be dropped, we still want to create spans for the children of this\n if (shouldDrop) {\n node.children.forEach(child => {\n createAndFinishSpanForOtelSpan(child, sentryParentSpan, remaining);\n });\n return;\n }\n\n const spanId = span.spanContext().spanId;\n const { attributes } = span;\n\n const { op, description, data, origin } = getSpanData(span);\n const allData = { ...removeSentryAttributes(attributes), ...data };\n\n // eslint-disable-next-line deprecation/deprecation\n const sentrySpan = sentryParentSpan.startChild({\n name: description,\n op,\n data: allData,\n startTimestamp: convertOtelTimeToSeconds(span.startTime),\n spanId,\n origin,\n }) as SentrySpan;\n sentrySpan.setStatus(mapStatus(span));\n\n node.children.forEach(child => {\n createAndFinishSpanForOtelSpan(child, sentrySpan, remaining);\n });\n\n sentrySpan.end(convertOtelTimeToSeconds(span.endTime));\n}\n\nfunction getSpanData(span: ReadableSpan): {\n data: Record<string, unknown>;\n op?: string;\n description: string;\n source?: TransactionSource;\n origin?: SpanOrigin;\n} {\n const { op: definedOp, source: definedSource, origin } = parseSpan(span);\n const { op: inferredOp, description, source: inferredSource, data: inferredData } = parseSpanDescription(span);\n\n const op = definedOp || inferredOp;\n const source = definedSource || inferredSource;\n\n const data = { ...inferredData, ...getData(span) };\n\n return {\n op,\n description,\n source,\n origin,\n data,\n };\n}\n\n/**\n * Remove custom `sentry.` attribtues we do not need to send.\n * These are more carrier attributes we use inside of the SDK, we do not need to send them to the API.\n */\nfunction removeSentryAttributes(data: Record<string, unknown>): Record<string, unknown> {\n const cleanedData = { ...data };\n\n /* eslint-disable @typescript-eslint/no-dynamic-delete */\n delete cleanedData[InternalSentrySemanticAttributes.PARENT_SAMPLED];\n delete cleanedData[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];\n /* eslint-enable @typescript-eslint/no-dynamic-delete */\n\n return cleanedData;\n}\n\nfunction getData(span: ReadableSpan): Record<string, unknown> {\n const attributes = span.attributes;\n const data: Record<string, unknown> = {\n 'otel.kind': SpanKind[span.kind],\n };\n\n if (attributes[SemanticAttributes.HTTP_STATUS_CODE]) {\n const statusCode = attributes[SemanticAttributes.HTTP_STATUS_CODE] as string;\n data['http.response.status_code'] = statusCode;\n }\n\n const requestData = getRequestSpanData(span);\n\n if (requestData.url) {\n data.url = requestData.url;\n }\n\n if (requestData['http.query']) {\n data['http.query'] = requestData['http.query'].slice(1);\n }\n if (requestData['http.fragment']) {\n data['http.fragment'] = requestData['http.fragment'].slice(1);\n }\n\n return data;\n}\n\nconst SCOPE_ON_START_SPAN_FIELD = '_sentryScope';\nconst ISOLATION_SCOPE_ON_START_SPAN_FIELD = '_sentryIsolationScope';\n\n/** Sets the scope and isolation scope to be used for when the transaction is finished. */\nfunction setCapturedScopesOnTransaction(span: Transaction, scope: Scope, isolationScope: Scope): void {\n if (span) {\n addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, isolationScope);\n addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope);\n }\n}\n"],"names":["ExportResultCode","DEBUG_BUILD","logger","groupSpansWithParents","convertOtelTimeToSeconds","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","getSpanHub","getCurrentHub","InternalSentrySemanticAttributes","getSpanMetadata","getSpanScopes","SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE","dynamicSamplingContext","getDynamicSamplingContextFromSpan","transaction","startTransaction","dropUndefinedKeys","mapStatus","parseSpanDescription","SpanKind","SemanticAttributes","getRequestSpanData","addNonEnumerableProperty"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA;AACA;AACA;AACO,MAAM,oBAA2C;;AAIxD,GAAS,WAAW,GAAG;AACvB,IAAI,IAAI,CAAC,QAAS,GAAE,KAAK,CAAA;AACzB,IAAI,IAAI,CAAC,cAAe,GAAE,EAAE,CAAA;AAC5B,GAAE;AACF;AACA;AACA,GAAS,MAAM,CAAC,KAAK,EAAkB,cAAc,EAAwC;AAC7F,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AACvB,MAAM,OAAO,cAAc,CAAC;AAC5B,QAAQ,IAAI,EAAEA,qBAAgB,CAAC,MAAM;AACrC,QAAQ,KAAK,EAAE,IAAI,KAAK,CAAC,2BAA2B,CAAC;AACrD,OAAO,CAAC,CAAA;AACR,KAAI;AACJ;AACA,IAAI,MAAM,aAAc,GAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAA;AACpD,IAAI,MAAM,YAAA,GAAe,KAAK,CAAC,MAAM,CAAA;AACrC;AACA,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;AACtC;AACA,IAAI,MAAM,iBAAiB,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;AACzD;AACA,IAAI,MAAM,sBAAA,GAAyB,cAAc,CAAC,MAAM,CAAA;AACxD,IAAI,MAAM,aAAc,GAAE,gBAAgB,YAAA,GAAe,sBAAsB,CAAA;AAC/E;AACA,IAAIC,sBAAY;AA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./spanExporter.js');
9
9
  const captureExceptionForTimedEvent = require('./utils/captureExceptionForTimedEvent.js');
10
10
  const contextData = require('./utils/contextData.js');
11
+ const setupCheck = require('./utils/setupCheck.js');
11
12
  const spanData = require('./utils/spanData.js');
12
13
 
13
14
  function onSpanStart(span, parentContext) {
@@ -55,6 +56,8 @@ function onSpanEnd(span) {
55
56
  class SentrySpanProcessor extends sdkTraceBase.BatchSpanProcessor {
56
57
  constructor() {
57
58
  super(new spanExporter.SentrySpanExporter());
59
+
60
+ setupCheck.setIsSetup('SentrySpanProcessor');
58
61
  }
59
62
 
60
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"spanProcessor.js","sources":["../../src/spanProcessor.ts"],"sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport { ROOT_CONTEXT, trace } from '@opentelemetry/api';\nimport type { Span, SpanProcessor as SpanProcessorInterface } from '@opentelemetry/sdk-trace-base';\nimport { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';\nimport { getCurrentHub } from '@sentry/core';\nimport { logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { SentrySpanExporter } from './spanExporter';\nimport { maybeCaptureExceptionForTimedEvent } from './utils/captureExceptionForTimedEvent';\nimport { getHubFromContext } from './utils/contextData';\nimport { getSpanHub, setSpanHub, setSpanParent, setSpanScopes } from './utils/spanData';\n\nfunction onSpanStart(span: Span, parentContext: Context): void {\n // This is a reliable way to get the parent span - because this is exactly how the parent is identified in the OTEL SDK\n const parentSpan = trace.getSpan(parentContext);\n const hub = getHubFromContext(parentContext);\n\n // We need access to the parent span in order to be able to move up the span tree for breadcrumbs\n if (parentSpan) {\n setSpanParent(span, parentSpan);\n }\n\n // The root context does not have a hub stored, so we check for this specifically\n // We do this instead of just falling back to `getCurrentHub` to avoid attaching the wrong hub\n let actualHub = hub;\n if (parentContext === ROOT_CONTEXT) {\n // eslint-disable-next-line deprecation/deprecation\n actualHub = getCurrentHub();\n }\n\n // We need the scope at time of span creation in order to apply it to the event when the span is finished\n if (actualHub) {\n // eslint-disable-next-line deprecation/deprecation\n const scope = actualHub.getScope();\n // eslint-disable-next-line deprecation/deprecation\n const isolationScope = actualHub.getIsolationScope();\n setSpanHub(span, actualHub);\n setSpanScopes(span, { scope, isolationScope });\n }\n}\n\nfunction onSpanEnd(span: Span): void {\n // Capture exceptions as events\n // eslint-disable-next-line deprecation/deprecation\n const hub = getSpanHub(span) || getCurrentHub();\n span.events.forEach(event => {\n maybeCaptureExceptionForTimedEvent(hub, event, span);\n });\n}\n\n/**\n * Converts OpenTelemetry Spans to Sentry Spans and sends them to Sentry via\n * the Sentry SDK.\n */\nexport class SentrySpanProcessor extends BatchSpanProcessor implements SpanProcessorInterface {\n public constructor() {\n super(new SentrySpanExporter());\n }\n\n /**\n * @inheritDoc\n */\n public onStart(span: Span, parentContext: Context): void {\n onSpanStart(span, parentContext);\n\n DEBUG_BUILD && logger.log(`[Tracing] Starting span \"${span.name}\" (${span.spanContext().spanId})`);\n\n return super.onStart(span, parentContext);\n }\n\n /** @inheritDoc */\n public onEnd(span: Span): void {\n DEBUG_BUILD && logger.log(`[Tracing] Finishing span \"${span.name}\" (${span.spanContext().spanId})`);\n\n if (!this._shouldSendSpanToSentry(span)) {\n // Prevent this being called to super.onEnd(), which would pass this to the span exporter\n return;\n }\n\n onSpanEnd(span);\n\n return super.onEnd(span);\n }\n\n /**\n * You can overwrite this in a sub class to implement custom behavior for dropping spans.\n * If you return `false` here, the span will not be passed to the exporter and thus not be sent.\n */\n protected _shouldSendSpanToSentry(_span: Span): boolean {\n return true;\n }\n}\n"],"names":["trace","getHubFromContext","setSpanParent","ROOT_CONTEXT","getCurrentHub","setSpanHub","setSpanScopes","getSpanHub","maybeCaptureExceptionForTimedEvent","BatchSpanProcessor","SentrySpanExporter","DEBUG_BUILD","logger"],"mappings":";;;;;;;;;;;;AAaA,SAAS,WAAW,CAAC,IAAI,EAAQ,aAAa,EAAiB;AAC/D;AACA,EAAE,MAAM,aAAa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B;AAC3D,IAAI,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;AACpC;AACA,IAAIC,sBAAA,IAAeC,YAAM,CAAC,GAAG,CAAC,CAAC,yBAAyB,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AACtG;AACA,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;AAC7C,GAAE;AACF;AACA;AACA,GAAS,KAAK,CAAC,IAAI,EAAc;AACjC,IAAID,sBAAA,IAAeC,YAAM,CAAC,GAAG,CAAC,CAAC,0BAA0B,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AACvG;AACA,IAAI,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE;AAC7C;AACA,MAAM,OAAM;AACZ,KAAI;AACJ;AACA,IAAI,SAAS,CAAC,IAAI,CAAC,CAAA;AACnB;AACA,IAAI,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC5B,GAAE;AACF;AACA;AACA;AACA;AACA;AACA,GAAY,uBAAuB,CAAC,KAAK,EAAiB;AAC1D,IAAI,OAAO,IAAI,CAAA;AACf,GAAE;AACF;;;;"}
1
+ {"version":3,"file":"spanProcessor.js","sources":["../../src/spanProcessor.ts"],"sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport { ROOT_CONTEXT, trace } from '@opentelemetry/api';\nimport type { Span, SpanProcessor as SpanProcessorInterface } from '@opentelemetry/sdk-trace-base';\nimport { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';\nimport { getCurrentHub } from '@sentry/core';\nimport { logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { SentrySpanExporter } from './spanExporter';\nimport { maybeCaptureExceptionForTimedEvent } from './utils/captureExceptionForTimedEvent';\nimport { getHubFromContext } from './utils/contextData';\nimport { setIsSetup } from './utils/setupCheck';\nimport { getSpanHub, setSpanHub, setSpanParent, setSpanScopes } from './utils/spanData';\n\nfunction onSpanStart(span: Span, parentContext: Context): void {\n // This is a reliable way to get the parent span - because this is exactly how the parent is identified in the OTEL SDK\n const parentSpan = trace.getSpan(parentContext);\n const hub = getHubFromContext(parentContext);\n\n // We need access to the parent span in order to be able to move up the span tree for breadcrumbs\n if (parentSpan) {\n setSpanParent(span, parentSpan);\n }\n\n // The root context does not have a hub stored, so we check for this specifically\n // We do this instead of just falling back to `getCurrentHub` to avoid attaching the wrong hub\n let actualHub = hub;\n if (parentContext === ROOT_CONTEXT) {\n // eslint-disable-next-line deprecation/deprecation\n actualHub = getCurrentHub();\n }\n\n // We need the scope at time of span creation in order to apply it to the event when the span is finished\n if (actualHub) {\n // eslint-disable-next-line deprecation/deprecation\n const scope = actualHub.getScope();\n // eslint-disable-next-line deprecation/deprecation\n const isolationScope = actualHub.getIsolationScope();\n setSpanHub(span, actualHub);\n setSpanScopes(span, { scope, isolationScope });\n }\n}\n\nfunction onSpanEnd(span: Span): void {\n // Capture exceptions as events\n // eslint-disable-next-line deprecation/deprecation\n const hub = getSpanHub(span) || getCurrentHub();\n span.events.forEach(event => {\n maybeCaptureExceptionForTimedEvent(hub, event, span);\n });\n}\n\n/**\n * Converts OpenTelemetry Spans to Sentry Spans and sends them to Sentry via\n * the Sentry SDK.\n */\nexport class SentrySpanProcessor extends BatchSpanProcessor implements SpanProcessorInterface {\n public constructor() {\n super(new SentrySpanExporter());\n\n setIsSetup('SentrySpanProcessor');\n }\n\n /**\n * @inheritDoc\n */\n public onStart(span: Span, parentContext: Context): void {\n onSpanStart(span, parentContext);\n\n DEBUG_BUILD && logger.log(`[Tracing] Starting span \"${span.name}\" (${span.spanContext().spanId})`);\n\n return super.onStart(span, parentContext);\n }\n\n /** @inheritDoc */\n public onEnd(span: Span): void {\n DEBUG_BUILD && logger.log(`[Tracing] Finishing span \"${span.name}\" (${span.spanContext().spanId})`);\n\n if (!this._shouldSendSpanToSentry(span)) {\n // Prevent this being called to super.onEnd(), which would pass this to the span exporter\n return;\n }\n\n onSpanEnd(span);\n\n return super.onEnd(span);\n }\n\n /**\n * You can overwrite this in a sub class to implement custom behavior for dropping spans.\n * If you return `false` here, the span will not be passed to the exporter and thus not be sent.\n */\n protected _shouldSendSpanToSentry(_span: Span): boolean {\n return true;\n }\n}\n"],"names":["trace","getHubFromContext","setSpanParent","ROOT_CONTEXT","getCurrentHub","setSpanHub","setSpanScopes","getSpanHub","maybeCaptureExceptionForTimedEvent","BatchSpanProcessor","SentrySpanExporter","setIsSetup","DEBUG_BUILD","logger"],"mappings":";;;;;;;;;;;;;AAcA,SAAS,WAAW,CAAC,IAAI,EAAQ,aAAa,EAAiB;AAC/D;AACA,EAAE,MAAM,aAAaA,SAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AACjD,EAAE,MAAM,GAAI,GAAEC,6BAAiB,CAAC,aAAa,CAAC,CAAA;AAC9C;AACA;AACA,EAAE,IAAI,UAAU,EAAE;AAClB,IAAIC,sBAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AACnC,GAAE;AACF;AACA;AACA;AACA,EAAE,IAAI,SAAU,GAAE,GAAG,CAAA;AACrB,EAAE,IAAI,aAAc,KAAIC,gBAAY,EAAE;AACtC;AACA,IAAI,SAAU,GAAEC,kBAAa,EAAE,CAAA;AAC/B,GAAE;AACF;AACA;AACA,EAAE,IAAI,SAAS,EAAE;AACjB;AACA,IAAI,MAAM,KAAM,GAAE,SAAS,CAAC,QAAQ,EAAE,CAAA;AACtC;AACA,IAAI,MAAM,cAAe,GAAE,SAAS,CAAC,iBAAiB,EAAE,CAAA;AACxD,IAAIC,mBAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;AAC/B,IAAIC,sBAAa,CAAC,IAAI,EAAE,EAAE,KAAK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AAC,EAAE;AAC7C;AACA,MAAM,OAAM;AACZ,KAAI;AACJ;AACA,IAAI,SAAS,CAAC,IAAI,CAAC,CAAA;AACnB;AACA,IAAI,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC5B,GAAE;AACF;AACA;AACA;AACA;AACA;AACA,GAAY,uBAAuB,CAAC,KAAK,EAAiB;AAC1D,IAAI,OAAO,IAAI,CAAA;AACf,GAAE;AACF;;;;"}
@@ -4,22 +4,6 @@ const constants = require('../constants.js');
4
4
 
5
5
  const SCOPE_CONTEXT_MAP = new WeakMap();
6
6
 
7
- /**
8
- * Try to get the Propagation Context from the given OTEL context.
9
- * This requires the SentryPropagator to be registered.
10
- */
11
- function getPropagationContextFromContext(context) {
12
- return context.getValue(constants.SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY) ;
13
- }
14
-
15
- /**
16
- * Set a Propagation Context on an OTEL context..
17
- * This will return a forked context with the Propagation Context set.
18
- */
19
- function setPropagationContextOnContext(context, propagationContext) {
20
- return context.setValue(constants.SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, propagationContext);
21
- }
22
-
23
7
  /**
24
8
  * Try to get the Hub from the given OTEL context.
25
9
  * This requires a Context Manager that was wrapped with getWrappedContextManager.
@@ -70,10 +54,8 @@ function getContextFromScope(scope) {
70
54
 
71
55
  exports.getContextFromScope = getContextFromScope;
72
56
  exports.getHubFromContext = getHubFromContext;
73
- exports.getPropagationContextFromContext = getPropagationContextFromContext;
74
57
  exports.getScopesFromContext = getScopesFromContext;
75
58
  exports.setContextOnScope = setContextOnScope;
76
59
  exports.setHubOnContext = setHubOnContext;
77
- exports.setPropagationContextOnContext = setPropagationContextOnContext;
78
60
  exports.setScopesOnContext = setScopesOnContext;
79
61
  //# sourceMappingURL=contextData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contextData.js","sources":["../../../src/utils/contextData.ts"],"sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport type { Hub, PropagationContext, Scope } from '@sentry/types';\n\nimport {\n SENTRY_HUB_CONTEXT_KEY,\n SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY,\n SENTRY_SCOPES_CONTEXT_KEY,\n} from '../constants';\nimport type { CurrentScopes } from '../types';\n\nconst SCOPE_CONTEXT_MAP = new WeakMap<Scope, Context>();\n\n/**\n * Try to get the Propagation Context from the given OTEL context.\n * This requires the SentryPropagator to be registered.\n */\nexport function getPropagationContextFromContext(context: Context): PropagationContext | undefined {\n return context.getValue(SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY) as PropagationContext | undefined;\n}\n\n/**\n * Set a Propagation Context on an OTEL context..\n * This will return a forked context with the Propagation Context set.\n */\nexport function setPropagationContextOnContext(context: Context, propagationContext: PropagationContext): Context {\n return context.setValue(SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, propagationContext);\n}\n\n/**\n * Try to get the Hub from the given OTEL context.\n * This requires a Context Manager that was wrapped with getWrappedContextManager.\n */\nexport function getHubFromContext(context: Context): Hub | undefined {\n return context.getValue(SENTRY_HUB_CONTEXT_KEY) as Hub | undefined;\n}\n\n/**\n * Set a Hub on an OTEL context..\n * This will return a forked context with the Propagation Context set.\n */\nexport function setHubOnContext(context: Context, hub: Hub): Context {\n return context.setValue(SENTRY_HUB_CONTEXT_KEY, hub);\n}\n\n/**\n * Try to get the current scopes from the given OTEL context.\n * This requires a Context Manager that was wrapped with getWrappedContextManager.\n */\nexport function getScopesFromContext(context: Context): CurrentScopes | undefined {\n return context.getValue(SENTRY_SCOPES_CONTEXT_KEY) as CurrentScopes | undefined;\n}\n\n/**\n * Set the current scopes on an OTEL context.\n * This will return a forked context with the Propagation Context set.\n */\nexport function setScopesOnContext(context: Context, scopes: CurrentScopes): Context {\n return context.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);\n}\n\n/**\n * Set the context on the scope so we can later look it up.\n * We need this to get the context from the scope in the `trace` functions.\n */\nexport function setContextOnScope(scope: Scope, context: Context): void {\n SCOPE_CONTEXT_MAP.set(scope, context);\n}\n\n/**\n * Get the context related to a scope.\n * TODO v8: Use this for the `trace` functions.\n * */\nexport function getContextFromScope(scope: Scope): Context | undefined {\n return SCOPE_CONTEXT_MAP.get(scope);\n}\n"],"names":["SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY","SENTRY_HUB_CONTEXT_KEY","SENTRY_SCOPES_CONTEXT_KEY"],"mappings":";;;;AAUA,MAAM,iBAAkB,GAAE,IAAI,OAAO,EAAkB,CAAA;AACvD;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA2C;AACnG,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gDAAsC,CAAE,EAAA;AAClE,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,OAAO,EAAW,kBAAkB,EAA+B;AAClH,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gDAAsC,EAAE,kBAAkB,CAAC,CAAA;AACrF,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAA4B;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACC,gCAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gCAAsB,EAAE,GAAG,CAAC,CAAA;AACtD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,OAAO,EAAsC;AAClF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACC,mCAAyB,CAAE,EAAA;AACrD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,OAAO,EAAW,MAAM,EAA0B;AACrF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,mCAAyB,EAAE,MAAM,CAAC,CAAA;AAC5D,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,KAAK,EAAS,OAAO,EAAiB;AACxE,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,KAAK,EAA8B;AACvE,EAAE,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACrC;;;;;;;;;;;"}
1
+ {"version":3,"file":"contextData.js","sources":["../../../src/utils/contextData.ts"],"sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport type { Hub, Scope } from '@sentry/types';\n\nimport { SENTRY_HUB_CONTEXT_KEY, SENTRY_SCOPES_CONTEXT_KEY } from '../constants';\nimport type { CurrentScopes } from '../types';\n\nconst SCOPE_CONTEXT_MAP = new WeakMap<Scope, Context>();\n\n/**\n * Try to get the Hub from the given OTEL context.\n * This requires a Context Manager that was wrapped with getWrappedContextManager.\n */\nexport function getHubFromContext(context: Context): Hub | undefined {\n return context.getValue(SENTRY_HUB_CONTEXT_KEY) as Hub | undefined;\n}\n\n/**\n * Set a Hub on an OTEL context..\n * This will return a forked context with the Propagation Context set.\n */\nexport function setHubOnContext(context: Context, hub: Hub): Context {\n return context.setValue(SENTRY_HUB_CONTEXT_KEY, hub);\n}\n\n/**\n * Try to get the current scopes from the given OTEL context.\n * This requires a Context Manager that was wrapped with getWrappedContextManager.\n */\nexport function getScopesFromContext(context: Context): CurrentScopes | undefined {\n return context.getValue(SENTRY_SCOPES_CONTEXT_KEY) as CurrentScopes | undefined;\n}\n\n/**\n * Set the current scopes on an OTEL context.\n * This will return a forked context with the Propagation Context set.\n */\nexport function setScopesOnContext(context: Context, scopes: CurrentScopes): Context {\n return context.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);\n}\n\n/**\n * Set the context on the scope so we can later look it up.\n * We need this to get the context from the scope in the `trace` functions.\n */\nexport function setContextOnScope(scope: Scope, context: Context): void {\n SCOPE_CONTEXT_MAP.set(scope, context);\n}\n\n/**\n * Get the context related to a scope.\n * TODO v8: Use this for the `trace` functions.\n * */\nexport function getContextFromScope(scope: Scope): Context | undefined {\n return SCOPE_CONTEXT_MAP.get(scope);\n}\n"],"names":["SENTRY_HUB_CONTEXT_KEY","SENTRY_SCOPES_CONTEXT_KEY"],"mappings":";;;;AAMA,MAAM,iBAAkB,GAAE,IAAI,OAAO,EAAkB,CAAA;AACvD;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAA4B;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gCAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,gCAAsB,EAAE,GAAG,CAAC,CAAA;AACtD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,OAAO,EAAsC;AAClF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACC,mCAAyB,CAAE,EAAA;AACrD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,OAAO,EAAW,MAAM,EAA0B;AACrF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAACA,mCAAyB,EAAE,MAAM,CAAC,CAAA;AAC5D,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,KAAK,EAAS,OAAO,EAAiB;AACxE,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACvC,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,KAAK,EAA8B;AACvE,EAAE,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACrC;;;;;;;;;"}
@@ -2,6 +2,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
3
  const api = require('@opentelemetry/api');
4
4
  const semanticConventions = require('@opentelemetry/semantic-conventions');
5
+ const core = require('@sentry/core');
5
6
  const spanTypes = require('./spanTypes.js');
6
7
 
7
8
  // canonicalCodesHTTPMap maps some HTTP codes to Sentry's span statuses. See possible mapping in https://develop.sentry.dev/sdk/event-payloads/span/
@@ -53,23 +54,23 @@ function mapStatus(span) {
53
54
  if (code) {
54
55
  const sentryStatus = canonicalCodesHTTPMap[code];
55
56
  if (sentryStatus) {
56
- return sentryStatus;
57
+ return { code: core.SPAN_STATUS_ERROR, message: sentryStatus };
57
58
  }
58
59
  }
59
60
 
60
61
  if (typeof grpcCode === 'string') {
61
62
  const sentryStatus = canonicalCodesGrpcMap[grpcCode];
62
63
  if (sentryStatus) {
63
- return sentryStatus;
64
+ return { code: core.SPAN_STATUS_ERROR, message: sentryStatus };
64
65
  }
65
66
  }
66
67
 
67
68
  const statusCode = status && status.code;
68
69
  if (statusCode === api.SpanStatusCode.OK || statusCode === api.SpanStatusCode.UNSET) {
69
- return 'ok';
70
+ return { code: core.SPAN_STATUS_OK };
70
71
  }
71
72
 
72
- return 'unknown_error';
73
+ return { code: core.SPAN_STATUS_ERROR, message: 'unknown_error' };
73
74
  }
74
75
 
75
76
  exports.mapStatus = mapStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"mapStatus.js","sources":["../../../src/utils/mapStatus.ts"],"sourcesContent":["import { SpanStatusCode } from '@opentelemetry/api';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type { SpanStatusType as SentryStatus } from '@sentry/core';\n\nimport type { AbstractSpan } from '../types';\nimport { spanHasAttributes, spanHasStatus } from './spanTypes';\n\n// canonicalCodesHTTPMap maps some HTTP codes to Sentry's span statuses. See possible mapping in https://develop.sentry.dev/sdk/event-payloads/span/\nconst canonicalCodesHTTPMap: Record<string, SentryStatus> = {\n '400': 'failed_precondition',\n '401': 'unauthenticated',\n '403': 'permission_denied',\n '404': 'not_found',\n '409': 'aborted',\n '429': 'resource_exhausted',\n '499': 'cancelled',\n '500': 'internal_error',\n '501': 'unimplemented',\n '503': 'unavailable',\n '504': 'deadline_exceeded',\n} as const;\n\n// canonicalCodesGrpcMap maps some GRPC codes to Sentry's span statuses. See description in grpc documentation.\nconst canonicalCodesGrpcMap: Record<string, SentryStatus> = {\n '1': 'cancelled',\n '2': 'unknown_error',\n '3': 'invalid_argument',\n '4': 'deadline_exceeded',\n '5': 'not_found',\n '6': 'already_exists',\n '7': 'permission_denied',\n '8': 'resource_exhausted',\n '9': 'failed_precondition',\n '10': 'aborted',\n '11': 'out_of_range',\n '12': 'unimplemented',\n '13': 'internal_error',\n '14': 'unavailable',\n '15': 'data_loss',\n '16': 'unauthenticated',\n} as const;\n\n/**\n * Get a Sentry span status from an otel span.\n */\nexport function mapStatus(span: AbstractSpan): SentryStatus {\n const attributes = spanHasAttributes(span) ? span.attributes : {};\n const status = spanHasStatus(span) ? span.status : undefined;\n\n const httpCode = attributes[SemanticAttributes.HTTP_STATUS_CODE];\n const grpcCode = attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE];\n\n const code = typeof httpCode === 'string' ? httpCode : typeof httpCode === 'number' ? httpCode.toString() : undefined;\n if (code) {\n const sentryStatus = canonicalCodesHTTPMap[code];\n if (sentryStatus) {\n return sentryStatus;\n }\n }\n\n if (typeof grpcCode === 'string') {\n const sentryStatus = canonicalCodesGrpcMap[grpcCode];\n if (sentryStatus) {\n return sentryStatus;\n }\n }\n\n const statusCode = status && status.code;\n if (statusCode === SpanStatusCode.OK || statusCode === SpanStatusCode.UNSET) {\n return 'ok';\n }\n\n return 'unknown_error';\n}\n"],"names":["spanHasAttributes","spanHasStatus","SemanticAttributes","SpanStatusCode"],"mappings":";;;;;;AAOA;AACA,MAAM,qBAAqB,GAAiC;AAC5D,EAAE,KAAK,EAAE,qBAAqB;AAC9B,EAAE,KAAK,EAAE,iBAAiB;AAC1B,EAAE,KAAK,EAAE,mBAAmB;AAC5B,EAAE,KAAK,EAAE,WAA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OAAO,aAAa,QAAA,GAAW,QAAS,GAAE,OAAO,QAAS,KAAI,WAAW,QAAQ,CAAC,QAAQ,EAAG,GAAE,SAAS,CAAA;AACvH,EAAE,IAAI,IAAI,EAAE;AACZ,IAAI,MAAM,YAAa,GAAE,qBAAqB,CAAC,IAAI,CAAC,CAAA;AACpD,IAAI,IAAI,YAAY,EAAE;AACtB,MAAM,OAAO,YAAY,CAAA;AACzB,KAAI;AACJ,GAAE;AACF;AACA,EAAE,IAAI,OAAO,QAAS,KAAI,QAAQ,EAAE;AACpC,IAAI,MAAM,YAAa,GAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAA;AACxD,IAAI,IAAI,YAAY,EAAE;AACtB,MAAM,OAAO,YAAY,CAAA;AACzB,KAAI;AACJ,GAAE;AACF;AACA,EAAE,MAAM,UAAW,GAAE,UAAU,MAAM,CAAC,IAAI,CAAA;AAC1C,EAAE,IAAI,UAAW,KAAIC,kBAAc,CAAC,EAAG,IAAG,UAAW,KAAIA,kBAAc,CAAC,KAAK,EAAE;AAC/E,IAAI,OAAO,IAAI,CAAA;AACf,GAAE;AACF;AACA,EAAE,OAAO,eAAe,CAAA;AACxB;;;;"}
1
+ {"version":3,"file":"mapStatus.js","sources":["../../../src/utils/mapStatus.ts"],"sourcesContent":["import { SpanStatusCode } from '@opentelemetry/api';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';\nimport type { SpanStatus } from '@sentry/types';\n\nimport type { AbstractSpan } from '../types';\nimport { spanHasAttributes, spanHasStatus } from './spanTypes';\n\n// canonicalCodesHTTPMap maps some HTTP codes to Sentry's span statuses. See possible mapping in https://develop.sentry.dev/sdk/event-payloads/span/\nconst canonicalCodesHTTPMap: Record<string, SpanStatus['message']> = {\n '400': 'failed_precondition',\n '401': 'unauthenticated',\n '403': 'permission_denied',\n '404': 'not_found',\n '409': 'aborted',\n '429': 'resource_exhausted',\n '499': 'cancelled',\n '500': 'internal_error',\n '501': 'unimplemented',\n '503': 'unavailable',\n '504': 'deadline_exceeded',\n} as const;\n\n// canonicalCodesGrpcMap maps some GRPC codes to Sentry's span statuses. See description in grpc documentation.\nconst canonicalCodesGrpcMap: Record<string, SpanStatus['message']> = {\n '1': 'cancelled',\n '2': 'unknown_error',\n '3': 'invalid_argument',\n '4': 'deadline_exceeded',\n '5': 'not_found',\n '6': 'already_exists',\n '7': 'permission_denied',\n '8': 'resource_exhausted',\n '9': 'failed_precondition',\n '10': 'aborted',\n '11': 'out_of_range',\n '12': 'unimplemented',\n '13': 'internal_error',\n '14': 'unavailable',\n '15': 'data_loss',\n '16': 'unauthenticated',\n} as const;\n\n/**\n * Get a Sentry span status from an otel span.\n */\nexport function mapStatus(span: AbstractSpan): SpanStatus {\n const attributes = spanHasAttributes(span) ? span.attributes : {};\n const status = spanHasStatus(span) ? span.status : undefined;\n\n const httpCode = attributes[SemanticAttributes.HTTP_STATUS_CODE];\n const grpcCode = attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE];\n\n const code = typeof httpCode === 'string' ? httpCode : typeof httpCode === 'number' ? httpCode.toString() : undefined;\n if (code) {\n const sentryStatus = canonicalCodesHTTPMap[code];\n if (sentryStatus) {\n return { code: SPAN_STATUS_ERROR, message: sentryStatus };\n }\n }\n\n if (typeof grpcCode === 'string') {\n const sentryStatus = canonicalCodesGrpcMap[grpcCode];\n if (sentryStatus) {\n return { code: SPAN_STATUS_ERROR, message: sentryStatus };\n }\n }\n\n const statusCode = status && status.code;\n if (statusCode === SpanStatusCode.OK || statusCode === SpanStatusCode.UNSET) {\n return { code: SPAN_STATUS_OK };\n }\n\n return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };\n}\n"],"names":["spanHasAttributes","spanHasStatus","SemanticAttributes","SPAN_STATUS_ERROR","SpanStatusCode","SPAN_STATUS_OK"],"mappings":";;;;;;;AAQA;AACA,MAAM,qBAAqB,GAA0C;AACrE,EAAE,KAAK,EAAE,qBAA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AClE,EAAE,MAAM,WAAW,UAAU,CAACA,sCAAkB,CAAC,oBAAoB,CAAC,CAAA;AACtE;AACA,EAAE,MAAM,OAAO,OAAO,aAAa,QAAA,GAAW,QAAS,GAAE,OAAO,QAAS,KAAI,WAAW,QAAQ,CAAC,QAAQ,EAAG,GAAE,SAAS,CAAA;AACvH,EAAE,IAAI,IAAI,EAAE;AACZ,IAAI,MAAM,YAAa,GAAE,qBAAqB,CAAC,IAAI,CAAC,CAAA;AACpD,IAAI,IAAI,YAAY,EAAE;AACtB,MAAM,OAAO,EAAE,IAAI,EAAEC,sBAAiB,EAAE,OAAO,EAAE,YAAA,EAAc,CAAA;AAC/D,KAAI;AACJ,GAAE;AACF;AACA,EAAE,IAAI,OAAO,QAAS,KAAI,QAAQ,EAAE;AACpC,IAAI,MAAM,YAAa,GAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAA;AACxD,IAAI,IAAI,YAAY,EAAE;AACtB,MAAM,OAAO,EAAE,IAAI,EAAEA,sBAAiB,EAAE,OAAO,EAAE,YAAA,EAAc,CAAA;AAC/D,KAAI;AACJ,GAAE;AACF;AACA,EAAE,MAAM,UAAW,GAAE,UAAU,MAAM,CAAC,IAAI,CAAA;AAC1C,EAAE,IAAI,UAAW,KAAIC,kBAAc,CAAC,EAAG,IAAG,UAAW,KAAIA,kBAAc,CAAC,KAAK,EAAE;AAC/E,IAAI,OAAO,EAAE,IAAI,EAAEC,qBAAgB,CAAA;AACnC,GAAE;AACF;AACA,EAAE,OAAO,EAAE,IAAI,EAAEF,sBAAiB,EAAE,OAAO,EAAE,eAAA,EAAiB,CAAA;AAC9D;;;;"}
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ const setupElements = new Set();
4
+
5
+ /** Get all the OpenTelemetry elements that have been set up. */
6
+ function openTelemetrySetupCheck() {
7
+ return Array.from(setupElements);
8
+ }
9
+
10
+ /** Mark an OpenTelemetry element as setup. */
11
+ function setIsSetup(element) {
12
+ setupElements.add(element);
13
+ }
14
+
15
+ exports.openTelemetrySetupCheck = openTelemetrySetupCheck;
16
+ exports.setIsSetup = setIsSetup;
17
+ //# sourceMappingURL=setupCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupCheck.js","sources":["../../../src/utils/setupCheck.ts"],"sourcesContent":["type OpenTelemetryElement = 'SentrySpanProcessor' | 'SentryContextManager' | 'SentryPropagator' | 'SentrySampler';\n\nconst setupElements = new Set<OpenTelemetryElement>();\n\n/** Get all the OpenTelemetry elements that have been set up. */\nexport function openTelemetrySetupCheck(): OpenTelemetryElement[] {\n return Array.from(setupElements);\n}\n\n/** Mark an OpenTelemetry element as setup. */\nexport function setIsSetup(element: OpenTelemetryElement): void {\n setupElements.add(element);\n}\n\n/** Only exported for tests. */\nexport function clearOpenTelemetrySetupCheck(): void {\n setupElements.clear();\n}\n"],"names":[],"mappings":";;AAEA,MAAM,aAAc,GAAE,IAAI,GAAG,EAAwB,CAAA;AACrD;AACA;AACO,SAAS,uBAAuB,GAA2B;AAClE,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAClC,CAAA;AACA;AACA;AACO,SAAS,UAAU,CAAC,OAAO,EAA8B;AAChE,EAAE,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AAC5B;;;;;"}
package/esm/constants.js CHANGED
@@ -3,9 +3,7 @@ import { createContextKey } from '@opentelemetry/api';
3
3
  const SENTRY_TRACE_HEADER = 'sentry-trace';
4
4
  const SENTRY_BAGGAGE_HEADER = 'baggage';
5
5
  const SENTRY_TRACE_STATE_DSC = 'sentry.trace';
6
-
7
- /** Context Key to hold a PropagationContext. */
8
- const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY = createContextKey('SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY');
6
+ const SENTRY_TRACE_STATE_PARENT_SPAN_ID = 'sentry.parent_span_id';
9
7
 
10
8
  /** Context Key to hold a Hub. */
11
9
  const SENTRY_HUB_CONTEXT_KEY = createContextKey('sentry_hub');
@@ -18,5 +16,5 @@ const SENTRY_FORK_SET_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_set_scop
18
16
 
19
17
  const SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_set_isolation_scope');
20
18
 
21
- export { SENTRY_BAGGAGE_HEADER, SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_SCOPE_CONTEXT_KEY, SENTRY_HUB_CONTEXT_KEY, SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, SENTRY_SCOPES_CONTEXT_KEY, SENTRY_TRACE_HEADER, SENTRY_TRACE_STATE_DSC };
19
+ export { SENTRY_BAGGAGE_HEADER, SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_SCOPE_CONTEXT_KEY, SENTRY_HUB_CONTEXT_KEY, SENTRY_SCOPES_CONTEXT_KEY, SENTRY_TRACE_HEADER, SENTRY_TRACE_STATE_DSC, SENTRY_TRACE_STATE_PARENT_SPAN_ID };
22
20
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["import { createContextKey } from '@opentelemetry/api';\n\nexport const SENTRY_TRACE_HEADER = 'sentry-trace';\nexport const SENTRY_BAGGAGE_HEADER = 'baggage';\nexport const SENTRY_TRACE_STATE_DSC = 'sentry.trace';\n\n/** Context Key to hold a PropagationContext. */\nexport const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY = createContextKey('SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY');\n\n/** Context Key to hold a Hub. */\nexport const SENTRY_HUB_CONTEXT_KEY = createContextKey('sentry_hub');\n\nexport const SENTRY_SCOPES_CONTEXT_KEY = createContextKey('sentry_scopes');\n\nexport const SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_isolation_scope');\n\nexport const SENTRY_FORK_SET_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_set_scope');\n\nexport const SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_set_isolation_scope');\n"],"names":[],"mappings":";;AAEO,MAAM,mBAAoB,GAAE,eAAc;AAC1C,MAAM,qBAAsB,GAAE,UAAS;AACvC,MAAM,sBAAuB,GAAE,eAAc;AACpD;AACA;MACa,sCAAuC,GAAE,gBAAgB,CAAC,wCAAwC,EAAC;AAChH;AACA;MACa,sBAAuB,GAAE,gBAAgB,CAAC,YAAY,EAAC;AACpE;MACa,yBAA0B,GAAE,gBAAgB,CAAC,eAAe,EAAC;AAC1E;MACa,uCAAwC,GAAE,gBAAgB,CAAC,6BAA6B,EAAC;AACtG;MACa,iCAAkC,GAAE,gBAAgB,CAAC,uBAAuB,EAAC;AAC1F;MACa,2CAA4C,GAAE,gBAAgB,CAAC,iCAAiC;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["import { createContextKey } from '@opentelemetry/api';\n\nexport const SENTRY_TRACE_HEADER = 'sentry-trace';\nexport const SENTRY_BAGGAGE_HEADER = 'baggage';\nexport const SENTRY_TRACE_STATE_DSC = 'sentry.trace';\nexport const SENTRY_TRACE_STATE_PARENT_SPAN_ID = 'sentry.parent_span_id';\n\n/** Context Key to hold a Hub. */\nexport const SENTRY_HUB_CONTEXT_KEY = createContextKey('sentry_hub');\n\nexport const SENTRY_SCOPES_CONTEXT_KEY = createContextKey('sentry_scopes');\n\nexport const SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_isolation_scope');\n\nexport const SENTRY_FORK_SET_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_set_scope');\n\nexport const SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY = createContextKey('sentry_fork_set_isolation_scope');\n"],"names":[],"mappings":";;AAEO,MAAM,mBAAoB,GAAE,eAAc;AAC1C,MAAM,qBAAsB,GAAE,UAAS;AACvC,MAAM,sBAAuB,GAAE,eAAc;AAC7C,MAAM,iCAAkC,GAAE,wBAAuB;AACxE;AACA;MACa,sBAAuB,GAAE,gBAAgB,CAAC,YAAY,EAAC;AACpE;MACa,yBAA0B,GAAE,gBAAgB,CAAC,eAAe,EAAC;AAC1E;MACa,uCAAwC,GAAE,gBAAgB,CAAC,6BAA6B,EAAC;AACtG;MACa,iCAAkC,GAAE,gBAAgB,CAAC,uBAAuB,EAAC;AAC1F;MACa,2CAA4C,GAAE,gBAAgB,CAAC,iCAAiC;;;;"}
@@ -3,6 +3,7 @@ import { getCurrentScope, getIsolationScope } from '@sentry/core';
3
3
  import { SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY } from './constants.js';
4
4
  import { getCurrentHub } from './custom/getCurrentHub.js';
5
5
  import { getScopesFromContext, setHubOnContext, setScopesOnContext, setContextOnScope } from './utils/contextData.js';
6
+ import { setIsSetup } from './utils/setupCheck.js';
6
7
 
7
8
  /**
8
9
  * Wrap an OpenTelemetry ContextManager in a way that ensures the context is kept in sync with the Sentry Hub.
@@ -25,6 +26,10 @@ function wrapContextManagerClass(
25
26
 
26
27
  // @ts-expect-error TS does not like this, but we know this is fine
27
28
  class SentryContextManager extends ContextManagerClass {
29
+ constructor() {
30
+ super();
31
+ setIsSetup('SentryContextManager');
32
+ }
28
33
  /**
29
34
  * Overwrite with() of the original AsyncLocalStorageContextManager
30
35
  * to ensure we also create a new hub per context.
@@ -1 +1 @@
1
- {"version":3,"file":"contextManager.js","sources":["../../src/contextManager.ts"],"sourcesContent":["import type { Context, ContextManager } from '@opentelemetry/api';\nimport { getCurrentScope, getIsolationScope } from '@sentry/core';\nimport type { Scope } from '@sentry/types';\n\nimport {\n SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY,\n SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY,\n SENTRY_FORK_SET_SCOPE_CONTEXT_KEY,\n} from './constants';\nimport { getCurrentHub } from './custom/getCurrentHub';\nimport { getScopesFromContext, setContextOnScope, setHubOnContext, setScopesOnContext } from './utils/contextData';\n\n/**\n * Wrap an OpenTelemetry ContextManager in a way that ensures the context is kept in sync with the Sentry Hub.\n *\n * Usage:\n * import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';\n * const SentryContextManager = wrapContextManagerClass(AsyncLocalStorageContextManager);\n * const contextManager = new SentryContextManager();\n */\nexport function wrapContextManagerClass<ContextManagerInstance extends ContextManager>(\n ContextManagerClass: new (...args: unknown[]) => ContextManagerInstance,\n): typeof ContextManagerClass {\n /**\n * This is a custom ContextManager for OpenTelemetry, which extends the default AsyncLocalStorageContextManager.\n * It ensures that we create a new hub per context, so that the OTEL Context & the Sentry Hub are always in sync.\n *\n * Note that we currently only support AsyncHooks with this,\n * but since this should work for Node 14+ anyhow that should be good enough.\n */\n\n // @ts-expect-error TS does not like this, but we know this is fine\n class SentryContextManager extends ContextManagerClass {\n /**\n * Overwrite with() of the original AsyncLocalStorageContextManager\n * to ensure we also create a new hub per context.\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 currentScopes = getScopesFromContext(context);\n const currentScope = currentScopes?.scope || getCurrentScope();\n const currentIsolationScope = currentScopes?.isolationScope || getIsolationScope();\n\n const shouldForkIsolationScope = context.getValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY) === true;\n const scope = context.getValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY) as Scope | undefined;\n const isolationScope = context.getValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY) as Scope | undefined;\n\n const newCurrentScope = scope || currentScope.clone();\n const newIsolationScope =\n isolationScope || (shouldForkIsolationScope ? currentIsolationScope.clone() : currentIsolationScope);\n const scopes = { scope: newCurrentScope, isolationScope: newIsolationScope };\n\n const mockHub = {\n // eslint-disable-next-line deprecation/deprecation\n ...getCurrentHub(),\n getScope: () => newCurrentScope,\n getIsolationScope: () => newIsolationScope,\n };\n\n const ctx1 = setHubOnContext(context, mockHub);\n const ctx2 = setScopesOnContext(ctx1, scopes);\n\n // Remove the unneeded values again\n const ctx3 = ctx2\n .deleteValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY)\n .deleteValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY)\n .deleteValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);\n\n setContextOnScope(newCurrentScope, ctx3);\n\n return super.with(ctx3, fn, thisArg, ...args);\n }\n }\n\n return SentryContextManager as unknown as typeof ContextManagerClass;\n}\n"],"names":[],"mappings":";;;;;;AAYA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA;CACA;CACA,EAAA,CAAA,CAAA,CAAA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,EAAE,CAAA,CAAA,CAAA,CAAI,CAAC;;MAExC,CAAO,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAI,CAAC,CAAI,CAAA,CAAA,CAAA,EAAE,CAAE,CAAA,EAAE,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAE,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC;IAC/C;EACF;;EAEA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,qBAAqB;AAC9B;;"}
1
+ {"version":3,"file":"contextManager.js","sources":["../../src/contextManager.ts"],"sourcesContent":["import type { Context, ContextManager } from '@opentelemetry/api';\nimport { getCurrentScope, getIsolationScope } from '@sentry/core';\nimport type { Scope } from '@sentry/types';\n\nimport {\n SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY,\n SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY,\n SENTRY_FORK_SET_SCOPE_CONTEXT_KEY,\n} from './constants';\nimport { getCurrentHub } from './custom/getCurrentHub';\nimport { getScopesFromContext, setContextOnScope, setHubOnContext, setScopesOnContext } from './utils/contextData';\nimport { setIsSetup } from './utils/setupCheck';\n\n/**\n * Wrap an OpenTelemetry ContextManager in a way that ensures the context is kept in sync with the Sentry Hub.\n *\n * Usage:\n * import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';\n * const SentryContextManager = wrapContextManagerClass(AsyncLocalStorageContextManager);\n * const contextManager = new SentryContextManager();\n */\nexport function wrapContextManagerClass<ContextManagerInstance extends ContextManager>(\n ContextManagerClass: new (...args: unknown[]) => ContextManagerInstance,\n): typeof ContextManagerClass {\n /**\n * This is a custom ContextManager for OpenTelemetry, which extends the default AsyncLocalStorageContextManager.\n * It ensures that we create a new hub per context, so that the OTEL Context & the Sentry Hub are always in sync.\n *\n * Note that we currently only support AsyncHooks with this,\n * but since this should work for Node 14+ anyhow that should be good enough.\n */\n\n // @ts-expect-error TS does not like this, but we know this is fine\n class SentryContextManager extends ContextManagerClass {\n public constructor() {\n super();\n setIsSetup('SentryContextManager');\n }\n /**\n * Overwrite with() of the original AsyncLocalStorageContextManager\n * to ensure we also create a new hub per context.\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 currentScopes = getScopesFromContext(context);\n const currentScope = currentScopes?.scope || getCurrentScope();\n const currentIsolationScope = currentScopes?.isolationScope || getIsolationScope();\n\n const shouldForkIsolationScope = context.getValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY) === true;\n const scope = context.getValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY) as Scope | undefined;\n const isolationScope = context.getValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY) as Scope | undefined;\n\n const newCurrentScope = scope || currentScope.clone();\n const newIsolationScope =\n isolationScope || (shouldForkIsolationScope ? currentIsolationScope.clone() : currentIsolationScope);\n const scopes = { scope: newCurrentScope, isolationScope: newIsolationScope };\n\n const mockHub = {\n // eslint-disable-next-line deprecation/deprecation\n ...getCurrentHub(),\n getScope: () => newCurrentScope,\n getIsolationScope: () => newIsolationScope,\n };\n\n const ctx1 = setHubOnContext(context, mockHub);\n const ctx2 = setScopesOnContext(ctx1, scopes);\n\n // Remove the unneeded values again\n const ctx3 = ctx2\n .deleteValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY)\n .deleteValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY)\n .deleteValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);\n\n setContextOnScope(newCurrentScope, ctx3);\n\n return super.with(ctx3, fn, thisArg, ...args);\n }\n }\n\n return SentryContextManager as unknown as typeof ContextManagerClass;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,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC;IAC/C;EACF;;EAEA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,qBAAqB;AAC9B;;"}
package/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { getRequestSpanData } from './utils/getRequestSpanData.js';
4
4
  export { wrapClientClass } from './custom/client.js';
5
5
  export { getSpanKind } from './utils/getSpanKind.js';
6
6
  export { getSpanHub, getSpanMetadata, getSpanParent, getSpanScopes, setSpanMetadata } from './utils/spanData.js';
7
- export { getPropagationContextFromContext, getScopesFromContext, setPropagationContextOnContext } from './utils/contextData.js';
7
+ export { getScopesFromContext } from './utils/contextData.js';
8
8
  export { spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus } from './utils/spanTypes.js';
9
9
  export { isSentryRequestSpan } from './utils/isSentryRequest.js';
10
10
  export { getActiveSpan, getRootSpan } from './utils/getActiveSpan.js';
@@ -18,6 +18,7 @@ export { wrapContextManagerClass } from './contextManager.js';
18
18
  export { SentryPropagator } from './propagator.js';
19
19
  export { SentrySpanProcessor } from './spanProcessor.js';
20
20
  export { SentrySampler } from './sampler.js';
21
+ export { openTelemetrySetupCheck } from './utils/setupCheck.js';
21
22
  export { getClient } from '@sentry/core';
22
23
 
23
24
  /**
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { addOriginToSpan } from './utils/addOriginToSpan';\nimport { maybeCaptureExceptionForTimedEvent } from './utils/captureExceptionForTimedEvent';\nimport { getRequestSpanData } from './utils/getRequestSpanData';\n\nexport type { OpenTelemetryClient } from './types';\nexport { wrapClientClass } from './custom/client';\n\nexport { getSpanKind } from './utils/getSpanKind';\nexport {\n getSpanHub,\n getSpanMetadata,\n getSpanParent,\n setSpanMetadata,\n getSpanScopes,\n} from './utils/spanData';\n\nexport {\n getPropagationContextFromContext,\n setPropagationContextOnContext,\n getScopesFromContext,\n} from './utils/contextData';\n\nexport {\n spanHasAttributes,\n spanHasEvents,\n spanHasKind,\n spanHasName,\n spanHasParentId,\n spanHasStatus,\n} from './utils/spanTypes';\n\nexport { isSentryRequestSpan } from './utils/isSentryRequest';\n\nexport { getActiveSpan, getRootSpan } from './utils/getActiveSpan';\nexport { startSpan, startSpanManual, startInactiveSpan, withActiveSpan } from './trace';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { setupGlobalHub } from './custom/hub';\n// eslint-disable-next-line deprecation/deprecation\nexport { getCurrentHub } from './custom/getCurrentHub';\nexport { addTracingExtensions } from './custom/hubextensions';\nexport { setupEventContextTrace } from './setupEventContextTrace';\n\nexport { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrategy';\nexport { wrapContextManagerClass } from './contextManager';\nexport { SentryPropagator } from './propagator';\nexport { SentrySpanProcessor } from './spanProcessor';\nexport { SentrySampler } from './sampler';\n\n// Legacy\nexport { getClient } from '@sentry/core';\n\n/**\n * The following internal utils are not considered public API and are subject to change.\n * @hidden\n */\nconst _INTERNAL = {\n addOriginToSpan,\n maybeCaptureExceptionForTimedEvent,\n getRequestSpanData,\n} as const;\n\nexport { _INTERNAL };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoDA;AACA;AACA;AACA;AACA,MAAM,YAAY;AAClB,EAAE,eAAe;AACjB,EAAE,kCAAkC;AACpC,EAAE,kBAAkB;AACpB,CAAE;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { addOriginToSpan } from './utils/addOriginToSpan';\nimport { maybeCaptureExceptionForTimedEvent } from './utils/captureExceptionForTimedEvent';\nimport { getRequestSpanData } from './utils/getRequestSpanData';\n\nexport type { OpenTelemetryClient } from './types';\nexport { wrapClientClass } from './custom/client';\n\nexport { getSpanKind } from './utils/getSpanKind';\nexport {\n getSpanHub,\n getSpanMetadata,\n getSpanParent,\n setSpanMetadata,\n getSpanScopes,\n} from './utils/spanData';\n\nexport { getScopesFromContext } from './utils/contextData';\n\nexport {\n spanHasAttributes,\n spanHasEvents,\n spanHasKind,\n spanHasName,\n spanHasParentId,\n spanHasStatus,\n} from './utils/spanTypes';\n\nexport { isSentryRequestSpan } from './utils/isSentryRequest';\n\nexport { getActiveSpan, getRootSpan } from './utils/getActiveSpan';\nexport { startSpan, startSpanManual, startInactiveSpan, withActiveSpan } from './trace';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { setupGlobalHub } from './custom/hub';\n// eslint-disable-next-line deprecation/deprecation\nexport { getCurrentHub } from './custom/getCurrentHub';\nexport { addTracingExtensions } from './custom/hubextensions';\nexport { setupEventContextTrace } from './setupEventContextTrace';\n\nexport { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrategy';\nexport { wrapContextManagerClass } from './contextManager';\nexport { SentryPropagator } from './propagator';\nexport { SentrySpanProcessor } from './spanProcessor';\nexport { SentrySampler } from './sampler';\n\nexport { openTelemetrySetupCheck } from './utils/setupCheck';\n\n// Legacy\nexport { getClient } from '@sentry/core';\n\n/**\n * The following internal utils are not considered public API and are subject to change.\n * @hidden\n */\nconst _INTERNAL = {\n addOriginToSpan,\n maybeCaptureExceptionForTimedEvent,\n getRequestSpanData,\n} as const;\n\nexport { _INTERNAL };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkDA;AACA;AACA;AACA;AACA,MAAM,YAAY;AAClB,EAAE,eAAe;AACjB,EAAE,kCAAkC;AACpC,EAAE,kBAAkB;AACpB,CAAE;;;;"}