@sentry/server-utils 10.62.0 → 10.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/build/cjs/index.js +6 -2
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/tracing-channel/fastify/errors.js +42 -0
  4. package/build/cjs/integrations/tracing-channel/fastify/errors.js.map +1 -0
  5. package/build/cjs/integrations/tracing-channel/fastify/index.js +34 -0
  6. package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -0
  7. package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +279 -0
  8. package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
  9. package/build/cjs/integrations/tracing-channel/fastify/utils.js +11 -0
  10. package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -0
  11. package/build/cjs/integrations/tracing-channel/lru-memoizer.js +31 -0
  12. package/build/cjs/integrations/tracing-channel/lru-memoizer.js.map +1 -0
  13. package/build/cjs/integrations/tracing-channel/mysql.js +45 -83
  14. package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
  15. package/build/cjs/orchestrion/channels.js +2 -1
  16. package/build/cjs/orchestrion/channels.js.map +1 -1
  17. package/build/cjs/orchestrion/config.js +6 -0
  18. package/build/cjs/orchestrion/config.js.map +1 -1
  19. package/build/cjs/orchestrion/index.js +2 -0
  20. package/build/cjs/orchestrion/index.js.map +1 -1
  21. package/build/cjs/tracing-channel.js +50 -11
  22. package/build/cjs/tracing-channel.js.map +1 -1
  23. package/build/cjs/vercel-ai/index.js +5 -3
  24. package/build/cjs/vercel-ai/index.js.map +1 -1
  25. package/build/esm/index.js +1 -0
  26. package/build/esm/index.js.map +1 -1
  27. package/build/esm/integrations/tracing-channel/fastify/errors.js +39 -0
  28. package/build/esm/integrations/tracing-channel/fastify/errors.js.map +1 -0
  29. package/build/esm/integrations/tracing-channel/fastify/index.js +30 -0
  30. package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -0
  31. package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +277 -0
  32. package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
  33. package/build/esm/integrations/tracing-channel/fastify/utils.js +8 -0
  34. package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -0
  35. package/build/esm/integrations/tracing-channel/lru-memoizer.js +29 -0
  36. package/build/esm/integrations/tracing-channel/lru-memoizer.js.map +1 -0
  37. package/build/esm/integrations/tracing-channel/mysql.js +46 -84
  38. package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
  39. package/build/esm/orchestrion/channels.js +2 -1
  40. package/build/esm/orchestrion/channels.js.map +1 -1
  41. package/build/esm/orchestrion/config.js +6 -0
  42. package/build/esm/orchestrion/config.js.map +1 -1
  43. package/build/esm/orchestrion/index.js +1 -0
  44. package/build/esm/orchestrion/index.js.map +1 -1
  45. package/build/esm/package.json +1 -1
  46. package/build/esm/tracing-channel.js +51 -12
  47. package/build/esm/tracing-channel.js.map +1 -1
  48. package/build/esm/vercel-ai/index.js +6 -4
  49. package/build/esm/vercel-ai/index.js.map +1 -1
  50. package/build/types/index.d.ts +1 -0
  51. package/build/types/index.d.ts.map +1 -1
  52. package/build/types/integrations/tracing-channel/fastify/errors.d.ts +12 -0
  53. package/build/types/integrations/tracing-channel/fastify/errors.d.ts.map +1 -0
  54. package/build/types/integrations/tracing-channel/fastify/index.d.ts +66 -0
  55. package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -0
  56. package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
  57. package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -0
  58. package/build/types/integrations/tracing-channel/fastify/types.d.ts +32 -0
  59. package/build/types/integrations/tracing-channel/fastify/types.d.ts.map +1 -0
  60. package/build/types/integrations/tracing-channel/fastify/utils.d.ts +9 -0
  61. package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -0
  62. package/build/types/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
  63. package/build/types/integrations/tracing-channel/lru-memoizer.d.ts.map +1 -0
  64. package/build/types/integrations/tracing-channel/mysql.d.ts +3 -1
  65. package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
  66. package/build/types/orchestrion/channels.d.ts +1 -0
  67. package/build/types/orchestrion/channels.d.ts.map +1 -1
  68. package/build/types/orchestrion/config.d.ts.map +1 -1
  69. package/build/types/orchestrion/index.d.ts +1 -0
  70. package/build/types/orchestrion/index.d.ts.map +1 -1
  71. package/build/types/tracing-channel.d.ts +22 -0
  72. package/build/types/tracing-channel.d.ts.map +1 -1
  73. package/build/types/vercel-ai/index.d.ts +3 -1
  74. package/build/types/vercel-ai/index.d.ts.map +1 -1
  75. package/build/types-ts3.8/index.d.ts +2 -0
  76. package/build/types-ts3.8/integrations/tracing-channel/fastify/errors.d.ts +12 -0
  77. package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +66 -0
  78. package/build/types-ts3.8/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
  79. package/build/types-ts3.8/integrations/tracing-channel/fastify/types.d.ts +32 -0
  80. package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +9 -0
  81. package/build/types-ts3.8/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
  82. package/build/types-ts3.8/integrations/tracing-channel/mysql.d.ts +3 -1
  83. package/build/types-ts3.8/node-diagnostics-channel.d.ts +19 -0
  84. package/build/types-ts3.8/orchestrion/channels.d.ts +1 -0
  85. package/build/types-ts3.8/orchestrion/index.d.ts +1 -0
  86. package/build/types-ts3.8/tracing-channel.d.ts +22 -0
  87. package/build/types-ts3.8/vercel-ai/index.d.ts +3 -1
  88. package/package.json +3 -3
@@ -18,6 +18,12 @@ const SENTRY_INSTRUMENTATIONS = [
18
18
  // returned `Query` emitter on `ctx.result`, which the integration uses to
19
19
  // attach `'end'`/`'error'` listeners that finish the span.
20
20
  functionQuery: { expressionName: "query", kind: "Auto" }
21
+ },
22
+ {
23
+ channelName: "load",
24
+ // `>=2.1.0` only: the named `function memoizedFunction()` the selector targets exists from 2.1.0
25
+ module: { name: "lru-memoizer", versionRange: ">=2.1.0 <4", filePath: "lib/async.js" },
26
+ functionQuery: { functionName: "memoizedFunction", kind: "Callback" }
21
27
  }
22
28
  ];
23
29
  const INSTRUMENTED_MODULE_NAMES = Array.from(new Set(SENTRY_INSTRUMENTATIONS.map((i) => i.module.name)));
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/orchestrion/config.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\n/**\n * The central list of channel injections orchestrion should perform.\n *\n * This module has NO side effects — it's the only thing both the runtime hook\n * (`runtime/import-hook.mjs`) and the bundler plugins (`bundler/vite.ts`, …)\n * import from. Adding a new instrumented method is one entry here plus one\n * subscriber in `integrations/<lib>/tracing-channel.ts`.\n *\n * `channelName` here is the unprefixed suffix; the actual diagnostics_channel\n * name is `orchestrion:${module.name}:${channelName}` (see `channels.ts`).\n */\nexport const SENTRY_INSTRUMENTATIONS: InstrumentationConfig[] = [\n {\n channelName: 'query',\n module: { name: 'mysql', versionRange: '>=2.0.0 <3', filePath: 'lib/Connection.js' },\n // `Connection` in mysql v2 is a constructor function (NOT a class):\n // `function Connection(options) { ... }`\n // `Connection.prototype.query = function query(sql, values, cb) { ... }`\n // orchestrion's `className`+`methodName` query only matches `class` declarations.\n // The named function expression on the right-hand side of the prototype\n // assignment is what we want — that's matched by `expressionName: 'query'`,\n // which produces the esquery selector\n // `AssignmentExpression[left.property.name=\"query\"] > FunctionExpression[async]`.\n // `Auto` so both `connection.query(sql, cb)` and `connection.query(sql)`\n // (streamable, no callback) get channel events. The transform picks\n // `wrapCallback` when the last arg is a function and `wrapPromise`\n // otherwise — for mysql's no-callback path the latter publishes\n // `start`/`end` synchronously around the original call and stores the\n // returned `Query` emitter on `ctx.result`, which the integration uses to\n // attach `'end'`/`'error'` listeners that finish the span.\n functionQuery: { expressionName: 'query', kind: 'Auto' },\n },\n];\n\n/**\n * The unique set of package names instrumented by `SENTRY_INSTRUMENTATIONS`\n * (e.g. `['mysql']`).\n *\n * Bundler plugins MUST ensure these are actually bundled rather than\n * externalized: an externalized dependency is resolved from `node_modules` at\n * runtime and never passes through the code transform's `onLoad`, so its\n * diagnostics_channel calls are silently never injected.\n */\nexport const INSTRUMENTED_MODULE_NAMES: string[] = Array.from(new Set(SENTRY_INSTRUMENTATIONS.map(i => i.module.name)));\n\n/**\n * Returns `external` with any instrumented packages removed, so a bundler that\n * uses an \"external\" denylist (esbuild, Bun, Rollup) still bundles — and thus\n * transforms — them. Matches an exact package name (`'mysql'`) or a subpath\n * (`'mysql/lib/...'`); wildcard/other patterns are left untouched. `undefined`\n * is returned unchanged.\n *\n * (Vite uses an `ssr.noExternal` allowlist instead, so it consumes\n * `INSTRUMENTED_MODULE_NAMES` directly rather than this helper.)\n */\nexport function withoutInstrumentedExternals(external: readonly string[] | undefined): string[] | undefined {\n if (!external) {\n return undefined;\n }\n return external.filter(\n entry => !INSTRUMENTED_MODULE_NAMES.some(name => entry === name || entry.startsWith(`${name}/`)),\n );\n}\n"],"names":[],"mappings":"AAaO,MAAM,uBAAA,GAAmD;AAAA,EAC9D;AAAA,IACE,WAAA,EAAa,OAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,SAAS,YAAA,EAAc,YAAA,EAAc,UAAU,mBAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBnF,aAAA,EAAe,EAAE,cAAA,EAAgB,OAAA,EAAS,MAAM,MAAA;AAAO;AAE3D;AAWO,MAAM,yBAAA,GAAsC,KAAA,CAAM,IAAA,CAAK,IAAI,GAAA,CAAI,uBAAA,CAAwB,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,CAAO,IAAI,CAAC,CAAC;AAY/G,SAAS,6BAA6B,QAAA,EAA+D;AAC1G,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACd,CAAA,KAAA,KAAS,CAAC,yBAAA,CAA0B,IAAA,CAAK,CAAA,IAAA,KAAQ,KAAA,KAAU,IAAA,IAAQ,KAAA,CAAM,UAAA,CAAW,CAAA,EAAG,IAAI,CAAA,CAAA,CAAG,CAAC;AAAA,GACjG;AACF;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/orchestrion/config.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\n/**\n * The central list of channel injections orchestrion should perform.\n *\n * This module has NO side effects — it's the only thing both the runtime hook\n * (`runtime/import-hook.mjs`) and the bundler plugins (`bundler/vite.ts`, …)\n * import from. Adding a new instrumented method is one entry here plus one\n * subscriber in `integrations/<lib>/tracing-channel.ts`.\n *\n * `channelName` here is the unprefixed suffix; the actual diagnostics_channel\n * name is `orchestrion:${module.name}:${channelName}` (see `channels.ts`).\n */\nexport const SENTRY_INSTRUMENTATIONS: InstrumentationConfig[] = [\n {\n channelName: 'query',\n module: { name: 'mysql', versionRange: '>=2.0.0 <3', filePath: 'lib/Connection.js' },\n // `Connection` in mysql v2 is a constructor function (NOT a class):\n // `function Connection(options) { ... }`\n // `Connection.prototype.query = function query(sql, values, cb) { ... }`\n // orchestrion's `className`+`methodName` query only matches `class` declarations.\n // The named function expression on the right-hand side of the prototype\n // assignment is what we want — that's matched by `expressionName: 'query'`,\n // which produces the esquery selector\n // `AssignmentExpression[left.property.name=\"query\"] > FunctionExpression[async]`.\n // `Auto` so both `connection.query(sql, cb)` and `connection.query(sql)`\n // (streamable, no callback) get channel events. The transform picks\n // `wrapCallback` when the last arg is a function and `wrapPromise`\n // otherwise — for mysql's no-callback path the latter publishes\n // `start`/`end` synchronously around the original call and stores the\n // returned `Query` emitter on `ctx.result`, which the integration uses to\n // attach `'end'`/`'error'` listeners that finish the span.\n functionQuery: { expressionName: 'query', kind: 'Auto' },\n },\n {\n channelName: 'load',\n // `>=2.1.0` only: the named `function memoizedFunction()` the selector targets exists from 2.1.0\n module: { name: 'lru-memoizer', versionRange: '>=2.1.0 <4', filePath: 'lib/async.js' },\n functionQuery: { functionName: 'memoizedFunction', kind: 'Callback' },\n },\n];\n\n/**\n * The unique set of package names instrumented by `SENTRY_INSTRUMENTATIONS`\n * (e.g. `['mysql']`).\n *\n * Bundler plugins MUST ensure these are actually bundled rather than\n * externalized: an externalized dependency is resolved from `node_modules` at\n * runtime and never passes through the code transform's `onLoad`, so its\n * diagnostics_channel calls are silently never injected.\n */\nexport const INSTRUMENTED_MODULE_NAMES: string[] = Array.from(new Set(SENTRY_INSTRUMENTATIONS.map(i => i.module.name)));\n\n/**\n * Returns `external` with any instrumented packages removed, so a bundler that\n * uses an \"external\" denylist (esbuild, Bun, Rollup) still bundles — and thus\n * transforms — them. Matches an exact package name (`'mysql'`) or a subpath\n * (`'mysql/lib/...'`); wildcard/other patterns are left untouched. `undefined`\n * is returned unchanged.\n *\n * (Vite uses an `ssr.noExternal` allowlist instead, so it consumes\n * `INSTRUMENTED_MODULE_NAMES` directly rather than this helper.)\n */\nexport function withoutInstrumentedExternals(external: readonly string[] | undefined): string[] | undefined {\n if (!external) {\n return undefined;\n }\n return external.filter(\n entry => !INSTRUMENTED_MODULE_NAMES.some(name => entry === name || entry.startsWith(`${name}/`)),\n );\n}\n"],"names":[],"mappings":"AAaO,MAAM,uBAAA,GAAmD;AAAA,EAC9D;AAAA,IACE,WAAA,EAAa,OAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,SAAS,YAAA,EAAc,YAAA,EAAc,UAAU,mBAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBnF,aAAA,EAAe,EAAE,cAAA,EAAgB,OAAA,EAAS,MAAM,MAAA;AAAO,GACzD;AAAA,EACA;AAAA,IACE,WAAA,EAAa,MAAA;AAAA;AAAA,IAEb,QAAQ,EAAE,IAAA,EAAM,gBAAgB,YAAA,EAAc,YAAA,EAAc,UAAU,cAAA,EAAe;AAAA,IACrF,aAAA,EAAe,EAAE,YAAA,EAAc,kBAAA,EAAoB,MAAM,UAAA;AAAW;AAExE;AAWO,MAAM,yBAAA,GAAsC,KAAA,CAAM,IAAA,CAAK,IAAI,GAAA,CAAI,uBAAA,CAAwB,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,CAAO,IAAI,CAAC,CAAC;AAY/G,SAAS,6BAA6B,QAAA,EAA+D;AAC1G,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACd,CAAA,KAAA,KAAS,CAAC,yBAAA,CAA0B,IAAA,CAAK,CAAA,IAAA,KAAQ,KAAA,KAAU,IAAA,IAAQ,KAAA,CAAM,UAAA,CAAW,CAAA,EAAG,IAAI,CAAA,CAAA,CAAG,CAAC;AAAA,GACjG;AACF;;;;"}
@@ -1,3 +1,4 @@
1
1
  export { detectOrchestrionSetup } from './detect.js';
2
2
  export { mysqlChannelIntegration } from '../integrations/tracing-channel/mysql.js';
3
+ export { lruMemoizerChannelIntegration } from '../integrations/tracing-channel/lru-memoizer.js';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.62.0","sideEffects":false}
1
+ {"type":"module","version":"10.63.0","sideEffects":false}
@@ -1,11 +1,13 @@
1
- import { _INTERNAL_getTracingChannelBinding, debug, captureException, SPAN_STATUS_ERROR } from '@sentry/core';
1
+ import { getAsyncContextStrategy, getMainCarrier, debug, captureException, SPAN_STATUS_ERROR } from '@sentry/core';
2
2
  import { DEBUG_BUILD } from './debug-build.js';
3
+ import { ERROR_TYPE } from '@sentry/conventions/attributes';
3
4
 
4
5
  const NOOP = () => {
5
6
  };
6
7
  function bindTracingChannelToSpan(channel, getSpan, opts) {
7
8
  const handle = bindSpanToChannelStore(channel, getSpan);
8
9
  const beforeSpanEnd = opts?.beforeSpanEnd;
10
+ const deferSpanEnd = opts?.deferSpanEnd;
9
11
  const getErrorHint = (e) => {
10
12
  if (typeof opts?.captureError === "function") {
11
13
  return opts.captureError(e);
@@ -17,11 +19,36 @@ function bindTracingChannelToSpan(channel, getSpan, opts) {
17
19
  }
18
20
  };
19
21
  };
22
+ const annotateSpanError = (span, error) => {
23
+ if (opts?.captureError) {
24
+ captureException(error, getErrorHint(error));
25
+ }
26
+ const { message, attributes } = getErrorInfo(error);
27
+ span.setStatus({ code: SPAN_STATUS_ERROR, message });
28
+ span.setAttributes(attributes);
29
+ };
30
+ const makeDeferredEnd = (span, data) => {
31
+ let ended = false;
32
+ return (error) => {
33
+ if (ended) {
34
+ return;
35
+ }
36
+ ended = true;
37
+ if (error !== void 0) {
38
+ annotateSpanError(span, error);
39
+ }
40
+ endBoundSpan(data, beforeSpanEnd);
41
+ };
42
+ };
20
43
  const subscribers = {
21
44
  start: NOOP,
22
45
  asyncStart: NOOP,
23
46
  end(data) {
24
47
  if ("error" in data || "result" in data) {
48
+ const span = data._sentrySpan;
49
+ if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {
50
+ return;
51
+ }
25
52
  endBoundSpan(data, beforeSpanEnd);
26
53
  }
27
54
  },
@@ -30,12 +57,13 @@ function bindTracingChannelToSpan(channel, getSpan, opts) {
30
57
  if (!span) {
31
58
  return;
32
59
  }
33
- if (opts?.captureError) {
34
- captureException(data.error, getErrorHint(data.error));
35
- }
36
- span.setStatus({ code: SPAN_STATUS_ERROR, message: getErrorMessage(data.error) });
60
+ annotateSpanError(span, data.error);
37
61
  },
38
62
  asyncEnd(data) {
63
+ const span = data._sentrySpan;
64
+ if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {
65
+ return;
66
+ }
39
67
  endBoundSpan(data, beforeSpanEnd);
40
68
  }
41
69
  };
@@ -49,7 +77,7 @@ function bindTracingChannelToSpan(channel, getSpan, opts) {
49
77
  };
50
78
  }
51
79
  function bindSpanToChannelStore(channel, getSpan) {
52
- const binding = _INTERNAL_getTracingChannelBinding();
80
+ const binding = getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();
53
81
  if (!binding) {
54
82
  DEBUG_BUILD && debug.log("[TracingChannel] Could not access async context binding.");
55
83
  return {
@@ -59,17 +87,22 @@ function bindSpanToChannelStore(channel, getSpan) {
59
87
  }
60
88
  const asyncLocalStorage = binding.asyncLocalStorage;
61
89
  channel.start.bindStore(asyncLocalStorage, (data) => {
90
+ data._sentryCallerStore = asyncLocalStorage.getStore();
62
91
  const span = getSpan(data);
63
92
  if (!span) {
64
- return asyncLocalStorage.getStore();
93
+ return data._sentryCallerStore;
65
94
  }
66
95
  data._sentrySpan = span;
67
96
  return binding.getStoreWithActiveSpan(span);
68
97
  });
98
+ channel.asyncStart.bindStore(asyncLocalStorage, (data) => {
99
+ return data._sentryCallerStore;
100
+ });
69
101
  return {
70
102
  channel,
71
103
  unbind: () => {
72
104
  channel.start.unbindStore(asyncLocalStorage);
105
+ channel.asyncStart.unbindStore(asyncLocalStorage);
73
106
  }
74
107
  };
75
108
  }
@@ -81,11 +114,17 @@ function endBoundSpan(data, beforeSpanEnd) {
81
114
  beforeSpanEnd?.(span, data);
82
115
  span.end();
83
116
  }
84
- function getErrorMessage(error) {
85
- if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
86
- return error.message;
87
- }
88
- return String(error);
117
+ function getErrorInfo(error) {
118
+ const isObject = !!error && typeof error === "object";
119
+ const raw = isObject ? "message" in error ? error.message : void 0 : error;
120
+ const message = raw ? String(raw) : "unknown_error";
121
+ const type = isObject && "name" in error ? String(error.name) : "unknown";
122
+ return {
123
+ message,
124
+ attributes: {
125
+ [ERROR_TYPE]: type
126
+ }
127
+ };
89
128
  }
90
129
 
91
130
  export { bindTracingChannelToSpan };
@@ -1 +1 @@
1
- {"version":3,"file":"tracing-channel.js","sources":["../../src/tracing-channel.ts"],"sourcesContent":["import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';\nimport { _INTERNAL_getTracingChannelBinding, debug, captureException, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\n\nexport type TracingChannelPayloadWithSpan<TData extends object> = TData & {\n _sentrySpan?: Span;\n};\n\n/*\n * A type patch so that we don't have to handle all subscription types.\n */\nexport interface SentryTracingChannel<TData extends object = object> extends Omit<\n TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>,\n 'subscribe' | 'unsubscribe'\n> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n}\n\nexport interface TracingChannelLifeCycleOptions<TData extends object = object> {\n /**\n * Invoked with the span and the channel context object once the traced operation completes\n * Use it to enrich the span from the result/error (branch on `'error' in data` / `'result' in data`) or to run cleanup.\n */\n beforeSpanEnd?: (span: Span, data: TracingChannelPayloadWithSpan<TData>) => void;\n\n /**\n * Whether a thrown error is captured as a Sentry event. The span is always marked with error status regardless. Defaults to `false`.\n * You can alternatively pass a function that sets the ExclusiveEventHintOrCaptureContext on the captured error.\n * Set `true` for instrumentations that own the error boundary, (e.g: route handlers)\n * For database drivers, it is not recommended to set this at all.\n */\n captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);\n}\n\n/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */\nexport interface TracingChannelBindingHandle<TData extends object = object> {\n /**\n * The tracing channel with the span bound into async context.\n */\n channel: SentryTracingChannel<TData>;\n\n /**\n * Tears down the binding: unsubscribes lifecycle handlers, when present, and unbinds the start store.\n * Idempotent, and a no-op when no async context binding was available.\n */\n unbind: () => void;\n}\n\nconst NOOP = (): void => {};\n\n/**\n * Bind a span and its lifecycle to a tracing channel so the span becomes the active async context\n * for the traced operation and is ended when the operation completes.\n *\n * `getSpan` may return `undefined` to opt a payload out entirely: nothing is bound, no span is\n * tracked, and the active context is left untouched. Use it for events that ride the same channel\n * but should reuse the enclosing span instead of opening (and ending) their own — e.g. an agent\n * loop's per-step events, where ending a freshly opened span would close the parent prematurely.\n */\nexport function bindTracingChannelToSpan<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: TracingChannelLifeCycleOptions<TData>,\n): TracingChannelBindingHandle<TData> {\n const handle = bindSpanToChannelStore(channel, getSpan);\n\n const beforeSpanEnd = opts?.beforeSpanEnd;\n const getErrorHint = (e: unknown): ExclusiveEventHintOrCaptureContext => {\n if (typeof opts?.captureError === 'function') {\n return opts.captureError(e);\n }\n\n return {\n mechanism: {\n type: 'auto.diagnostic_channels.bind_span',\n handled: false,\n },\n };\n };\n\n const subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>> = {\n start: NOOP,\n asyncStart: NOOP,\n end(data) {\n // The operation settled synchronously (returned or threw)\n // Presence checks because caller can return `undefined` result or throw a falsy value.\n if ('error' in data || 'result' in data) {\n endBoundSpan(data, beforeSpanEnd);\n }\n },\n error(data) {\n // No span was bound for this payload (`getSpan` returned undefined), so there is nothing to\n // annotate and no instrumentation that owns capturing this error.\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n\n if (opts?.captureError) {\n captureException(data.error, getErrorHint(data.error));\n }\n\n span.setStatus({ code: SPAN_STATUS_ERROR, message: getErrorMessage(data.error) });\n },\n asyncEnd(data) {\n endBoundSpan(data, beforeSpanEnd);\n },\n };\n\n handle.channel.subscribe(subscribers);\n\n return {\n channel: handle.channel,\n unbind: () => {\n handle.channel.unsubscribe(subscribers);\n handle.unbind();\n },\n };\n}\n\n/**\n * Bind a span into the channel's async context so it becomes active for the traced operation,\n * without managing its lifecycle. The primitive behind {@link bindTracingChannelToSpan}, which\n * layers span-ending and error handling on top.\n *\n * `getSpan` may return `undefined` to leave the active context untouched for that payload.\n */\nfunction bindSpanToChannelStore<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n): TracingChannelBindingHandle<TData> {\n // Grabs the tracing channel binding defined by the AsyncContext strategy implementation\n const binding = _INTERNAL_getTracingChannelBinding();\n\n // If no binding, then either the implementer doesn't support tracing channels or there is no active strategy\n // Failure mode here means we would still access the channel and potentially subscribe to it, but parenting will be off.\n if (!binding) {\n DEBUG_BUILD && debug.log('[TracingChannel] Could not access async context binding.');\n\n return {\n channel,\n unbind: NOOP,\n };\n }\n\n // Grab the ALS instance, we don't really care what is in it as long as the AsyncContext strategy can use its value to figure out parenting.\n const asyncLocalStorage = binding.asyncLocalStorage as AsyncLocalStorage<TData>;\n\n // bindStore activates the ALS for the traced call; any getStore() inside it returns the value bound for that context.\n // 1. Produce: getStoreWithActiveSpan(span) clones the current scope, plants the span via _INTERNAL_setSpanForScope, and returns { scope, isolationScope }, the active context carrying our span.\n // 2. Bind: the courier hands that opaque value to channel.start.bindStore(asyncLocalStorage, producer), which runs the traced op inside asyncLocalStorage.run(value, …); it never inspects the value.\n // 3. Read: inside the op, Sentry's scope machinery calls getScopes() → asyncStorage.getStore() on that same ALS, so getCurrentScope/getIsolationScope/getActiveSpan resolve to the scope carrying our span.\n // 4. Nest: any child span started in the traced op parents to that active span.\n channel.start.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n const span = getSpan(data);\n if (!span) {\n // Leave the active context untouched so nested operations keep parenting to the enclosing span.\n return asyncLocalStorage.getStore() as TData;\n }\n data._sentrySpan = span;\n\n return binding.getStoreWithActiveSpan(span) as TData;\n });\n\n return {\n channel,\n unbind: () => {\n // Removes the store\n channel.start.unbindStore(asyncLocalStorage);\n },\n };\n}\n\nfunction endBoundSpan<TData extends object>(\n data: TracingChannelPayloadWithSpan<TData>,\n beforeSpanEnd: TracingChannelLifeCycleOptions<TData>['beforeSpanEnd'],\n): void {\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n beforeSpanEnd?.(span, data);\n span.end();\n}\n\n/** Best-effort short message for a span status: an error-like's `message`, otherwise its string form. */\nfunction getErrorMessage(error: unknown): string {\n if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string') {\n return error.message;\n }\n return String(error);\n}\n"],"names":[],"mappings":";;;AAmDA,MAAM,OAAO,MAAY;AAAC,CAAA;AAWnB,SAAS,wBAAA,CACd,OAAA,EACA,OAAA,EACA,IAAA,EACoC;AACpC,EAAA,MAAM,MAAA,GAAS,sBAAA,CAAuB,OAAA,EAAS,OAAO,CAAA;AAEtD,EAAA,MAAM,gBAAgB,IAAA,EAAM,aAAA;AAC5B,EAAA,MAAM,YAAA,GAAe,CAAC,CAAA,KAAmD;AACvE,IAAA,IAAI,OAAO,IAAA,EAAM,YAAA,KAAiB,UAAA,EAAY;AAC5C,MAAA,OAAO,IAAA,CAAK,aAAa,CAAC,CAAA;AAAA,IAC5B;AAEA,IAAA,OAAO;AAAA,MACL,SAAA,EAAW;AAAA,QACT,IAAA,EAAM,oCAAA;AAAA,QACN,OAAA,EAAS;AAAA;AACX,KACF;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,WAAA,GAAwF;AAAA,IAC5F,KAAA,EAAO,IAAA;AAAA,IACP,UAAA,EAAY,IAAA;AAAA,IACZ,IAAI,IAAA,EAAM;AAGR,MAAA,IAAI,OAAA,IAAW,IAAA,IAAQ,QAAA,IAAY,IAAA,E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AAM,IAAA,GAAO,QAAQ,IAAI,CAAA;AACzB,IAAA,IAAI,CAAC,IAAA,EAAM;AAET,MAAA,OAAO,kBAAkB,QAAA,EAAS;AAAA,IACpC;AACA,IAAA,IAAA,CAAK,WAAA,GAAc,IAAA;AAEnB,IAAA,OAAO,OAAA,CAAQ,uBAAuB,IAAI,CAAA;AAAA,EAC5C,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,QAAQ,MAAM;AAEZ,MAAA,OAAA,CAAQ,KAAA,CAAM,YAAY,iBAAiB,CAAA;AAAA,IAC7C;AAAA,GACF;AACF;AAEA,SAAS,YAAA,CACP,MACA,aAAA,EACM;AACN,EAAA,MAAM,OAAO,IAAA,CAAK,WAAA;AAClB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA;AAAA,EACF;AACA,EAAA,aAAA,GAAgB,MAAM,IAAI,CAAA;AAC1B,EAAA,IAAA,CAAK,GAAA,EAAI;AACX;AAGA,SAAS,gBAAgB,KAAA,EAAwB;AAC/C,EAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,aAAa,KAAA,IAAS,OAAO,KAAA,CAAM,OAAA,KAAY,QAAA,EAAU;AACjG,IAAA,OAAO,KAAA,CAAM,OAAA;AAAA,EACf;AACA,EAAA,OAAO,OAAO,KAAK,CAAA;AACrB;;;;"}
1
+ {"version":3,"file":"tracing-channel.js","sources":["../../src/tracing-channel.ts"],"sourcesContent":["import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';\nimport { debug, captureException, SPAN_STATUS_ERROR, getAsyncContextStrategy, getMainCarrier } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { ERROR_TYPE } from '@sentry/conventions/attributes';\n\nexport type TracingChannelPayloadWithSpan<TData extends object> = TData & {\n /**\n * The current active span for the traced call.\n */\n _sentrySpan?: Span;\n\n /**\n * The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.\n */\n _sentryCallerStore?: unknown;\n};\n\n/*\n * A type patch so that we don't have to handle all subscription types.\n */\nexport interface SentryTracingChannel<TData extends object = object> extends Omit<\n TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>,\n 'subscribe' | 'unsubscribe'\n> {\n subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n unsubscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;\n}\n\nexport interface TracingChannelLifeCycleOptions<TData extends object = object> {\n /**\n * Invoked with the span and the channel context object once the traced operation completes\n * Use it to enrich the span from the result/error (branch on `'error' in data` / `'result' in data`) or to run cleanup.\n */\n beforeSpanEnd?: (span: Span, data: TracingChannelPayloadWithSpan<TData>) => void;\n\n /**\n * Whether a thrown error is captured as a Sentry event. The span is always marked with error status regardless. Defaults to `false`.\n * You can alternatively pass a function that sets the ExclusiveEventHintOrCaptureContext on the captured error.\n * Set `true` for instrumentations that own the error boundary, (e.g: route handlers)\n * For database drivers, it is not recommended to set this at all.\n */\n captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);\n\n /**\n * Take ownership of *when* the span ends: return `true` and the helper won't end it on\n * `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that\n * completes via its own `'end'`/`'error'` events.\n *\n * Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span\n * ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`\n * lets the helper end the span as usual.\n */\n deferSpanEnd?: (args: {\n span: Span;\n data: TracingChannelPayloadWithSpan<TData>;\n /** Ends the span: `end()` on success, `end(error)` on failure. Idempotent. */\n end: (error?: unknown) => void;\n }) => boolean;\n}\n\n/** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */\nexport interface TracingChannelBindingHandle<TData extends object = object> {\n /**\n * The tracing channel with the span bound into async context.\n */\n channel: SentryTracingChannel<TData>;\n\n /**\n * Tears down the binding: unsubscribes lifecycle handlers, when present, and unbinds the start store.\n * Idempotent, and a no-op when no async context binding was available.\n */\n unbind: () => void;\n}\n\nconst NOOP = (): void => {};\n\n/**\n * Bind a span and its lifecycle to a tracing channel so the span becomes the active async context\n * for the traced operation and is ended when the operation completes.\n *\n * `getSpan` may return `undefined` to opt a payload out entirely: nothing is bound, no span is\n * tracked, and the active context is left untouched. Use it for events that ride the same channel\n * but should reuse the enclosing span instead of opening (and ending) their own — e.g. an agent\n * loop's per-step events, where ending a freshly opened span would close the parent prematurely.\n */\nexport function bindTracingChannelToSpan<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n opts?: TracingChannelLifeCycleOptions<TData>,\n): TracingChannelBindingHandle<TData> {\n const handle = bindSpanToChannelStore(channel, getSpan);\n\n const beforeSpanEnd = opts?.beforeSpanEnd;\n const deferSpanEnd = opts?.deferSpanEnd;\n const getErrorHint = (e: unknown): ExclusiveEventHintOrCaptureContext => {\n if (typeof opts?.captureError === 'function') {\n return opts.captureError(e);\n }\n\n return {\n mechanism: {\n type: 'auto.diagnostic_channels.bind_span',\n handled: false,\n },\n };\n };\n\n // Apply Sentry error status + attributes (and capture, if configured) to a span. Shared by the\n // channel `error` lifecycle and the deferred `end` util so the two can't drift.\n const annotateSpanError = (span: Span, error: unknown): void => {\n if (opts?.captureError) {\n captureException(error, getErrorHint(error));\n }\n\n const { message, attributes } = getErrorInfo(error);\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n span.setAttributes(attributes);\n };\n\n // Creates an end fn for deferred handlers to use, ensures consistent span end behavior\n const makeDeferredEnd = (span: Span, data: TracingChannelPayloadWithSpan<TData>) => {\n let ended = false;\n\n return (error?: unknown): void => {\n if (ended) {\n return;\n }\n\n ended = true;\n if (error !== undefined) {\n annotateSpanError(span, error);\n }\n\n endBoundSpan(data, beforeSpanEnd);\n };\n };\n\n const subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>> = {\n start: NOOP,\n asyncStart: NOOP,\n end(data) {\n // The operation settled synchronously (returned or threw)\n // Presence checks because caller can return `undefined` result or throw a falsy value.\n if ('error' in data || 'result' in data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n }\n },\n error(data) {\n // No span was bound for this payload (`getSpan` returned undefined), so there is nothing to\n // annotate and no instrumentation that owns capturing this error.\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n\n annotateSpanError(span, data.error);\n },\n asyncEnd(data) {\n const span = data._sentrySpan;\n if (span && deferSpanEnd?.({ span, data, end: makeDeferredEnd(span, data) })) {\n return;\n }\n endBoundSpan(data, beforeSpanEnd);\n },\n };\n\n handle.channel.subscribe(subscribers);\n\n return {\n channel: handle.channel,\n unbind: () => {\n handle.channel.unsubscribe(subscribers);\n handle.unbind();\n },\n };\n}\n\n/**\n * Bind a span into the channel's async context so it becomes active for the traced operation,\n * without managing its lifecycle. The primitive behind {@link bindTracingChannelToSpan}, which\n * layers span-ending and error handling on top.\n *\n * `getSpan` may return `undefined` to leave the active context untouched for that payload.\n */\nfunction bindSpanToChannelStore<TData extends object>(\n channel: TracingChannel<TData, TData>,\n getSpan: (data: TracingChannelPayloadWithSpan<TData>) => Span | undefined,\n): TracingChannelBindingHandle<TData> {\n // Grabs the tracing channel binding defined by the AsyncContext strategy implementation\n const binding = getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.();\n\n // If no binding, then either the implementer doesn't support tracing channels or there is no active strategy\n // Failure mode here means we would still access the channel and potentially subscribe to it, but parenting will be off.\n if (!binding) {\n DEBUG_BUILD && debug.log('[TracingChannel] Could not access async context binding.');\n\n return {\n channel,\n unbind: NOOP,\n };\n }\n\n // Grab the ALS instance, we don't really care what is in it as long as the AsyncContext strategy can use its value to figure out parenting.\n const asyncLocalStorage = binding.asyncLocalStorage as AsyncLocalStorage<TData>;\n\n // bindStore activates the ALS for the traced call; any getStore() inside it returns the value bound for that context.\n // 1. Produce: getStoreWithActiveSpan(span) clones the current scope, plants the span via _INTERNAL_setSpanForScope, and returns { scope, isolationScope }, the active context carrying our span.\n // 2. Bind: the courier hands that opaque value to channel.start.bindStore(asyncLocalStorage, producer), which runs the traced op inside asyncLocalStorage.run(value, …); it never inspects the value.\n // 3. Read: inside the op, Sentry's scope machinery calls getScopes() → asyncStorage.getStore() on that same ALS, so getCurrentScope/getIsolationScope/getActiveSpan resolve to the scope carrying our span.\n // 4. Nest: any child span started in the traced op parents to that active span.\n channel.start.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n // Stash the caller's store before we swap in the span store, so `asyncStart` can restore it for\n // callback-style channels (see `_sentryCallerStore`).\n data._sentryCallerStore = asyncLocalStorage.getStore();\n\n const span = getSpan(data);\n if (!span) {\n // Leave the active context untouched so nested operations keep parenting to the enclosing span.\n return data._sentryCallerStore as TData;\n }\n data._sentrySpan = span;\n\n return binding.getStoreWithActiveSpan(span) as TData;\n });\n\n // Restore the caller's context for the async continuation. Only callback-style channels `runStores`\n // `asyncStart` (so the callback runs inside this store). promise channels `publish` it, leaving this\n // inert, their continuation already inherits the caller's context natively.\n channel.asyncStart.bindStore(asyncLocalStorage, (data: TracingChannelPayloadWithSpan<TData>) => {\n return data._sentryCallerStore as TData;\n });\n\n return {\n channel,\n unbind: () => {\n // Removes the stores\n channel.start.unbindStore(asyncLocalStorage);\n channel.asyncStart.unbindStore(asyncLocalStorage);\n },\n };\n}\n\nfunction endBoundSpan<TData extends object>(\n data: TracingChannelPayloadWithSpan<TData>,\n beforeSpanEnd: TracingChannelLifeCycleOptions<TData>['beforeSpanEnd'],\n): void {\n const span = data._sentrySpan;\n if (!span) {\n return;\n }\n beforeSpanEnd?.(span, data);\n span.end();\n}\n\ntype ErrorInfo = {\n message: string;\n attributes: Record<string, string>;\n};\n\n/**\n * Best-effort message and attribute extraction for thrown/rejected values.\n */\nfunction getErrorInfo(error: unknown): ErrorInfo {\n const isObject = !!error && typeof error === 'object';\n const raw = isObject ? ('message' in error ? error.message : undefined) : error;\n\n const message = raw ? String(raw) : 'unknown_error';\n const type = isObject && 'name' in error ? String(error.name) : 'unknown';\n\n return {\n message,\n attributes: {\n [ERROR_TYPE]: type,\n },\n };\n}\n"],"names":[],"mappings":";;;;AA4EA,MAAM,OAAO,MAAY;AAAC,CAAA;AAWnB,SAAS,wBAAA,CACd,OAAA,EACA,OAAA,EACA,IAAA,EACoC;AACpC,EAAA,MAAM,MAAA,GAAS,sBAAA,CAAuB,OAAA,EAAS,OAAO,CAAA;AAEtD,EAAA,MAAM,gBAAgB,IAAA,EAAM,aAAA;AAC5B,EAAA,MAAM,eAAe,IAAA,EAAM,YAAA;AAC3B,EAAA,MAAM,YAAA,GAAe,CAAC,CAAA,KAAmD;AACvE,IAAA,IAAI,OAAO,IAAA,EAAM,YAAA,KAAiB,UAAA,EAAY;AAC5C,MAAA,OAAO,IAAA,CAAK,aAAa,CAAC,CAAA;AAAA,IAC5B;AAEA,IAAA,OAAO;AAAA,MACL,SAAA,EAAW;AAAA,QACT,IAAA,EAAM,oCAAA;AAAA,QACN,OAAA,EAAS;AAAA;AACX,KACF;AAAA,EACF,CAAA;AAIA,EAAA,MAAM,iBAAA,GAAoB,CAAC,IAAA,EAAY,KAAA,KAAyB;AAC9D,IAAA,IAAI,MAAM,YAAA,EAAc;AACtB,MAAA,gBAAA,CAAiB,KAAA,EAAO,YAAA,CAAa,KAAK,CAAC,CAAA;AAAA,IAC7C;AAEA,IAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAI,aAAa,KAAK,CAAA;AAClD,IAAA,IAAA,CAAK,SAAA,CAAU,EAAE,IAAA,EAAM,iBAAA,EAAmB,SAAS,CAAA;AACnD,IAAA,IAAA,CAAK,cAAc,UAAU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F,IAAA,OAAO,IAAA,CAAK,kBAAA;AAAA,EACd,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,QAAQ,MAAM;AAEZ,MAAA,OAAA,CAAQ,KAAA,CAAM,YAAY,iBAAiB,CAAA;AAC3C,MAAA,OAAA,CAAQ,UAAA,CAAW,YAAY,iBAAiB,CAAA;AAAA,IAClD;AAAA,GACF;AACF;AAEA,SAAS,YAAA,CACP,MACA,aAAA,EACM;AACN,EAAA,MAAM,OAAO,IAAA,CAAK,WAAA;AAClB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA;AAAA,EACF;AACA,EAAA,aAAA,GAAgB,MAAM,IAAI,CAAA;AAC1B,EAAA,IAAA,CAAK,GAAA,EAAI;AACX;AAUA,SAAS,aAAa,KAAA,EAA2B;AAC/C,EAAA,MAAM,QAAA,GAAW,CAAC,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA;AAC7C,EAAA,MAAM,MAAM,QAAA,GAAY,SAAA,IAAa,KAAA,GAAQ,KAAA,CAAM,UAAU,MAAA,GAAa,KAAA;AAE1E,EAAA,MAAM,OAAA,GAAU,GAAA,GAAM,MAAA,CAAO,GAAG,CAAA,GAAI,eAAA;AACpC,EAAA,MAAM,OAAO,QAAA,IAAY,MAAA,IAAU,QAAQ,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,GAAI,SAAA;AAEhE,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,CAAC,UAAU,GAAG;AAAA;AAChB,GACF;AACF;;;;"}
@@ -1,15 +1,17 @@
1
- import { defineIntegration } from '@sentry/core';
1
+ import { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';
2
2
  import { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber.js';
3
- import * as dc from 'node:diagnostics_channel';
3
+ import * as diagnosticsChannel from 'node:diagnostics_channel';
4
4
 
5
5
  const _vercelAiIntegration = ((options = {}) => {
6
6
  return {
7
7
  name: "VercelAI",
8
8
  setupOnce() {
9
- if (!dc.tracingChannel) {
9
+ if (!diagnosticsChannel.tracingChannel) {
10
10
  return;
11
11
  }
12
- void Promise.resolve().then(() => subscribeVercelAiTracingChannel(dc.tracingChannel, options));
12
+ waitForTracingChannelBinding(() => {
13
+ subscribeVercelAiTracingChannel(diagnosticsChannel.tracingChannel, options);
14
+ });
13
15
  }
14
16
  };
15
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/vercel-ai/index.ts"],"sourcesContent":["import { defineIntegration, type IntegrationFn } from '@sentry/core';\nimport { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber';\nimport * as dc from 'node:diagnostics_channel';\n\ntype VercelAiOptions = {\n /**\n * Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true`\n * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.\n * Integration-level options take precedence over global `dataCollection` config.\n */\n recordInputs?: boolean;\n\n /**\n * Enable or disable output recording. Enabled if `dataCollection.genAI.outputs` (or the deprecated `sendDefaultPii` option) is `true`\n * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.\n * Integration-level options take precedence over global `dataCollection` config.\n */\n recordOutputs?: boolean;\n\n /**\n * Enable or disable truncation of recorded input messages.\n * Defaults to `true`.\n */\n enableTruncation?: boolean;\n};\n\nconst _vercelAiIntegration = ((options: VercelAiOptions = {}) => {\n return {\n name: 'VercelAI' as const,\n setupOnce() {\n // Bail if this is not available\n if (!dc.tracingChannel) {\n return;\n }\n\n // Subscribe to the `ai` SDK's native telemetry tracing channel (ai >= 7).\n // This is a no-op on versions that don't publish to the channel, so it is always safe to call.\n // The factory needs the Sentry OTel context manager, which `initOpenTelemetry()` registers after `setupOnce`, so defer a tick.\n // Options are passed in here rather than read back off the integration per event.\n void Promise.resolve().then(() => subscribeVercelAiTracingChannel(dc.tracingChannel, options));\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Auto-instrument the `ai` SDK's native telemetry tracing channel (ai >= 7).\n */\nexport const vercelAiIntegration = defineIntegration(_vercelAiIntegration);\n"],"names":[],"mappings":";;;;AA0BA,MAAM,oBAAA,IAAwB,CAAC,OAAA,GAA2B,EAAC,KAAM;AAC/D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,GAAG,cAAA,EAAgB;AACtB,QAAA;AAAA,MACF;AAMA,MAAA,KAAK,OAAA,CAAQ,SAAQ,CAAE,IAAA,CAAK,MAAM,+BAAA,CAAgC,EAAA,CAAG,cAAA,EAAgB,OAAO,CAAC,CAAA;AAAA,IAC/F;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,mBAAA,GAAsB,kBAAkB,oBAAoB;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/vercel-ai/index.ts"],"sourcesContent":["import { defineIntegration, waitForTracingChannelBinding, type IntegrationFn } from '@sentry/core';\nimport { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber';\nimport * as dc from 'node:diagnostics_channel';\n\ntype VercelAiOptions = {\n /**\n * Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true`\n * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.\n * Integration-level options take precedence over global `dataCollection` config.\n */\n recordInputs?: boolean;\n\n /**\n * Enable or disable output recording. Enabled if `dataCollection.genAI.outputs` (or the deprecated `sendDefaultPii` option) is `true`\n * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.\n * Integration-level options take precedence over global `dataCollection` config.\n */\n recordOutputs?: boolean;\n\n /**\n * Enable or disable truncation of recorded input messages.\n * Defaults to `true`.\n */\n enableTruncation?: boolean;\n};\n\nconst _vercelAiIntegration = ((options: VercelAiOptions = {}) => {\n return {\n name: 'VercelAI' as const,\n setupOnce() {\n // Bail if this is not available\n if (!dc.tracingChannel) {\n return;\n }\n\n // Subscribe to the `ai` SDK's native telemetry tracing channel (ai >= 7).\n // This is a no-op on versions that don't publish to the channel, so it is always safe to call.\n waitForTracingChannelBinding(() => {\n subscribeVercelAiTracingChannel(dc.tracingChannel, options);\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Auto-instrument the `ai` SDK's native telemetry tracing channel (ai >= 7).\n */\nexport const vercelAiIntegration = defineIntegration(_vercelAiIntegration);\n"],"names":["dc"],"mappings":";;;;AA0BA,MAAM,oBAAA,IAAwB,CAAC,OAAA,GAA2B,EAAC,KAAM;AAC/D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAACA,mBAAG,cAAA,EAAgB;AACtB,QAAA;AAAA,MACF;AAIA,MAAA,4BAAA,CAA6B,MAAM;AACjC,QAAA,+BAAA,CAAgCA,kBAAA,CAAG,gBAAgB,OAAO,CAAA;AAAA,MAC5D,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,mBAAA,GAAsB,kBAAkB,oBAAoB;;;;"}
@@ -8,4 +8,5 @@ export type { IORedisCommandData, RedisBatchData, RedisCommandData, RedisConnect
8
8
  export { bindTracingChannelToSpan } from './tracing-channel';
9
9
  export type { SentryTracingChannel, TracingChannelLifeCycleOptions, TracingChannelBindingHandle, TracingChannelPayloadWithSpan, } from './tracing-channel';
10
10
  export { vercelAiIntegration } from './vercel-ai';
11
+ export { fastifyIntegration, handleFastifyError, instrumentFastify, } from './integrations/tracing-channel/fastify';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EAElB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { FastifyReply, FastifyRequest } from './types';
2
+ /**
3
+ * Subscribe to the Fastify v5 error diagnostics channel.
4
+ */
5
+ export declare function subscribeToFastifyErrorChannel(): void;
6
+ /**
7
+ * Handle a Fastify error, and possibly send it to Sentry.
8
+ */
9
+ export declare function handleFastifyError(this: {
10
+ diagnosticsChannelExists?: boolean;
11
+ }, error: Error, request: FastifyRequest, reply: FastifyReply, handlerOrigin: 'diagnostics-channel' | 'onError-hook'): void;
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/fastify/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAWhF;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAUrD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE;IACJ,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,EACD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,EACnB,aAAa,EAAE,qBAAqB,GAAG,cAAc,GACpD,IAAI,CA0BN"}
@@ -0,0 +1,66 @@
1
+ import type { FastifyReply, FastifyRequest } from './types';
2
+ import { handleFastifyError as _handleFastifyError } from './errors';
3
+ /**
4
+ * Options for the Fastify integration.
5
+ *
6
+ * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry
7
+ * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
8
+ * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
9
+ *
10
+ * @example
11
+ *
12
+ * ```javascript
13
+ * Sentry.init({
14
+ * integrations: [
15
+ * Sentry.fastifyIntegration({
16
+ * shouldHandleError(_error, _request, reply) {
17
+ * return reply.statusCode >= 500;
18
+ * },
19
+ * });
20
+ * },
21
+ * });
22
+ * ```
23
+ *
24
+ */
25
+ interface FastifyIntegrationOptions {
26
+ /**
27
+ * Callback method deciding whether error should be captured and sent to Sentry
28
+ * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
29
+ * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
30
+ *
31
+ * @param error Captured Fastify error
32
+ * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
33
+ * @param reply Fastify reply (or any object containing at least statusCode)
34
+ */
35
+ shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
36
+ }
37
+ /**
38
+ * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).
39
+ * This integration supports Fastify v5 only.
40
+ *
41
+ * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).
42
+ *
43
+ * @example
44
+ * ```javascript
45
+ * const Sentry = require('@sentry/node');
46
+ *
47
+ * Sentry.init({
48
+ * integrations: [Sentry.fastifyIntegration()],
49
+ * })
50
+ * ```
51
+ */
52
+ export declare const fastifyIntegration: (options?: Partial<FastifyIntegrationOptions> | undefined) => import("@sentry/core").Integration & {
53
+ name: string;
54
+ };
55
+ /**
56
+ * @deprecated This export is deprecated and will not longer be exposed in the next major version.
57
+ */
58
+ export declare const instrumentFastify: (() => void) & {
59
+ id: string;
60
+ };
61
+ /**
62
+ * @deprecated This export is deprecated and will not longer be exposed in the next major version.
63
+ */
64
+ export declare const handleFastifyError: typeof _handleFastifyError;
65
+ export {};
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIhF,OAAO,EAAkC,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAErG;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,UAAU,yBAAyB;IACjC;;;;;;;;OAQG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;CAC5F;AAsBD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB;;CAE9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;CAAqB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,kBAAkB,4BAAsB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Set up the Fastify (>= 3.21.0 < 6) instrumentation by subscribing to the `fastify.initialization`
3
+ * diagnostics channel and registering the span-creating plugin on every Fastify instance.
4
+ *
5
+ * Idempotent and exposes an `id` so it can participate in the OpenTelemetry preload list.
6
+ */
7
+ export declare const instrumentFastify: (() => void) & {
8
+ id: string;
9
+ };
10
+ //# sourceMappingURL=instrumentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/fastify/instrumentation.ts"],"names":[],"mappings":"AA+XA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SACE,IAAI;;CAmBnC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { Integration } from '@sentry/core';
2
+ type HandlerOriginal = ((request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => Promise<void>) | ((request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => void);
3
+ type FastifyError = any;
4
+ type HookHandlerDoneFunction = <TError extends Error = FastifyError>(err?: TError) => void;
5
+ export interface FastifyInstance {
6
+ version: string;
7
+ register: (plugin: any) => FastifyInstance;
8
+ decorate: (key: string | symbol, value: unknown) => void;
9
+ decorateRequest: (key: string | symbol, value: unknown) => void;
10
+ setNotFoundHandler: (hooks: any, handler?: any) => void;
11
+ after: (listener?: (err: Error) => void) => FastifyInstance;
12
+ addHook(hook: string, handler: HandlerOriginal): FastifyInstance;
13
+ addHook(hook: 'onError', handler: (request: FastifyRequest, reply: FastifyReply, error: Error) => void): FastifyInstance;
14
+ addHook(hook: 'onRequest', handler: (request: FastifyRequest, reply: FastifyReply) => void): FastifyInstance;
15
+ }
16
+ export interface FastifyReply {
17
+ send: () => FastifyReply;
18
+ statusCode: number;
19
+ }
20
+ export interface FastifyRequest {
21
+ method?: string;
22
+ routeOptions?: {
23
+ url?: string;
24
+ };
25
+ routerPath?: string;
26
+ }
27
+ export interface FastifyIntegration extends Integration {
28
+ getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
29
+ setShouldHandleError: (shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) => void;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/fastify/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,eAAe,GAChB,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAChG,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC,CAAC;AAE5F,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB,KAAK,uBAAuB,GAAG,CAAC,MAAM,SAAS,KAAK,GAAG,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,eAAe,CAAC;IAC3C,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAChE,kBAAkB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACxD,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,KAAK,eAAe,CAAC;IAC5D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,eAAe,CAAC;IACjE,OAAO,CACL,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,GAC5E,eAAe,CAAC;IACnB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,eAAe,CAAC;CAC9G;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,YAAY,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,YAAY,CAAC,EAAE;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,oBAAoB,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;IAEpG,oBAAoB,EAAE,CACpB,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,KACvF,IAAI,CAAC;CACX"}
@@ -0,0 +1,9 @@
1
+ import type { FastifyReply, FastifyRequest } from './types';
2
+ export declare const INTEGRATION_NAME = "Fastify";
3
+ /**
4
+ * Default function to determine if an error should be sent to Sentry
5
+ *
6
+ * 3xx and 4xx errors are not sent by default.
7
+ */
8
+ export declare function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean;
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAI9G"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * EXPERIMENTAL — orchestrion-driven lru-memoizer integration. Subscribes to
3
+ * `orchestrion:lru-memoizer:load` (injected into `lru-memoizer/lib/async.js`'s
4
+ * `memoizedFunction`). Creates no spans; only re-runs the memoized callback with the
5
+ * caller's scope. Requires the orchestrion runtime hook or bundler plugin.
6
+ */
7
+ export declare const lruMemoizerChannelIntegration: () => import("@sentry/core").Integration & {
8
+ name: "LruMemoizer";
9
+ };
10
+ //# sourceMappingURL=lru-memoizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lru-memoizer.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/lru-memoizer.ts"],"names":[],"mappings":"AAqCA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;CAAoD,CAAC"}
@@ -6,5 +6,7 @@
6
6
  * `Connection.prototype.query`. Requires the orchestrion runtime hook or
7
7
  * bundler plugin to be active — wire that up via `_experimentalSetupOrchestrion`.
8
8
  */
9
- export declare const mysqlChannelIntegration: () => import("@sentry/core").Integration;
9
+ export declare const mysqlChannelIntegration: () => import("@sentry/core").Integration & {
10
+ name: "Mysql";
11
+ };
10
12
  //# sourceMappingURL=mysql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/mysql.ts"],"names":[],"mappings":"AAoRA;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,0CAA8C,CAAC"}
1
+ {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing-channel/mysql.ts"],"names":[],"mappings":"AAuKA;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;CAA8C,CAAC"}
@@ -13,6 +13,7 @@
13
13
  */
14
14
  export declare const CHANNELS: {
15
15
  readonly MYSQL_QUERY: "orchestrion:mysql:query";
16
+ readonly LRU_MEMOIZER_LOAD: "orchestrion:lru-memoizer:load";
16
17
  };
17
18
  export type ChannelName = (typeof CHANNELS)[keyof typeof CHANNELS];
18
19
  //# sourceMappingURL=channels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ;;CAEX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAqB1D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,EAAyE,CAAC;AAExH;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAO1G"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EA2B1D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,EAAyE,CAAC;AAExH;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAO1G"}
@@ -1,3 +1,4 @@
1
1
  export { detectOrchestrionSetup } from './detect';
2
2
  export { mysqlChannelIntegration } from '../integrations/tracing-channel/mysql';
3
+ export { lruMemoizerChannelIntegration } from '../integrations/tracing-channel/lru-memoizer';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC"}
@@ -1,7 +1,14 @@
1
1
  import type { TracingChannel, TracingChannelSubscribers } from 'node:diagnostics_channel';
2
2
  import type { ExclusiveEventHintOrCaptureContext, Span } from '@sentry/core';
3
3
  export type TracingChannelPayloadWithSpan<TData extends object> = TData & {
4
+ /**
5
+ * The current active span for the traced call.
6
+ */
4
7
  _sentrySpan?: Span;
8
+ /**
9
+ * The context's active store value, used to restore the context for asyncStart continuations for callback-based tracing.
10
+ */
11
+ _sentryCallerStore?: unknown;
5
12
  };
6
13
  export interface SentryTracingChannel<TData extends object = object> extends Omit<TracingChannel<TData, TracingChannelPayloadWithSpan<TData>>, 'subscribe' | 'unsubscribe'> {
7
14
  subscribe(subscribers: Partial<TracingChannelSubscribers<TracingChannelPayloadWithSpan<TData>>>): void;
@@ -20,6 +27,21 @@ export interface TracingChannelLifeCycleOptions<TData extends object = object> {
20
27
  * For database drivers, it is not recommended to set this at all.
21
28
  */
22
29
  captureError?: boolean | ((e: unknown) => ExclusiveEventHintOrCaptureContext);
30
+ /**
31
+ * Take ownership of *when* the span ends: return `true` and the helper won't end it on
32
+ * `end`/`asyncEnd`. For results that settle out-of-band — e.g. a streamed `EventEmitter` that
33
+ * completes via its own `'end'`/`'error'` events.
34
+ *
35
+ * Call `end` when it settles — `end()` on success, `end(error)` on failure. `end` owns *how* the span
36
+ * ends (error status/attributes, `captureError`, `beforeSpanEnd`) and is idempotent. Default `false`
37
+ * lets the helper end the span as usual.
38
+ */
39
+ deferSpanEnd?: (args: {
40
+ span: Span;
41
+ data: TracingChannelPayloadWithSpan<TData>;
42
+ /** Ends the span: `end()` on success, `end(error)` on failure. Idempotent. */
43
+ end: (error?: unknown) => void;
44
+ }) => boolean;
23
45
  }
24
46
  /** Returned by {@link bindTracingChannelToSpan}: the bound channel plus a teardown handle. */
25
47
  export interface TracingChannelBindingHandle<TData extends object = object> {
@@ -1 +1 @@
1
- {"version":3,"file":"tracing-channel.d.ts","sourceRoot":"","sources":["../../src/tracing-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,KAAK,EA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kCAAkC,CAAC,CAAC;IAE9E;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC;QAC3C,8EAA8E;QAC9E,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;KAChC,KAAK,OAAO,CAAC;CACf;AAED,8FAA8F;AAC9F,MAAM,WAAW,2BAA2B,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM;IACxE;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAErC;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAID;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,MAAM,EAC3D,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,EACrC,OAAO,EAAE,CAAC,IAAI,EAAE,6BAA6B,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,SAAS,EACzE,IAAI,CAAC,EAAE,8BAA8B,CAAC,KAAK,CAAC,GAC3C,2BAA2B,CAAC,KAAK,CAAC,CA0FpC"}
@@ -20,6 +20,8 @@ type VercelAiOptions = {
20
20
  /**
21
21
  * Auto-instrument the `ai` SDK's native telemetry tracing channel (ai >= 7).
22
22
  */
23
- export declare const vercelAiIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration;
23
+ export declare const vercelAiIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
24
+ name: "VercelAI";
25
+ };
24
26
  export {};
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vercel-ai/index.ts"],"names":[],"mappings":"AAIA,KAAK,eAAe,GAAG;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAoBF;;GAEG;AACH,eAAO,MAAM,mBAAmB,+EAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vercel-ai/index.ts"],"names":[],"mappings":"AAIA,KAAK,eAAe,GAAG;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAoBF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;CAA0C,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference path="./node-diagnostics-channel.d.ts" />
1
2
  /**
2
3
  * Server-only utilities shared across Sentry server SDKs.
3
4
  *
@@ -8,4 +9,5 @@ export { IORedisCommandData, RedisBatchData, RedisCommandData, RedisConnectData,
8
9
  export { bindTracingChannelToSpan } from './tracing-channel';
9
10
  export { SentryTracingChannel, TracingChannelLifeCycleOptions, TracingChannelBindingHandle, TracingChannelPayloadWithSpan, } from './tracing-channel';
10
11
  export { vercelAiIntegration } from './vercel-ai';
12
+ export { fastifyIntegration, handleFastifyError, instrumentFastify, } from './integrations/tracing-channel/fastify';
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { FastifyReply, FastifyRequest } from './types';
2
+ /**
3
+ * Subscribe to the Fastify v5 error diagnostics channel.
4
+ */
5
+ export declare function subscribeToFastifyErrorChannel(): void;
6
+ /**
7
+ * Handle a Fastify error, and possibly send it to Sentry.
8
+ */
9
+ export declare function handleFastifyError(this: {
10
+ diagnosticsChannelExists?: boolean;
11
+ }, error: Error, request: FastifyRequest, reply: FastifyReply, handlerOrigin: 'diagnostics-channel' | 'onError-hook'): void;
12
+ //# sourceMappingURL=errors.d.ts.map