@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":"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":[],"mappings":";;;;;;;;;;AAaA,SAAS,WAAW,CAAC,IAAI,EAAQ,aAAa,EAAiB;AAC/D;AACA,EAAE,MAAM,aAAa,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AACjD,EAAE,MAAM,GAAI,GAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;AAC9C;AACA;AACA,EAAE,IAAI,UAAU,EAAE;AAClB,IAAI,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AACnC,GAAE;AACF;AACA;AACA;AACA,EAAE,IAAI,SAAU,GAAE,GAAG,CAAA;AACrB,EAAE,IAAI,aAAc,KAAI,YAAY,EAAE;AACtC;AACA,IAAI,SAAU,GAAE,aAAa,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,IAAI,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;AAC/B,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,cAAe,EAAC,CAAC,CAAA;AAClD,GAAE;AACF,CAAA;AACA;AACA,SAAS,SAAS,CAAC,IAAI,EAAc;AACrC;AACA;AACA,EAAE,MAAM,GAAI,GAAE,UAAU,CAAC,IAAI,CAAE,IAAG,aAAa,EAAE,CAAA;AACjD,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS;AAC/B,IAAI,kCAAkC,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACxD,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mBAAA,SAA4B,kBAAA,EAAqD;AAC9F,GAAS,WAAW,GAAG;AACvB,IAAI,KAAK,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAA;AACnC,GAAE;AACF;AACA;AACA;AACA;AACA,GAAS,OAAO,CAAC,IAAI,EAAQ,aAAa,EAAiB;AAC3D,IAAI,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;AACpC;AACA,IAAI,WAAA,IAAe,MAAM,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,IAAI,WAAA,IAAe,MAAM,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":[],"mappings":";;;;;;;;;;;AAcA,SAAS,WAAW,CAAC,IAAI,EAAQ,aAAa,EAAiB;AAC/D;AACA,EAAE,MAAM,aAAa,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AACjD,EAAE,MAAM,GAAI,GAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;AAC9C;AACA;AACA,EAAE,IAAI,UAAU,EAAE;AAClB,IAAI,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AACnC,GAAE;AACF;AACA;AACA;AACA,EAAE,IAAI,SAAU,GAAE,GAAG,CAAA;AACrB,EAAE,IAAI,aAAc,KAAI,YAAY,EAAE;AACtC;AACA,IAAI,SAAU,GAAE,aAAa,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,IAAI,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAA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,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,23 +1,7 @@
1
- import { SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, SENTRY_SCOPES_CONTEXT_KEY, SENTRY_HUB_CONTEXT_KEY } from '../constants.js';
1
+ import { SENTRY_SCOPES_CONTEXT_KEY, SENTRY_HUB_CONTEXT_KEY } from '../constants.js';
2
2
 
3
3
  const SCOPE_CONTEXT_MAP = new WeakMap();
4
4
 
5
- /**
6
- * Try to get the Propagation Context from the given OTEL context.
7
- * This requires the SentryPropagator to be registered.
8
- */
9
- function getPropagationContextFromContext(context) {
10
- return context.getValue(SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY) ;
11
- }
12
-
13
- /**
14
- * Set a Propagation Context on an OTEL context..
15
- * This will return a forked context with the Propagation Context set.
16
- */
17
- function setPropagationContextOnContext(context, propagationContext) {
18
- return context.setValue(SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY, propagationContext);
19
- }
20
-
21
5
  /**
22
6
  * Try to get the Hub from the given OTEL context.
23
7
  * This requires a Context Manager that was wrapped with getWrappedContextManager.
@@ -66,5 +50,5 @@ function getContextFromScope(scope) {
66
50
  return SCOPE_CONTEXT_MAP.get(scope);
67
51
  }
68
52
 
69
- export { getContextFromScope, getHubFromContext, getPropagationContextFromContext, getScopesFromContext, setContextOnScope, setHubOnContext, setPropagationContextOnContext, setScopesOnContext };
53
+ export { getContextFromScope, getHubFromContext, getScopesFromContext, setContextOnScope, setHubOnContext, setScopesOnContext };
70
54
  //# 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":[],"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,CAAC,sCAAsC,CAAE,EAAA;AAClE,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,OAAO,EAAW,kBAAkB,EAA+B;AAClH,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sCAAsC,EAAE,kBAAkB,CAAC,CAAA;AACrF,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAA4B;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;AACtD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,OAAO,EAAsC;AAClF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAE,EAAA;AACrD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,OAAO,EAAW,MAAM,EAA0B;AACrF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,yBAAyB,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":[],"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,CAAC,sBAAsB,CAAE,EAAA;AAClD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO,EAAW,GAAG,EAAgB;AACrE,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;AACtD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,OAAO,EAAsC;AAClF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAE,EAAA;AACrD,CAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,OAAO,EAAW,MAAM,EAA0B;AACrF,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,yBAAyB,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,5 +1,6 @@
1
1
  import { SpanStatusCode } from '@opentelemetry/api';
2
2
  import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
3
+ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';
3
4
  import { spanHasAttributes, spanHasStatus } from './spanTypes.js';
4
5
 
5
6
  // canonicalCodesHTTPMap maps some HTTP codes to Sentry's span statuses. See possible mapping in https://develop.sentry.dev/sdk/event-payloads/span/
@@ -51,23 +52,23 @@ function mapStatus(span) {
51
52
  if (code) {
52
53
  const sentryStatus = canonicalCodesHTTPMap[code];
53
54
  if (sentryStatus) {
54
- return sentryStatus;
55
+ return { code: SPAN_STATUS_ERROR, message: sentryStatus };
55
56
  }
56
57
  }
57
58
 
58
59
  if (typeof grpcCode === 'string') {
59
60
  const sentryStatus = canonicalCodesGrpcMap[grpcCode];
60
61
  if (sentryStatus) {
61
- return sentryStatus;
62
+ return { code: SPAN_STATUS_ERROR, message: sentryStatus };
62
63
  }
63
64
  }
64
65
 
65
66
  const statusCode = status && status.code;
66
67
  if (statusCode === SpanStatusCode.OK || statusCode === SpanStatusCode.UNSET) {
67
- return 'ok';
68
+ return { code: SPAN_STATUS_OK };
68
69
  }
69
70
 
70
- return 'unknown_error';
71
+ return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
71
72
  }
72
73
 
73
74
  export { 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":[],"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,WAAW;AACpB,EAAE,KAAK,EAAE,SAAS;AAClB,EAAE,KAAK,EAAE,oBAAoB;AAC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C,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,KAAI,cAAc,CAAC,EAAG,IAAG,UAAW,KAAI,cAAc,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":[],"mappings":";;;;;AAQA;AACA,MAAM,qBAAqB,GAA0C;AACrE,EAAE,KAAK,EAAE,qBAAqB;AAC9B,EAAE,KAAK,EAAE,iBAAiB;AAC1B,EAAE,KAAK,EAAE,mBAAmB;AAC5B,EAAE,KAAK,EAAE,WAAW;AACpB,EAAE,KAAK,EAAE,SAAS;AAClB,EAAE,KAAK,EAA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W,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,EAAE,iBAAiB,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,EAAE,iBAAiB,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,KAAI,cAAc,CAAC,EAAG,IAAG,UAAW,KAAI,cAAc,CAAC,KAAK,EAAE;AAC/E,IAAI,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAA;AACnC,GAAE;AACF;AACA,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAA,EAAiB,CAAA;AAC9D;;;;"}
@@ -0,0 +1,14 @@
1
+ const setupElements = new Set();
2
+
3
+ /** Get all the OpenTelemetry elements that have been set up. */
4
+ function openTelemetrySetupCheck() {
5
+ return Array.from(setupElements);
6
+ }
7
+
8
+ /** Mark an OpenTelemetry element as setup. */
9
+ function setIsSetup(element) {
10
+ setupElements.add(element);
11
+ }
12
+
13
+ export { openTelemetrySetupCheck, setIsSetup };
14
+ //# 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/opentelemetry",
3
- "version": "8.0.0-alpha.1",
3
+ "version": "8.0.0-alpha.2",
4
4
  "description": "Official Sentry utilities for OpenTelemetry",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/opentelemetry",
@@ -29,9 +29,9 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@sentry/core": "8.0.0-alpha.1",
33
- "@sentry/types": "8.0.0-alpha.1",
34
- "@sentry/utils": "8.0.0-alpha.1"
32
+ "@sentry/core": "8.0.0-alpha.2",
33
+ "@sentry/types": "8.0.0-alpha.2",
34
+ "@sentry/utils": "8.0.0-alpha.2"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@opentelemetry/api": "^1.0.0",
@@ -1,8 +1,7 @@
1
1
  export declare const SENTRY_TRACE_HEADER = "sentry-trace";
2
2
  export declare const SENTRY_BAGGAGE_HEADER = "baggage";
3
3
  export declare const SENTRY_TRACE_STATE_DSC = "sentry.trace";
4
- /** Context Key to hold a PropagationContext. */
5
- export declare const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY: symbol;
4
+ export declare const SENTRY_TRACE_STATE_PARENT_SPAN_ID = "sentry.parent_span_id";
6
5
  /** Context Key to hold a Hub. */
7
6
  export declare const SENTRY_HUB_CONTEXT_KEY: symbol;
8
7
  export declare const SENTRY_SCOPES_CONTEXT_KEY: symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,gDAAgD;AAChD,eAAO,MAAM,sCAAsC,QAA6D,CAAC;AAEjH,iCAAiC;AACjC,eAAO,MAAM,sBAAsB,QAAiC,CAAC;AAErE,eAAO,MAAM,yBAAyB,QAAoC,CAAC;AAE3E,eAAO,MAAM,uCAAuC,QAAkD,CAAC;AAEvG,eAAO,MAAM,iCAAiC,QAA4C,CAAC;AAE3F,eAAO,MAAM,2CAA2C,QAAsD,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AACrD,eAAO,MAAM,iCAAiC,0BAA0B,CAAC;AAEzE,iCAAiC;AACjC,eAAO,MAAM,sBAAsB,QAAiC,CAAC;AAErE,eAAO,MAAM,yBAAyB,QAAoC,CAAC;AAE3E,eAAO,MAAM,uCAAuC,QAAkD,CAAC;AAEvG,eAAO,MAAM,iCAAiC,QAA4C,CAAC;AAE3F,eAAO,MAAM,2CAA2C,QAAsD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"contextManager.d.ts","sourceRoot":"","sources":["../../src/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAYlE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,sBAAsB,SAAS,cAAc,EACnF,mBAAmB,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,sBAAsB,GACtE,OAAO,mBAAmB,CAyD5B"}
1
+ {"version":3,"file":"contextManager.d.ts","sourceRoot":"","sources":["../../src/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAalE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,sBAAsB,SAAS,cAAc,EACnF,mBAAmB,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,sBAAsB,GACtE,OAAO,mBAAmB,CA6D5B"}
package/types/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export type { OpenTelemetryClient } from './types';
5
5
  export { wrapClientClass } from './custom/client';
6
6
  export { getSpanKind } from './utils/getSpanKind';
7
7
  export { getSpanHub, getSpanMetadata, getSpanParent, setSpanMetadata, getSpanScopes, } from './utils/spanData';
8
- export { getPropagationContextFromContext, setPropagationContextOnContext, getScopesFromContext, } from './utils/contextData';
8
+ export { getScopesFromContext } from './utils/contextData';
9
9
  export { spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus, } from './utils/spanTypes';
10
10
  export { isSentryRequestSpan } from './utils/isSentryRequest';
11
11
  export { getActiveSpan, getRootSpan } from './utils/getActiveSpan';
@@ -19,6 +19,7 @@ export { wrapContextManagerClass } from './contextManager';
19
19
  export { SentryPropagator } from './propagator';
20
20
  export { SentrySpanProcessor } from './spanProcessor';
21
21
  export { SentrySampler } from './sampler';
22
+ export { openTelemetrySetupCheck } from './utils/setupCheck';
22
23
  export { getClient } from '@sentry/core';
23
24
  /**
24
25
  * The following internal utils are not considered public API and are subject to change.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,UAAU,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGxF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,2CAA2C,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,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BAAwB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,2CAA2C,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,QAAA,MAAM,SAAS;;;;CAIL,CAAC;AAEX,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,9 +1,13 @@
1
- import type { Context, TextMapGetter, TextMapSetter } from '@opentelemetry/api';
2
- import { W3CBaggagePropagator } from '@opentelemetry/core';
1
+ import type { Context, SpanContext, TextMapGetter, TextMapSetter } from '@opentelemetry/api';
2
+ import { TraceState, W3CBaggagePropagator } from '@opentelemetry/core';
3
+ import type { DynamicSamplingContext, PropagationContext } from '@sentry/types';
4
+ /** Get the Sentry propagation context from a span context. */
5
+ export declare function getPropagationContextFromSpanContext(spanContext: SpanContext): PropagationContext;
3
6
  /**
4
7
  * Injects and extracts `sentry-trace` and `baggage` headers from carriers.
5
8
  */
6
9
  export declare class SentryPropagator extends W3CBaggagePropagator {
10
+ constructor();
7
11
  /**
8
12
  * @inheritDoc
9
13
  */
@@ -17,4 +21,9 @@ export declare class SentryPropagator extends W3CBaggagePropagator {
17
21
  */
18
22
  fields(): string[];
19
23
  }
24
+ /** Exported for tests. */
25
+ export declare function makeTraceState({ parentSpanId, dsc, }: {
26
+ parentSpanId?: string;
27
+ dsc?: Partial<DynamicSamplingContext>;
28
+ }): TraceState | undefined;
20
29
  //# sourceMappingURL=propagator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"propagator.d.ts","sourceRoot":"","sources":["../../src/propagator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,OAAO,EAAe,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,EAAc,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAmC5F;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,oBAAoB;IACxD;;OAEG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IA0B9E;;OAEG;IACI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;IAkClF;;OAEG;IACI,MAAM,IAAI,MAAM,EAAE;CAG1B"}
1
+ {"version":3,"file":"propagator.d.ts","sourceRoot":"","sources":["../../src/propagator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAE5F,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAkBhF,8DAA8D;AAC9D,wBAAgB,oCAAoC,CAAC,WAAW,EAAE,WAAW,GAAG,kBAAkB,CAejG;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,oBAAoB;;IAMxD;;OAEG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAuB9E;;OAEG;IACI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;IAwClF;;OAEG;IACI,MAAM,IAAI,MAAM,EAAE;CAG1B;AAED,0BAA0B;AAC1B,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,GAAG,GACJ,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAAE,GAAG,UAAU,GAAG,SAAS,CAa3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../../src/sampler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,OAAO,EAAe,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG7E,OAAO,KAAK,EAAE,MAAM,EAAkC,MAAM,eAAe,CAAC;AAO5E;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,OAAO,CAAS;gBAEL,MAAM,EAAE,MAAM;IAIjC,kBAAkB;IACX,YAAY,CACjB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,EAClB,cAAc,EAAE,OAAO,EACvB,MAAM,EAAE,OAAO,GACd,cAAc;IA+FjB,4EAA4E;IACrE,QAAQ,IAAI,MAAM;CAG1B"}
1
+ {"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../../src/sampler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,OAAO,EAAe,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG7E,OAAO,KAAK,EAAE,MAAM,EAAkC,MAAM,eAAe,CAAC;AAQ5E;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,OAAO,CAAS;gBAEL,MAAM,EAAE,MAAM;IAKjC,kBAAkB;IACX,YAAY,CACjB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,EAClB,cAAc,EAAE,OAAO,EACvB,MAAM,EAAE,OAAO,GACd,cAAc;IA+FjB,4EAA4E;IACrE,QAAQ,IAAI,MAAM;CAG1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"spanProcessor.d.ts","sourceRoot":"","sources":["../../src/spanProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAgDnE;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,kBAAmB,YAAW,sBAAsB;;IAK3F;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAQxD,kBAAkB;IACX,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAa9B;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;CAGxD"}
1
+ {"version":3,"file":"spanProcessor.d.ts","sourceRoot":"","sources":["../../src/spanProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAiDnE;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,kBAAmB,YAAW,sBAAsB;;IAO3F;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAQxD,kBAAkB;IACX,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAa9B;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;CAGxD"}
@@ -1,16 +1,6 @@
1
1
  import type { Context } from '@opentelemetry/api';
2
- import type { Hub, PropagationContext, Scope } from '@sentry/types';
2
+ import type { Hub, Scope } from '@sentry/types';
3
3
  import type { CurrentScopes } from '../types';
4
- /**
5
- * Try to get the Propagation Context from the given OTEL context.
6
- * This requires the SentryPropagator to be registered.
7
- */
8
- export declare function getPropagationContextFromContext(context: Context): PropagationContext | undefined;
9
- /**
10
- * Set a Propagation Context on an OTEL context..
11
- * This will return a forked context with the Propagation Context set.
12
- */
13
- export declare function setPropagationContextOnContext(context: Context, propagationContext: PropagationContext): Context;
14
4
  /**
15
5
  * Try to get the Hub from the given OTEL context.
16
6
  * This requires a Context Manager that was wrapped with getWrappedContextManager.
@@ -1 +1 @@
1
- {"version":3,"file":"contextData.d.ts","sourceRoot":"","sources":["../../../src/utils/contextData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAEjG;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,OAAO,CAEhH;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,GAAG,SAAS,CAEnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAA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KAAK,GAAG,OAAO,GAAG,SAAS,CAErE"}
@@ -1,7 +1,7 @@
1
- import type { SpanStatusType as SentryStatus } from '@sentry/core';
1
+ import type { SpanStatus } from '@sentry/types';
2
2
  import type { AbstractSpan } from '../types';
3
3
  /**
4
4
  * Get a Sentry span status from an otel span.
5
5
  */
6
- export declare function mapStatus(span: AbstractSpan): SentryStatus;
6
+ export declare function mapStatus(span: AbstractSpan): SpanStatus;
7
7
  //# sourceMappingURL=mapStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapStatus.d.ts","sourceRoot":"","sources":["../../../src/utils/mapStatus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAsC7C;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CA4B1D"}
1
+ {"version":3,"file":"mapStatus.d.ts","sourceRoot":"","sources":["../../../src/utils/mapStatus.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAsC7C;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CA4BxD"}
@@ -0,0 +1,9 @@
1
+ type OpenTelemetryElement = 'SentrySpanProcessor' | 'SentryContextManager' | 'SentryPropagator' | 'SentrySampler';
2
+ /** Get all the OpenTelemetry elements that have been set up. */
3
+ export declare function openTelemetrySetupCheck(): OpenTelemetryElement[];
4
+ /** Mark an OpenTelemetry element as setup. */
5
+ export declare function setIsSetup(element: OpenTelemetryElement): void;
6
+ /** Only exported for tests. */
7
+ export declare function clearOpenTelemetrySetupCheck(): void;
8
+ export {};
9
+ //# sourceMappingURL=setupCheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupCheck.d.ts","sourceRoot":"","sources":["../../../src/utils/setupCheck.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG,qBAAqB,GAAG,sBAAsB,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAIlH,gEAAgE;AAChE,wBAAgB,uBAAuB,IAAI,oBAAoB,EAAE,CAEhE;AAED,8CAA8C;AAC9C,wBAAgB,UAAU,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAE9D;AAED,+BAA+B;AAC/B,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
@@ -1,8 +1,7 @@
1
1
  export declare const SENTRY_TRACE_HEADER = "sentry-trace";
2
2
  export declare const SENTRY_BAGGAGE_HEADER = "baggage";
3
3
  export declare const SENTRY_TRACE_STATE_DSC = "sentry.trace";
4
- /** Context Key to hold a PropagationContext. */
5
- export declare const SENTRY_PROPAGATION_CONTEXT_CONTEXT_KEY: symbol;
4
+ export declare const SENTRY_TRACE_STATE_PARENT_SPAN_ID = "sentry.parent_span_id";
6
5
  /** Context Key to hold a Hub. */
7
6
  export declare const SENTRY_HUB_CONTEXT_KEY: symbol;
8
7
  export declare const SENTRY_SCOPES_CONTEXT_KEY: symbol;
@@ -5,7 +5,7 @@ export { OpenTelemetryClient } from './types';
5
5
  export { wrapClientClass } from './custom/client';
6
6
  export { getSpanKind } from './utils/getSpanKind';
7
7
  export { getSpanHub, getSpanMetadata, getSpanParent, setSpanMetadata, getSpanScopes, } from './utils/spanData';
8
- export { getPropagationContextFromContext, setPropagationContextOnContext, getScopesFromContext, } from './utils/contextData';
8
+ export { getScopesFromContext } from './utils/contextData';
9
9
  export { spanHasAttributes, spanHasEvents, spanHasKind, spanHasName, spanHasParentId, spanHasStatus, } from './utils/spanTypes';
10
10
  export { isSentryRequestSpan } from './utils/isSentryRequest';
11
11
  export { getActiveSpan, getRootSpan } from './utils/getActiveSpan';
@@ -19,6 +19,7 @@ export { wrapContextManagerClass } from './contextManager';
19
19
  export { SentryPropagator } from './propagator';
20
20
  export { SentrySpanProcessor } from './spanProcessor';
21
21
  export { SentrySampler } from './sampler';
22
+ export { openTelemetrySetupCheck } from './utils/setupCheck';
22
23
  export { getClient } from '@sentry/core';
23
24
  /**
24
25
  * The following internal utils are not considered public API and are subject to change.
@@ -1,9 +1,13 @@
1
- import { Context, TextMapGetter, TextMapSetter } from '@opentelemetry/api';
2
- import { W3CBaggagePropagator } from '@opentelemetry/core';
1
+ import { Context, SpanContext, TextMapGetter, TextMapSetter } from '@opentelemetry/api';
2
+ import { TraceState, W3CBaggagePropagator } from '@opentelemetry/core';
3
+ import { DynamicSamplingContext, PropagationContext } from '@sentry/types';
4
+ /** Get the Sentry propagation context from a span context. */
5
+ export declare function getPropagationContextFromSpanContext(spanContext: SpanContext): PropagationContext;
3
6
  /**
4
7
  * Injects and extracts `sentry-trace` and `baggage` headers from carriers.
5
8
  */
6
9
  export declare class SentryPropagator extends W3CBaggagePropagator {
10
+ constructor();
7
11
  /**
8
12
  * @inheritDoc
9
13
  */
@@ -17,4 +21,9 @@ export declare class SentryPropagator extends W3CBaggagePropagator {
17
21
  */
18
22
  fields(): string[];
19
23
  }
24
+ /** Exported for tests. */
25
+ export declare function makeTraceState({ parentSpanId, dsc, }: {
26
+ parentSpanId?: string;
27
+ dsc?: Partial<DynamicSamplingContext>;
28
+ }): TraceState | undefined;
20
29
  //# sourceMappingURL=propagator.d.ts.map
@@ -1,16 +1,6 @@
1
1
  import { Context } from '@opentelemetry/api';
2
- import { Hub, PropagationContext, Scope } from '@sentry/types';
2
+ import { Hub, Scope } from '@sentry/types';
3
3
  import { CurrentScopes } from '../types';
4
- /**
5
- * Try to get the Propagation Context from the given OTEL context.
6
- * This requires the SentryPropagator to be registered.
7
- */
8
- export declare function getPropagationContextFromContext(context: Context): PropagationContext | undefined;
9
- /**
10
- * Set a Propagation Context on an OTEL context..
11
- * This will return a forked context with the Propagation Context set.
12
- */
13
- export declare function setPropagationContextOnContext(context: Context, propagationContext: PropagationContext): Context;
14
4
  /**
15
5
  * Try to get the Hub from the given OTEL context.
16
6
  * This requires a Context Manager that was wrapped with getWrappedContextManager.
@@ -1,7 +1,7 @@
1
- import { SpanStatusType as SentryStatus } from '@sentry/core';
1
+ import { SpanStatus } from '@sentry/types';
2
2
  import { AbstractSpan } from '../types';
3
3
  /**
4
4
  * Get a Sentry span status from an otel span.
5
5
  */
6
- export declare function mapStatus(span: AbstractSpan): SentryStatus;
6
+ export declare function mapStatus(span: AbstractSpan): SpanStatus;
7
7
  //# sourceMappingURL=mapStatus.d.ts.map
@@ -0,0 +1,9 @@
1
+ type OpenTelemetryElement = 'SentrySpanProcessor' | 'SentryContextManager' | 'SentryPropagator' | 'SentrySampler';
2
+ /** Get all the OpenTelemetry elements that have been set up. */
3
+ export declare function openTelemetrySetupCheck(): OpenTelemetryElement[];
4
+ /** Mark an OpenTelemetry element as setup. */
5
+ export declare function setIsSetup(element: OpenTelemetryElement): void;
6
+ /** Only exported for tests. */
7
+ export declare function clearOpenTelemetrySetupCheck(): void;
8
+ export {};
9
+ //# sourceMappingURL=setupCheck.d.ts.map