@sentry/opentelemetry 10.49.0 → 10.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"type":"module","version":"10.49.0","sideEffects":false}
1
+ {"type":"module","version":"10.50.0","sideEffects":false}
@@ -0,0 +1,66 @@
1
+ import { tracingChannel as tracingChannel$1 } from 'node:diagnostics_channel';
2
+ import { context, trace } from '@opentelemetry/api';
3
+ import { logger } from '@sentry/core';
4
+ import { D as DEBUG_BUILD } from './debug-build-DcLzdrV_.js';
5
+
6
+ /**
7
+ * Transform function that creates a span from the channel data.
8
+ */
9
+
10
+ /**
11
+ * Creates a new tracing channel with proper OTel context propagation.
12
+ *
13
+ * When the channel's `tracePromise` / `traceSync` / `traceCallback` is called,
14
+ * the `transformStart` function runs inside `bindStore` so that:
15
+ * 1. A new span is created from the channel data.
16
+ * 2. The span is set on the OTel context stored in AsyncLocalStorage.
17
+ * 3. Downstream code (including Sentry's span processor) sees the correct parent.
18
+ *
19
+ * @param channelNameOrInstance - Either a channel name string or an existing TracingChannel instance.
20
+ * @param transformStart - Function that creates an OpenTelemetry span from the channel data.
21
+ * @returns The tracing channel with OTel context bound.
22
+ */
23
+ function tracingChannel(
24
+ channelNameOrInstance,
25
+ transformStart,
26
+ ) {
27
+ const channel = tracingChannel$1(
28
+ channelNameOrInstance,
29
+ ) ;
30
+
31
+ let lookup;
32
+ try {
33
+ const contextManager = (context )._getContextManager();
34
+ lookup = contextManager.getAsyncLocalStorageLookup();
35
+ } catch {
36
+ // getAsyncLocalStorageLookup may not exist if using a non-Sentry context manager
37
+ }
38
+
39
+ if (!lookup) {
40
+ DEBUG_BUILD &&
41
+ logger.warn(
42
+ '[TracingChannel] Could not access OpenTelemetry AsyncLocalStorage, context propagation will not work.',
43
+ );
44
+ return channel;
45
+ }
46
+
47
+ const otelStorage = lookup.asyncLocalStorage;
48
+
49
+ // Bind the start channel so that each trace invocation runs the transform
50
+ // and stores the resulting context (with span) in AsyncLocalStorage.
51
+ // @ts-expect-error bindStore types don't account for AsyncLocalStorage of a different generic type
52
+ channel.start.bindStore(otelStorage, (data) => {
53
+ const span = transformStart(data);
54
+
55
+ // Store the span on data so downstream event handlers (asyncEnd, error, etc.) can access it.
56
+ data._sentrySpan = span;
57
+
58
+ // Return the context with the span set — this is what gets stored in AsyncLocalStorage.
59
+ return trace.setSpan(context.active(), span);
60
+ });
61
+
62
+ return channel;
63
+ }
64
+
65
+ export { tracingChannel };
66
+ //# sourceMappingURL=tracingChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracingChannel.js","sources":["../../src/tracingChannel.ts"],"sourcesContent":["/**\n * Vendored and adapted from https://github.com/logaretm/otel-tracing-channel\n *\n * Creates a TracingChannel with proper OpenTelemetry context propagation\n * using Node.js diagnostic_channel's `bindStore` mechanism.\n */\nimport type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport { tracingChannel as nativeTracingChannel } from 'node:diagnostics_channel';\nimport type { Span } from '@opentelemetry/api';\nimport { context, trace } from '@opentelemetry/api';\nimport { logger } from '@sentry/core';\nimport type { SentryAsyncLocalStorageContextManager } from './asyncLocalStorageContextManager';\nimport type { AsyncLocalStorageLookup } from './contextManager';\nimport { DEBUG_BUILD } from './debug-build';\n\n/**\n * Transform function that creates a span from the channel data.\n */\nexport type OtelTracingChannelTransform<TData = object> = (data: TData) => Span;\n\ntype WithSpan<TData = object> = TData & { _sentrySpan?: Span };\n\n/**\n * A TracingChannel whose `subscribe` / `unsubscribe` accept partial subscriber\n * objects — you only need to provide handlers for the events you care about.\n */\nexport interface OtelTracingChannel<\n TData extends object = object,\n TDataWithSpan extends object = WithSpan<TData>,\n> extends Omit<TracingChannel<TData, TDataWithSpan>, 'subscribe' | 'unsubscribe'> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TDataWithSpan>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TDataWithSpan>>): void;\n}\n\ninterface ContextApi {\n _getContextManager(): SentryAsyncLocalStorageContextManager;\n}\n\n/**\n * Creates a new tracing channel with proper OTel context propagation.\n *\n * When the channel's `tracePromise` / `traceSync` / `traceCallback` is called,\n * the `transformStart` function runs inside `bindStore` so that:\n * 1. A new span is created from the channel data.\n * 2. The span is set on the OTel context stored in AsyncLocalStorage.\n * 3. Downstream code (including Sentry's span processor) sees the correct parent.\n *\n * @param channelNameOrInstance - Either a channel name string or an existing TracingChannel instance.\n * @param transformStart - Function that creates an OpenTelemetry span from the channel data.\n * @returns The tracing channel with OTel context bound.\n */\nexport function tracingChannel<TData extends object = object>(\n channelNameOrInstance: string,\n transformStart: OtelTracingChannelTransform<TData>,\n): OtelTracingChannel<TData, WithSpan<TData>> {\n const channel = nativeTracingChannel<WithSpan<TData>, WithSpan<TData>>(\n channelNameOrInstance,\n ) as unknown as OtelTracingChannel<TData, WithSpan<TData>>;\n\n let lookup: AsyncLocalStorageLookup | undefined;\n try {\n const contextManager = (context as unknown as ContextApi)._getContextManager();\n lookup = contextManager.getAsyncLocalStorageLookup();\n } catch {\n // getAsyncLocalStorageLookup may not exist if using a non-Sentry context manager\n }\n\n if (!lookup) {\n DEBUG_BUILD &&\n logger.warn(\n '[TracingChannel] Could not access OpenTelemetry AsyncLocalStorage, context propagation will not work.',\n );\n return channel;\n }\n\n const otelStorage = lookup.asyncLocalStorage;\n\n // Bind the start channel so that each trace invocation runs the transform\n // and stores the resulting context (with span) in AsyncLocalStorage.\n // @ts-expect-error bindStore types don't account for AsyncLocalStorage of a different generic type\n channel.start.bindStore(otelStorage, (data: WithSpan<TData>) => {\n const span = transformStart(data);\n\n // Store the span on data so downstream event handlers (asyncEnd, error, etc.) can access it.\n data._sentrySpan = span;\n\n // Return the context with the span set — this is what gets stored in AsyncLocalStorage.\n return trace.setSpan(context.active(), span);\n });\n\n return channel;\n}\n"],"names":["nativeTracingChannel"],"mappings":";;;;;AAeA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;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AM,SAAS,CAAC;AA8E7E;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC,CAE9F;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,OAAO,EAAE,wBAAwB,EACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC,GAC9C,CAAC,CAEH;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CA2BzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,CAGrF;AAqGD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvG;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAoBrD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,GACX,CAAC,sBAAsB,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAUvF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Vendored and adapted from https://github.com/logaretm/otel-tracing-channel
3
+ *
4
+ * Creates a TracingChannel with proper OpenTelemetry context propagation
5
+ * using Node.js diagnostic_channel's `bindStore` mechanism.
6
+ */
7
+ import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';
8
+ import type { Span } from '@opentelemetry/api';
9
+ /**
10
+ * Transform function that creates a span from the channel data.
11
+ */
12
+ export type OtelTracingChannelTransform<TData = object> = (data: TData) => Span;
13
+ type WithSpan<TData = object> = TData & {
14
+ _sentrySpan?: Span;
15
+ };
16
+ /**
17
+ * A TracingChannel whose `subscribe` / `unsubscribe` accept partial subscriber
18
+ * objects — you only need to provide handlers for the events you care about.
19
+ */
20
+ export interface OtelTracingChannel<TData extends object = object, TDataWithSpan extends object = WithSpan<TData>> extends Omit<TracingChannel<TData, TDataWithSpan>, 'subscribe' | 'unsubscribe'> {
21
+ subscribe(subscribers: Partial<TracingChannelSubscribers<TDataWithSpan>>): void;
22
+ unsubscribe(subscribers: Partial<TracingChannelSubscribers<TDataWithSpan>>): void;
23
+ }
24
+ /**
25
+ * Creates a new tracing channel with proper OTel context propagation.
26
+ *
27
+ * When the channel's `tracePromise` / `traceSync` / `traceCallback` is called,
28
+ * the `transformStart` function runs inside `bindStore` so that:
29
+ * 1. A new span is created from the channel data.
30
+ * 2. The span is set on the OTel context stored in AsyncLocalStorage.
31
+ * 3. Downstream code (including Sentry's span processor) sees the correct parent.
32
+ *
33
+ * @param channelNameOrInstance - Either a channel name string or an existing TracingChannel instance.
34
+ * @param transformStart - Function that creates an OpenTelemetry span from the channel data.
35
+ * @returns The tracing channel with OTel context bound.
36
+ */
37
+ export declare function tracingChannel<TData extends object = object>(channelNameOrInstance: string, transformStart: OtelTracingChannelTransform<TData>): OtelTracingChannel<TData, WithSpan<TData>>;
38
+ export {};
39
+ //# sourceMappingURL=tracingChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracingChannel.d.ts","sourceRoot":"","sources":["../../src/tracingChannel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAO/C;;GAEG;AACH,MAAM,MAAM,2BAA2B,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;AAEhF,KAAK,QAAQ,CAAC,KAAK,GAAG,MAAM,IAAI,KAAK,GAAG;IAAE,WAAW,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CACjC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,aAAa,SAAS,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAC9C,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC;IAC/E,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC;IAChF,WAAW,CAAC,WAAW,EAAE,OAAO,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC;CACnF;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC1D,qBAAqB,EAAE,MAAM,EAC7B,cAAc,EAAE,2BAA2B,CAAC,KAAK,CAAC,GACjD,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAqC5C"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Vendored and adapted from https://github.com/logaretm/otel-tracing-channel
3
+ *
4
+ * Creates a TracingChannel with proper OpenTelemetry context propagation
5
+ * using Node.js diagnostic_channel's `bindStore` mechanism.
6
+ */
7
+ import { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';
8
+ import { Span } from '@opentelemetry/api';
9
+ /**
10
+ * Transform function that creates a span from the channel data.
11
+ */
12
+ export type OtelTracingChannelTransform<TData = object> = (data: TData) => Span;
13
+ type WithSpan<TData = object> = TData & {
14
+ _sentrySpan?: Span;
15
+ };
16
+ /**
17
+ * A TracingChannel whose `subscribe` / `unsubscribe` accept partial subscriber
18
+ * objects — you only need to provide handlers for the events you care about.
19
+ */
20
+ export interface OtelTracingChannel<TData extends object = object, TDataWithSpan extends object = WithSpan<TData>> extends Pick<TracingChannel<TData, TDataWithSpan>, Exclude<keyof TracingChannel<TData, TDataWithSpan>, 'subscribe' | 'unsubscribe'>> {
21
+ subscribe(subscribers: Partial<TracingChannelSubscribers<TDataWithSpan>>): void;
22
+ unsubscribe(subscribers: Partial<TracingChannelSubscribers<TDataWithSpan>>): void;
23
+ }
24
+ /**
25
+ * Creates a new tracing channel with proper OTel context propagation.
26
+ *
27
+ * When the channel's `tracePromise` / `traceSync` / `traceCallback` is called,
28
+ * the `transformStart` function runs inside `bindStore` so that:
29
+ * 1. A new span is created from the channel data.
30
+ * 2. The span is set on the OTel context stored in AsyncLocalStorage.
31
+ * 3. Downstream code (including Sentry's span processor) sees the correct parent.
32
+ *
33
+ * @param channelNameOrInstance - Either a channel name string or an existing TracingChannel instance.
34
+ * @param transformStart - Function that creates an OpenTelemetry span from the channel data.
35
+ * @returns The tracing channel with OTel context bound.
36
+ */
37
+ export declare function tracingChannel<TData extends object = object>(channelNameOrInstance: string, transformStart: OtelTracingChannelTransform<TData>): OtelTracingChannel<TData, WithSpan<TData>>;
38
+ export {};
39
+ //# sourceMappingURL=tracingChannel.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/opentelemetry",
3
- "version": "10.49.0",
3
+ "version": "10.50.0",
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",
@@ -26,6 +26,16 @@
26
26
  "types": "./build/types/index.d.ts",
27
27
  "default": "./build/cjs/index.js"
28
28
  }
29
+ },
30
+ "./tracing-channel": {
31
+ "import": {
32
+ "types": "./build/types/tracingChannel.d.ts",
33
+ "default": "./build/esm/tracingChannel.js"
34
+ },
35
+ "require": {
36
+ "types": "./build/types/tracingChannel.d.ts",
37
+ "default": "./build/cjs/tracingChannel.js"
38
+ }
29
39
  }
30
40
  },
31
41
  "typesVersions": {
@@ -39,7 +49,7 @@
39
49
  "access": "public"
40
50
  },
41
51
  "dependencies": {
42
- "@sentry/core": "10.49.0"
52
+ "@sentry/core": "10.50.0"
43
53
  },
44
54
  "peerDependencies": {
45
55
  "@opentelemetry/api": "^1.9.0",