@sentry/node 8.42.0 → 8.44.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 (99) hide show
  1. package/build/cjs/index.js +1 -0
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/anr/index.js +26 -1
  4. package/build/cjs/integrations/anr/index.js.map +1 -1
  5. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +4 -2
  6. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +1 -1
  7. package/build/cjs/integrations/http/index.js +13 -9
  8. package/build/cjs/integrations/http/index.js.map +1 -1
  9. package/build/cjs/integrations/http/vendor/getRequestInfo.js +130 -0
  10. package/build/cjs/integrations/http/vendor/getRequestInfo.js.map +1 -0
  11. package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
  12. package/build/cjs/integrations/onunhandledrejection.js +2 -8
  13. package/build/cjs/integrations/onunhandledrejection.js.map +1 -1
  14. package/build/cjs/integrations/tracing/express.js +2 -0
  15. package/build/cjs/integrations/tracing/express.js.map +1 -1
  16. package/build/cjs/integrations/tracing/index.js +5 -2
  17. package/build/cjs/integrations/tracing/index.js.map +1 -1
  18. package/build/cjs/integrations/tracing/nest/nest.js +9 -2
  19. package/build/cjs/integrations/tracing/nest/nest.js.map +1 -1
  20. package/build/cjs/integrations/tracing/vercelai/index.js +202 -0
  21. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -0
  22. package/build/cjs/integrations/tracing/vercelai/instrumentation.js +75 -0
  23. package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -0
  24. package/build/cjs/sdk/index.js +7 -2
  25. package/build/cjs/sdk/index.js.map +1 -1
  26. package/build/cjs/sdk/initOtel.js +30 -5
  27. package/build/cjs/sdk/initOtel.js.map +1 -1
  28. package/build/cjs/utils/errorhandling.js.map +1 -1
  29. package/build/cjs/utils/module.js +8 -10
  30. package/build/cjs/utils/module.js.map +1 -1
  31. package/build/esm/index.js +1 -1
  32. package/build/esm/integrations/anr/index.js +27 -3
  33. package/build/esm/integrations/anr/index.js.map +1 -1
  34. package/build/esm/integrations/anr/worker-script.js +2 -2
  35. package/build/esm/integrations/http/SentryHttpInstrumentation.js +4 -2
  36. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +1 -1
  37. package/build/esm/integrations/http/index.js +13 -9
  38. package/build/esm/integrations/http/index.js.map +1 -1
  39. package/build/esm/integrations/http/vendor/getRequestInfo.js +128 -0
  40. package/build/esm/integrations/http/vendor/getRequestInfo.js.map +1 -0
  41. package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
  42. package/build/esm/integrations/local-variables/worker-script.js +2 -2
  43. package/build/esm/integrations/onunhandledrejection.js +2 -8
  44. package/build/esm/integrations/onunhandledrejection.js.map +1 -1
  45. package/build/esm/integrations/tracing/express.js +2 -0
  46. package/build/esm/integrations/tracing/express.js.map +1 -1
  47. package/build/esm/integrations/tracing/index.js +3 -0
  48. package/build/esm/integrations/tracing/index.js.map +1 -1
  49. package/build/esm/integrations/tracing/nest/nest.js +9 -2
  50. package/build/esm/integrations/tracing/nest/nest.js.map +1 -1
  51. package/build/esm/integrations/tracing/vercelai/index.js +196 -0
  52. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -0
  53. package/build/esm/integrations/tracing/vercelai/instrumentation.js +73 -0
  54. package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -0
  55. package/build/esm/package.json +1 -1
  56. package/build/esm/sdk/index.js +7 -2
  57. package/build/esm/sdk/index.js.map +1 -1
  58. package/build/esm/sdk/initOtel.js +30 -6
  59. package/build/esm/sdk/initOtel.js.map +1 -1
  60. package/build/esm/utils/errorhandling.js.map +1 -1
  61. package/build/esm/utils/module.js +8 -10
  62. package/build/esm/utils/module.js.map +1 -1
  63. package/build/types/index.d.ts +1 -1
  64. package/build/types/index.d.ts.map +1 -1
  65. package/build/types/integrations/anr/index.d.ts +2 -0
  66. package/build/types/integrations/anr/index.d.ts.map +1 -1
  67. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +1 -1
  68. package/build/types/integrations/http/index.d.ts +9 -0
  69. package/build/types/integrations/http/index.d.ts.map +1 -1
  70. package/build/types/integrations/http/vendor/getRequestInfo.d.ts +21 -0
  71. package/build/types/integrations/http/vendor/getRequestInfo.d.ts.map +1 -0
  72. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  73. package/build/types/integrations/tracing/index.d.ts.map +1 -1
  74. package/build/types/integrations/tracing/nest/nest.d.ts.map +1 -1
  75. package/build/types/integrations/tracing/nest/types.d.ts +14 -6
  76. package/build/types/integrations/tracing/nest/types.d.ts.map +1 -1
  77. package/build/types/integrations/tracing/vercelai/index.d.ts +40 -0
  78. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -0
  79. package/build/types/integrations/tracing/vercelai/instrumentation.d.ts +21 -0
  80. package/build/types/integrations/tracing/vercelai/instrumentation.d.ts.map +1 -0
  81. package/build/types/integrations/tracing/vercelai/types.d.ts +38 -0
  82. package/build/types/integrations/tracing/vercelai/types.d.ts.map +1 -0
  83. package/build/types/sdk/index.d.ts.map +1 -1
  84. package/build/types/sdk/initOtel.d.ts +2 -0
  85. package/build/types/sdk/initOtel.d.ts.map +1 -1
  86. package/build/types/utils/errorhandling.d.ts +1 -1
  87. package/build/types/utils/errorhandling.d.ts.map +1 -1
  88. package/build/types/utils/module.d.ts.map +1 -1
  89. package/build/types-ts3.8/index.d.ts +1 -1
  90. package/build/types-ts3.8/integrations/anr/index.d.ts +2 -0
  91. package/build/types-ts3.8/integrations/http/index.d.ts +9 -0
  92. package/build/types-ts3.8/integrations/http/vendor/getRequestInfo.d.ts +21 -0
  93. package/build/types-ts3.8/integrations/tracing/nest/types.d.ts +14 -6
  94. package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +40 -0
  95. package/build/types-ts3.8/integrations/tracing/vercelai/instrumentation.d.ts +21 -0
  96. package/build/types-ts3.8/integrations/tracing/vercelai/types.d.ts +38 -0
  97. package/build/types-ts3.8/sdk/initOtel.d.ts +2 -0
  98. package/build/types-ts3.8/utils/errorhandling.d.ts +1 -1
  99. package/package.json +33 -33
@@ -0,0 +1,196 @@
1
+ import { _optionalChain } from '@sentry/core';
2
+ import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
3
+ import { generateInstrumentOnce } from '../../../otel/instrument.js';
4
+ import { addOriginToSpan } from '../../../utils/addOriginToSpan.js';
5
+ import { SentryVercelAiInstrumentation, sentryVercelAiPatched } from './instrumentation.js';
6
+
7
+ /* eslint-disable complexity */
8
+
9
+ const instrumentVercelAi = generateInstrumentOnce('vercelAI', () => new SentryVercelAiInstrumentation({}));
10
+
11
+ const _vercelAIIntegration = (() => {
12
+ return {
13
+ name: 'vercelAI',
14
+ setupOnce() {
15
+ instrumentVercelAi();
16
+ },
17
+ processEvent(event) {
18
+ if (event.type === 'transaction' && _optionalChain([event, 'access', _ => _.spans, 'optionalAccess', _2 => _2.length])) {
19
+ for (const span of event.spans) {
20
+ const { data: attributes, description: name } = span;
21
+
22
+ if (!attributes || !name || span.origin !== 'auto.vercelai.otel') {
23
+ continue;
24
+ }
25
+
26
+ // attributes around token usage can only be set on span finish
27
+ span.data = span.data || {};
28
+
29
+ if (attributes['ai.usage.completionTokens'] != undefined) {
30
+ span.data['ai.completion_tokens.used'] = attributes['ai.usage.completionTokens'];
31
+ }
32
+ if (attributes['ai.usage.promptTokens'] != undefined) {
33
+ span.data['ai.prompt_tokens.used'] = attributes['ai.usage.promptTokens'];
34
+ }
35
+ if (
36
+ attributes['ai.usage.completionTokens'] != undefined &&
37
+ attributes['ai.usage.promptTokens'] != undefined
38
+ ) {
39
+ span.data['ai.total_tokens.used'] =
40
+ attributes['ai.usage.completionTokens'] + attributes['ai.usage.promptTokens'];
41
+ }
42
+ }
43
+ }
44
+
45
+ return event;
46
+ },
47
+ setup(client) {
48
+ client.on('spanStart', span => {
49
+ if (!sentryVercelAiPatched) {
50
+ return;
51
+ }
52
+
53
+ const { data: attributes, description: name } = spanToJSON(span);
54
+
55
+ if (!attributes || !name) {
56
+ return;
57
+ }
58
+
59
+ // The id of the model
60
+ const aiModelId = attributes['ai.model.id'];
61
+
62
+ // the provider of the model
63
+ const aiModelProvider = attributes['ai.model.provider'];
64
+
65
+ // both of these must be defined for the integration to work
66
+ if (!aiModelId || !aiModelProvider) {
67
+ return;
68
+ }
69
+
70
+ let isPipelineSpan = false;
71
+
72
+ switch (name) {
73
+ case 'ai.generateText': {
74
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');
75
+ isPipelineSpan = true;
76
+ break;
77
+ }
78
+ case 'ai.generateText.doGenerate': {
79
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');
80
+ break;
81
+ }
82
+ case 'ai.streamText': {
83
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');
84
+ isPipelineSpan = true;
85
+ break;
86
+ }
87
+ case 'ai.streamText.doStream': {
88
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');
89
+ break;
90
+ }
91
+ case 'ai.generateObject': {
92
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');
93
+ isPipelineSpan = true;
94
+ break;
95
+ }
96
+ case 'ai.generateObject.doGenerate': {
97
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');
98
+ break;
99
+ }
100
+ case 'ai.streamObject': {
101
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');
102
+ isPipelineSpan = true;
103
+ break;
104
+ }
105
+ case 'ai.streamObject.doStream': {
106
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');
107
+ break;
108
+ }
109
+ case 'ai.embed': {
110
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');
111
+ isPipelineSpan = true;
112
+ break;
113
+ }
114
+ case 'ai.embed.doEmbed': {
115
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');
116
+ break;
117
+ }
118
+ case 'ai.embedMany': {
119
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');
120
+ isPipelineSpan = true;
121
+ break;
122
+ }
123
+ case 'ai.embedMany.doEmbed': {
124
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');
125
+ break;
126
+ }
127
+ case 'ai.toolCall':
128
+ case 'ai.stream.firstChunk':
129
+ case 'ai.stream.finish':
130
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');
131
+ break;
132
+ }
133
+
134
+ addOriginToSpan(span, 'auto.vercelai.otel');
135
+
136
+ const nameWthoutAi = name.replace('ai.', '');
137
+ span.setAttribute('ai.pipeline.name', nameWthoutAi);
138
+ span.updateName(nameWthoutAi);
139
+
140
+ // If a Telemetry name is set and it is a pipeline span, use that as the operation name
141
+ if (attributes['ai.telemetry.functionId'] && isPipelineSpan) {
142
+ span.updateName(attributes['ai.telemetry.functionId']);
143
+ span.setAttribute('ai.pipeline.name', attributes['ai.telemetry.functionId']);
144
+ }
145
+
146
+ if (attributes['ai.prompt']) {
147
+ span.setAttribute('ai.input_messages', attributes['ai.prompt']);
148
+ }
149
+ if (attributes['ai.model.id']) {
150
+ span.setAttribute('ai.model_id', attributes['ai.model.id']);
151
+ }
152
+ span.setAttribute('ai.streaming', name.includes('stream'));
153
+ });
154
+ },
155
+ };
156
+ }) ;
157
+
158
+ /**
159
+ * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
160
+ *
161
+ * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
162
+ *
163
+ * @example
164
+ * ```javascript
165
+ * const Sentry = require('@sentry/node');
166
+ *
167
+ * Sentry.init({
168
+ * integrations: [Sentry.vercelAIIntegration()],
169
+ * });
170
+ * ```
171
+ *
172
+ * By default this integration adds tracing support to all `ai` function calls. If you need to disable
173
+ * collecting spans for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to
174
+ * `false` in the first argument of the function call.
175
+ *
176
+ * ```javascript
177
+ * const result = await generateText({
178
+ * model: openai('gpt-4-turbo'),
179
+ * experimental_telemetry: { isEnabled: false },
180
+ * });
181
+ * ```
182
+ *
183
+ * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each
184
+ * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`
185
+ * to `true`.
186
+ *
187
+ * ```javascript
188
+ * const result = await generateText({
189
+ * model: openai('gpt-4-turbo'),
190
+ * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
191
+ * });
192
+ */
193
+ const vercelAIIntegration = defineIntegration(_vercelAIIntegration);
194
+
195
+ export { instrumentVercelAi, vercelAIIntegration };
196
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"sourcesContent":["/* eslint-disable complexity */\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP, defineIntegration, spanToJSON } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../../otel/instrument';\nimport { addOriginToSpan } from '../../../utils/addOriginToSpan';\nimport { SentryVercelAiInstrumentation, sentryVercelAiPatched } from './instrumentation';\n\nexport const instrumentVercelAi = generateInstrumentOnce('vercelAI', () => new SentryVercelAiInstrumentation({}));\n\nconst _vercelAIIntegration = (() => {\n return {\n name: 'vercelAI',\n setupOnce() {\n instrumentVercelAi();\n },\n processEvent(event) {\n if (event.type === 'transaction' && event.spans?.length) {\n for (const span of event.spans) {\n const { data: attributes, description: name } = span;\n\n if (!attributes || !name || span.origin !== 'auto.vercelai.otel') {\n continue;\n }\n\n // attributes around token usage can only be set on span finish\n span.data = span.data || {};\n\n if (attributes['ai.usage.completionTokens'] != undefined) {\n span.data['ai.completion_tokens.used'] = attributes['ai.usage.completionTokens'];\n }\n if (attributes['ai.usage.promptTokens'] != undefined) {\n span.data['ai.prompt_tokens.used'] = attributes['ai.usage.promptTokens'];\n }\n if (\n attributes['ai.usage.completionTokens'] != undefined &&\n attributes['ai.usage.promptTokens'] != undefined\n ) {\n span.data['ai.total_tokens.used'] =\n attributes['ai.usage.completionTokens'] + attributes['ai.usage.promptTokens'];\n }\n }\n }\n\n return event;\n },\n setup(client) {\n client.on('spanStart', span => {\n if (!sentryVercelAiPatched) {\n return;\n }\n\n const { data: attributes, description: name } = spanToJSON(span);\n\n if (!attributes || !name) {\n return;\n }\n\n // The id of the model\n const aiModelId: string | undefined = attributes['ai.model.id'];\n\n // the provider of the model\n const aiModelProvider: string | undefined = attributes['ai.model.provider'];\n\n // both of these must be defined for the integration to work\n if (!aiModelId || !aiModelProvider) {\n return;\n }\n\n let isPipelineSpan = false;\n\n switch (name) {\n case 'ai.generateText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateText.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamText.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.generateObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateObject.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamObject.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.embed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embed.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.embedMany': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embedMany.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.toolCall':\n case 'ai.stream.firstChunk':\n case 'ai.stream.finish':\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');\n break;\n }\n\n addOriginToSpan(span, 'auto.vercelai.otel');\n\n const nameWthoutAi = name.replace('ai.', '');\n span.setAttribute('ai.pipeline.name', nameWthoutAi);\n span.updateName(nameWthoutAi);\n\n // If a Telemetry name is set and it is a pipeline span, use that as the operation name\n if (attributes['ai.telemetry.functionId'] && isPipelineSpan) {\n span.updateName(attributes['ai.telemetry.functionId']);\n span.setAttribute('ai.pipeline.name', attributes['ai.telemetry.functionId']);\n }\n\n if (attributes['ai.prompt']) {\n span.setAttribute('ai.input_messages', attributes['ai.prompt']);\n }\n if (attributes['ai.model.id']) {\n span.setAttribute('ai.model_id', attributes['ai.model.id']);\n }\n span.setAttribute('ai.streaming', name.includes('stream'));\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.vercelAIIntegration()],\n * });\n * ```\n *\n * By default this integration adds tracing support to all `ai` function calls. If you need to disable\n * collecting spans for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to\n * `false` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: false },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":[],"mappings":";;;;;;AAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA;;CAOa,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAqB,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,EAAE,CAAA,EAAA,CAAA,EAAM,CAAI,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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AAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAE,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
@@ -0,0 +1,73 @@
1
+ import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
2
+ import { SDK_VERSION } from '@sentry/core';
3
+
4
+ // List of patched methods
5
+ // From: https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#collected-data
6
+ const INSTRUMENTED_METHODS = [
7
+ 'generateText',
8
+ 'streamText',
9
+ 'generateObject',
10
+ 'streamObject',
11
+ 'embed',
12
+ 'embedMany',
13
+ ] ;
14
+
15
+ let sentryVercelAiPatched = false;
16
+
17
+ /**
18
+ * This detects is added by the Sentry Vercel AI Integration to detect if the integration should
19
+ * be enabled.
20
+ *
21
+ * It also patches the `ai` module to enable Vercel AI telemetry automatically for all methods.
22
+ */
23
+ class SentryVercelAiInstrumentation extends InstrumentationBase {
24
+ constructor(config = {}) {
25
+ super('@sentry/instrumentation-vercel-ai', SDK_VERSION, config);
26
+ }
27
+
28
+ /**
29
+ * Initializes the instrumentation by defining the modules to be patched.
30
+ */
31
+ init() {
32
+ const module = new InstrumentationNodeModuleDefinition('ai', ['>=3.0.0 <5'], this._patch.bind(this));
33
+ return module;
34
+ }
35
+
36
+ /**
37
+ * Patches module exports to enable Vercel AI telemetry.
38
+ */
39
+ _patch(moduleExports) {
40
+ sentryVercelAiPatched = true;
41
+
42
+ function generatePatch(name) {
43
+ return (...args) => {
44
+ const existingExperimentalTelemetry = args[0].experimental_telemetry || {};
45
+ const isEnabled = existingExperimentalTelemetry.isEnabled;
46
+
47
+ // if `isEnabled` is not explicitly set to `true` or `false`, enable telemetry
48
+ // but disable capturing inputs and outputs by default
49
+ if (isEnabled === undefined) {
50
+ args[0].experimental_telemetry = {
51
+ isEnabled: true,
52
+ recordInputs: false,
53
+ recordOutputs: false,
54
+ ...existingExperimentalTelemetry,
55
+ };
56
+ }
57
+
58
+ // @ts-expect-error we know that the method exists
59
+ return moduleExports[name].apply(this, args);
60
+ };
61
+ }
62
+
63
+ const patchedModuleExports = INSTRUMENTED_METHODS.reduce((acc, curr) => {
64
+ acc[curr] = generatePatch(curr);
65
+ return acc;
66
+ }, {} );
67
+
68
+ return { ...moduleExports, ...patchedModuleExports };
69
+ }
70
+ }
71
+
72
+ export { SentryVercelAiInstrumentation, sentryVercelAiPatched };
73
+ //# sourceMappingURL=instrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/vercelai/instrumentation.ts"],"sourcesContent":["import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport type { InstrumentationConfig, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport type { TelemetrySettings } from './types';\n\n// List of patched methods\n// From: https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#collected-data\nconst INSTRUMENTED_METHODS = [\n 'generateText',\n 'streamText',\n 'generateObject',\n 'streamObject',\n 'embed',\n 'embedMany',\n] as const;\n\ninterface MethodFirstArg extends Record<string, unknown> {\n experimental_telemetry?: TelemetrySettings;\n}\n\ntype MethodArgs = [MethodFirstArg, ...unknown[]];\n\ntype PatchedModuleExports = Record<(typeof INSTRUMENTED_METHODS)[number], (...args: MethodArgs) => unknown> &\n Record<string, unknown>;\n\nexport let sentryVercelAiPatched = false;\n\n/**\n * This detects is added by the Sentry Vercel AI Integration to detect if the integration should\n * be enabled.\n *\n * It also patches the `ai` module to enable Vercel AI telemetry automatically for all methods.\n */\nexport class SentryVercelAiInstrumentation extends InstrumentationBase {\n public constructor(config: InstrumentationConfig = {}) {\n super('@sentry/instrumentation-vercel-ai', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition('ai', ['>=3.0.0 <5'], this._patch.bind(this));\n return module;\n }\n\n /**\n * Patches module exports to enable Vercel AI telemetry.\n */\n private _patch(moduleExports: PatchedModuleExports): unknown {\n sentryVercelAiPatched = true;\n\n function generatePatch(name: string) {\n return (...args: MethodArgs) => {\n const existingExperimentalTelemetry = args[0].experimental_telemetry || {};\n const isEnabled = existingExperimentalTelemetry.isEnabled;\n\n // if `isEnabled` is not explicitly set to `true` or `false`, enable telemetry\n // but disable capturing inputs and outputs by default\n if (isEnabled === undefined) {\n args[0].experimental_telemetry = {\n isEnabled: true,\n recordInputs: false,\n recordOutputs: false,\n ...existingExperimentalTelemetry,\n };\n }\n\n // @ts-expect-error we know that the method exists\n return moduleExports[name].apply(this, args);\n };\n }\n\n const patchedModuleExports = INSTRUMENTED_METHODS.reduce((acc, curr) => {\n acc[curr] = generatePatch(curr);\n return acc;\n }, {} as PatchedModuleExports);\n\n return { ...moduleExports, ...patchedModuleExports };\n }\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA,MAAM,uBAAuB;AAC7B,EAAE,cAAc;AAChB,EAAE,YAAY;AACd,EAAE,gBAAgB;AAClB,EAAE,cAAc;AAChB,EAAE,OAAO;AACT,EAAE,WAAW;AACb,CAAE;;AAWK,IAAI,qBAAsB,GAAE;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,6BAA8B,SAAQ,mBAAoB,CAAA;AACvE,GAAS,WAAW,CAAC,MAAM,GAA0B,EAAE,EAAE;AACzD,IAAI,KAAK,CAAC,mCAAmC,EAAE,WAAW,EAAE,MAAM,CAAC;AACnE;;AAEA;AACA;AACA;A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+132,8 @@ function _init(
132
132
 
133
133
  logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);
134
134
 
135
+ // TODO(V9): Remove this code since all of the logic should be in an integration
136
+ // eslint-disable-next-line deprecation/deprecation
135
137
  if (options.autoSessionTracking) {
136
138
  startSessionTracking();
137
139
  }
@@ -193,9 +195,11 @@ function getClientOptions(
193
195
  const autoSessionTracking =
194
196
  typeof release !== 'string'
195
197
  ? false
196
- : options.autoSessionTracking === undefined
198
+ : // eslint-disable-next-line deprecation/deprecation
199
+ options.autoSessionTracking === undefined
197
200
  ? true
198
- : options.autoSessionTracking;
201
+ : // eslint-disable-next-line deprecation/deprecation
202
+ options.autoSessionTracking;
199
203
 
200
204
  if (options.spotlight == null) {
201
205
  const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });
@@ -290,6 +294,7 @@ function updateScopeFromEnvVariables() {
290
294
  */
291
295
  function startSessionTracking() {
292
296
  const client = getClient();
297
+ // eslint-disable-next-line deprecation/deprecation
293
298
  if (client && client.getOptions().autoSessionTracking) {
294
299
  client.initSessionFlusher();
295
300
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n endSession,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getIsolationScope,\n hasTracingEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n logger,\n propagationContextFromHeaders,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n startSession,\n} from '@sentry/core';\nimport {\n enhanceDscWithOpenTelemetryRootSpanName,\n openTelemetrySetupCheck,\n setOpenTelemetryContextAsyncContextStrategy,\n setupEventContextTrace,\n} from '@sentry/opentelemetry';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { childProcessIntegration } from '../integrations/childProcess';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport { envToBool } from '../utils/envToBool';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOpenTelemetry, maybeInitializeEsmLoader } from './initOtel';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs() ? [modulesIntegration()] : [];\n}\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n childProcessIntegration(),\n ...getCjsOnlyIntegrations(),\n ];\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultIntegrationsWithoutPerformance(),\n // We only add performance integrations if tracing is enabled\n // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n // This means that generally request isolation will work (because that is done by httpIntegration)\n // But `transactionName` will not be set automatically\n ...(shouldAddPerformanceIntegrations(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\nfunction shouldAddPerformanceIntegrations(options: Options): boolean {\n if (!hasTracingEnabled(options)) {\n return false;\n }\n\n // We want to ensure `tracesSampleRate` is not just undefined/null here\n // eslint-disable-next-line deprecation/deprecation\n return options.enableTracing || options.tracesSampleRate != null || 'tracesSampler' in options;\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): NodeClient | undefined {\n return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): NodeClient {\n return _init(options, () => []);\n}\n\n/**\n * Initialize Sentry for Node, without performance instrumentation.\n */\nfunction _init(\n _options: NodeOptions | undefined = {},\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClient {\n const options = getClientOptions(_options, getDefaultIntegrationsImpl);\n\n if (options.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n if (!isCjs() && options.registerEsmLoaderHooks !== false) {\n maybeInitializeEsmLoader(options.registerEsmLoaderHooks === true ? undefined : options.registerEsmLoaderHooks);\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n if (options.spotlight && !options.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n options.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n const client = new NodeClient(options);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n client.init();\n\n logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n client.startClientReportTracking();\n\n updateScopeFromEnvVariables();\n\n // If users opt-out of this, they _have_ to set up OpenTelemetry themselves\n // There is no way to use this SDK without OpenTelemetry!\n if (!options.skipOpenTelemetrySetup) {\n initOpenTelemetry(client);\n validateOpenTelemetrySetup();\n }\n\n enhanceDscWithOpenTelemetryRootSpanName(client);\n setupEventContextTrace(client);\n\n return client;\n}\n\n/**\n * Validate that your OpenTelemetry setup is correct.\n */\nexport function validateOpenTelemetrySetup(): void {\n if (!DEBUG_BUILD) {\n return;\n }\n\n const setup = openTelemetrySetupCheck();\n\n const required: ReturnType<typeof openTelemetrySetupCheck> = ['SentryContextManager', 'SentryPropagator'];\n\n if (hasTracingEnabled()) {\n required.push('SentrySpanProcessor');\n }\n\n for (const k of required) {\n if (!setup.includes(k)) {\n logger.error(\n `You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,\n );\n }\n }\n\n if (!setup.includes('SentrySampler')) {\n logger.warn(\n 'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.',\n );\n }\n}\n\nfunction getClientOptions(\n options: NodeOptions,\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClientOptions {\n const release = getRelease(options.release);\n\n const autoSessionTracking =\n typeof release !== 'string'\n ? false\n : options.autoSessionTracking === undefined\n ? true\n : options.autoSessionTracking;\n\n if (options.spotlight == null) {\n const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });\n if (spotlightEnv == null) {\n options.spotlight = process.env.SENTRY_SPOTLIGHT;\n } else {\n options.spotlight = spotlightEnv;\n }\n }\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n sendClientReports: true,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n autoSessionTracking,\n tracesSampleRate,\n });\n\n const mergedOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n };\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrationsImpl(mergedOptions);\n }\n\n const clientOptions: NodeClientOptions = {\n ...mergedOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n if (envToBool(process.env.SENTRY_USE_ENVIRONMENT) !== false) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n\n/**\n * Enable automatic Session Tracking for the node process.\n */\nfunction startSessionTracking(): void {\n const client = getClient<NodeClient>();\n if (client && client.getOptions().autoSessionTracking) {\n client.initSessionFlusher();\n }\n\n startSession();\n\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // such as calling process.exit() or uncaught exceptions.\n // Ref: https://nodejs.org/api/process.html#process_event_beforeexit\n process.on('beforeExit', () => {\n const session = getIsolationScope().getSession();\n\n // Only call endSession, if the Session exists on Scope and SessionStatus is not a\n // Terminal Status i.e. Exited or Crashed because\n // \"When a session is moved away from ok it must not be updated anymore.\"\n // Ref: https://develop.sentry.dev/sdk/sessions/\n if (session && session.status !== 'ok') {\n endSession();\n }\n });\n}\n"],"names":["SPOTLIGHT_INTEGRATION_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAS,sBAAsB,GAAkB;AACjD,EAAE,OAAO,KAAK,EAAC,GAAI,CAAC,kBAAkB,EAAE,CAAA,GAAI,EAAE;AAC9C;;AAEA;AACA;AACA;AACO,SAAS,wCAAwC,GAAkB;AAC1E,EAAE,OAAO;AACT;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,uBAAuB,EAAE;AAC7B,IAAI,sBAAsB,EAAE;AAC5B;AACA,IAAI,kBAAkB,EAAE;AACxB,IAAI,eAAe,EAAE;AACrB,IAAI,0BAA0B,EAAE;AAChC;AACA,IAAI,8BAA8B,EAAE;AACpC,IAAI,+BAA+B,EAAE;AACrC;AACA,IAAI,uBAAuB,EAAE;AAC7B,IAAI,yBAAyB,EAAE;AAC/B,IAAI,sBAAsB,EAAE;AAC5B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,GAAG,sBAAsB,EAAE;AAC/B,GAAG;AACH;;AAEA;AACO,SAAS,sBAAsB,CAAC,OAAO,EAA0B;AACxE,EAAE,OAAO;AACT,IAAI,GAAG,wCAAwC,EAAE;AACjD;AACA;AACA;AACA;AACA,IAAI,IAAI,gCAAgC,CAAC,OAAO,CAAA,GAAI,8BAA8B,EAAC,GAAI,EAAE,CAAC;AAC1F,GAAG;AACH;;AAEA,SAAS,gCAAgC,CAAC,OAAO,EAAoB;AACrE,E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":["import type { Integration, Options } from '@sentry/core';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n endSession,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getIsolationScope,\n hasTracingEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n logger,\n propagationContextFromHeaders,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n startSession,\n} from '@sentry/core';\nimport {\n enhanceDscWithOpenTelemetryRootSpanName,\n openTelemetrySetupCheck,\n setOpenTelemetryContextAsyncContextStrategy,\n setupEventContextTrace,\n} from '@sentry/opentelemetry';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { childProcessIntegration } from '../integrations/childProcess';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport { envToBool } from '../utils/envToBool';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOpenTelemetry, maybeInitializeEsmLoader } from './initOtel';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs() ? [modulesIntegration()] : [];\n}\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n childProcessIntegration(),\n ...getCjsOnlyIntegrations(),\n ];\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultIntegrationsWithoutPerformance(),\n // We only add performance integrations if tracing is enabled\n // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n // This means that generally request isolation will work (because that is done by httpIntegration)\n // But `transactionName` will not be set automatically\n ...(shouldAddPerformanceIntegrations(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\nfunction shouldAddPerformanceIntegrations(options: Options): boolean {\n if (!hasTracingEnabled(options)) {\n return false;\n }\n\n // We want to ensure `tracesSampleRate` is not just undefined/null here\n // eslint-disable-next-line deprecation/deprecation\n return options.enableTracing || options.tracesSampleRate != null || 'tracesSampler' in options;\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): NodeClient | undefined {\n return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): NodeClient {\n return _init(options, () => []);\n}\n\n/**\n * Initialize Sentry for Node, without performance instrumentation.\n */\nfunction _init(\n _options: NodeOptions | undefined = {},\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClient {\n const options = getClientOptions(_options, getDefaultIntegrationsImpl);\n\n if (options.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n if (!isCjs() && options.registerEsmLoaderHooks !== false) {\n maybeInitializeEsmLoader(options.registerEsmLoaderHooks === true ? undefined : options.registerEsmLoaderHooks);\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n if (options.spotlight && !options.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n options.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n const client = new NodeClient(options);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n client.init();\n\n logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);\n\n // TODO(V9): Remove this code since all of the logic should be in an integration\n // eslint-disable-next-line deprecation/deprecation\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n client.startClientReportTracking();\n\n updateScopeFromEnvVariables();\n\n // If users opt-out of this, they _have_ to set up OpenTelemetry themselves\n // There is no way to use this SDK without OpenTelemetry!\n if (!options.skipOpenTelemetrySetup) {\n initOpenTelemetry(client);\n validateOpenTelemetrySetup();\n }\n\n enhanceDscWithOpenTelemetryRootSpanName(client);\n setupEventContextTrace(client);\n\n return client;\n}\n\n/**\n * Validate that your OpenTelemetry setup is correct.\n */\nexport function validateOpenTelemetrySetup(): void {\n if (!DEBUG_BUILD) {\n return;\n }\n\n const setup = openTelemetrySetupCheck();\n\n const required: ReturnType<typeof openTelemetrySetupCheck> = ['SentryContextManager', 'SentryPropagator'];\n\n if (hasTracingEnabled()) {\n required.push('SentrySpanProcessor');\n }\n\n for (const k of required) {\n if (!setup.includes(k)) {\n logger.error(\n `You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,\n );\n }\n }\n\n if (!setup.includes('SentrySampler')) {\n logger.warn(\n 'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.',\n );\n }\n}\n\nfunction getClientOptions(\n options: NodeOptions,\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClientOptions {\n const release = getRelease(options.release);\n\n const autoSessionTracking =\n typeof release !== 'string'\n ? false\n : // eslint-disable-next-line deprecation/deprecation\n options.autoSessionTracking === undefined\n ? true\n : // eslint-disable-next-line deprecation/deprecation\n options.autoSessionTracking;\n\n if (options.spotlight == null) {\n const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });\n if (spotlightEnv == null) {\n options.spotlight = process.env.SENTRY_SPOTLIGHT;\n } else {\n options.spotlight = spotlightEnv;\n }\n }\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n sendClientReports: true,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n autoSessionTracking,\n tracesSampleRate,\n });\n\n const mergedOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n };\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrationsImpl(mergedOptions);\n }\n\n const clientOptions: NodeClientOptions = {\n ...mergedOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n if (envToBool(process.env.SENTRY_USE_ENVIRONMENT) !== false) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n\n/**\n * Enable automatic Session Tracking for the node process.\n */\nfunction startSessionTracking(): void {\n const client = getClient<NodeClient>();\n // eslint-disable-next-line deprecation/deprecation\n if (client && client.getOptions().autoSessionTracking) {\n client.initSessionFlusher();\n }\n\n startSession();\n\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // such as calling process.exit() or uncaught exceptions.\n // Ref: https://nodejs.org/api/process.html#process_event_beforeexit\n process.on('beforeExit', () => {\n const session = getIsolationScope().getSession();\n\n // Only call endSession, if the Session exists on Scope and SessionStatus is not a\n // Terminal Status i.e. Exited or Crashed because\n // \"When a session is moved away from ok it must not be updated anymore.\"\n // Ref: https://develop.sentry.dev/sdk/sessions/\n if (session && session.status !== 'ok') {\n endSession();\n }\n });\n}\n"],"names":["SPOTLIGHT_INTEGRATION_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAS,sBAAsB,GAAkB;AACjD,EAAE,OAAO,KAAK,EAAC,GAAI,CAAC,kBAAkB,EAAE,CAAA,GAAI,EAAE;AAC9C;;AAEA;AACA;AACA;AACO,SAAS,wCAAwC,GAAkB;AAC1E,EAAE,OAAO;AACT;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,uBA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AI,eAAe,EAAE,CAAC,qBAAqB,CAAC,kBAAkB,CAAC;AAC/D;AACA;;AAEA;AACA;AACA;AACA,SAAS,oBAAoB,GAAS;AACtC,EAAE,MAAM,MAAA,GAAS,SAAS,EAAc;AACxC;AACA,EAAE,IAAI,MAAA,IAAU,MAAM,CAAC,UAAU,EAAE,CAAC,mBAAmB,EAAE;AACzD,IAAI,MAAM,CAAC,kBAAkB,EAAE;AAC/B;;AAEA,EAAE,YAAY,EAAE;;AAEhB;AACA;AACA;AACA;AACA,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM;AACjC,IAAI,MAAM,UAAU,iBAAiB,EAAE,CAAC,UAAU,EAAE;;AAEpD;AACA;AACA;AACA;AACA,IAAI,IAAI,OAAQ,IAAG,OAAO,CAAC,MAAA,KAAW,IAAI,EAAE;AAC5C,MAAM,UAAU,EAAE;AAClB;AACA,GAAG,CAAC;AACJ;;;;"}
@@ -7,10 +7,14 @@ import { ATTR_SERVICE_NAME, SEMRESATTRS_SERVICE_NAMESPACE, ATTR_SERVICE_VERSION
7
7
  import { logger, SDK_VERSION, GLOBAL_OBJ, consoleSandbox } from '@sentry/core';
8
8
  import { SentrySampler, SentrySpanProcessor, SentryPropagator } from '@sentry/opentelemetry';
9
9
  import { createAddHookMessageChannel } from 'import-in-the-middle';
10
+ import { DEBUG_BUILD } from '../debug-build.js';
10
11
  import { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing/index.js';
11
12
  import { SentryContextManager } from '../otel/contextManager.js';
12
13
  import { isCjs } from '../utils/commonjs.js';
13
14
 
15
+ // About 277h - this must fit into new Array(len)!
16
+ const MAX_MAX_SPAN_WAIT_DURATION = 1000000;
17
+
14
18
  /**
15
19
  * Initialize OpenTelemetry for Node.
16
20
  */
@@ -114,12 +118,12 @@ function setupOtel(client) {
114
118
  [ATTR_SERVICE_VERSION]: SDK_VERSION,
115
119
  }),
116
120
  forceFlushTimeoutMillis: 500,
121
+ spanProcessors: [
122
+ new SentrySpanProcessor({
123
+ timeout: _clampSpanProcessorTimeout(client.getOptions().maxSpanWaitDuration),
124
+ }),
125
+ ],
117
126
  });
118
- provider.addSpanProcessor(
119
- new SentrySpanProcessor({
120
- timeout: client.getOptions().maxSpanWaitDuration,
121
- }),
122
- );
123
127
 
124
128
  // Initialize the provider
125
129
  provider.register({
@@ -130,6 +134,26 @@ function setupOtel(client) {
130
134
  return provider;
131
135
  }
132
136
 
137
+ /** Just exported for tests. */
138
+ function _clampSpanProcessorTimeout(maxSpanWaitDuration) {
139
+ if (maxSpanWaitDuration == null) {
140
+ return undefined;
141
+ }
142
+
143
+ // We guard for a max. value here, because we create an array with this length
144
+ // So if this value is too large, this would fail
145
+ if (maxSpanWaitDuration > MAX_MAX_SPAN_WAIT_DURATION) {
146
+ DEBUG_BUILD &&
147
+ logger.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${MAX_MAX_SPAN_WAIT_DURATION}`);
148
+ return MAX_MAX_SPAN_WAIT_DURATION;
149
+ } else if (maxSpanWaitDuration <= 0 || Number.isNaN(maxSpanWaitDuration)) {
150
+ DEBUG_BUILD && logger.warn('`maxSpanWaitDuration` must be a positive number, using default value instead.');
151
+ return undefined;
152
+ }
153
+
154
+ return maxSpanWaitDuration;
155
+ }
156
+
133
157
  /**
134
158
  * Setup the OTEL logger to use our own logger.
135
159
  */
@@ -146,5 +170,5 @@ function setupOpenTelemetryLogger() {
146
170
  diag.setLogger(otelLogger, DiagLogLevel.DEBUG);
147
171
  }
148
172
 
149
- export { initOpenTelemetry, maybeInitializeEsmLoader, preloadOpenTelemetry, setupOtel };
173
+ export { _clampSpanProcessorTimeout, initOpenTelemetry, maybeInitializeEsmLoader, preloadOpenTelemetry, setupOtel };
150
174
  //# sourceMappingURL=initOtel.js.map