@sentry/server-utils 10.63.0 → 10.64.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 (206) 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/anthropic.js +101 -0
  4. package/build/cjs/integrations/tracing-channel/anthropic.js.map +1 -0
  5. package/build/cjs/integrations/tracing-channel/hapi-types.js +30 -0
  6. package/build/cjs/integrations/tracing-channel/hapi-types.js.map +1 -0
  7. package/build/cjs/integrations/tracing-channel/hapi-utils.js +177 -0
  8. package/build/cjs/integrations/tracing-channel/hapi-utils.js.map +1 -0
  9. package/build/cjs/integrations/tracing-channel/hapi.js +52 -0
  10. package/build/cjs/integrations/tracing-channel/hapi.js.map +1 -0
  11. package/build/cjs/integrations/tracing-channel/ioredis.js +96 -0
  12. package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -0
  13. package/build/cjs/integrations/tracing-channel/mysql.js +1 -0
  14. package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
  15. package/build/cjs/integrations/tracing-channel/openai.js +83 -0
  16. package/build/cjs/integrations/tracing-channel/openai.js.map +1 -0
  17. package/build/cjs/integrations/tracing-channel/postgres.js +170 -0
  18. package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -0
  19. package/build/cjs/integrations/tracing-channel/vercel-ai.js +25 -0
  20. package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -0
  21. package/build/cjs/mongoose/index.js +23 -0
  22. package/build/cjs/mongoose/index.js.map +1 -0
  23. package/build/cjs/mongoose/mongoose-dc-subscriber.js +97 -0
  24. package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -0
  25. package/build/cjs/orchestrion/bundler/vite.js +3 -3
  26. package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
  27. package/build/cjs/orchestrion/channels.js +17 -2
  28. package/build/cjs/orchestrion/channels.js.map +1 -1
  29. package/build/cjs/orchestrion/config/anthropic-ai.js +43 -0
  30. package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -0
  31. package/build/cjs/orchestrion/config/hapi.js +26 -0
  32. package/build/cjs/orchestrion/config/hapi.js.map +1 -0
  33. package/build/cjs/orchestrion/config/index.js +35 -0
  34. package/build/cjs/orchestrion/config/index.js.map +1 -0
  35. package/build/cjs/orchestrion/config/ioredis.js +35 -0
  36. package/build/cjs/orchestrion/config/ioredis.js.map +1 -0
  37. package/build/cjs/orchestrion/config/lru-memoizer.js +17 -0
  38. package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -0
  39. package/build/cjs/orchestrion/config/mysql.js +16 -0
  40. package/build/cjs/orchestrion/config/mysql.js.map +1 -0
  41. package/build/cjs/orchestrion/config/openai.js +40 -0
  42. package/build/cjs/orchestrion/config/openai.js.map +1 -0
  43. package/build/cjs/orchestrion/config/pg.js +51 -0
  44. package/build/cjs/orchestrion/config/pg.js.map +1 -0
  45. package/build/cjs/orchestrion/config/vercel-ai.js +44 -0
  46. package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -0
  47. package/build/cjs/orchestrion/detect.js +6 -1
  48. package/build/cjs/orchestrion/detect.js.map +1 -1
  49. package/build/cjs/orchestrion/index.js +27 -5
  50. package/build/cjs/orchestrion/index.js.map +1 -1
  51. package/build/cjs/orchestrion/runtime/register.js +10 -7
  52. package/build/cjs/orchestrion/runtime/register.js.map +1 -1
  53. package/build/cjs/redis/redis-statement-serializer.js +34 -0
  54. package/build/cjs/redis/redis-statement-serializer.js.map +1 -0
  55. package/build/cjs/tracing-channel.js +1 -1
  56. package/build/cjs/tracing-channel.js.map +1 -1
  57. package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +11 -4
  58. package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
  59. package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js +256 -0
  60. package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +1 -0
  61. package/build/esm/index.js +2 -0
  62. package/build/esm/index.js.map +1 -1
  63. package/build/esm/integrations/tracing-channel/anthropic.js +99 -0
  64. package/build/esm/integrations/tracing-channel/anthropic.js.map +1 -0
  65. package/build/esm/integrations/tracing-channel/hapi-types.js +25 -0
  66. package/build/esm/integrations/tracing-channel/hapi-types.js.map +1 -0
  67. package/build/esm/integrations/tracing-channel/hapi-utils.js +172 -0
  68. package/build/esm/integrations/tracing-channel/hapi-utils.js.map +1 -0
  69. package/build/esm/integrations/tracing-channel/hapi.js +50 -0
  70. package/build/esm/integrations/tracing-channel/hapi.js.map +1 -0
  71. package/build/esm/integrations/tracing-channel/ioredis.js +94 -0
  72. package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -0
  73. package/build/esm/integrations/tracing-channel/mysql.js +2 -1
  74. package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
  75. package/build/esm/integrations/tracing-channel/openai.js +81 -0
  76. package/build/esm/integrations/tracing-channel/openai.js.map +1 -0
  77. package/build/esm/integrations/tracing-channel/postgres.js +168 -0
  78. package/build/esm/integrations/tracing-channel/postgres.js.map +1 -0
  79. package/build/esm/integrations/tracing-channel/vercel-ai.js +23 -0
  80. package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -0
  81. package/build/esm/mongoose/index.js +21 -0
  82. package/build/esm/mongoose/index.js.map +1 -0
  83. package/build/esm/mongoose/mongoose-dc-subscriber.js +89 -0
  84. package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -0
  85. package/build/esm/orchestrion/bundler/vite.js +1 -1
  86. package/build/esm/orchestrion/channels.js +17 -2
  87. package/build/esm/orchestrion/channels.js.map +1 -1
  88. package/build/esm/orchestrion/config/anthropic-ai.js +40 -0
  89. package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -0
  90. package/build/esm/orchestrion/config/hapi.js +23 -0
  91. package/build/esm/orchestrion/config/hapi.js.map +1 -0
  92. package/build/esm/orchestrion/config/index.js +31 -0
  93. package/build/esm/orchestrion/config/index.js.map +1 -0
  94. package/build/esm/orchestrion/config/ioredis.js +32 -0
  95. package/build/esm/orchestrion/config/ioredis.js.map +1 -0
  96. package/build/esm/orchestrion/config/lru-memoizer.js +14 -0
  97. package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -0
  98. package/build/esm/orchestrion/config/mysql.js +13 -0
  99. package/build/esm/orchestrion/config/mysql.js.map +1 -0
  100. package/build/esm/orchestrion/config/openai.js +37 -0
  101. package/build/esm/orchestrion/config/openai.js.map +1 -0
  102. package/build/esm/orchestrion/config/pg.js +48 -0
  103. package/build/esm/orchestrion/config/pg.js.map +1 -0
  104. package/build/esm/orchestrion/config/vercel-ai.js +41 -0
  105. package/build/esm/orchestrion/config/vercel-ai.js.map +1 -0
  106. package/build/esm/orchestrion/detect.js +6 -2
  107. package/build/esm/orchestrion/detect.js.map +1 -1
  108. package/build/esm/orchestrion/index.js +21 -3
  109. package/build/esm/orchestrion/index.js.map +1 -1
  110. package/build/esm/orchestrion/runtime/register.js +8 -4
  111. package/build/esm/orchestrion/runtime/register.js.map +1 -1
  112. package/build/esm/package.json +1 -1
  113. package/build/esm/redis/redis-statement-serializer.js +32 -0
  114. package/build/esm/redis/redis-statement-serializer.js.map +1 -0
  115. package/build/esm/tracing-channel.js +2 -2
  116. package/build/esm/tracing-channel.js.map +1 -1
  117. package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +14 -8
  118. package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
  119. package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js +254 -0
  120. package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +1 -0
  121. package/build/types/index.d.ts +2 -0
  122. package/build/types/index.d.ts.map +1 -1
  123. package/build/types/integrations/tracing-channel/anthropic.d.ts +10 -0
  124. package/build/types/integrations/tracing-channel/anthropic.d.ts.map +1 -0
  125. package/build/types/integrations/tracing-channel/hapi-types.d.ts +53 -0
  126. package/build/types/integrations/tracing-channel/hapi-types.d.ts.map +1 -0
  127. package/build/types/integrations/tracing-channel/hapi-utils.d.ts +25 -0
  128. package/build/types/integrations/tracing-channel/hapi-utils.d.ts.map +1 -0
  129. package/build/types/integrations/tracing-channel/hapi.d.ts +9 -0
  130. package/build/types/integrations/tracing-channel/hapi.d.ts.map +1 -0
  131. package/build/types/integrations/tracing-channel/ioredis.d.ts +17 -0
  132. package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -0
  133. package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
  134. package/build/types/integrations/tracing-channel/openai.d.ts +10 -0
  135. package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -0
  136. package/build/types/integrations/tracing-channel/postgres.d.ts +15 -0
  137. package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -0
  138. package/build/types/integrations/tracing-channel/vercel-ai.d.ts +13 -0
  139. package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -0
  140. package/build/types/mongoose/index.d.ts +11 -0
  141. package/build/types/mongoose/index.d.ts.map +1 -0
  142. package/build/types/mongoose/mongoose-dc-subscriber.d.ts +63 -0
  143. package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -0
  144. package/build/types/orchestrion/channels.d.ts +21 -1
  145. package/build/types/orchestrion/channels.d.ts.map +1 -1
  146. package/build/types/orchestrion/config/anthropic-ai.d.ts +31 -0
  147. package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -0
  148. package/build/types/orchestrion/config/hapi.d.ts +17 -0
  149. package/build/types/orchestrion/config/hapi.d.ts.map +1 -0
  150. package/build/types/orchestrion/{config.d.ts → config/index.d.ts} +1 -12
  151. package/build/types/orchestrion/config/index.d.ts.map +1 -0
  152. package/build/types/orchestrion/config/ioredis.d.ts +7 -0
  153. package/build/types/orchestrion/config/ioredis.d.ts.map +1 -0
  154. package/build/types/orchestrion/config/lru-memoizer.d.ts +16 -0
  155. package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -0
  156. package/build/types/orchestrion/config/mysql.d.ts +16 -0
  157. package/build/types/orchestrion/config/mysql.d.ts.map +1 -0
  158. package/build/types/orchestrion/config/openai.d.ts +20 -0
  159. package/build/types/orchestrion/config/openai.d.ts.map +1 -0
  160. package/build/types/orchestrion/config/pg.d.ts +33 -0
  161. package/build/types/orchestrion/config/pg.d.ts.map +1 -0
  162. package/build/types/orchestrion/config/vercel-ai.d.ts +11 -0
  163. package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -0
  164. package/build/types/orchestrion/detect.d.ts +10 -0
  165. package/build/types/orchestrion/detect.d.ts.map +1 -1
  166. package/build/types/orchestrion/index.d.ts +53 -3
  167. package/build/types/orchestrion/index.d.ts.map +1 -1
  168. package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
  169. package/build/types/redis/redis-statement-serializer.d.ts +6 -0
  170. package/build/types/redis/redis-statement-serializer.d.ts.map +1 -0
  171. package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +10 -4
  172. package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
  173. package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts +12 -0
  174. package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts.map +1 -0
  175. package/build/types-ts3.8/index.d.ts +2 -0
  176. package/build/types-ts3.8/integrations/tracing-channel/anthropic.d.ts +10 -0
  177. package/build/types-ts3.8/integrations/tracing-channel/hapi-types.d.ts +65 -0
  178. package/build/types-ts3.8/integrations/tracing-channel/hapi-utils.d.ts +25 -0
  179. package/build/types-ts3.8/integrations/tracing-channel/hapi.d.ts +9 -0
  180. package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +17 -0
  181. package/build/types-ts3.8/integrations/tracing-channel/openai.d.ts +10 -0
  182. package/build/types-ts3.8/integrations/tracing-channel/postgres.d.ts +15 -0
  183. package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +13 -0
  184. package/build/types-ts3.8/mongoose/index.d.ts +11 -0
  185. package/build/types-ts3.8/mongoose/mongoose-dc-subscriber.d.ts +63 -0
  186. package/build/types-ts3.8/orchestrion/channels.d.ts +21 -1
  187. package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +31 -0
  188. package/build/types-ts3.8/orchestrion/config/hapi.d.ts +17 -0
  189. package/build/types-ts3.8/orchestrion/{config.d.ts → config/index.d.ts} +1 -12
  190. package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +7 -0
  191. package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +16 -0
  192. package/build/types-ts3.8/orchestrion/config/mysql.d.ts +16 -0
  193. package/build/types-ts3.8/orchestrion/config/openai.d.ts +20 -0
  194. package/build/types-ts3.8/orchestrion/config/pg.d.ts +33 -0
  195. package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +11 -0
  196. package/build/types-ts3.8/orchestrion/detect.d.ts +10 -0
  197. package/build/types-ts3.8/orchestrion/index.d.ts +53 -3
  198. package/build/types-ts3.8/redis/redis-statement-serializer.d.ts +6 -0
  199. package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +10 -4
  200. package/build/types-ts3.8/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts +12 -0
  201. package/package.json +9 -9
  202. package/build/cjs/orchestrion/config.js +0 -44
  203. package/build/cjs/orchestrion/config.js.map +0 -1
  204. package/build/esm/orchestrion/config.js +0 -40
  205. package/build/esm/orchestrion/config.js.map +0 -1
  206. package/build/types/orchestrion/config.d.ts.map +0 -1
@@ -0,0 +1,21 @@
1
+ import { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';
2
+ import * as diagnosticsChannel from 'node:diagnostics_channel';
3
+ import { subscribeMongooseDiagnosticChannels } from './mongoose-dc-subscriber.js';
4
+
5
+ const _mongooseIntegration = (() => {
6
+ return {
7
+ name: "Mongoose",
8
+ setupOnce() {
9
+ if (!diagnosticsChannel.tracingChannel) {
10
+ return;
11
+ }
12
+ waitForTracingChannelBinding(() => {
13
+ subscribeMongooseDiagnosticChannels(diagnosticsChannel.tracingChannel);
14
+ });
15
+ }
16
+ };
17
+ });
18
+ const mongooseIntegration = defineIntegration(_mongooseIntegration);
19
+
20
+ export { mongooseIntegration };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/mongoose/index.ts"],"sourcesContent":["import { defineIntegration, type IntegrationFn, waitForTracingChannelBinding } from '@sentry/core';\nimport * as dc from 'node:diagnostics_channel';\nimport { subscribeMongooseDiagnosticChannels } from './mongoose-dc-subscriber';\n\nconst _mongooseIntegration = (() => {\n return {\n name: 'Mongoose',\n setupOnce() {\n // Bail on Node <= 18.18.0, where `tracingChannel` does not exist.\n if (!dc.tracingChannel) {\n return;\n }\n\n // Subscribe to mongoose's native tracing channels (mongoose >= 9.7).\n // This is a no-op on versions that don't publish to the channels, so it is always safe to call.\n waitForTracingChannelBinding(() => {\n subscribeMongooseDiagnosticChannels(dc.tracingChannel);\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Auto-instrument the [mongoose](https://www.npmjs.com/package/mongoose) library via its native\n * `node:diagnostics_channel` tracing channels (mongoose >= 9.7).\n *\n * On older mongoose versions the channels are never published to, so this integration is inert and\n * the IITM-based patcher (gated to `< 9.7.0`) handles instrumentation instead.\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":["dc"],"mappings":";;;;AAIA,MAAM,wBAAwB,MAAM;AAClC,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,mCAAA,CAAoCA,mBAAG,cAAc,CAAA;AAAA,MACvD,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AASO,MAAM,mBAAA,GAAsB,kBAAkB,oBAAoB;;;;"}
@@ -0,0 +1,89 @@
1
+ import { SERVER_PORT, SERVER_ADDRESS, DB_OPERATION_BATCH_SIZE, DB_QUERY_TEXT, DB_NAMESPACE, DB_COLLECTION_NAME, DB_OPERATION_NAME, DB_SYSTEM_NAME } from '@sentry/conventions/attributes';
2
+ import { debug, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
3
+ import { DEBUG_BUILD } from '../debug-build.js';
4
+ import { bindTracingChannelToSpan } from '../tracing-channel.js';
5
+
6
+ const MONGOOSE_DC_CHANNEL_QUERY = "mongoose:query";
7
+ const MONGOOSE_DC_CHANNEL_AGGREGATE = "mongoose:aggregate";
8
+ const MONGOOSE_DC_CHANNEL_MODEL_SAVE = "mongoose:model:save";
9
+ const MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY = "mongoose:model:insertMany";
10
+ const MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE = "mongoose:model:bulkWrite";
11
+ const MONGOOSE_DC_CHANNEL_CURSOR_NEXT = "mongoose:cursor:next";
12
+ const ORIGIN = "auto.db.mongoose.diagnostic_channel";
13
+ const DB_SYSTEM_NAME_VALUE_MONGODB = "mongodb";
14
+ const MAX_REDACTION_DEPTH = 10;
15
+ let subscribed = false;
16
+ function subscribeMongooseDiagnosticChannels(tracingChannel) {
17
+ if (subscribed) {
18
+ return;
19
+ }
20
+ subscribed = true;
21
+ try {
22
+ setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_QUERY);
23
+ setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_AGGREGATE);
24
+ setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_MODEL_SAVE);
25
+ setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY);
26
+ setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE);
27
+ setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_CURSOR_NEXT);
28
+ } catch {
29
+ DEBUG_BUILD && debug.log("Mongoose node:diagnostics_channel subscription failed.");
30
+ }
31
+ }
32
+ function setupChannel(tracingChannel, channelName) {
33
+ bindTracingChannelToSpan(tracingChannel(channelName), (data) => {
34
+ const collection = data.collection;
35
+ const queryText = redactMongoQuery(data.args?.pipeline ?? data.args?.filter);
36
+ const batchSize = getBatchSize(data);
37
+ return startInactiveSpan({
38
+ name: collection ? `mongoose.${collection}.${data.operation}` : `mongoose.${data.operation}`,
39
+ attributes: {
40
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
41
+ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db",
42
+ [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB,
43
+ [DB_OPERATION_NAME]: data.operation,
44
+ [DB_COLLECTION_NAME]: collection ?? void 0,
45
+ [DB_NAMESPACE]: data.database ?? void 0,
46
+ [DB_QUERY_TEXT]: queryText ?? void 0,
47
+ [DB_OPERATION_BATCH_SIZE]: batchSize ?? void 0,
48
+ [SERVER_ADDRESS]: data.serverAddress ?? void 0,
49
+ [SERVER_PORT]: data.serverPort ?? void 0
50
+ }
51
+ });
52
+ });
53
+ }
54
+ function getBatchSize(data) {
55
+ const args = data.args;
56
+ const batch = data.operation === "insertMany" ? args?.docs : data.operation === "bulkWrite" ? args?.ops : void 0;
57
+ return Array.isArray(batch) && batch.length > 1 ? batch.length : void 0;
58
+ }
59
+ function redactMongoQuery(value) {
60
+ if (value == null) {
61
+ return void 0;
62
+ }
63
+ try {
64
+ const redacted = redactValue(value, 0);
65
+ const text = JSON.stringify(redacted);
66
+ return text == null || text === "{}" || text === "[]" ? void 0 : text;
67
+ } catch {
68
+ return void 0;
69
+ }
70
+ }
71
+ function redactValue(value, depth) {
72
+ if (depth > MAX_REDACTION_DEPTH) {
73
+ return "?";
74
+ }
75
+ if (Array.isArray(value)) {
76
+ return value.map((item) => redactValue(item, depth + 1));
77
+ }
78
+ if (value && typeof value === "object") {
79
+ const out = {};
80
+ for (const key of Object.keys(value)) {
81
+ out[key] = redactValue(value[key], depth + 1);
82
+ }
83
+ return out;
84
+ }
85
+ return "?";
86
+ }
87
+
88
+ export { MONGOOSE_DC_CHANNEL_AGGREGATE, MONGOOSE_DC_CHANNEL_CURSOR_NEXT, MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE, MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY, MONGOOSE_DC_CHANNEL_MODEL_SAVE, MONGOOSE_DC_CHANNEL_QUERY, subscribeMongooseDiagnosticChannels };
89
+ //# sourceMappingURL=mongoose-dc-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongoose-dc-subscriber.js","sources":["../../../src/mongoose/mongoose-dc-subscriber.ts"],"sourcesContent":["import type { TracingChannel } from 'node:diagnostics_channel';\nimport {\n DB_COLLECTION_NAME,\n DB_NAMESPACE,\n DB_OPERATION_BATCH_SIZE,\n DB_OPERATION_NAME,\n DB_QUERY_TEXT,\n DB_SYSTEM_NAME,\n SERVER_ADDRESS,\n SERVER_PORT,\n} from '@sentry/conventions/attributes';\nimport { debug, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\n\n// Channel names published by mongoose >= 9.7.0 (see mongoose `lib/tracing.js`,\n// `lib/query.js`, `lib/aggregate.js`, `lib/model.js` and `lib/cursor/*`).\n// Hardcoded so the subscriber does not have to import mongoose — the channels\n// just have to be subscribed to before the user's mongoose code publishes.\nexport const MONGOOSE_DC_CHANNEL_QUERY = 'mongoose:query';\nexport const MONGOOSE_DC_CHANNEL_AGGREGATE = 'mongoose:aggregate';\nexport const MONGOOSE_DC_CHANNEL_MODEL_SAVE = 'mongoose:model:save';\nexport const MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY = 'mongoose:model:insertMany';\nexport const MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE = 'mongoose:model:bulkWrite';\nexport const MONGOOSE_DC_CHANNEL_CURSOR_NEXT = 'mongoose:cursor:next';\n\nconst ORIGIN = 'auto.db.mongoose.diagnostic_channel';\nconst DB_SYSTEM_NAME_VALUE_MONGODB = 'mongodb';\n\n// Cap recursion so a self-referential or pathologically deep query can never\n// stall (or blow the stack in) instrumentation.\nconst MAX_REDACTION_DEPTH = 10;\n\n/**\n * Shape of the context object mongoose >= 9.7.0 publishes on its tracing\n * channels (mongoose's `TracingContext`, see `types/tracing.d.ts`).\n *\n * Node's `tracePromise` mutates this same object with `result`/`error` once the\n * operation settles, which `bindTracingChannelToSpan` reads in its lifecycle\n * handlers — hence both are declared optional here.\n *\n * Unlike redis/ioredis, mongoose does NOT pre-sanitize the payload, so `args`\n * carries the raw user query. We redact it before emitting `db.query.text`.\n */\nexport interface MongooseTracingData {\n operation: string;\n /** Absent for connection-level `aggregate()` calls, which have no model/collection. */\n collection?: string;\n database?: string;\n serverAddress?: string;\n serverPort?: number;\n /** Cursor channels only: the cursor's fetch batch size and tailable flag. */\n batchSize?: number;\n tailable?: boolean;\n /**\n * Operation-specific arguments. `filter` (queries/cursors) and `pipeline`\n * (aggregations) carry the query shape; `docs`/`ops` carry batch payloads.\n */\n args?: {\n filter?: unknown;\n pipeline?: unknown;\n docs?: unknown;\n ops?: unknown;\n [key: string]: unknown;\n };\n result?: unknown;\n error?: Error;\n}\n\n/**\n * Platform-provided factory that creates a native tracing channel for the given name. The\n * subscriber binds the span and its lifecycle onto the channel via `bindTracingChannelToSpan`,\n * which propagates the active span through the runtime's async context.\n *\n * Node passes `node:diagnostics_channel`'s `tracingChannel` directly.\n */\nexport type MongooseTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;\n\nlet subscribed = false;\n\n/**\n * Subscribe Sentry span handlers to mongoose's diagnostics-channel events\n * (`mongoose:query`, `:aggregate`, `:model:save`, `:model:insertMany`,\n * `:model:bulkWrite`, `:cursor:next`), published by mongoose >= 9.7.0.\n *\n * On older mongoose versions the channels are never published to, so the\n * subscribers are inert — there is no double-instrumentation against the\n * IITM-based vendored patcher, which is gated to `< 9.7.0`.\n *\n * Idempotent: subsequent calls are a no-op.\n */\nexport function subscribeMongooseDiagnosticChannels(tracingChannel: MongooseTracingChannelFactory): void {\n if (subscribed) {\n return;\n }\n subscribed = true;\n\n try {\n setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_QUERY);\n setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_AGGREGATE);\n setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_MODEL_SAVE);\n setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY);\n setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE);\n setupChannel(tracingChannel, MONGOOSE_DC_CHANNEL_CURSOR_NEXT);\n } catch {\n // The factory relies on `node:diagnostics_channel`, which isn't always\n // available. Fail closed; the SDK simply won't emit mongoose spans here.\n DEBUG_BUILD && debug.log('Mongoose node:diagnostics_channel subscription failed.');\n }\n}\n\nfunction setupChannel(tracingChannel: MongooseTracingChannelFactory, channelName: string): void {\n bindTracingChannelToSpan(tracingChannel<MongooseTracingData>(channelName), data => {\n const collection = data.collection;\n const queryText = redactMongoQuery(data.args?.pipeline ?? data.args?.filter);\n const batchSize = getBatchSize(data);\n\n return startInactiveSpan({\n name: collection ? `mongoose.${collection}.${data.operation}` : `mongoose.${data.operation}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db',\n [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB,\n [DB_OPERATION_NAME]: data.operation,\n [DB_COLLECTION_NAME]: collection ?? undefined,\n [DB_NAMESPACE]: data.database ?? undefined,\n [DB_QUERY_TEXT]: queryText ?? undefined,\n [DB_OPERATION_BATCH_SIZE]: batchSize ?? undefined,\n [SERVER_ADDRESS]: data.serverAddress ?? undefined,\n [SERVER_PORT]: data.serverPort ?? undefined,\n },\n });\n });\n}\n\n/**\n * `db.operation.batch.size` is only meaningful for genuine batch operations.\n * Mongoose's cursor `batchSize` is a fetch-tuning option, not a batch operation\n * size, so it is intentionally excluded here.\n */\nfunction getBatchSize(data: MongooseTracingData): number | undefined {\n const args = data.args;\n const batch = data.operation === 'insertMany' ? args?.docs : data.operation === 'bulkWrite' ? args?.ops : undefined;\n\n return Array.isArray(batch) && batch.length > 1 ? batch.length : undefined;\n}\n\n/**\n * Serialize a mongoose filter/pipeline into `db.query.text` while stripping every\n * value: keys and Mongo operators (`$gt`, `$in`, …) are preserved, leaf values\n * become `'?'`. Mongoose does not sanitize its channel payload, so this prevents\n * raw user data (potential PII) from leaving the process. Returns `undefined`\n * (rather than throwing) on anything it cannot serialize.\n */\nfunction redactMongoQuery(value: unknown): string | undefined {\n if (value == null) {\n return undefined;\n }\n\n try {\n const redacted = redactValue(value, 0);\n const text = JSON.stringify(redacted);\n\n // Skip empty/uninformative shapes (e.g. a `findOne()` with no filter).\n return text == null || text === '{}' || text === '[]' ? undefined : text;\n } catch {\n return undefined;\n }\n}\n\nfunction redactValue(value: unknown, depth: number): unknown {\n if (depth > MAX_REDACTION_DEPTH) {\n return '?';\n }\n\n if (Array.isArray(value)) {\n return value.map(item => redactValue(item, depth + 1));\n }\n\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>)) {\n out[key] = redactValue((value as Record<string, unknown>)[key], depth + 1);\n }\n\n return out;\n }\n\n return '?';\n}\n"],"names":[],"mappings":";;;;;AAmBO,MAAM,yBAAA,GAA4B;AAClC,MAAM,6BAAA,GAAgC;AACtC,MAAM,8BAAA,GAAiC;AACvC,MAAM,qCAAA,GAAwC;AAC9C,MAAM,oCAAA,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A,EACtE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,WAAA,CAAY,OAAgB,KAAA,EAAwB;AAC3D,EAAA,IAAI,QAAQ,mBAAA,EAAqB;AAC/B,IAAA,OAAO,GAAA;AAAA,EACT;AAEA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,MAAM,GAAA,CAAI,CAAA,IAAA,KAAQ,YAAY,IAAA,EAAM,KAAA,GAAQ,CAAC,CAAC,CAAA;AAAA,EACvD;AAEA,EAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,EAAU;AACtC,IAAA,MAAM,MAA+B,EAAC;AACtC,IAAA,KAAA,MAAW,GAAA,IAAO,MAAA,CAAO,IAAA,CAAK,KAAgC,CAAA,EAAG;AAC/D,MAAA,GAAA,CAAI,GAAG,CAAA,GAAI,WAAA,CAAa,MAAkC,GAAG,CAAA,EAAG,QAAQ,CAAC,CAAA;AAAA,IAC3E;AAEA,IAAA,OAAO,GAAA;AAAA,EACT;AAEA,EAAA,OAAO,GAAA;AACT;;;;"}
@@ -1,6 +1,6 @@
1
1
  import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/vite';
2
2
  import MagicString from 'magic-string';
3
- import { SENTRY_INSTRUMENTATIONS, INSTRUMENTED_MODULE_NAMES } from '../config.js';
3
+ import { SENTRY_INSTRUMENTATIONS, INSTRUMENTED_MODULE_NAMES } from '../config/index.js';
4
4
 
5
5
  function sentryOrchestrionPlugin() {
6
6
  const codeTransformerPlugins = codeTransformer({ instrumentations: SENTRY_INSTRUMENTATIONS });
@@ -1,6 +1,21 @@
1
+ import { mysqlChannels } from './config/mysql.js';
2
+ import { lruMemoizerChannels } from './config/lru-memoizer.js';
3
+ import { ioredisChannels } from './config/ioredis.js';
4
+ import { pgChannels } from './config/pg.js';
5
+ import { openaiChannels } from './config/openai.js';
6
+ import { anthropicAiChannels } from './config/anthropic-ai.js';
7
+ import { vercelAiChannels } from './config/vercel-ai.js';
8
+ import { hapiChannels } from './config/hapi.js';
9
+
1
10
  const CHANNELS = {
2
- MYSQL_QUERY: "orchestrion:mysql:query",
3
- LRU_MEMOIZER_LOAD: "orchestrion:lru-memoizer:load"
11
+ ...mysqlChannels,
12
+ ...lruMemoizerChannels,
13
+ ...ioredisChannels,
14
+ ...pgChannels,
15
+ ...openaiChannels,
16
+ ...anthropicAiChannels,
17
+ ...vercelAiChannels,
18
+ ...hapiChannels
4
19
  };
5
20
 
6
21
  export { CHANNELS };
@@ -1 +1 @@
1
- {"version":3,"file":"channels.js","sources":["../../../src/orchestrion/channels.ts"],"sourcesContent":["/**\n * Fully-qualified `diagnostics_channel` names that orchestrion publishes to.\n *\n * Orchestrion's transform always prefixes the configured `channelName` with\n * `orchestrion:${module.name}:`. So a config of\n * `{ channelName: 'query', module: { name: 'mysql' } }`\n * publishes to `orchestrion:mysql:query`.\n *\n * Subscribers (`integrations/<lib>/tracing-channel.ts`) consume the full\n * prefixed string from this map; the config files set only the unprefixed\n * suffix in `channelName`. Keeping both pieces in one file is what guarantees\n * they don't drift apart and silently stop firing.\n */\nexport const CHANNELS = {\n MYSQL_QUERY: 'orchestrion:mysql:query',\n LRU_MEMOIZER_LOAD: 'orchestrion:lru-memoizer:load',\n} as const;\n\nexport type ChannelName = (typeof CHANNELS)[keyof typeof CHANNELS];\n"],"names":[],"mappings":"AAaO,MAAM,QAAA,GAAW;AAAA,EACtB,WAAA,EAAa,yBAAA;AAAA,EACb,iBAAA,EAAmB;AACrB;;;;"}
1
+ {"version":3,"file":"channels.js","sources":["../../../src/orchestrion/channels.ts"],"sourcesContent":["import { mysqlChannels } from './config/mysql';\nimport { lruMemoizerChannels } from './config/lru-memoizer';\nimport { ioredisChannels } from './config/ioredis';\nimport { pgChannels } from './config/pg';\nimport { openaiChannels } from './config/openai';\nimport { anthropicAiChannels } from './config/anthropic-ai';\nimport { vercelAiChannels } from './config/vercel-ai';\nimport { hapiChannels } from './config/hapi';\n\n/**\n * Fully-qualified `diagnostics_channel` names that orchestrion publishes to.\n *\n * Orchestrion's transform always prefixes the configured `channelName` with\n * `orchestrion:${module.name}:`. So a config of\n * `{ channelName: 'query', module: { name: 'mysql' } }`\n * publishes to `orchestrion:mysql:query`.\n *\n * Subscribers (`integrations/<lib>/tracing-channel.ts`) consume the full\n * prefixed string from this map; the config files set only the unprefixed\n * suffix in `channelName`. Keeping both pieces in one file is what guarantees\n * they don't drift apart and silently stop firing.\n */\nexport const CHANNELS = {\n ...mysqlChannels,\n ...lruMemoizerChannels,\n ...ioredisChannels,\n ...pgChannels,\n ...openaiChannels,\n ...anthropicAiChannels,\n ...vercelAiChannels,\n ...hapiChannels,\n} as const;\n\nexport type ChannelName = (typeof CHANNELS)[keyof typeof CHANNELS];\n"],"names":[],"mappings":";;;;;;;;;AAsBO,MAAM,QAAA,GAAW;AAAA,EACtB,GAAG,aAAA;AAAA,EACH,GAAG,mBAAA;AAAA,EACH,GAAG,eAAA;AAAA,EACH,GAAG,UAAA;AAAA,EACH,GAAG,cAAA;AAAA,EACH,GAAG,mBAAA;AAAA,EACH,GAAG,gBAAA;AAAA,EACH,GAAG;AACL;;;;"}
@@ -0,0 +1,40 @@
1
+ const anthropicAiConfig = [
2
+ // One entry each for CJS/ESM
3
+ ...["resources/messages/messages.js", "resources/messages/messages.mjs"].flatMap(
4
+ (filePath) => ["create", "countTokens"].map((methodName) => ({
5
+ channelName: "chat",
6
+ module: { name: "@anthropic-ai/sdk", versionRange: ">=0.19.2 <1", filePath },
7
+ functionQuery: { className: "Messages", methodName, kind: "Auto" }
8
+ }))
9
+ ),
10
+ ...["resources/completions.js", "resources/completions.mjs"].map((filePath) => ({
11
+ channelName: "chat",
12
+ module: { name: "@anthropic-ai/sdk", versionRange: ">=0.19.2 <1", filePath },
13
+ functionQuery: { className: "Completions", methodName: "create", kind: "Auto" }
14
+ })),
15
+ ...["resources/beta/messages/messages.js", "resources/beta/messages/messages.mjs"].map((filePath) => ({
16
+ channelName: "chat",
17
+ module: { name: "@anthropic-ai/sdk", versionRange: ">=0.19.2 <1", filePath },
18
+ functionQuery: { className: "Messages", methodName: "create", kind: "Auto" }
19
+ })),
20
+ ...["resources/models.js", "resources/models.mjs"].map((filePath) => ({
21
+ channelName: "models",
22
+ module: { name: "@anthropic-ai/sdk", versionRange: ">=0.19.2 <1", filePath },
23
+ functionQuery: { className: "Models", methodName: "retrieve", kind: "Auto" }
24
+ })),
25
+ // `messages.stream()` returns a synchronous emitter, not a promise, so `kind: 'Sync'` is required:
26
+ // `Auto`'s promise wrapper never publishes `end` for a non-thenable return, so the span would never end.
27
+ ...["resources/messages/messages.js", "resources/messages/messages.mjs"].map((filePath) => ({
28
+ channelName: "messages-stream",
29
+ module: { name: "@anthropic-ai/sdk", versionRange: ">=0.19.2 <1", filePath },
30
+ functionQuery: { className: "Messages", methodName: "stream", kind: "Sync" }
31
+ }))
32
+ ];
33
+ const anthropicAiChannels = {
34
+ ANTHROPIC_CHAT: "orchestrion:@anthropic-ai/sdk:chat",
35
+ ANTHROPIC_MODELS: "orchestrion:@anthropic-ai/sdk:models",
36
+ ANTHROPIC_MESSAGES_STREAM: "orchestrion:@anthropic-ai/sdk:messages-stream"
37
+ };
38
+
39
+ export { anthropicAiChannels, anthropicAiConfig };
40
+ //# sourceMappingURL=anthropic-ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic-ai.js","sources":["../../../../src/orchestrion/config/anthropic-ai.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const anthropicAiConfig = [\n // One entry each for CJS/ESM\n ...['resources/messages/messages.js', 'resources/messages/messages.mjs'].flatMap(filePath =>\n (['create', 'countTokens'] as const).map(methodName => ({\n channelName: 'chat',\n module: { name: '@anthropic-ai/sdk', versionRange: '>=0.19.2 <1', filePath },\n functionQuery: { className: 'Messages', methodName, kind: 'Auto' as const },\n })),\n ),\n ...['resources/completions.js', 'resources/completions.mjs'].map(filePath => ({\n channelName: 'chat',\n module: { name: '@anthropic-ai/sdk', versionRange: '>=0.19.2 <1', filePath },\n functionQuery: { className: 'Completions', methodName: 'create', kind: 'Auto' as const },\n })),\n ...['resources/beta/messages/messages.js', 'resources/beta/messages/messages.mjs'].map(filePath => ({\n channelName: 'chat',\n module: { name: '@anthropic-ai/sdk', versionRange: '>=0.19.2 <1', filePath },\n functionQuery: { className: 'Messages', methodName: 'create', kind: 'Auto' as const },\n })),\n ...['resources/models.js', 'resources/models.mjs'].map(filePath => ({\n channelName: 'models',\n module: { name: '@anthropic-ai/sdk', versionRange: '>=0.19.2 <1', filePath },\n functionQuery: { className: 'Models', methodName: 'retrieve', kind: 'Auto' as const },\n })),\n // `messages.stream()` returns a synchronous emitter, not a promise, so `kind: 'Sync'` is required:\n // `Auto`'s promise wrapper never publishes `end` for a non-thenable return, so the span would never end.\n ...['resources/messages/messages.js', 'resources/messages/messages.mjs'].map(filePath => ({\n channelName: 'messages-stream',\n module: { name: '@anthropic-ai/sdk', versionRange: '>=0.19.2 <1', filePath },\n functionQuery: { className: 'Messages', methodName: 'stream', kind: 'Sync' as const },\n })),\n] satisfies InstrumentationConfig[];\n\nexport const anthropicAiChannels = {\n ANTHROPIC_CHAT: 'orchestrion:@anthropic-ai/sdk:chat',\n ANTHROPIC_MODELS: 'orchestrion:@anthropic-ai/sdk:models',\n ANTHROPIC_MESSAGES_STREAM: 'orchestrion:@anthropic-ai/sdk:messages-stream',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,iBAAA,GAAoB;AAAA;AAAA,EAE/B,GAAG,CAAC,gCAAA,EAAkC,iCAAiC,CAAA,CAAE,OAAA;AAAA,IAAQ,cAC9E,CAAC,QAAA,EAAU,aAAa,CAAA,CAAY,IAAI,CAAA,UAAA,MAAe;AAAA,MACtD,WAAA,EAAa,MAAA;AAAA,MACb,QAAQ,EAAE,IAAA,EAAM,mBAAA,EAAqB,YAAA,EAAc,eAAe,QAAA,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AAE,SAAA,EAAW,YAAY,UAAA,EAAY,QAAA,EAAU,MAAM,MAAA;AAAgB,GACtF,CAAE;AACJ;AAEO,MAAM,mBAAA,GAAsB;AAAA,EACjC,cAAA,EAAgB,oCAAA;AAAA,EAChB,gBAAA,EAAkB,sCAAA;AAAA,EAClB,yBAAA,EAA2B;AAC7B;;;;"}
@@ -0,0 +1,23 @@
1
+ const hapiConfig = [
2
+ // hapi's `route`/`ext` live on an anonymous class (`internals.Server = class {}`),
3
+ // so `{className}` can't match — `{methodName}` targets them in lib/server.js. Both
4
+ // are synchronous void methods, so `Sync` suffices: we only use `start` to swap
5
+ // handlers in `ctx.arguments`. Shape verified across the whole range.
6
+ {
7
+ channelName: "route",
8
+ module: { name: "@hapi/hapi", versionRange: ">=17.0.0 <22.0.0", filePath: "lib/server.js" },
9
+ functionQuery: { methodName: "route", kind: "Sync" }
10
+ },
11
+ {
12
+ channelName: "ext",
13
+ module: { name: "@hapi/hapi", versionRange: ">=17.0.0 <22.0.0", filePath: "lib/server.js" },
14
+ functionQuery: { methodName: "ext", kind: "Sync" }
15
+ }
16
+ ];
17
+ const hapiChannels = {
18
+ HAPI_ROUTE: "orchestrion:@hapi/hapi:route",
19
+ HAPI_EXT: "orchestrion:@hapi/hapi:ext"
20
+ };
21
+
22
+ export { hapiChannels, hapiConfig };
23
+ //# sourceMappingURL=hapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hapi.js","sources":["../../../../src/orchestrion/config/hapi.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const hapiConfig = [\n // hapi's `route`/`ext` live on an anonymous class (`internals.Server = class {}`),\n // so `{className}` can't match — `{methodName}` targets them in lib/server.js. Both\n // are synchronous void methods, so `Sync` suffices: we only use `start` to swap\n // handlers in `ctx.arguments`. Shape verified across the whole range.\n {\n channelName: 'route',\n module: { name: '@hapi/hapi', versionRange: '>=17.0.0 <22.0.0', filePath: 'lib/server.js' },\n functionQuery: { methodName: 'route', kind: 'Sync' },\n },\n {\n channelName: 'ext',\n module: { name: '@hapi/hapi', versionRange: '>=17.0.0 <22.0.0', filePath: 'lib/server.js' },\n functionQuery: { methodName: 'ext', kind: 'Sync' },\n },\n] satisfies InstrumentationConfig[];\n\nexport const hapiChannels = {\n HAPI_ROUTE: 'orchestrion:@hapi/hapi:route',\n HAPI_EXT: 'orchestrion:@hapi/hapi:ext',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,UAAA,GAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxB;AAAA,IACE,WAAA,EAAa,OAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,cAAc,YAAA,EAAc,kBAAA,EAAoB,UAAU,eAAA,EAAgB;AAAA,IAC1F,aAAA,EAAe,EAAE,UAAA,EAAY,OAAA,EAAS,MAAM,MAAA;AAAO,GACrD;AAAA,EACA;AAAA,IACE,WAAA,EAAa,KAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,cAAc,YAAA,EAAc,kBAAA,EAAoB,UAAU,eAAA,EAAgB;AAAA,IAC1F,aAAA,EAAe,EAAE,UAAA,EAAY,KAAA,EAAO,MAAM,MAAA;AAAO;AAErD;AAEO,MAAM,YAAA,GAAe;AAAA,EAC1B,UAAA,EAAY,8BAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;;"}
@@ -0,0 +1,31 @@
1
+ import { mysqlConfig } from './mysql.js';
2
+ import { lruMemoizerConfig } from './lru-memoizer.js';
3
+ import { ioredisConfig } from './ioredis.js';
4
+ import { openaiConfig } from './openai.js';
5
+ import { pgConfig } from './pg.js';
6
+ import { anthropicAiConfig } from './anthropic-ai.js';
7
+ import { vercelAiConfig } from './vercel-ai.js';
8
+ import { hapiConfig } from './hapi.js';
9
+
10
+ const SENTRY_INSTRUMENTATIONS = [
11
+ ...mysqlConfig,
12
+ ...lruMemoizerConfig,
13
+ ...ioredisConfig,
14
+ ...openaiConfig,
15
+ ...pgConfig,
16
+ ...anthropicAiConfig,
17
+ ...vercelAiConfig,
18
+ ...hapiConfig
19
+ ];
20
+ const INSTRUMENTED_MODULE_NAMES = Array.from(new Set(SENTRY_INSTRUMENTATIONS.map((i) => i.module.name)));
21
+ function withoutInstrumentedExternals(external) {
22
+ if (!external) {
23
+ return void 0;
24
+ }
25
+ return external.filter(
26
+ (entry) => !INSTRUMENTED_MODULE_NAMES.some((name) => entry === name || entry.startsWith(`${name}/`))
27
+ );
28
+ }
29
+
30
+ export { INSTRUMENTED_MODULE_NAMES, SENTRY_INSTRUMENTATIONS, withoutInstrumentedExternals };
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/orchestrion/config/index.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\nimport { mysqlConfig } from './mysql';\nimport { lruMemoizerConfig } from './lru-memoizer';\nimport { ioredisConfig } from './ioredis';\nimport { openaiConfig } from './openai';\nimport { pgConfig } from './pg';\nimport { anthropicAiConfig } from './anthropic-ai';\nimport { vercelAiConfig } from './vercel-ai';\nimport { hapiConfig } from './hapi';\n\nexport const SENTRY_INSTRUMENTATIONS: InstrumentationConfig[] = [\n ...mysqlConfig,\n ...lruMemoizerConfig,\n ...ioredisConfig,\n ...openaiConfig,\n ...pgConfig,\n ...anthropicAiConfig,\n ...vercelAiConfig,\n ...hapiConfig,\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":";;;;;;;;;AAUO,MAAM,uBAAA,GAAmD;AAAA,EAC9D,GAAG,WAAA;AAAA,EACH,GAAG,iBAAA;AAAA,EACH,GAAG,aAAA;AAAA,EACH,GAAG,YAAA;AAAA,EACH,GAAG,QAAA;AAAA,EACH,GAAG,iBAAA;AAAA,EACH,GAAG,cAAA;AAAA,EACH,GAAG;AACL;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;;;;"}
@@ -0,0 +1,32 @@
1
+ const ioredisConfig = [
2
+ // ioredis `<5.11.0` (>=5.11.0 publishes its own `ioredis:*` diagnostics_channel)
3
+ ...["lib/redis.js", "built/redis.js", "built/redis/index.js"].flatMap((filePath) => [
4
+ {
5
+ channelName: "command",
6
+ module: { name: "ioredis", versionRange: ">=2.0.0 <5.0.0", filePath },
7
+ functionQuery: { expressionName: "sendCommand", kind: "Async" }
8
+ },
9
+ {
10
+ channelName: "connect",
11
+ module: { name: "ioredis", versionRange: ">=2.0.0 <5.0.0", filePath },
12
+ functionQuery: { expressionName: "connect", kind: "Async" }
13
+ }
14
+ ]),
15
+ {
16
+ channelName: "command",
17
+ module: { name: "ioredis", versionRange: ">=5.0.0 <5.11.0", filePath: "built/Redis.js" },
18
+ functionQuery: { className: "Redis", methodName: "sendCommand", kind: "Async" }
19
+ },
20
+ {
21
+ channelName: "connect",
22
+ module: { name: "ioredis", versionRange: ">=5.0.0 <5.11.0", filePath: "built/Redis.js" },
23
+ functionQuery: { className: "Redis", methodName: "connect", kind: "Async" }
24
+ }
25
+ ];
26
+ const ioredisChannels = {
27
+ IOREDIS_COMMAND: "orchestrion:ioredis:command",
28
+ IOREDIS_CONNECT: "orchestrion:ioredis:connect"
29
+ };
30
+
31
+ export { ioredisChannels, ioredisConfig };
32
+ //# sourceMappingURL=ioredis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ioredis.js","sources":["../../../../src/orchestrion/config/ioredis.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const ioredisConfig = [\n // ioredis `<5.11.0` (>=5.11.0 publishes its own `ioredis:*` diagnostics_channel)\n ...['lib/redis.js', 'built/redis.js', 'built/redis/index.js'].flatMap((filePath): InstrumentationConfig[] => [\n {\n channelName: 'command',\n module: { name: 'ioredis', versionRange: '>=2.0.0 <5.0.0', filePath },\n functionQuery: { expressionName: 'sendCommand', kind: 'Async' },\n },\n {\n channelName: 'connect',\n module: { name: 'ioredis', versionRange: '>=2.0.0 <5.0.0', filePath },\n functionQuery: { expressionName: 'connect', kind: 'Async' },\n },\n ]),\n {\n channelName: 'command',\n module: { name: 'ioredis', versionRange: '>=5.0.0 <5.11.0', filePath: 'built/Redis.js' },\n functionQuery: { className: 'Redis', methodName: 'sendCommand', kind: 'Async' },\n },\n {\n channelName: 'connect',\n module: { name: 'ioredis', versionRange: '>=5.0.0 <5.11.0', filePath: 'built/Redis.js' },\n functionQuery: { className: 'Redis', methodName: 'connect', kind: 'Async' },\n },\n] satisfies InstrumentationConfig[];\n\nexport const ioredisChannels = {\n IOREDIS_COMMAND: 'orchestrion:ioredis:command',\n IOREDIS_CONNECT: 'orchestrion:ioredis:connect',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,GAAG,CAAC,cAAA,EAAgB,gBAAA,EAAkB,sBAAsB,CAAA,CAAE,OAAA,CAAQ,CAAC,QAAA,KAAsC;AAAA,IAC3G;AAAA,MACE,WAAA,EAAa,SAAA;AAAA,MACb,QAAQ,EAAE,IAAA,EAAM,SAAA,EAAW,YAAA,EAAc,kBAAkB,QAAA,EAAS;AAAA,MACpE,aAAA,EAAe,EAAE,cAAA,EAAgB,aAAA,EAAe,MAAM,OAAA;AAAQ,KAChE;AAAA,IACA;AAAA,MACE,WAAA,EAAa,SAAA;AAAA,MACb,QAAQ,EAAE,IAAA,EAAM,SAAA,EAAW,YAAA,EAAc,kBAAkB,QAAA,EAAS;AAAA,MACpE,aAAA,EAAe,EAAE,cAAA,EAAgB,SAAA,EAAW,MAAM,OAAA;AAAQ;AAC5D,GACD,CAAA;AAAA,EACD;AAAA,IACE,WAAA,EAAa,SAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,WAAW,YAAA,EAAc,iBAAA,EAAmB,UAAU,gBAAA,EAAiB;AAAA,IACvF,eAAe,EAAE,SAAA,EAAW,SAAS,UAAA,EAAY,aAAA,EAAe,MAAM,OAAA;AAAQ,GAChF;AAAA,EACA;AAAA,IACE,WAAA,EAAa,SAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,WAAW,YAAA,EAAc,iBAAA,EAAmB,UAAU,gBAAA,EAAiB;AAAA,IACvF,eAAe,EAAE,SAAA,EAAW,SAAS,UAAA,EAAY,SAAA,EAAW,MAAM,OAAA;AAAQ;AAE9E;AAEO,MAAM,eAAA,GAAkB;AAAA,EAC7B,eAAA,EAAiB,6BAAA;AAAA,EACjB,eAAA,EAAiB;AACnB;;;;"}
@@ -0,0 +1,14 @@
1
+ const lruMemoizerConfig = [
2
+ {
3
+ channelName: "load",
4
+ // `>=2.1.0` only: the named `function memoizedFunction()` the selector targets exists from 2.1.0
5
+ module: { name: "lru-memoizer", versionRange: ">=2.1.0 <4", filePath: "lib/async.js" },
6
+ functionQuery: { functionName: "memoizedFunction", kind: "Callback" }
7
+ }
8
+ ];
9
+ const lruMemoizerChannels = {
10
+ LRU_MEMOIZER_LOAD: "orchestrion:lru-memoizer:load"
11
+ };
12
+
13
+ export { lruMemoizerChannels, lruMemoizerConfig };
14
+ //# sourceMappingURL=lru-memoizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lru-memoizer.js","sources":["../../../../src/orchestrion/config/lru-memoizer.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const lruMemoizerConfig = [\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] satisfies InstrumentationConfig[];\n\nexport const lruMemoizerChannels = {\n LRU_MEMOIZER_LOAD: 'orchestrion:lru-memoizer:load',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,iBAAA,GAAoB;AAAA,EAC/B;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;AAEO,MAAM,mBAAA,GAAsB;AAAA,EACjC,iBAAA,EAAmB;AACrB;;;;"}
@@ -0,0 +1,13 @@
1
+ const mysqlConfig = [
2
+ {
3
+ channelName: "query",
4
+ module: { name: "mysql", versionRange: ">=2.0.0 <3", filePath: "lib/Connection.js" },
5
+ functionQuery: { expressionName: "query", kind: "Auto" }
6
+ }
7
+ ];
8
+ const mysqlChannels = {
9
+ MYSQL_QUERY: "orchestrion:mysql:query"
10
+ };
11
+
12
+ export { mysqlChannels, mysqlConfig };
13
+ //# sourceMappingURL=mysql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mysql.js","sources":["../../../../src/orchestrion/config/mysql.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const mysqlConfig = [\n {\n channelName: 'query',\n module: { name: 'mysql', versionRange: '>=2.0.0 <3', filePath: 'lib/Connection.js' },\n functionQuery: { expressionName: 'query', kind: 'Auto' },\n },\n] satisfies InstrumentationConfig[];\n\nexport const mysqlChannels = {\n MYSQL_QUERY: 'orchestrion:mysql:query',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,WAAA,GAAc;AAAA,EACzB;AAAA,IACE,WAAA,EAAa,OAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,SAAS,YAAA,EAAc,YAAA,EAAc,UAAU,mBAAA,EAAoB;AAAA,IACnF,aAAA,EAAe,EAAE,cAAA,EAAgB,OAAA,EAAS,MAAM,MAAA;AAAO;AAE3D;AAEO,MAAM,aAAA,GAAgB;AAAA,EAC3B,WAAA,EAAa;AACf;;;;"}
@@ -0,0 +1,37 @@
1
+ const openaiConfig = [
2
+ // OpenAI chat completions. `Completions.create` returns a thenable `APIPromise` with no callback arg,
3
+ // so `kind: 'Auto'` resolves to `wrapPromise`. openai ships dual CJS/ESM and the matcher compares
4
+ // `filePath` exactly, hence one entry per built file (`.js` for `require`, `.mjs` for `import`).
5
+ ...["resources/chat/completions/completions.js", "resources/chat/completions/completions.mjs"].map((filePath) => ({
6
+ channelName: "chat",
7
+ module: { name: "openai", versionRange: ">=4.0.0 <7", filePath },
8
+ functionQuery: { className: "Completions", methodName: "create", kind: "Auto" }
9
+ })),
10
+ // OpenAI responses API — same `create(body, options)` shape as chat completions.
11
+ ...["resources/responses/responses.js", "resources/responses/responses.mjs"].map((filePath) => ({
12
+ channelName: "responses",
13
+ module: { name: "openai", versionRange: ">=4.0.0 <7", filePath },
14
+ functionQuery: { className: "Responses", methodName: "create", kind: "Auto" }
15
+ })),
16
+ // OpenAI embeddings API — same `create(body, options)` shape as chat completions.
17
+ ...["resources/embeddings.js", "resources/embeddings.mjs"].map((filePath) => ({
18
+ channelName: "embeddings",
19
+ module: { name: "openai", versionRange: ">=4.0.0 <7", filePath },
20
+ functionQuery: { className: "Embeddings", methodName: "create", kind: "Auto" }
21
+ })),
22
+ // OpenAI conversations API — same `create(body, options)` shape as chat completions.
23
+ ...["resources/conversations/conversations.js", "resources/conversations/conversations.mjs"].map((filePath) => ({
24
+ channelName: "conversations",
25
+ module: { name: "openai", versionRange: ">=4.0.0 <7", filePath },
26
+ functionQuery: { className: "Conversations", methodName: "create", kind: "Auto" }
27
+ }))
28
+ ];
29
+ const openaiChannels = {
30
+ OPENAI_CHAT: "orchestrion:openai:chat",
31
+ OPENAI_RESPONSES: "orchestrion:openai:responses",
32
+ OPENAI_EMBEDDINGS: "orchestrion:openai:embeddings",
33
+ OPENAI_CONVERSATIONS: "orchestrion:openai:conversations"
34
+ };
35
+
36
+ export { openaiChannels, openaiConfig };
37
+ //# sourceMappingURL=openai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.js","sources":["../../../../src/orchestrion/config/openai.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const openaiConfig = [\n // OpenAI chat completions. `Completions.create` returns a thenable `APIPromise` with no callback arg,\n // so `kind: 'Auto'` resolves to `wrapPromise`. openai ships dual CJS/ESM and the matcher compares\n // `filePath` exactly, hence one entry per built file (`.js` for `require`, `.mjs` for `import`).\n ...['resources/chat/completions/completions.js', 'resources/chat/completions/completions.mjs'].map(filePath => ({\n channelName: 'chat',\n module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath },\n functionQuery: { className: 'Completions', methodName: 'create', kind: 'Auto' as const },\n })),\n // OpenAI responses API — same `create(body, options)` shape as chat completions.\n ...['resources/responses/responses.js', 'resources/responses/responses.mjs'].map(filePath => ({\n channelName: 'responses',\n module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath },\n functionQuery: { className: 'Responses', methodName: 'create', kind: 'Auto' as const },\n })),\n // OpenAI embeddings API — same `create(body, options)` shape as chat completions.\n ...['resources/embeddings.js', 'resources/embeddings.mjs'].map(filePath => ({\n channelName: 'embeddings',\n module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath },\n functionQuery: { className: 'Embeddings', methodName: 'create', kind: 'Auto' as const },\n })),\n // OpenAI conversations API — same `create(body, options)` shape as chat completions.\n ...['resources/conversations/conversations.js', 'resources/conversations/conversations.mjs'].map(filePath => ({\n channelName: 'conversations',\n module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath },\n functionQuery: { className: 'Conversations', methodName: 'create', kind: 'Auto' as const },\n })),\n] satisfies InstrumentationConfig[];\n\nexport const openaiChannels = {\n OPENAI_CHAT: 'orchestrion:openai:chat',\n OPENAI_RESPONSES: 'orchestrion:openai:responses',\n OPENAI_EMBEDDINGS: 'orchestrion:openai:embeddings',\n OPENAI_CONVERSATIONS: 'orchestrion:openai:conversations',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,GAAG,CAAC,2CAAA,EAA6C,4CAA4C,CAAA,CAAE,IAAI,CAAA,QAAA,MAAa;AAAA,IAC9G,WAAA,EAAa,MAAA;AAAA,IACb,QAAQ,EAAE,IAAA,EAAM,QAAA,EAAU,YAAA,EAAc,cAAc,QAAA,EAAS;AAAA,IAC/D,eAAe,EAAE,SAAA,EAAW,eAAe,U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+ // clients) plus `pg-pool`'s `Pool.prototype.connect`.
5
+ // `Auto` covers the callback, promise, and streamable-`Submittable`
6
+ // call shapes (like mysql).
7
+ // `pg/lib/client.js` is `class Client { query() {...} connect() {...} }`,
8
+ // so `className`+`methodName` matches directly.
9
+ {
10
+ channelName: "query",
11
+ module: { name: "pg", versionRange: ">=8.0.3 <9", filePath: "lib/client.js" },
12
+ functionQuery: { className: "Client", methodName: "query", kind: "Auto" }
13
+ },
14
+ {
15
+ channelName: "connect",
16
+ module: { name: "pg", versionRange: ">=8.0.3 <9", filePath: "lib/client.js" },
17
+ functionQuery: { className: "Client", methodName: "connect", kind: "Auto" }
18
+ },
19
+ // The native client (`pg/lib/native/client.js`) is a constructor function,
20
+ // not a class.
21
+ // `Client.prototype.query = function (config, values, callback) {...}`
22
+ // so it needs `expressionName` (the mysql shape), publishing to the SAME
23
+ // `orchestrion:pg:query`/`:connect` channels as the JS client.
24
+ {
25
+ channelName: "query",
26
+ module: { name: "pg", versionRange: ">=8.0.3 <9", filePath: "lib/native/client.js" },
27
+ functionQuery: { expressionName: "query", kind: "Auto" }
28
+ },
29
+ {
30
+ channelName: "connect",
31
+ module: { name: "pg", versionRange: ">=8.0.3 <9", filePath: "lib/native/client.js" },
32
+ functionQuery: { expressionName: "connect", kind: "Auto" }
33
+ },
34
+ // `pg-pool` is `class Pool extends EventEmitter { connect(cb) {...} }`.
35
+ {
36
+ channelName: "connect",
37
+ module: { name: "pg-pool", versionRange: ">=2.0.0 <4", filePath: "index.js" },
38
+ functionQuery: { className: "Pool", methodName: "connect", kind: "Auto" }
39
+ }
40
+ ];
41
+ const pgChannels = {
42
+ PG_QUERY: "orchestrion:pg:query",
43
+ PG_CONNECT: "orchestrion:pg:connect",
44
+ PGPOOL_CONNECT: "orchestrion:pg-pool:connect"
45
+ };
46
+
47
+ export { pgChannels, pgConfig };
48
+ //# sourceMappingURL=pg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pg.js","sources":["../../../../src/orchestrion/config/pg.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const pgConfig = [\n // `pg` (node-postgres).\n // instruments `Client.prototype.query`/`connect` (both the JS and native\n // clients) plus `pg-pool`'s `Pool.prototype.connect`.\n // `Auto` covers the callback, promise, and streamable-`Submittable`\n // call shapes (like mysql).\n // `pg/lib/client.js` is `class Client { query() {...} connect() {...} }`,\n // so `className`+`methodName` matches directly.\n {\n channelName: 'query',\n module: { name: 'pg', versionRange: '>=8.0.3 <9', filePath: 'lib/client.js' },\n functionQuery: { className: 'Client', methodName: 'query', kind: 'Auto' },\n },\n {\n channelName: 'connect',\n module: { name: 'pg', versionRange: '>=8.0.3 <9', filePath: 'lib/client.js' },\n functionQuery: { className: 'Client', methodName: 'connect', kind: 'Auto' },\n },\n // The native client (`pg/lib/native/client.js`) is a constructor function,\n // not a class.\n // `Client.prototype.query = function (config, values, callback) {...}`\n // so it needs `expressionName` (the mysql shape), publishing to the SAME\n // `orchestrion:pg:query`/`:connect` channels as the JS client.\n {\n channelName: 'query',\n module: { name: 'pg', versionRange: '>=8.0.3 <9', filePath: 'lib/native/client.js' },\n functionQuery: { expressionName: 'query', kind: 'Auto' },\n },\n {\n channelName: 'connect',\n module: { name: 'pg', versionRange: '>=8.0.3 <9', filePath: 'lib/native/client.js' },\n functionQuery: { expressionName: 'connect', kind: 'Auto' },\n },\n // `pg-pool` is `class Pool extends EventEmitter { connect(cb) {...} }`.\n {\n channelName: 'connect',\n module: { name: 'pg-pool', versionRange: '>=2.0.0 <4', filePath: 'index.js' },\n functionQuery: { className: 'Pool', methodName: 'connect', kind: 'Auto' },\n },\n] satisfies InstrumentationConfig[];\n\nexport const pgChannels = {\n PG_QUERY: 'orchestrion:pg:query',\n PG_CONNECT: 'orchestrion:pg:connect',\n PGPOOL_CONNECT: 'orchestrion:pg-pool:connect',\n} as const;\n"],"names":[],"mappings":"AAEO,MAAM,QAAA,GAAW;AAAA;AAAA;AAAA;AAAA;A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B;AAClB;;;;"}
@@ -0,0 +1,41 @@
1
+ const vercelAiConfig = [
2
+ // Vercel AI v6: mirror the v7 native `ai:telemetry` channel by injecting
3
+ // channels into the top-level entry points. `resolveLanguageModel` is wrapped
4
+ // not to span it, but so the subscriber can monkey-patch `doGenerate`/
5
+ // `doStream` on the returned model (the only way to span the model call,
6
+ // which is an inline call with no injectable definition in `ai`).
7
+ // `streamText` returns its result synchronously (streaming is lazy), so it's
8
+ // `Sync`; the subscriber binds the span via `bindTracingChannelToSpan`, which
9
+ // ends it when the (synchronous) call returns.
10
+ ...vercelAiV6Entries("generateText", "generateText", "Async"),
11
+ ...vercelAiV6Entries("streamText", "streamText", "Sync"),
12
+ ...vercelAiV6Entries("embed", "embed", "Async"),
13
+ ...vercelAiV6Entries("embedMany", "embedMany", "Async"),
14
+ ...vercelAiV6Entries("executeToolCall", "executeToolCall", "Async"),
15
+ ...vercelAiV6Entries("resolveLanguageModel", "resolveLanguageModel", "Sync")
16
+ ];
17
+ const vercelAiChannels = {
18
+ // Vercel AI (`ai`) v6: orchestrion injects these so the same channel-based
19
+ // integration that consumes `ai`'s native `ai:telemetry` channel (v7) can
20
+ // also instrument v6. Each maps to a top-level function in `ai`'s bundle.
21
+ VERCEL_AI_GENERATE_TEXT: "orchestrion:ai:generateText",
22
+ VERCEL_AI_STREAM_TEXT: "orchestrion:ai:streamText",
23
+ VERCEL_AI_EMBED: "orchestrion:ai:embed",
24
+ VERCEL_AI_EMBED_MANY: "orchestrion:ai:embedMany",
25
+ VERCEL_AI_EXECUTE_TOOL_CALL: "orchestrion:ai:executeToolCall",
26
+ // `resolveLanguageModel` is the single chokepoint every model call flows
27
+ // through; we wrap it to monkey-patch `doGenerate`/`doStream` on the returned
28
+ // model (the model-call site itself is an inline call with no injectable
29
+ // definition).
30
+ VERCEL_AI_RESOLVE_LANGUAGE_MODEL: "orchestrion:ai:resolveLanguageModel"
31
+ };
32
+ function vercelAiV6Entries(channelName, functionName, kind) {
33
+ return ["dist/index.js", "dist/index.mjs"].map((filePath) => ({
34
+ channelName,
35
+ module: { name: "ai", versionRange: ">=6.0.0 <7.0.0", filePath },
36
+ functionQuery: { functionName, kind }
37
+ }));
38
+ }
39
+
40
+ export { vercelAiChannels, vercelAiConfig };
41
+ //# sourceMappingURL=vercel-ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel-ai.js","sources":["../../../../src/orchestrion/config/vercel-ai.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\n\nexport const vercelAiConfig = [\n // Vercel AI v6: mirror the v7 native `ai:telemetry` channel by injecting\n // channels into the top-level entry points. `resolveLanguageModel` is wrapped\n // not to span it, but so the subscriber can monkey-patch `doGenerate`/\n // `doStream` on the returned model (the only way to span the model call,\n // which is an inline call with no injectable definition in `ai`).\n // `streamText` returns its result synchronously (streaming is lazy), so it's\n // `Sync`; the subscriber binds the span via `bindTracingChannelToSpan`, which\n // ends it when the (synchronous) call returns.\n ...vercelAiV6Entries('generateText', 'generateText', 'Async'),\n ...vercelAiV6Entries('streamText', 'streamText', 'Sync'),\n ...vercelAiV6Entries('embed', 'embed', 'Async'),\n ...vercelAiV6Entries('embedMany', 'embedMany', 'Async'),\n ...vercelAiV6Entries('executeToolCall', 'executeToolCall', 'Async'),\n ...vercelAiV6Entries('resolveLanguageModel', 'resolveLanguageModel', 'Sync'),\n] satisfies InstrumentationConfig[];\n\nexport const vercelAiChannels = {\n // Vercel AI (`ai`) v6: orchestrion injects these so the same channel-based\n // integration that consumes `ai`'s native `ai:telemetry` channel (v7) can\n // also instrument v6. Each maps to a top-level function in `ai`'s bundle.\n VERCEL_AI_GENERATE_TEXT: 'orchestrion:ai:generateText',\n VERCEL_AI_STREAM_TEXT: 'orchestrion:ai:streamText',\n VERCEL_AI_EMBED: 'orchestrion:ai:embed',\n VERCEL_AI_EMBED_MANY: 'orchestrion:ai:embedMany',\n VERCEL_AI_EXECUTE_TOOL_CALL: 'orchestrion:ai:executeToolCall',\n // `resolveLanguageModel` is the single chokepoint every model call flows\n // through; we wrap it to monkey-patch `doGenerate`/`doStream` on the returned\n // model (the model-call site itself is an inline call with no injectable\n // definition).\n VERCEL_AI_RESOLVE_LANGUAGE_MODEL: 'orchestrion:ai:resolveLanguageModel',\n} as const;\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 */\n/**\n * `ai` ships a single bundled entry per module system, so each instrumented\n * function needs one config entry per file (the app loads whichever matches its\n * module system). This expands a single target into both.\n */\nfunction vercelAiV6Entries(channelName: string, functionName: string, kind: 'Async' | 'Sync'): InstrumentationConfig[] {\n return ['dist/index.js', 'dist/index.mjs'].map(filePath => ({\n channelName,\n module: { name: 'ai', versionRange: '>=6.0.0 <7.0.0', filePath },\n functionQuery: { functionName, kind },\n }));\n}\n"],"names":[],"mappings":"AAEO,MAAM,cAAA,GAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS5B,GAAG,iBAAA,CAAkB,cAAA,EAAgB,cAAA,EAAgB,OAAO,CAAA;AAAA,EAC5D,GAAG,iBAAA,CAAkB,YAAA,EAAc,YAAA,EAAc,MAAM,CAAA;AAAA,EACvD,GAAG,iBAAA,CAAkB,OAAA,EAAS,OAAA,EAAS,OAAO,CAAA;AAAA,EAC9C,GAAG,iBAAA,CAAkB,WAAA,EAAa,WAAA,EAAa,OAAO,CAAA;AAAA,EACtD,GAAG,iBAAA,CAAkB,iBAAA,EAAmB,iBAAA,EAAmB,OAAO,CAAA;AAAA,EAClE,GAAG,iBAAA,CAAkB,sBAAA,EAAwB,sBAAA,EAAwB,MAAM;AAC7E;AAEO,MAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA,EAI9B,uBAAA,EAAyB,6BAAA;AAAA,EACzB,qBAAA,EAAuB,2BAAA;AAAA,EACvB,eAAA,EAAiB,sBAAA;AAAA,EACjB,oBAAA,EAAsB,0BAAA;AAAA,EACtB,2BAAA,EAA6B,gCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7B,gCAAA,EAAkC;AACpC;AAkBA,SAAS,iBAAA,CAAkB,WAAA,EAAqB,YAAA,EAAsB,IAAA,EAAiD;AACrH,EAAA,OAAO,CAAC,eAAA,EAAiB,gBAAgB,CAAA,CAAE,IAAI,CAAA,QAAA,MAAa;AAAA,IAC1D,WAAA;AAAA,IACA,QAAQ,EAAE,IAAA,EAAM,IAAA,EAAM,YAAA,EAAc,kBAAkB,QAAA,EAAS;AAAA,IAC/D,aAAA,EAAe,EAAE,YAAA,EAAc,IAAA;AAAK,GACtC,CAAE,CAAA;AACJ;;;;"}
@@ -1,18 +1,22 @@
1
1
  import { debug } from '@sentry/core';
2
2
  import { DEBUG_BUILD } from '../debug-build.js';
3
3
 
4
+ function isOrchestrionInjected() {
5
+ const marker = globalThis.__SENTRY_ORCHESTRION__;
6
+ return !!(marker?.runtime || marker?.bundler);
7
+ }
4
8
  function detectOrchestrionSetup() {
5
9
  if (!DEBUG_BUILD) return;
6
10
  const marker = globalThis.__SENTRY_ORCHESTRION__;
7
11
  const runtime = !!marker?.runtime;
8
12
  const bundler = !!marker?.bundler;
9
13
  DEBUG_BUILD && debug.log(`[orchestrion] detect: runtime=${runtime} bundler=${bundler}`);
10
- if (!runtime && !bundler) {
14
+ if (!isOrchestrionInjected()) {
11
15
  DEBUG_BUILD && debug.warn(
12
16
  "[Sentry] No diagnostics-channel injection detected. Channel-based integrations (mysql, \u2026) will not record spans. Make sure the diagnostics channels are injected via the runtime `--import` hook or a bundler plugin before the instrumented modules load."
13
17
  );
14
18
  }
15
19
  }
16
20
 
17
- export { detectOrchestrionSetup };
21
+ export { detectOrchestrionSetup, isOrchestrionInjected };
18
22
  //# sourceMappingURL=detect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detect.js","sources":["../../../src/orchestrion/detect.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __SENTRY_ORCHESTRION__: { runtime?: boolean; bundler?: boolean } | undefined;\n}\n\n/**\n * Verifies that the diagnostics channels have been injected either by the\n * runtime `--import` hook (or init-time registration), a bundler plugin, or\n * both, and warns if not.\n *\n * Both injectors being active at once is fine: they operate on disjoint module\n * sets (a module is either loaded through Node's loader and transformed by the\n * runtime hook, or inlined by the bundler and transformed by the plugin), so\n * a single module can't be double-wrapped. A hybrid setup, with some deps\n * external and runtime-instrumented, others bundled and plugin-instrumented,\n * is fine.\n *\n * Note: intentionally does NOT warn in production, only in debug builds,\n * because production warnings are reserved for truly critical issues.\n */\nexport function detectOrchestrionSetup(): void {\n if (!DEBUG_BUILD) return;\n\n const marker = globalThis.__SENTRY_ORCHESTRION__;\n const runtime = !!marker?.runtime;\n const bundler = !!marker?.bundler;\n\n DEBUG_BUILD && debug.log(`[orchestrion] detect: runtime=${runtime} bundler=${bundler}`);\n\n if (!runtime && !bundler) {\n DEBUG_BUILD &&\n debug.warn(\n '[Sentry] No diagnostics-channel injection detected. Channel-based integrations ' +\n '(mysql, …) will not record spans. Make sure the diagnostics channels are injected ' +\n 'via the runtime `--import` hook or a bundler plugin before the instrumented modules load.',\n );\n }\n}\n"],"names":[],"mappings":";;;AAuBO,SAAS,sBAAA,GAA+B;AAC7C,EAAA,IAAI,CAAC,WAAA,EAAa;AAElB,EAAA,MAAM,SAAS,UAAA,CAAW,sBAAA;AAC1B,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,MAAA,EAAQ,OAAA;AAC1B,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,MAAA,EAAQ,OAAA;AAE1B,EAAA,WAAA,IAAe,MAAM,GAAA,CAAI,CAAA,8BAAA,EAAiC,OAAO,CAAA,SAAA,EAAY,OAAO,CAAA,CAAE,CAAA;AAEtF,EAAA,IAAI,CAAC,OAAA,IAAW,CAAC,OAAA,EAAS;AACxB,IAAA,WAAA,IACE,KAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KAGF;AAAA,EACJ;AACF;;;;"}
1
+ {"version":3,"file":"detect.js","sources":["../../../src/orchestrion/detect.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __SENTRY_ORCHESTRION__: { runtime?: boolean; bundler?: boolean } | undefined;\n}\n\n/**\n * Whether orchestrion has injected the diagnostics channels into this process,\n * either by the runtime `--import` hook / init-time registration (`runtime`)\n * or a bundler plugin (`bundler`). Both injectors set a flag on the\n * `globalThis.__SENTRY_ORCHESTRION__` marker.\n *\n * Use this to avoid wiring up channel-subscriber integrations when nothing\n * will ever publish to those channels.\n */\nexport function isOrchestrionInjected(): boolean {\n const marker = globalThis.__SENTRY_ORCHESTRION__;\n return !!(marker?.runtime || marker?.bundler);\n}\n\n/**\n * Verifies that the diagnostics channels have been injected either by the\n * runtime `--import` hook (or init-time registration), a bundler plugin, or\n * both, and warns if not.\n *\n * Both injectors being active at once is fine: they operate on disjoint module\n * sets (a module is either loaded through Node's loader and transformed by the\n * runtime hook, or inlined by the bundler and transformed by the plugin), so\n * a single module can't be double-wrapped. A hybrid setup, with some deps\n * external and runtime-instrumented, others bundled and plugin-instrumented,\n * is fine.\n *\n * Note: intentionally does NOT warn in production, only in debug builds,\n * because production warnings are reserved for truly critical issues.\n */\nexport function detectOrchestrionSetup(): void {\n if (!DEBUG_BUILD) return;\n\n const marker = globalThis.__SENTRY_ORCHESTRION__;\n const runtime = !!marker?.runtime;\n const bundler = !!marker?.bundler;\n\n DEBUG_BUILD && debug.log(`[orchestrion] detect: runtime=${runtime} bundler=${bundler}`);\n\n if (!isOrchestrionInjected()) {\n DEBUG_BUILD &&\n debug.warn(\n '[Sentry] No diagnostics-channel injection detected. Channel-based integrations ' +\n '(mysql, …) will not record spans. Make sure the diagnostics channels are injected ' +\n 'via the runtime `--import` hook or a bundler plugin before the instrumented modules load.',\n );\n }\n}\n"],"names":[],"mappings":";;;AAiBO,SAAS,qBAAA,GAAiC;AAC/C,EAAA,MAAM,SAAS,UAAA,CAAW,sBAAA;AAC1B,EAAA,OAAO,CAAC,EAAE,MAAA,EAAQ,OAAA,IAAW,MAAA,EAAQ,OAAA,CAAA;AACvC;AAiBO,SAAS,sBAAA,GAA+B;AAC7C,EAAA,IAAI,CAAC,WAAA,EAAa;AAElB,EAAA,MAAM,SAAS,UAAA,CAAW,sBAAA;AAC1B,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,MAAA,EAAQ,OAAA;AAC1B,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,MAAA,EAAQ,OAAA;AAE1B,EAAA,WAAA,IAAe,MAAM,GAAA,CAAI,CAAA,8BAAA,EAAiC,OAAO,CAAA,SAAA,EAAY,OAAO,CAAA,CAAE,CAAA;AAEtF,EAAA,IAAI,CAAC,uBAAsB,EAAG;AAC5B,IAAA,WAAA,IACE,KAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KAGF;AAAA,EACJ;AACF;;;;"}