@depup/sentry__server-utils 10.67.0-depup.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 (848) hide show
  1. package/README.md +32 -0
  2. package/build/cjs/debug-build.js +6 -0
  3. package/build/cjs/debug-build.js.map +1 -0
  4. package/build/cjs/graphql/graphql-dc-subscriber.js +123 -0
  5. package/build/cjs/graphql/graphql-dc-subscriber.js.map +1 -0
  6. package/build/cjs/graphql/index.js +23 -0
  7. package/build/cjs/graphql/index.js.map +1 -0
  8. package/build/cjs/graphql/utils.js +92 -0
  9. package/build/cjs/graphql/utils.js.map +1 -0
  10. package/build/cjs/index.js +34 -0
  11. package/build/cjs/index.js.map +1 -0
  12. package/build/cjs/integrations/tracing-channel/amqplib.js +420 -0
  13. package/build/cjs/integrations/tracing-channel/amqplib.js.map +1 -0
  14. package/build/cjs/integrations/tracing-channel/anthropic.js +101 -0
  15. package/build/cjs/integrations/tracing-channel/anthropic.js.map +1 -0
  16. package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js +16 -0
  17. package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
  18. package/build/cjs/integrations/tracing-channel/aws-sdk/index.js +154 -0
  19. package/build/cjs/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
  20. package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +46 -0
  21. package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
  22. package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +47 -0
  23. package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
  24. package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +419 -0
  25. package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
  26. package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js +131 -0
  27. package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
  28. package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js +21 -0
  29. package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
  30. package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js +64 -0
  31. package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
  32. package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js +21 -0
  33. package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
  34. package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +27 -0
  35. package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
  36. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js +63 -0
  37. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
  38. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js +116 -0
  39. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
  40. package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +25 -0
  41. package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
  42. package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js +30 -0
  43. package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
  44. package/build/cjs/integrations/tracing-channel/dataloader.js +95 -0
  45. package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -0
  46. package/build/cjs/integrations/tracing-channel/express/index.js +24 -0
  47. package/build/cjs/integrations/tracing-channel/express/index.js.map +1 -0
  48. package/build/cjs/integrations/tracing-channel/express/instrumentation.js +168 -0
  49. package/build/cjs/integrations/tracing-channel/express/instrumentation.js.map +1 -0
  50. package/build/cjs/integrations/tracing-channel/express/route.js +76 -0
  51. package/build/cjs/integrations/tracing-channel/express/route.js.map +1 -0
  52. package/build/cjs/integrations/tracing-channel/fastify/errors.js +42 -0
  53. package/build/cjs/integrations/tracing-channel/fastify/errors.js.map +1 -0
  54. package/build/cjs/integrations/tracing-channel/fastify/index.js +34 -0
  55. package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -0
  56. package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +279 -0
  57. package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
  58. package/build/cjs/integrations/tracing-channel/fastify/utils.js +11 -0
  59. package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -0
  60. package/build/cjs/integrations/tracing-channel/generic-pool.js +34 -0
  61. package/build/cjs/integrations/tracing-channel/generic-pool.js.map +1 -0
  62. package/build/cjs/integrations/tracing-channel/google-genai.js +96 -0
  63. package/build/cjs/integrations/tracing-channel/google-genai.js.map +1 -0
  64. package/build/cjs/integrations/tracing-channel/graphql/constants.js +26 -0
  65. package/build/cjs/integrations/tracing-channel/graphql/constants.js.map +1 -0
  66. package/build/cjs/integrations/tracing-channel/graphql/index.js +66 -0
  67. package/build/cjs/integrations/tracing-channel/graphql/index.js.map +1 -0
  68. package/build/cjs/integrations/tracing-channel/graphql/resolvers.js +168 -0
  69. package/build/cjs/integrations/tracing-channel/graphql/resolvers.js.map +1 -0
  70. package/build/cjs/integrations/tracing-channel/graphql/spans.js +102 -0
  71. package/build/cjs/integrations/tracing-channel/graphql/spans.js.map +1 -0
  72. package/build/cjs/integrations/tracing-channel/hapi-types.js +30 -0
  73. package/build/cjs/integrations/tracing-channel/hapi-types.js.map +1 -0
  74. package/build/cjs/integrations/tracing-channel/hapi-utils.js +177 -0
  75. package/build/cjs/integrations/tracing-channel/hapi-utils.js.map +1 -0
  76. package/build/cjs/integrations/tracing-channel/hapi.js +52 -0
  77. package/build/cjs/integrations/tracing-channel/hapi.js.map +1 -0
  78. package/build/cjs/integrations/tracing-channel/ioredis.js +99 -0
  79. package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -0
  80. package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js +71 -0
  81. package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
  82. package/build/cjs/integrations/tracing-channel/kafkajs/index.js +70 -0
  83. package/build/cjs/integrations/tracing-channel/kafkajs/index.js.map +1 -0
  84. package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js +22 -0
  85. package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
  86. package/build/cjs/integrations/tracing-channel/kafkajs/spans.js +119 -0
  87. package/build/cjs/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
  88. package/build/cjs/integrations/tracing-channel/knex.js +188 -0
  89. package/build/cjs/integrations/tracing-channel/knex.js.map +1 -0
  90. package/build/cjs/integrations/tracing-channel/koa.js +146 -0
  91. package/build/cjs/integrations/tracing-channel/koa.js.map +1 -0
  92. package/build/cjs/integrations/tracing-channel/langchain.js +63 -0
  93. package/build/cjs/integrations/tracing-channel/langchain.js.map +1 -0
  94. package/build/cjs/integrations/tracing-channel/langgraph.js +100 -0
  95. package/build/cjs/integrations/tracing-channel/langgraph.js.map +1 -0
  96. package/build/cjs/integrations/tracing-channel/lru-memoizer.js +31 -0
  97. package/build/cjs/integrations/tracing-channel/lru-memoizer.js.map +1 -0
  98. package/build/cjs/integrations/tracing-channel/mongodb.js +104 -0
  99. package/build/cjs/integrations/tracing-channel/mongodb.js.map +1 -0
  100. package/build/cjs/integrations/tracing-channel/mongoose.js +110 -0
  101. package/build/cjs/integrations/tracing-channel/mongoose.js.map +1 -0
  102. package/build/cjs/integrations/tracing-channel/mysql.js +107 -0
  103. package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -0
  104. package/build/cjs/integrations/tracing-channel/mysql2.js +83 -0
  105. package/build/cjs/integrations/tracing-channel/mysql2.js.map +1 -0
  106. package/build/cjs/integrations/tracing-channel/openai.js +81 -0
  107. package/build/cjs/integrations/tracing-channel/openai.js.map +1 -0
  108. package/build/cjs/integrations/tracing-channel/postgres-js.js +191 -0
  109. package/build/cjs/integrations/tracing-channel/postgres-js.js.map +1 -0
  110. package/build/cjs/integrations/tracing-channel/postgres.js +170 -0
  111. package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -0
  112. package/build/cjs/integrations/tracing-channel/redis.js +218 -0
  113. package/build/cjs/integrations/tracing-channel/redis.js.map +1 -0
  114. package/build/cjs/integrations/tracing-channel/tedious.js +145 -0
  115. package/build/cjs/integrations/tracing-channel/tedious.js.map +1 -0
  116. package/build/cjs/integrations/tracing-channel/vercel-ai.js +25 -0
  117. package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -0
  118. package/build/cjs/mongodb/mongodb-span.js +133 -0
  119. package/build/cjs/mongodb/mongodb-span.js.map +1 -0
  120. package/build/cjs/mongoose/index.js +23 -0
  121. package/build/cjs/mongoose/index.js.map +1 -0
  122. package/build/cjs/mongoose/mongoose-dc-subscriber.js +97 -0
  123. package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -0
  124. package/build/cjs/mongoose/mongoose-legacy-span.js +40 -0
  125. package/build/cjs/mongoose/mongoose-legacy-span.js.map +1 -0
  126. package/build/cjs/mysql2/index.js +23 -0
  127. package/build/cjs/mysql2/index.js.map +1 -0
  128. package/build/cjs/mysql2/mysql2-dc-subscriber.js +68 -0
  129. package/build/cjs/mysql2/mysql2-dc-subscriber.js.map +1 -0
  130. package/build/cjs/orchestrion/bundler/esbuild.js +15 -0
  131. package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -0
  132. package/build/cjs/orchestrion/bundler/options.js +24 -0
  133. package/build/cjs/orchestrion/bundler/options.js.map +1 -0
  134. package/build/cjs/orchestrion/bundler/rollup.js +15 -0
  135. package/build/cjs/orchestrion/bundler/rollup.js.map +1 -0
  136. package/build/cjs/orchestrion/bundler/vite.js +21 -0
  137. package/build/cjs/orchestrion/bundler/vite.js.map +1 -0
  138. package/build/cjs/orchestrion/bundler/webpack.js +36 -0
  139. package/build/cjs/orchestrion/bundler/webpack.js.map +1 -0
  140. package/build/cjs/orchestrion/channels.js +70 -0
  141. package/build/cjs/orchestrion/channels.js.map +1 -0
  142. package/build/cjs/orchestrion/config/amqplib.js +81 -0
  143. package/build/cjs/orchestrion/config/amqplib.js.map +1 -0
  144. package/build/cjs/orchestrion/config/anthropic-ai.js +43 -0
  145. package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -0
  146. package/build/cjs/orchestrion/config/aws-sdk.js +28 -0
  147. package/build/cjs/orchestrion/config/aws-sdk.js.map +1 -0
  148. package/build/cjs/orchestrion/config/dataloader.js +53 -0
  149. package/build/cjs/orchestrion/config/dataloader.js.map +1 -0
  150. package/build/cjs/orchestrion/config/express.js +77 -0
  151. package/build/cjs/orchestrion/config/express.js.map +1 -0
  152. package/build/cjs/orchestrion/config/firebase.js +8 -0
  153. package/build/cjs/orchestrion/config/firebase.js.map +1 -0
  154. package/build/cjs/orchestrion/config/generic-pool.js +21 -0
  155. package/build/cjs/orchestrion/config/generic-pool.js.map +1 -0
  156. package/build/cjs/orchestrion/config/google-genai.js +38 -0
  157. package/build/cjs/orchestrion/config/google-genai.js.map +1 -0
  158. package/build/cjs/orchestrion/config/graphql.js +28 -0
  159. package/build/cjs/orchestrion/config/graphql.js.map +1 -0
  160. package/build/cjs/orchestrion/config/hapi.js +26 -0
  161. package/build/cjs/orchestrion/config/hapi.js.map +1 -0
  162. package/build/cjs/orchestrion/config/index.js +89 -0
  163. package/build/cjs/orchestrion/config/index.js.map +1 -0
  164. package/build/cjs/orchestrion/config/ioredis.js +35 -0
  165. package/build/cjs/orchestrion/config/ioredis.js.map +1 -0
  166. package/build/cjs/orchestrion/config/kafkajs.js +30 -0
  167. package/build/cjs/orchestrion/config/kafkajs.js.map +1 -0
  168. package/build/cjs/orchestrion/config/knex.js +43 -0
  169. package/build/cjs/orchestrion/config/knex.js.map +1 -0
  170. package/build/cjs/orchestrion/config/koa.js +16 -0
  171. package/build/cjs/orchestrion/config/koa.js.map +1 -0
  172. package/build/cjs/orchestrion/config/langchain.js +52 -0
  173. package/build/cjs/orchestrion/config/langchain.js.map +1 -0
  174. package/build/cjs/orchestrion/config/langgraph.js +28 -0
  175. package/build/cjs/orchestrion/config/langgraph.js.map +1 -0
  176. package/build/cjs/orchestrion/config/lru-memoizer.js +17 -0
  177. package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -0
  178. package/build/cjs/orchestrion/config/mongodb.js +67 -0
  179. package/build/cjs/orchestrion/config/mongodb.js.map +1 -0
  180. package/build/cjs/orchestrion/config/mongoose.js +107 -0
  181. package/build/cjs/orchestrion/config/mongoose.js.map +1 -0
  182. package/build/cjs/orchestrion/config/mysql.js +16 -0
  183. package/build/cjs/orchestrion/config/mysql.js.map +1 -0
  184. package/build/cjs/orchestrion/config/mysql2.js +32 -0
  185. package/build/cjs/orchestrion/config/mysql2.js.map +1 -0
  186. package/build/cjs/orchestrion/config/nestjs.js +122 -0
  187. package/build/cjs/orchestrion/config/nestjs.js.map +1 -0
  188. package/build/cjs/orchestrion/config/openai.js +40 -0
  189. package/build/cjs/orchestrion/config/openai.js.map +1 -0
  190. package/build/cjs/orchestrion/config/pg.js +51 -0
  191. package/build/cjs/orchestrion/config/pg.js.map +1 -0
  192. package/build/cjs/orchestrion/config/postgres.js +50 -0
  193. package/build/cjs/orchestrion/config/postgres.js.map +1 -0
  194. package/build/cjs/orchestrion/config/prisma.js +8 -0
  195. package/build/cjs/orchestrion/config/prisma.js.map +1 -0
  196. package/build/cjs/orchestrion/config/react-router.js +8 -0
  197. package/build/cjs/orchestrion/config/react-router.js.map +1 -0
  198. package/build/cjs/orchestrion/config/redis.js +76 -0
  199. package/build/cjs/orchestrion/config/redis.js.map +1 -0
  200. package/build/cjs/orchestrion/config/remix.js +54 -0
  201. package/build/cjs/orchestrion/config/remix.js.map +1 -0
  202. package/build/cjs/orchestrion/config/tedious.js +24 -0
  203. package/build/cjs/orchestrion/config/tedious.js.map +1 -0
  204. package/build/cjs/orchestrion/config/vercel-ai.js +48 -0
  205. package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -0
  206. package/build/cjs/orchestrion/detect.js +26 -0
  207. package/build/cjs/orchestrion/detect.js.map +1 -0
  208. package/build/cjs/orchestrion/index.js +89 -0
  209. package/build/cjs/orchestrion/index.js.map +1 -0
  210. package/build/cjs/orchestrion/runtime/register.js +77 -0
  211. package/build/cjs/orchestrion/runtime/register.js.map +1 -0
  212. package/build/cjs/prisma/global.js +14 -0
  213. package/build/cjs/prisma/global.js.map +1 -0
  214. package/build/cjs/prisma/index.js +27 -0
  215. package/build/cjs/prisma/index.js.map +1 -0
  216. package/build/cjs/prisma/tracing-helper.js +211 -0
  217. package/build/cjs/prisma/tracing-helper.js.map +1 -0
  218. package/build/cjs/redis/index.js +23 -0
  219. package/build/cjs/redis/index.js.map +1 -0
  220. package/build/cjs/redis/redis-dc-subscriber.js +101 -0
  221. package/build/cjs/redis/redis-dc-subscriber.js.map +1 -0
  222. package/build/cjs/redis/redis-statement-serializer.js +34 -0
  223. package/build/cjs/redis/redis-statement-serializer.js.map +1 -0
  224. package/build/cjs/tracing-channel.js +134 -0
  225. package/build/cjs/tracing-channel.js.map +1 -0
  226. package/build/cjs/vercel-ai/index.js +23 -0
  227. package/build/cjs/vercel-ai/index.js.map +1 -0
  228. package/build/cjs/vercel-ai/util.js +112 -0
  229. package/build/cjs/vercel-ai/util.js.map +1 -0
  230. package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +433 -0
  231. package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -0
  232. package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js +399 -0
  233. package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
  234. package/build/esm/debug-build.js +4 -0
  235. package/build/esm/debug-build.js.map +1 -0
  236. package/build/esm/graphql/graphql-dc-subscriber.js +116 -0
  237. package/build/esm/graphql/graphql-dc-subscriber.js.map +1 -0
  238. package/build/esm/graphql/index.js +21 -0
  239. package/build/esm/graphql/index.js.map +1 -0
  240. package/build/esm/graphql/utils.js +87 -0
  241. package/build/esm/graphql/utils.js.map +1 -0
  242. package/build/esm/index.js +12 -0
  243. package/build/esm/index.js.map +1 -0
  244. package/build/esm/integrations/tracing-channel/amqplib.js +418 -0
  245. package/build/esm/integrations/tracing-channel/amqplib.js.map +1 -0
  246. package/build/esm/integrations/tracing-channel/anthropic.js +99 -0
  247. package/build/esm/integrations/tracing-channel/anthropic.js.map +1 -0
  248. package/build/esm/integrations/tracing-channel/aws-sdk/constants.js +9 -0
  249. package/build/esm/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
  250. package/build/esm/integrations/tracing-channel/aws-sdk/index.js +152 -0
  251. package/build/esm/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
  252. package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +41 -0
  253. package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
  254. package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +45 -0
  255. package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
  256. package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +417 -0
  257. package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
  258. package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js +129 -0
  259. package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
  260. package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js +19 -0
  261. package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
  262. package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js +62 -0
  263. package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
  264. package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js +19 -0
  265. package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
  266. package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +25 -0
  267. package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
  268. package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js +61 -0
  269. package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
  270. package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js +114 -0
  271. package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
  272. package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +23 -0
  273. package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
  274. package/build/esm/integrations/tracing-channel/aws-sdk/utils.js +26 -0
  275. package/build/esm/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
  276. package/build/esm/integrations/tracing-channel/dataloader.js +93 -0
  277. package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -0
  278. package/build/esm/integrations/tracing-channel/express/index.js +22 -0
  279. package/build/esm/integrations/tracing-channel/express/index.js.map +1 -0
  280. package/build/esm/integrations/tracing-channel/express/instrumentation.js +166 -0
  281. package/build/esm/integrations/tracing-channel/express/instrumentation.js.map +1 -0
  282. package/build/esm/integrations/tracing-channel/express/route.js +68 -0
  283. package/build/esm/integrations/tracing-channel/express/route.js.map +1 -0
  284. package/build/esm/integrations/tracing-channel/fastify/errors.js +39 -0
  285. package/build/esm/integrations/tracing-channel/fastify/errors.js.map +1 -0
  286. package/build/esm/integrations/tracing-channel/fastify/index.js +30 -0
  287. package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -0
  288. package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +277 -0
  289. package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
  290. package/build/esm/integrations/tracing-channel/fastify/utils.js +8 -0
  291. package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -0
  292. package/build/esm/integrations/tracing-channel/generic-pool.js +32 -0
  293. package/build/esm/integrations/tracing-channel/generic-pool.js.map +1 -0
  294. package/build/esm/integrations/tracing-channel/google-genai.js +94 -0
  295. package/build/esm/integrations/tracing-channel/google-genai.js.map +1 -0
  296. package/build/esm/integrations/tracing-channel/graphql/constants.js +14 -0
  297. package/build/esm/integrations/tracing-channel/graphql/constants.js.map +1 -0
  298. package/build/esm/integrations/tracing-channel/graphql/index.js +63 -0
  299. package/build/esm/integrations/tracing-channel/graphql/index.js.map +1 -0
  300. package/build/esm/integrations/tracing-channel/graphql/resolvers.js +164 -0
  301. package/build/esm/integrations/tracing-channel/graphql/resolvers.js.map +1 -0
  302. package/build/esm/integrations/tracing-channel/graphql/spans.js +96 -0
  303. package/build/esm/integrations/tracing-channel/graphql/spans.js.map +1 -0
  304. package/build/esm/integrations/tracing-channel/hapi-types.js +25 -0
  305. package/build/esm/integrations/tracing-channel/hapi-types.js.map +1 -0
  306. package/build/esm/integrations/tracing-channel/hapi-utils.js +172 -0
  307. package/build/esm/integrations/tracing-channel/hapi-utils.js.map +1 -0
  308. package/build/esm/integrations/tracing-channel/hapi.js +50 -0
  309. package/build/esm/integrations/tracing-channel/hapi.js.map +1 -0
  310. package/build/esm/integrations/tracing-channel/ioredis.js +96 -0
  311. package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -0
  312. package/build/esm/integrations/tracing-channel/kafkajs/consumer.js +67 -0
  313. package/build/esm/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
  314. package/build/esm/integrations/tracing-channel/kafkajs/index.js +68 -0
  315. package/build/esm/integrations/tracing-channel/kafkajs/index.js.map +1 -0
  316. package/build/esm/integrations/tracing-channel/kafkajs/semconv.js +12 -0
  317. package/build/esm/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
  318. package/build/esm/integrations/tracing-channel/kafkajs/spans.js +112 -0
  319. package/build/esm/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
  320. package/build/esm/integrations/tracing-channel/knex.js +186 -0
  321. package/build/esm/integrations/tracing-channel/knex.js.map +1 -0
  322. package/build/esm/integrations/tracing-channel/koa.js +144 -0
  323. package/build/esm/integrations/tracing-channel/koa.js.map +1 -0
  324. package/build/esm/integrations/tracing-channel/langchain.js +61 -0
  325. package/build/esm/integrations/tracing-channel/langchain.js.map +1 -0
  326. package/build/esm/integrations/tracing-channel/langgraph.js +98 -0
  327. package/build/esm/integrations/tracing-channel/langgraph.js.map +1 -0
  328. package/build/esm/integrations/tracing-channel/lru-memoizer.js +29 -0
  329. package/build/esm/integrations/tracing-channel/lru-memoizer.js.map +1 -0
  330. package/build/esm/integrations/tracing-channel/mongodb.js +102 -0
  331. package/build/esm/integrations/tracing-channel/mongodb.js.map +1 -0
  332. package/build/esm/integrations/tracing-channel/mongoose.js +108 -0
  333. package/build/esm/integrations/tracing-channel/mongoose.js.map +1 -0
  334. package/build/esm/integrations/tracing-channel/mysql.js +105 -0
  335. package/build/esm/integrations/tracing-channel/mysql.js.map +1 -0
  336. package/build/esm/integrations/tracing-channel/mysql2.js +81 -0
  337. package/build/esm/integrations/tracing-channel/mysql2.js.map +1 -0
  338. package/build/esm/integrations/tracing-channel/openai.js +79 -0
  339. package/build/esm/integrations/tracing-channel/openai.js.map +1 -0
  340. package/build/esm/integrations/tracing-channel/postgres-js.js +189 -0
  341. package/build/esm/integrations/tracing-channel/postgres-js.js.map +1 -0
  342. package/build/esm/integrations/tracing-channel/postgres.js +168 -0
  343. package/build/esm/integrations/tracing-channel/postgres.js.map +1 -0
  344. package/build/esm/integrations/tracing-channel/redis.js +216 -0
  345. package/build/esm/integrations/tracing-channel/redis.js.map +1 -0
  346. package/build/esm/integrations/tracing-channel/tedious.js +143 -0
  347. package/build/esm/integrations/tracing-channel/tedious.js.map +1 -0
  348. package/build/esm/integrations/tracing-channel/vercel-ai.js +23 -0
  349. package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -0
  350. package/build/esm/mongodb/mongodb-span.js +126 -0
  351. package/build/esm/mongodb/mongodb-span.js.map +1 -0
  352. package/build/esm/mongoose/index.js +21 -0
  353. package/build/esm/mongoose/index.js.map +1 -0
  354. package/build/esm/mongoose/mongoose-dc-subscriber.js +89 -0
  355. package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -0
  356. package/build/esm/mongoose/mongoose-legacy-span.js +38 -0
  357. package/build/esm/mongoose/mongoose-legacy-span.js.map +1 -0
  358. package/build/esm/mysql2/index.js +21 -0
  359. package/build/esm/mysql2/index.js.map +1 -0
  360. package/build/esm/mysql2/mysql2-dc-subscriber.js +62 -0
  361. package/build/esm/mysql2/mysql2-dc-subscriber.js.map +1 -0
  362. package/build/esm/orchestrion/bundler/esbuild.js +9 -0
  363. package/build/esm/orchestrion/bundler/esbuild.js.map +1 -0
  364. package/build/esm/orchestrion/bundler/options.js +22 -0
  365. package/build/esm/orchestrion/bundler/options.js.map +1 -0
  366. package/build/esm/orchestrion/bundler/rollup.js +9 -0
  367. package/build/esm/orchestrion/bundler/rollup.js.map +1 -0
  368. package/build/esm/orchestrion/bundler/vite.js +15 -0
  369. package/build/esm/orchestrion/bundler/vite.js.map +1 -0
  370. package/build/esm/orchestrion/bundler/webpack.js +27 -0
  371. package/build/esm/orchestrion/bundler/webpack.js.map +1 -0
  372. package/build/esm/orchestrion/channels.js +68 -0
  373. package/build/esm/orchestrion/channels.js.map +1 -0
  374. package/build/esm/orchestrion/config/amqplib.js +78 -0
  375. package/build/esm/orchestrion/config/amqplib.js.map +1 -0
  376. package/build/esm/orchestrion/config/anthropic-ai.js +40 -0
  377. package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -0
  378. package/build/esm/orchestrion/config/aws-sdk.js +25 -0
  379. package/build/esm/orchestrion/config/aws-sdk.js.map +1 -0
  380. package/build/esm/orchestrion/config/dataloader.js +50 -0
  381. package/build/esm/orchestrion/config/dataloader.js.map +1 -0
  382. package/build/esm/orchestrion/config/express.js +74 -0
  383. package/build/esm/orchestrion/config/express.js.map +1 -0
  384. package/build/esm/orchestrion/config/firebase.js +5 -0
  385. package/build/esm/orchestrion/config/firebase.js.map +1 -0
  386. package/build/esm/orchestrion/config/generic-pool.js +18 -0
  387. package/build/esm/orchestrion/config/generic-pool.js.map +1 -0
  388. package/build/esm/orchestrion/config/google-genai.js +35 -0
  389. package/build/esm/orchestrion/config/google-genai.js.map +1 -0
  390. package/build/esm/orchestrion/config/graphql.js +25 -0
  391. package/build/esm/orchestrion/config/graphql.js.map +1 -0
  392. package/build/esm/orchestrion/config/hapi.js +23 -0
  393. package/build/esm/orchestrion/config/hapi.js.map +1 -0
  394. package/build/esm/orchestrion/config/index.js +84 -0
  395. package/build/esm/orchestrion/config/index.js.map +1 -0
  396. package/build/esm/orchestrion/config/ioredis.js +32 -0
  397. package/build/esm/orchestrion/config/ioredis.js.map +1 -0
  398. package/build/esm/orchestrion/config/kafkajs.js +27 -0
  399. package/build/esm/orchestrion/config/kafkajs.js.map +1 -0
  400. package/build/esm/orchestrion/config/knex.js +40 -0
  401. package/build/esm/orchestrion/config/knex.js.map +1 -0
  402. package/build/esm/orchestrion/config/koa.js +13 -0
  403. package/build/esm/orchestrion/config/koa.js.map +1 -0
  404. package/build/esm/orchestrion/config/langchain.js +48 -0
  405. package/build/esm/orchestrion/config/langchain.js.map +1 -0
  406. package/build/esm/orchestrion/config/langgraph.js +25 -0
  407. package/build/esm/orchestrion/config/langgraph.js.map +1 -0
  408. package/build/esm/orchestrion/config/lru-memoizer.js +14 -0
  409. package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -0
  410. package/build/esm/orchestrion/config/mongodb.js +64 -0
  411. package/build/esm/orchestrion/config/mongodb.js.map +1 -0
  412. package/build/esm/orchestrion/config/mongoose.js +103 -0
  413. package/build/esm/orchestrion/config/mongoose.js.map +1 -0
  414. package/build/esm/orchestrion/config/mysql.js +13 -0
  415. package/build/esm/orchestrion/config/mysql.js.map +1 -0
  416. package/build/esm/orchestrion/config/mysql2.js +29 -0
  417. package/build/esm/orchestrion/config/mysql2.js.map +1 -0
  418. package/build/esm/orchestrion/config/nestjs.js +119 -0
  419. package/build/esm/orchestrion/config/nestjs.js.map +1 -0
  420. package/build/esm/orchestrion/config/openai.js +37 -0
  421. package/build/esm/orchestrion/config/openai.js.map +1 -0
  422. package/build/esm/orchestrion/config/pg.js +48 -0
  423. package/build/esm/orchestrion/config/pg.js.map +1 -0
  424. package/build/esm/orchestrion/config/postgres.js +47 -0
  425. package/build/esm/orchestrion/config/postgres.js.map +1 -0
  426. package/build/esm/orchestrion/config/prisma.js +5 -0
  427. package/build/esm/orchestrion/config/prisma.js.map +1 -0
  428. package/build/esm/orchestrion/config/react-router.js +5 -0
  429. package/build/esm/orchestrion/config/react-router.js.map +1 -0
  430. package/build/esm/orchestrion/config/redis.js +73 -0
  431. package/build/esm/orchestrion/config/redis.js.map +1 -0
  432. package/build/esm/orchestrion/config/remix.js +51 -0
  433. package/build/esm/orchestrion/config/remix.js.map +1 -0
  434. package/build/esm/orchestrion/config/tedious.js +21 -0
  435. package/build/esm/orchestrion/config/tedious.js.map +1 -0
  436. package/build/esm/orchestrion/config/vercel-ai.js +45 -0
  437. package/build/esm/orchestrion/config/vercel-ai.js.map +1 -0
  438. package/build/esm/orchestrion/detect.js +23 -0
  439. package/build/esm/orchestrion/detect.js.map +1 -0
  440. package/build/esm/orchestrion/index.js +58 -0
  441. package/build/esm/orchestrion/index.js.map +1 -0
  442. package/build/esm/orchestrion/runtime/register.js +76 -0
  443. package/build/esm/orchestrion/runtime/register.js.map +1 -0
  444. package/build/esm/package.json +1 -0
  445. package/build/esm/prisma/global.js +12 -0
  446. package/build/esm/prisma/global.js.map +1 -0
  447. package/build/esm/prisma/index.js +24 -0
  448. package/build/esm/prisma/index.js.map +1 -0
  449. package/build/esm/prisma/tracing-helper.js +209 -0
  450. package/build/esm/prisma/tracing-helper.js.map +1 -0
  451. package/build/esm/redis/index.js +21 -0
  452. package/build/esm/redis/index.js.map +1 -0
  453. package/build/esm/redis/redis-dc-subscriber.js +94 -0
  454. package/build/esm/redis/redis-dc-subscriber.js.map +1 -0
  455. package/build/esm/redis/redis-statement-serializer.js +32 -0
  456. package/build/esm/redis/redis-statement-serializer.js.map +1 -0
  457. package/build/esm/tracing-channel.js +132 -0
  458. package/build/esm/tracing-channel.js.map +1 -0
  459. package/build/esm/vercel-ai/index.js +21 -0
  460. package/build/esm/vercel-ai/index.js.map +1 -0
  461. package/build/esm/vercel-ai/util.js +106 -0
  462. package/build/esm/vercel-ai/util.js.map +1 -0
  463. package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +425 -0
  464. package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -0
  465. package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js +397 -0
  466. package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
  467. package/build/orchestrion/import-hook.mjs +19 -0
  468. package/build/types/debug-build.d.ts +7 -0
  469. package/build/types/debug-build.d.ts.map +1 -0
  470. package/build/types/graphql/graphql-dc-subscriber.d.ts +94 -0
  471. package/build/types/graphql/graphql-dc-subscriber.d.ts.map +1 -0
  472. package/build/types/graphql/index.d.ts +12 -0
  473. package/build/types/graphql/index.d.ts.map +1 -0
  474. package/build/types/graphql/utils.d.ts +36 -0
  475. package/build/types/graphql/utils.d.ts.map +1 -0
  476. package/build/types/index.d.ts +22 -0
  477. package/build/types/index.d.ts.map +1 -0
  478. package/build/types/integrations/tracing-channel/amqplib.d.ts +11 -0
  479. package/build/types/integrations/tracing-channel/amqplib.d.ts.map +1 -0
  480. package/build/types/integrations/tracing-channel/anthropic.d.ts +10 -0
  481. package/build/types/integrations/tracing-channel/anthropic.d.ts.map +1 -0
  482. package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
  483. package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts.map +1 -0
  484. package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
  485. package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts.map +1 -0
  486. package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
  487. package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts.map +1 -0
  488. package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
  489. package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts.map +1 -0
  490. package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
  491. package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts.map +1 -0
  492. package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
  493. package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts.map +1 -0
  494. package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
  495. package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts.map +1 -0
  496. package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
  497. package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts.map +1 -0
  498. package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
  499. package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts.map +1 -0
  500. package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
  501. package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts.map +1 -0
  502. package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
  503. package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts.map +1 -0
  504. package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
  505. package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts.map +1 -0
  506. package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
  507. package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts.map +1 -0
  508. package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
  509. package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts.map +1 -0
  510. package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
  511. package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts.map +1 -0
  512. package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
  513. package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts.map +1 -0
  514. package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
  515. package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts.map +1 -0
  516. package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
  517. package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts.map +1 -0
  518. package/build/types/integrations/tracing-channel/dataloader.d.ts +11 -0
  519. package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -0
  520. package/build/types/integrations/tracing-channel/express/index.d.ts +18 -0
  521. package/build/types/integrations/tracing-channel/express/index.d.ts.map +1 -0
  522. package/build/types/integrations/tracing-channel/express/instrumentation.d.ts +4 -0
  523. package/build/types/integrations/tracing-channel/express/instrumentation.d.ts.map +1 -0
  524. package/build/types/integrations/tracing-channel/express/route.d.ts +28 -0
  525. package/build/types/integrations/tracing-channel/express/route.d.ts.map +1 -0
  526. package/build/types/integrations/tracing-channel/express/types.d.ts +64 -0
  527. package/build/types/integrations/tracing-channel/express/types.d.ts.map +1 -0
  528. package/build/types/integrations/tracing-channel/fastify/errors.d.ts +12 -0
  529. package/build/types/integrations/tracing-channel/fastify/errors.d.ts.map +1 -0
  530. package/build/types/integrations/tracing-channel/fastify/index.d.ts +66 -0
  531. package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -0
  532. package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
  533. package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -0
  534. package/build/types/integrations/tracing-channel/fastify/types.d.ts +32 -0
  535. package/build/types/integrations/tracing-channel/fastify/types.d.ts.map +1 -0
  536. package/build/types/integrations/tracing-channel/fastify/utils.d.ts +9 -0
  537. package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -0
  538. package/build/types/integrations/tracing-channel/generic-pool.d.ts +10 -0
  539. package/build/types/integrations/tracing-channel/generic-pool.d.ts.map +1 -0
  540. package/build/types/integrations/tracing-channel/google-genai.d.ts +12 -0
  541. package/build/types/integrations/tracing-channel/google-genai.d.ts.map +1 -0
  542. package/build/types/integrations/tracing-channel/graphql/constants.d.ts +12 -0
  543. package/build/types/integrations/tracing-channel/graphql/constants.d.ts.map +1 -0
  544. package/build/types/integrations/tracing-channel/graphql/graphql-types.d.ts +135 -0
  545. package/build/types/integrations/tracing-channel/graphql/graphql-types.d.ts.map +1 -0
  546. package/build/types/integrations/tracing-channel/graphql/index.d.ts +28 -0
  547. package/build/types/integrations/tracing-channel/graphql/index.d.ts.map +1 -0
  548. package/build/types/integrations/tracing-channel/graphql/resolvers.d.ts +13 -0
  549. package/build/types/integrations/tracing-channel/graphql/resolvers.d.ts.map +1 -0
  550. package/build/types/integrations/tracing-channel/graphql/spans.d.ts +17 -0
  551. package/build/types/integrations/tracing-channel/graphql/spans.d.ts.map +1 -0
  552. package/build/types/integrations/tracing-channel/graphql/types.d.ts +25 -0
  553. package/build/types/integrations/tracing-channel/graphql/types.d.ts.map +1 -0
  554. package/build/types/integrations/tracing-channel/hapi-types.d.ts +53 -0
  555. package/build/types/integrations/tracing-channel/hapi-types.d.ts.map +1 -0
  556. package/build/types/integrations/tracing-channel/hapi-utils.d.ts +25 -0
  557. package/build/types/integrations/tracing-channel/hapi-utils.d.ts.map +1 -0
  558. package/build/types/integrations/tracing-channel/hapi.d.ts +9 -0
  559. package/build/types/integrations/tracing-channel/hapi.d.ts.map +1 -0
  560. package/build/types/integrations/tracing-channel/ioredis.d.ts +37 -0
  561. package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -0
  562. package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
  563. package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts.map +1 -0
  564. package/build/types/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
  565. package/build/types/integrations/tracing-channel/kafkajs/index.d.ts.map +1 -0
  566. package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
  567. package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts.map +1 -0
  568. package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
  569. package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts.map +1 -0
  570. package/build/types/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
  571. package/build/types/integrations/tracing-channel/kafkajs/types.d.ts.map +1 -0
  572. package/build/types/integrations/tracing-channel/knex.d.ts +11 -0
  573. package/build/types/integrations/tracing-channel/knex.d.ts.map +1 -0
  574. package/build/types/integrations/tracing-channel/koa.d.ts +14 -0
  575. package/build/types/integrations/tracing-channel/koa.d.ts.map +1 -0
  576. package/build/types/integrations/tracing-channel/langchain.d.ts +10 -0
  577. package/build/types/integrations/tracing-channel/langchain.d.ts.map +1 -0
  578. package/build/types/integrations/tracing-channel/langgraph.d.ts +10 -0
  579. package/build/types/integrations/tracing-channel/langgraph.d.ts.map +1 -0
  580. package/build/types/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
  581. package/build/types/integrations/tracing-channel/lru-memoizer.d.ts.map +1 -0
  582. package/build/types/integrations/tracing-channel/mongodb.d.ts +12 -0
  583. package/build/types/integrations/tracing-channel/mongodb.d.ts.map +1 -0
  584. package/build/types/integrations/tracing-channel/mongoose.d.ts +15 -0
  585. package/build/types/integrations/tracing-channel/mongoose.d.ts.map +1 -0
  586. package/build/types/integrations/tracing-channel/mysql.d.ts +12 -0
  587. package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -0
  588. package/build/types/integrations/tracing-channel/mysql2.d.ts +15 -0
  589. package/build/types/integrations/tracing-channel/mysql2.d.ts.map +1 -0
  590. package/build/types/integrations/tracing-channel/openai.d.ts +10 -0
  591. package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -0
  592. package/build/types/integrations/tracing-channel/postgres-js.d.ts +26 -0
  593. package/build/types/integrations/tracing-channel/postgres-js.d.ts.map +1 -0
  594. package/build/types/integrations/tracing-channel/postgres.d.ts +15 -0
  595. package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -0
  596. package/build/types/integrations/tracing-channel/redis.d.ts +16 -0
  597. package/build/types/integrations/tracing-channel/redis.d.ts.map +1 -0
  598. package/build/types/integrations/tracing-channel/tedious.d.ts +11 -0
  599. package/build/types/integrations/tracing-channel/tedious.d.ts.map +1 -0
  600. package/build/types/integrations/tracing-channel/vercel-ai.d.ts +13 -0
  601. package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -0
  602. package/build/types/mongodb/mongodb-span.d.ts +66 -0
  603. package/build/types/mongodb/mongodb-span.d.ts.map +1 -0
  604. package/build/types/mongoose/index.d.ts +13 -0
  605. package/build/types/mongoose/index.d.ts.map +1 -0
  606. package/build/types/mongoose/mongoose-dc-subscriber.d.ts +63 -0
  607. package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -0
  608. package/build/types/mongoose/mongoose-legacy-span.d.ts +29 -0
  609. package/build/types/mongoose/mongoose-legacy-span.d.ts.map +1 -0
  610. package/build/types/mysql2/index.d.ts +11 -0
  611. package/build/types/mysql2/index.d.ts.map +1 -0
  612. package/build/types/mysql2/mysql2-dc-subscriber.d.ts +59 -0
  613. package/build/types/mysql2/mysql2-dc-subscriber.d.ts.map +1 -0
  614. package/build/types/orchestrion/bundler/esbuild.d.ts +21 -0
  615. package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -0
  616. package/build/types/orchestrion/bundler/options.d.ts +29 -0
  617. package/build/types/orchestrion/bundler/options.d.ts.map +1 -0
  618. package/build/types/orchestrion/bundler/rollup.d.ts +17 -0
  619. package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -0
  620. package/build/types/orchestrion/bundler/vite.d.ts +18 -0
  621. package/build/types/orchestrion/bundler/vite.d.ts.map +1 -0
  622. package/build/types/orchestrion/bundler/webpack.d.ts +19 -0
  623. package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -0
  624. package/build/types/orchestrion/channels.d.ts +130 -0
  625. package/build/types/orchestrion/channels.d.ts.map +1 -0
  626. package/build/types/orchestrion/config/amqplib.d.ts +66 -0
  627. package/build/types/orchestrion/config/amqplib.d.ts.map +1 -0
  628. package/build/types/orchestrion/config/anthropic-ai.d.ts +31 -0
  629. package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -0
  630. package/build/types/orchestrion/config/aws-sdk.d.ts +19 -0
  631. package/build/types/orchestrion/config/aws-sdk.d.ts.map +1 -0
  632. package/build/types/orchestrion/config/dataloader.d.ts +46 -0
  633. package/build/types/orchestrion/config/dataloader.d.ts.map +1 -0
  634. package/build/types/orchestrion/config/express.d.ts +30 -0
  635. package/build/types/orchestrion/config/express.d.ts.map +1 -0
  636. package/build/types/orchestrion/config/firebase.d.ts +4 -0
  637. package/build/types/orchestrion/config/firebase.d.ts.map +1 -0
  638. package/build/types/orchestrion/config/generic-pool.d.ts +31 -0
  639. package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -0
  640. package/build/types/orchestrion/config/google-genai.d.ts +30 -0
  641. package/build/types/orchestrion/config/google-genai.d.ts.map +1 -0
  642. package/build/types/orchestrion/config/graphql.d.ts +29 -0
  643. package/build/types/orchestrion/config/graphql.d.ts.map +1 -0
  644. package/build/types/orchestrion/config/hapi.d.ts +17 -0
  645. package/build/types/orchestrion/config/hapi.d.ts.map +1 -0
  646. package/build/types/orchestrion/config/index.d.ts +37 -0
  647. package/build/types/orchestrion/config/index.d.ts.map +1 -0
  648. package/build/types/orchestrion/config/ioredis.d.ts +7 -0
  649. package/build/types/orchestrion/config/ioredis.d.ts.map +1 -0
  650. package/build/types/orchestrion/config/kafkajs.d.ts +17 -0
  651. package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -0
  652. package/build/types/orchestrion/config/knex.d.ts +9 -0
  653. package/build/types/orchestrion/config/knex.d.ts.map +1 -0
  654. package/build/types/orchestrion/config/koa.d.ts +17 -0
  655. package/build/types/orchestrion/config/koa.d.ts.map +1 -0
  656. package/build/types/orchestrion/config/langchain.d.ts +18 -0
  657. package/build/types/orchestrion/config/langchain.d.ts.map +1 -0
  658. package/build/types/orchestrion/config/langgraph.d.ts +21 -0
  659. package/build/types/orchestrion/config/langgraph.d.ts.map +1 -0
  660. package/build/types/orchestrion/config/lru-memoizer.d.ts +16 -0
  661. package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -0
  662. package/build/types/orchestrion/config/mongodb.d.ts +59 -0
  663. package/build/types/orchestrion/config/mongodb.d.ts.map +1 -0
  664. package/build/types/orchestrion/config/mongoose.d.ts +40 -0
  665. package/build/types/orchestrion/config/mongoose.d.ts.map +1 -0
  666. package/build/types/orchestrion/config/mysql.d.ts +16 -0
  667. package/build/types/orchestrion/config/mysql.d.ts.map +1 -0
  668. package/build/types/orchestrion/config/mysql2.d.ts +18 -0
  669. package/build/types/orchestrion/config/mysql2.d.ts.map +1 -0
  670. package/build/types/orchestrion/config/nestjs.d.ts +24 -0
  671. package/build/types/orchestrion/config/nestjs.d.ts.map +1 -0
  672. package/build/types/orchestrion/config/openai.d.ts +18 -0
  673. package/build/types/orchestrion/config/openai.d.ts.map +1 -0
  674. package/build/types/orchestrion/config/pg.d.ts +33 -0
  675. package/build/types/orchestrion/config/pg.d.ts.map +1 -0
  676. package/build/types/orchestrion/config/postgres.d.ts +9 -0
  677. package/build/types/orchestrion/config/postgres.d.ts.map +1 -0
  678. package/build/types/orchestrion/config/prisma.d.ts +4 -0
  679. package/build/types/orchestrion/config/prisma.d.ts.map +1 -0
  680. package/build/types/orchestrion/config/react-router.d.ts +4 -0
  681. package/build/types/orchestrion/config/react-router.d.ts.map +1 -0
  682. package/build/types/orchestrion/config/redis.d.ts +37 -0
  683. package/build/types/orchestrion/config/redis.d.ts.map +1 -0
  684. package/build/types/orchestrion/config/remix.d.ts +9 -0
  685. package/build/types/orchestrion/config/remix.d.ts.map +1 -0
  686. package/build/types/orchestrion/config/tedious.d.ts +12 -0
  687. package/build/types/orchestrion/config/tedious.d.ts.map +1 -0
  688. package/build/types/orchestrion/config/vercel-ai.d.ts +12 -0
  689. package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -0
  690. package/build/types/orchestrion/detect.d.ts +26 -0
  691. package/build/types/orchestrion/detect.d.ts.map +1 -0
  692. package/build/types/orchestrion/index.d.ts +136 -0
  693. package/build/types/orchestrion/index.d.ts.map +1 -0
  694. package/build/types/orchestrion/runtime/register.d.ts +25 -0
  695. package/build/types/orchestrion/runtime/register.d.ts.map +1 -0
  696. package/build/types/prisma/global.d.ts +5 -0
  697. package/build/types/prisma/global.d.ts.map +1 -0
  698. package/build/types/prisma/index.d.ts +45 -0
  699. package/build/types/prisma/index.d.ts.map +1 -0
  700. package/build/types/prisma/tracing-helper.d.ts +46 -0
  701. package/build/types/prisma/tracing-helper.d.ts.map +1 -0
  702. package/build/types/prisma/types.d.ts +37 -0
  703. package/build/types/prisma/types.d.ts.map +1 -0
  704. package/build/types/redis/index.d.ts +18 -0
  705. package/build/types/redis/index.d.ts.map +1 -0
  706. package/build/types/redis/redis-dc-subscriber.d.ts +89 -0
  707. package/build/types/redis/redis-dc-subscriber.d.ts.map +1 -0
  708. package/build/types/redis/redis-statement-serializer.d.ts +6 -0
  709. package/build/types/redis/redis-statement-serializer.d.ts.map +1 -0
  710. package/build/types/tracing-channel.d.ts +73 -0
  711. package/build/types/tracing-channel.d.ts.map +1 -0
  712. package/build/types/vercel-ai/index.d.ts +27 -0
  713. package/build/types/vercel-ai/index.d.ts.map +1 -0
  714. package/build/types/vercel-ai/util.d.ts +30 -0
  715. package/build/types/vercel-ai/util.d.ts.map +1 -0
  716. package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +72 -0
  717. package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -0
  718. package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts +12 -0
  719. package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -0
  720. package/build/types-ts3.8/debug-build.d.ts +7 -0
  721. package/build/types-ts3.8/graphql/graphql-dc-subscriber.d.ts +94 -0
  722. package/build/types-ts3.8/graphql/index.d.ts +12 -0
  723. package/build/types-ts3.8/graphql/utils.d.ts +36 -0
  724. package/build/types-ts3.8/index.d.ts +23 -0
  725. package/build/types-ts3.8/integrations/tracing-channel/amqplib.d.ts +11 -0
  726. package/build/types-ts3.8/integrations/tracing-channel/anthropic.d.ts +10 -0
  727. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
  728. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
  729. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
  730. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
  731. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
  732. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
  733. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
  734. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
  735. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
  736. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
  737. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
  738. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
  739. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
  740. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
  741. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
  742. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
  743. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
  744. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
  745. package/build/types-ts3.8/integrations/tracing-channel/dataloader.d.ts +11 -0
  746. package/build/types-ts3.8/integrations/tracing-channel/express/index.d.ts +18 -0
  747. package/build/types-ts3.8/integrations/tracing-channel/express/instrumentation.d.ts +4 -0
  748. package/build/types-ts3.8/integrations/tracing-channel/express/route.d.ts +28 -0
  749. package/build/types-ts3.8/integrations/tracing-channel/express/types.d.ts +64 -0
  750. package/build/types-ts3.8/integrations/tracing-channel/fastify/errors.d.ts +12 -0
  751. package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +66 -0
  752. package/build/types-ts3.8/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
  753. package/build/types-ts3.8/integrations/tracing-channel/fastify/types.d.ts +32 -0
  754. package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +9 -0
  755. package/build/types-ts3.8/integrations/tracing-channel/generic-pool.d.ts +10 -0
  756. package/build/types-ts3.8/integrations/tracing-channel/google-genai.d.ts +12 -0
  757. package/build/types-ts3.8/integrations/tracing-channel/graphql/constants.d.ts +12 -0
  758. package/build/types-ts3.8/integrations/tracing-channel/graphql/graphql-types.d.ts +135 -0
  759. package/build/types-ts3.8/integrations/tracing-channel/graphql/index.d.ts +30 -0
  760. package/build/types-ts3.8/integrations/tracing-channel/graphql/resolvers.d.ts +13 -0
  761. package/build/types-ts3.8/integrations/tracing-channel/graphql/spans.d.ts +17 -0
  762. package/build/types-ts3.8/integrations/tracing-channel/graphql/types.d.ts +25 -0
  763. package/build/types-ts3.8/integrations/tracing-channel/hapi-types.d.ts +65 -0
  764. package/build/types-ts3.8/integrations/tracing-channel/hapi-utils.d.ts +25 -0
  765. package/build/types-ts3.8/integrations/tracing-channel/hapi.d.ts +9 -0
  766. package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +37 -0
  767. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
  768. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
  769. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
  770. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
  771. package/build/types-ts3.8/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
  772. package/build/types-ts3.8/integrations/tracing-channel/knex.d.ts +11 -0
  773. package/build/types-ts3.8/integrations/tracing-channel/koa.d.ts +14 -0
  774. package/build/types-ts3.8/integrations/tracing-channel/langchain.d.ts +10 -0
  775. package/build/types-ts3.8/integrations/tracing-channel/langgraph.d.ts +10 -0
  776. package/build/types-ts3.8/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
  777. package/build/types-ts3.8/integrations/tracing-channel/mongodb.d.ts +12 -0
  778. package/build/types-ts3.8/integrations/tracing-channel/mongoose.d.ts +15 -0
  779. package/build/types-ts3.8/integrations/tracing-channel/mysql.d.ts +12 -0
  780. package/build/types-ts3.8/integrations/tracing-channel/mysql2.d.ts +15 -0
  781. package/build/types-ts3.8/integrations/tracing-channel/openai.d.ts +10 -0
  782. package/build/types-ts3.8/integrations/tracing-channel/postgres-js.d.ts +26 -0
  783. package/build/types-ts3.8/integrations/tracing-channel/postgres.d.ts +15 -0
  784. package/build/types-ts3.8/integrations/tracing-channel/redis.d.ts +16 -0
  785. package/build/types-ts3.8/integrations/tracing-channel/tedious.d.ts +11 -0
  786. package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +13 -0
  787. package/build/types-ts3.8/mongodb/mongodb-span.d.ts +66 -0
  788. package/build/types-ts3.8/mongoose/index.d.ts +13 -0
  789. package/build/types-ts3.8/mongoose/mongoose-dc-subscriber.d.ts +63 -0
  790. package/build/types-ts3.8/mongoose/mongoose-legacy-span.d.ts +29 -0
  791. package/build/types-ts3.8/mysql2/index.d.ts +11 -0
  792. package/build/types-ts3.8/mysql2/mysql2-dc-subscriber.d.ts +59 -0
  793. package/build/types-ts3.8/node-diagnostics-channel.d.ts +19 -0
  794. package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +21 -0
  795. package/build/types-ts3.8/orchestrion/bundler/options.d.ts +29 -0
  796. package/build/types-ts3.8/orchestrion/bundler/rollup.d.ts +17 -0
  797. package/build/types-ts3.8/orchestrion/bundler/vite.d.ts +18 -0
  798. package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +19 -0
  799. package/build/types-ts3.8/orchestrion/channels.d.ts +130 -0
  800. package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +66 -0
  801. package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +31 -0
  802. package/build/types-ts3.8/orchestrion/config/aws-sdk.d.ts +19 -0
  803. package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +46 -0
  804. package/build/types-ts3.8/orchestrion/config/express.d.ts +30 -0
  805. package/build/types-ts3.8/orchestrion/config/firebase.d.ts +4 -0
  806. package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +31 -0
  807. package/build/types-ts3.8/orchestrion/config/google-genai.d.ts +30 -0
  808. package/build/types-ts3.8/orchestrion/config/graphql.d.ts +29 -0
  809. package/build/types-ts3.8/orchestrion/config/hapi.d.ts +17 -0
  810. package/build/types-ts3.8/orchestrion/config/index.d.ts +37 -0
  811. package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +7 -0
  812. package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +17 -0
  813. package/build/types-ts3.8/orchestrion/config/knex.d.ts +9 -0
  814. package/build/types-ts3.8/orchestrion/config/koa.d.ts +17 -0
  815. package/build/types-ts3.8/orchestrion/config/langchain.d.ts +18 -0
  816. package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +21 -0
  817. package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +16 -0
  818. package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +59 -0
  819. package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +40 -0
  820. package/build/types-ts3.8/orchestrion/config/mysql.d.ts +16 -0
  821. package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +18 -0
  822. package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +24 -0
  823. package/build/types-ts3.8/orchestrion/config/openai.d.ts +18 -0
  824. package/build/types-ts3.8/orchestrion/config/pg.d.ts +33 -0
  825. package/build/types-ts3.8/orchestrion/config/postgres.d.ts +9 -0
  826. package/build/types-ts3.8/orchestrion/config/prisma.d.ts +4 -0
  827. package/build/types-ts3.8/orchestrion/config/react-router.d.ts +4 -0
  828. package/build/types-ts3.8/orchestrion/config/redis.d.ts +37 -0
  829. package/build/types-ts3.8/orchestrion/config/remix.d.ts +9 -0
  830. package/build/types-ts3.8/orchestrion/config/tedious.d.ts +12 -0
  831. package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +12 -0
  832. package/build/types-ts3.8/orchestrion/detect.d.ts +26 -0
  833. package/build/types-ts3.8/orchestrion/index.d.ts +138 -0
  834. package/build/types-ts3.8/orchestrion/runtime/register.d.ts +25 -0
  835. package/build/types-ts3.8/prisma/global.d.ts +5 -0
  836. package/build/types-ts3.8/prisma/index.d.ts +45 -0
  837. package/build/types-ts3.8/prisma/tracing-helper.d.ts +52 -0
  838. package/build/types-ts3.8/prisma/types.d.ts +40 -0
  839. package/build/types-ts3.8/redis/index.d.ts +18 -0
  840. package/build/types-ts3.8/redis/redis-dc-subscriber.d.ts +89 -0
  841. package/build/types-ts3.8/redis/redis-statement-serializer.d.ts +6 -0
  842. package/build/types-ts3.8/tracing-channel.d.ts +73 -0
  843. package/build/types-ts3.8/vercel-ai/index.d.ts +27 -0
  844. package/build/types-ts3.8/vercel-ai/util.d.ts +30 -0
  845. package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +72 -0
  846. package/build/types-ts3.8/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts +12 -0
  847. package/changes.json +14 -0
  848. package/package.json +189 -0
@@ -0,0 +1,188 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const attributes = require('@sentry/conventions/attributes');
6
+ const debugBuild = require('../../debug-build.js');
7
+ const channels = require('../../orchestrion/channels.js');
8
+ const tracingChannel = require('../../tracing-channel.js');
9
+
10
+ const INTEGRATION_NAME = "Knex";
11
+ const ORIGIN = "auto.db.orchestrion.knex";
12
+ const MAX_QUERY_LENGTH = 1021;
13
+ const ATTR_DB_SQL_TABLE = "db.sql.table";
14
+ const DB_SYSTEM_SQLITE = "sqlite";
15
+ const DB_SYSTEM_POSTGRESQL = "postgresql";
16
+ const parentSpanSymbol = /* @__PURE__ */ Symbol("sentry.orchestrion.knex.parent-span");
17
+ const _knexChannelIntegration = (() => {
18
+ return {
19
+ name: INTEGRATION_NAME,
20
+ setupOnce() {
21
+ if (!diagnosticsChannel.tracingChannel) {
22
+ return;
23
+ }
24
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:knex] subscribing to channel "${channels.CHANNELS.KNEX_QUERY}"`);
25
+ core.waitForTracingChannelBinding(() => {
26
+ subscribeBuilder(channels.CHANNELS.KNEX_QUERY_BUILDER);
27
+ subscribeBuilder(channels.CHANNELS.KNEX_SCHEMA_BUILDER);
28
+ subscribeBuilder(channels.CHANNELS.KNEX_RAW);
29
+ subscribeQuery();
30
+ });
31
+ }
32
+ };
33
+ });
34
+ function subscribeBuilder(channelName) {
35
+ diagnosticsChannel.tracingChannel(channelName).end.subscribe((message) => {
36
+ const builder = message.result;
37
+ if (!builder || typeof builder !== "object" || parentSpanSymbol in builder) {
38
+ return;
39
+ }
40
+ const activeSpan = core.getActiveSpan();
41
+ if (!activeSpan) {
42
+ return;
43
+ }
44
+ Object.defineProperty(builder, parentSpanSymbol, { value: activeSpan });
45
+ });
46
+ }
47
+ function subscribeQuery() {
48
+ tracingChannel.bindTracingChannelToSpan(
49
+ diagnosticsChannel.tracingChannel(channels.CHANNELS.KNEX_QUERY),
50
+ (data) => {
51
+ const runner = data.self;
52
+ const builder = runner?.builder;
53
+ const parentSpan = builder?.[parentSpanSymbol] ?? core.getActiveSpan();
54
+ if (!parentSpan) {
55
+ return void 0;
56
+ }
57
+ const query = data.arguments[0];
58
+ const client = runner?.client;
59
+ const connection = client?.config?.connection;
60
+ const connectionString = connection?.connectionString;
61
+ const table = extractTableName(builder);
62
+ const operation = query?.method;
63
+ const name = connection?.filename || connection?.database || extractDatabaseFromConnectionString(connectionString);
64
+ const attributes$1 = {
65
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
66
+ "knex.version": data.moduleVersion,
67
+ [attributes.DB_SYSTEM]: mapSystem(client?.driverName),
68
+ [ATTR_DB_SQL_TABLE]: table,
69
+ [attributes.DB_OPERATION]: operation,
70
+ [attributes.DB_USER]: connection?.user,
71
+ [attributes.DB_NAME]: name,
72
+ [attributes.NET_PEER_NAME]: connection?.host ?? extractHostFromConnectionString(connectionString),
73
+ [attributes.NET_PEER_PORT]: connection?.port ?? extractPortFromConnectionString(connectionString),
74
+ [attributes.NET_TRANSPORT]: connection?.filename === ":memory:" ? "inproc" : void 0,
75
+ [attributes.DB_STATEMENT]: query?.sql != null ? core.truncate(query.sql, MAX_QUERY_LENGTH) : void 0
76
+ };
77
+ return core.startInactiveSpan({
78
+ name: getName(name, operation, table) ?? "knex.query",
79
+ kind: core.SPAN_KIND.CLIENT,
80
+ op: "db",
81
+ parentSpan,
82
+ attributes: attributes$1
83
+ });
84
+ },
85
+ {
86
+ beforeSpanEnd(span, data) {
87
+ if ("error" in data) {
88
+ const message = cleanErrorMessage(data);
89
+ if (message !== void 0) {
90
+ span.setStatus({ code: core.SPAN_STATUS_ERROR, message });
91
+ }
92
+ }
93
+ }
94
+ }
95
+ );
96
+ }
97
+ function cleanErrorMessage(data) {
98
+ const error = data.error;
99
+ if (!error || typeof error !== "object" || typeof error.message !== "string") {
100
+ return void 0;
101
+ }
102
+ const rawMessage = error.message;
103
+ const query = data.arguments[0];
104
+ if (!query?.sql) {
105
+ return rawMessage;
106
+ }
107
+ try {
108
+ const formatter = getFormatter(data.self);
109
+ const fullQuery = formatter(query.sql, query.bindings || []);
110
+ return rawMessage.replace(`${fullQuery} - `, "");
111
+ } catch {
112
+ return rawMessage;
113
+ }
114
+ }
115
+ function getFormatter(runner) {
116
+ if (runner) {
117
+ const client = runner.client;
118
+ if (client) {
119
+ if (client._formatQuery) {
120
+ return client._formatQuery.bind(client);
121
+ } else if (client.SqlString) {
122
+ return client.SqlString.format.bind(client.SqlString);
123
+ }
124
+ }
125
+ if (runner.builder?.toString) {
126
+ return runner.builder.toString.bind(runner.builder);
127
+ }
128
+ }
129
+ return () => "<noop formatter>";
130
+ }
131
+ function mapSystem(driverName) {
132
+ if (driverName === "sqlite3") {
133
+ return DB_SYSTEM_SQLITE;
134
+ }
135
+ if (driverName === "pg") {
136
+ return DB_SYSTEM_POSTGRESQL;
137
+ }
138
+ return driverName;
139
+ }
140
+ function getName(db, operation, table) {
141
+ if (operation && db) {
142
+ return table ? `${operation} ${db}.${table}` : `${operation} ${db}`;
143
+ }
144
+ return db;
145
+ }
146
+ function extractTableName(builder) {
147
+ const table = builder?._single?.table;
148
+ if (table && typeof table === "object") {
149
+ return extractTableName(table);
150
+ }
151
+ return typeof table === "string" ? table : void 0;
152
+ }
153
+ function extractDatabaseFromConnectionString(connectionString) {
154
+ if (!connectionString) {
155
+ return void 0;
156
+ }
157
+ try {
158
+ const db = new URL(connectionString).pathname?.replace(/^\//, "");
159
+ return db || void 0;
160
+ } catch {
161
+ return void 0;
162
+ }
163
+ }
164
+ function extractHostFromConnectionString(connectionString) {
165
+ if (!connectionString) {
166
+ return void 0;
167
+ }
168
+ try {
169
+ return new URL(connectionString).hostname || void 0;
170
+ } catch {
171
+ return void 0;
172
+ }
173
+ }
174
+ function extractPortFromConnectionString(connectionString) {
175
+ if (!connectionString) {
176
+ return void 0;
177
+ }
178
+ try {
179
+ const port = new URL(connectionString).port;
180
+ return port ? parseInt(port, 10) : void 0;
181
+ } catch {
182
+ return void 0;
183
+ }
184
+ }
185
+ const knexChannelIntegration = core.defineIntegration(_knexChannelIntegration);
186
+
187
+ exports.knexChannelIntegration = knexChannelIntegration;
188
+ //# sourceMappingURL=knex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knex.js","sources":["../../../../src/integrations/tracing-channel/knex.ts"],"sourcesContent":["// The `@sentry/conventions` db/net attribute keys are deprecated (superseded by newer semconv), but we\n// emit them deliberately to preserve parity with what `@opentelemetry/instrumentation-knex` produced.\n/* oxlint-disable typescript/no-deprecated */\n\nimport * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span, SpanAttributes } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n getActiveSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n truncate,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport {\n DB_NAME,\n DB_OPERATION,\n DB_STATEMENT,\n DB_SYSTEM,\n DB_USER,\n NET_PEER_NAME,\n NET_PEER_PORT,\n NET_TRANSPORT,\n} from '@sentry/conventions/attributes';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// NOTE: this uses the same name as the OTel integration by design. `@sentry/node`'s `knexIntegration`\n// picks this subscriber over the vendored OTel path when orchestrion injection is active.\nconst INTEGRATION_NAME = 'Knex' as const;\nconst ORIGIN = 'auto.db.orchestrion.knex';\n\n// Max length of the query text captured in `db.statement`; \"...\" is appended when truncated, so the\n// truncated statement caps at 1024 chars (1 KiB), matching `@opentelemetry/instrumentation-knex`.\nconst MAX_QUERY_LENGTH = 1021;\n\n// `db.sql.table` is deprecated and not exported by `@sentry/conventions`, so keep it local. Matches\n// what `@opentelemetry/instrumentation-knex` emitted.\nconst ATTR_DB_SQL_TABLE = 'db.sql.table';\n\nconst DB_SYSTEM_SQLITE = 'sqlite';\nconst DB_SYSTEM_POSTGRESQL = 'postgresql';\n\n// The span active when a builder is created, reused as the parent when the query runs later (the query\n// often executes in a different async context than the builder was created in).\nconst parentSpanSymbol = Symbol('sentry.orchestrion.knex.parent-span');\n\ninterface KnexQuery {\n sql?: string;\n method?: string;\n bindings?: unknown[];\n}\n\ninterface KnexConnectionConfig {\n filename?: string;\n database?: string;\n user?: string;\n host?: string;\n port?: number;\n connectionString?: string;\n}\n\ninterface KnexBuilder {\n _single?: { table?: unknown };\n toString?: () => string;\n [parentSpanSymbol]?: Span;\n}\n\ninterface KnexClient {\n driverName?: string;\n config?: { connection?: KnexConnectionConfig };\n _formatQuery?: (sql: string, bindings: unknown[]) => string;\n SqlString?: { format: (sql: string, bindings: unknown[]) => string };\n}\n\ninterface KnexRunner {\n client?: KnexClient;\n builder?: KnexBuilder;\n}\n\n/** Context orchestrion attaches to the `orchestrion:knex:query` channel (wrapping `Runner.query`). */\ninterface KnexQueryChannelContext {\n // `arguments[0]` is the query object (`{ sql, method, bindings }`).\n arguments: [KnexQuery?];\n self?: KnexRunner;\n moduleVersion?: string;\n result?: unknown;\n error?: unknown;\n}\n\n/** Context orchestrion attaches to the `Client.queryBuilder`/`schemaBuilder`/`raw` channels. */\ninterface KnexBuilderChannelContext {\n arguments: unknown[];\n self?: unknown;\n // The builder returned by the wrapped method.\n result?: KnexBuilder;\n}\n\nconst _knexChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD && debug.log(`[orchestrion:knex] subscribing to channel \"${CHANNELS.KNEX_QUERY}\"`);\n\n waitForTracingChannelBinding(() => {\n subscribeBuilder(CHANNELS.KNEX_QUERY_BUILDER);\n subscribeBuilder(CHANNELS.KNEX_SCHEMA_BUILDER);\n subscribeBuilder(CHANNELS.KNEX_RAW);\n subscribeQuery();\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Bookkeeping only: stash the span active at builder-creation time onto the returned builder. It is\n * read back as the parent when the query runs (see `subscribeQuery`), because the query often executes\n * in a different async context. A `Client` builder method is synchronous, so its `result` (the builder)\n * is available on the channel's `end`.\n */\nfunction subscribeBuilder(channelName: string): void {\n diagnosticsChannel.tracingChannel(channelName).end.subscribe(message => {\n const builder = (message as KnexBuilderChannelContext).result;\n if (!builder || typeof builder !== 'object' || parentSpanSymbol in builder) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n Object.defineProperty(builder, parentSpanSymbol, { value: activeSpan });\n });\n}\n\nfunction subscribeQuery(): void {\n bindTracingChannelToSpan<KnexQueryChannelContext>(\n diagnosticsChannel.tracingChannel<KnexQueryChannelContext>(CHANNELS.KNEX_QUERY),\n data => {\n const runner = data.self;\n const builder = runner?.builder;\n\n // The builder captures the span active when it was created (see `subscribeBuilder`).\n // `onlyIfParent`: only instrument queries that run as part of an existing trace, matching OTel.\n const parentSpan = builder?.[parentSpanSymbol] ?? getActiveSpan();\n if (!parentSpan) {\n return undefined;\n }\n\n const query = data.arguments[0];\n const client = runner?.client;\n const connection = client?.config?.connection;\n const connectionString = connection?.connectionString;\n const table = extractTableName(builder);\n const operation = query?.method;\n const name =\n connection?.filename || connection?.database || extractDatabaseFromConnectionString(connectionString);\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n 'knex.version': data.moduleVersion,\n [DB_SYSTEM]: mapSystem(client?.driverName),\n [ATTR_DB_SQL_TABLE]: table,\n [DB_OPERATION]: operation,\n [DB_USER]: connection?.user,\n [DB_NAME]: name,\n [NET_PEER_NAME]: connection?.host ?? extractHostFromConnectionString(connectionString),\n [NET_PEER_PORT]: connection?.port ?? extractPortFromConnectionString(connectionString),\n [NET_TRANSPORT]: connection?.filename === ':memory:' ? 'inproc' : undefined,\n [DB_STATEMENT]: query?.sql != null ? truncate(query.sql, MAX_QUERY_LENGTH) : undefined,\n };\n\n return startInactiveSpan({\n name: getName(name, operation, table) ?? 'knex.query',\n kind: SPAN_KIND.CLIENT,\n op: 'db',\n parentSpan,\n attributes,\n });\n },\n {\n beforeSpanEnd(span, data) {\n // knex prefixes query errors with the full SQL (\"<query> - <error>\"). Strip it so the span\n // status message is just the driver error, matching the vendored OTel instrumentation.\n if ('error' in data) {\n const message = cleanErrorMessage(data);\n if (message !== undefined) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n }\n }\n },\n },\n );\n}\n\nfunction cleanErrorMessage(data: KnexQueryChannelContext): string | undefined {\n const error = data.error;\n if (!error || typeof error !== 'object' || typeof (error as { message?: unknown }).message !== 'string') {\n return undefined;\n }\n\n const rawMessage = (error as { message: string }).message;\n const query = data.arguments[0];\n if (!query?.sql) {\n return rawMessage;\n }\n\n try {\n const formatter = getFormatter(data.self);\n const fullQuery = formatter(query.sql, query.bindings || []);\n return rawMessage.replace(`${fullQuery} - `, '');\n } catch {\n return rawMessage;\n }\n}\n\nfunction getFormatter(runner: KnexRunner | undefined): (sql: string, bindings: unknown[]) => string {\n if (runner) {\n const client = runner.client;\n if (client) {\n if (client._formatQuery) {\n return client._formatQuery.bind(client);\n } else if (client.SqlString) {\n return client.SqlString.format.bind(client.SqlString);\n }\n }\n if (runner.builder?.toString) {\n return runner.builder.toString.bind(runner.builder);\n }\n }\n\n return () => '<noop formatter>';\n}\n\nfunction mapSystem(driverName: string | undefined): string | undefined {\n if (driverName === 'sqlite3') {\n return DB_SYSTEM_SQLITE;\n }\n if (driverName === 'pg') {\n return DB_SYSTEM_POSTGRESQL;\n }\n return driverName;\n}\n\nfunction getName(db: string | undefined, operation?: string, table?: string): string | undefined {\n // `db` can be undefined when the database can't be determined from the knex config. Guard against\n // interpolating it (which would emit the literal \"undefined\") and let the call site fall back.\n if (operation && db) {\n return table ? `${operation} ${db}.${table}` : `${operation} ${db}`;\n }\n return db;\n}\n\nfunction extractTableName(builder: KnexBuilder | undefined): string | undefined {\n const table = builder?._single?.table;\n if (table && typeof table === 'object') {\n return extractTableName(table as KnexBuilder);\n }\n return typeof table === 'string' ? table : undefined;\n}\n\nfunction extractDatabaseFromConnectionString(connectionString: string | undefined): string | undefined {\n if (!connectionString) {\n return undefined;\n }\n try {\n const db = new URL(connectionString).pathname?.replace(/^\\//, '');\n return db || undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction extractHostFromConnectionString(connectionString: string | undefined): string | undefined {\n if (!connectionString) {\n return undefined;\n }\n try {\n return new URL(connectionString).hostname || undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction extractPortFromConnectionString(connectionString: string | undefined): number | undefined {\n if (!connectionString) {\n return undefined;\n }\n try {\n const port = new URL(connectionString).port;\n return port ? parseInt(port, 10) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * EXPERIMENTAL - orchestrion-driven knex integration.\n *\n * Subscribes to the `orchestrion:knex:*` diagnostics_channels that the orchestrion code transform\n * injects into knex's `Runner.query` (span) and `Client.queryBuilder`/`schemaBuilder`/`raw` (parent-span\n * bookkeeping). Requires the orchestrion runtime hook or bundler plugin to be active.\n */\nexport const knexChannelIntegration = defineIntegration(_knexChannelIntegration);\n"],"names":["DEBUG_BUILD","debug","CHANNELS","waitForTracingChannelBinding","getActiveSpan","bindTracingChannelToSpan","attributes","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","DB_SYSTEM","DB_OPERATION","DB_USER","DB_NAME","NET_PEER_NAME","NET_PEER_PORT","NET_TRANSPORT","DB_ST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ACjG,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,gBAAgB,CAAA,CAAE,IAAA;AACvC,IAAA,OAAO,IAAA,GAAO,QAAA,CAAS,IAAA,EAAM,EAAE,CAAA,GAAI,KAAA,CAAA;AAAA,EACrC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AASO,MAAM,sBAAA,GAAyBC,uBAAkB,uBAAuB;;;;"}
@@ -0,0 +1,146 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const attributes = require('@sentry/conventions/attributes');
6
+ const debugBuild = require('../../debug-build.js');
7
+ const channels = require('../../orchestrion/channels.js');
8
+
9
+ const INTEGRATION_NAME = "Koa";
10
+ const ORIGIN = "auto.http.orchestrion.koa";
11
+ const LAYER_TYPE = {
12
+ ROUTER: "router",
13
+ MIDDLEWARE: "middleware"
14
+ };
15
+ const kLayerPatched = /* @__PURE__ */ Symbol("sentry.koa.layer-patched");
16
+ let subscribed = false;
17
+ const _koaChannelIntegration = ((options = {}) => {
18
+ const ignoreLayersType = options.ignoreLayersType ?? [];
19
+ return {
20
+ name: INTEGRATION_NAME,
21
+ setupOnce() {
22
+ if (!diagnosticsChannel.tracingChannel || subscribed) {
23
+ return;
24
+ }
25
+ subscribed = true;
26
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:koa] subscribing to channel "${channels.CHANNELS.KOA_USE}"`);
27
+ diagnosticsChannel.tracingChannel(channels.CHANNELS.KOA_USE).subscribe({
28
+ start(rawCtx) {
29
+ handleUse(rawCtx, ignoreLayersType);
30
+ },
31
+ end() {
32
+ },
33
+ asyncStart() {
34
+ },
35
+ asyncEnd() {
36
+ },
37
+ error() {
38
+ }
39
+ });
40
+ }
41
+ };
42
+ });
43
+ function handleUse(ctx, ignoreLayersType) {
44
+ const middleware = ctx.arguments[0];
45
+ if (typeof middleware === "function") {
46
+ ctx.arguments[0] = patchUse(middleware, ignoreLayersType);
47
+ }
48
+ }
49
+ function patchUse(middleware, ignoreLayersType) {
50
+ return middleware.router ? patchRouterDispatch(middleware, ignoreLayersType) : patchLayer(middleware, false, ignoreLayersType);
51
+ }
52
+ function patchRouterDispatch(dispatchLayer, ignoreLayersType) {
53
+ const router = dispatchLayer.router;
54
+ const routesStack = router?.stack ?? [];
55
+ for (const pathLayer of routesStack) {
56
+ const path = pathLayer.path;
57
+ const pathStack = pathLayer.stack;
58
+ pathStack.forEach((routedMiddleware, j) => {
59
+ pathStack[j] = patchLayer(routedMiddleware, true, ignoreLayersType, path);
60
+ });
61
+ }
62
+ return dispatchLayer;
63
+ }
64
+ function patchLayer(middlewareLayer, isRouter, ignoreLayersType, layerPath) {
65
+ const layerType = isRouter ? LAYER_TYPE.ROUTER : LAYER_TYPE.MIDDLEWARE;
66
+ if (middlewareLayer[kLayerPatched] === true || ignoreLayersType.includes(layerType)) {
67
+ return middlewareLayer;
68
+ }
69
+ if (middlewareLayer.constructor.name === "GeneratorFunction" || middlewareLayer.constructor.name === "AsyncGeneratorFunction") {
70
+ return middlewareLayer;
71
+ }
72
+ middlewareLayer[kLayerPatched] = true;
73
+ return (context, next) => {
74
+ if (!core.getActiveSpan()) {
75
+ return middlewareLayer(context, next);
76
+ }
77
+ const metadata = getMiddlewareMetadata(context, middlewareLayer, isRouter, layerPath);
78
+ if (context._matchedRoute) {
79
+ setHttpServerSpanRouteAttribute(context._matchedRoute.toString());
80
+ }
81
+ const koaName = metadata.attributes[attributes.KOA_NAME];
82
+ const name = typeof koaName === "string" ? koaName || "< unknown >" : metadata.name;
83
+ return core.startSpan(
84
+ {
85
+ name,
86
+ op: `${layerType}.koa`,
87
+ attributes: {
88
+ ...metadata.attributes,
89
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
90
+ }
91
+ },
92
+ () => {
93
+ const route = metadata.attributes[attributes.HTTP_ROUTE];
94
+ if (core.getIsolationScope() === core.getDefaultIsolationScope()) {
95
+ debugBuild.DEBUG_BUILD && core.debug.warn("Isolation scope is default isolation scope - skipping setting transactionName");
96
+ } else if (route) {
97
+ const method = context.request?.method?.toUpperCase() || "GET";
98
+ core.getIsolationScope().setTransactionName(`${method} ${route}`);
99
+ }
100
+ return middlewareLayer(context, next);
101
+ }
102
+ );
103
+ };
104
+ }
105
+ function getMiddlewareMetadata(context, layer, isRouter, layerPath) {
106
+ if (isRouter) {
107
+ return {
108
+ attributes: {
109
+ // oxlint-disable-next-line typescript/no-deprecated
110
+ [attributes.KOA_NAME]: layerPath?.toString(),
111
+ // TODO(v11): remove, replaced by http.route
112
+ [attributes.KOA_TYPE]: LAYER_TYPE.ROUTER,
113
+ [attributes.HTTP_ROUTE]: layerPath?.toString()
114
+ },
115
+ name: context._matchedRouteName || `router - ${layerPath}`
116
+ };
117
+ }
118
+ return {
119
+ attributes: {
120
+ // oxlint-disable-next-line typescript/no-deprecated
121
+ [attributes.KOA_NAME]: layer.name || "middleware",
122
+ // TODO(v11): remove, replaced by code.function.name
123
+ [attributes.KOA_TYPE]: LAYER_TYPE.MIDDLEWARE,
124
+ [attributes.CODE_FUNCTION_NAME]: layer.name || "middleware"
125
+ },
126
+ name: `middleware - ${layer.name}`
127
+ };
128
+ }
129
+ function setHttpServerSpanRouteAttribute(route) {
130
+ const activeSpan = core.getActiveSpan();
131
+ if (!activeSpan) {
132
+ return;
133
+ }
134
+ const rootSpan = core.getRootSpan(activeSpan);
135
+ if (!rootSpan) {
136
+ return;
137
+ }
138
+ if (core.spanToJSON(rootSpan).data[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] !== "http.server") {
139
+ return;
140
+ }
141
+ rootSpan.setAttribute(attributes.HTTP_ROUTE, route);
142
+ }
143
+ const koaChannelIntegration = core.defineIntegration(_koaChannelIntegration);
144
+
145
+ exports.koaChannelIntegration = koaChannelIntegration;
146
+ //# sourceMappingURL=koa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"koa.js","sources":["../../../../src/integrations/tracing-channel/koa.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n getActiveSpan,\n getDefaultIsolationScope,\n getIsolationScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n startSpan,\n} from '@sentry/core';\n// oxlint-disable-next-line typescript/no-deprecated\nimport { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_NAME, KOA_TYPE } from '@sentry/conventions/attributes';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\n\n// Same name as the OTel integration. When enabled, the OTel 'Koa' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Koa' as const;\n\nconst ORIGIN = 'auto.http.orchestrion.koa';\n\nconst LAYER_TYPE = {\n ROUTER: 'router',\n MIDDLEWARE: 'middleware',\n} as const;\ntype KoaLayerType = (typeof LAYER_TYPE)[keyof typeof LAYER_TYPE];\n\n// Keeps wrapping idempotent — the same middleware instance can be registered on\n// multiple routes (mirrors the vendored OTel instrumentation's symbol).\nconst kLayerPatched: unique symbol = Symbol('sentry.koa.layer-patched');\n\n// Core dedupes `setupOnce` by integration name, but the Deno SDK also runs this\n// under the name `DenoKoa` (via `extendIntegration`), so guard against a second\n// subscription here.\nlet subscribed = false;\n\ntype Next = () => Promise<unknown>;\n\ninterface KoaContext {\n [key: string]: unknown;\n _matchedRoute?: string | RegExp;\n _matchedRouteName?: string;\n request?: { method?: string };\n}\n\ninterface Layer {\n path: string | RegExp;\n stack: KoaMiddleware[];\n}\n\ninterface Router {\n stack: Layer[];\n}\n\ntype KoaMiddleware = ((context: KoaContext, next: Next) => unknown) & {\n router?: Router;\n [kLayerPatched]?: boolean;\n};\n\ntype KoaSpanAttributes = Record<string, string | undefined>;\n\ninterface KoaMiddlewareMetadata {\n attributes: KoaSpanAttributes;\n name: string;\n}\n\ninterface KoaUseContext {\n arguments: unknown[];\n}\n\nexport interface KoaChannelIntegrationOptions {\n /** Ignore layers of the specified types (`'middleware'` and/or `'router'`). */\n ignoreLayersType?: Array<'middleware' | 'router'>;\n}\n\nconst _koaChannelIntegration = ((options: KoaChannelIntegrationOptions = {}) => {\n const ignoreLayersType = options.ignoreLayersType ?? [];\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel || subscribed) {\n return;\n }\n subscribed = true;\n DEBUG_BUILD && debug.log(`[orchestrion:koa] subscribing to channel \"${CHANNELS.KOA_USE}\"`);\n\n diagnosticsChannel.tracingChannel(CHANNELS.KOA_USE).subscribe({\n start(rawCtx) {\n handleUse(rawCtx as KoaUseContext, ignoreLayersType);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction handleUse(ctx: KoaUseContext, ignoreLayersType: KoaLayerType[]): void {\n const middleware = ctx.arguments[0];\n if (typeof middleware === 'function') {\n ctx.arguments[0] = patchUse(middleware as KoaMiddleware, ignoreLayersType);\n }\n}\n\n/**\n * Wrap a registered koa middleware. A `@koa/router` dispatch layer\n * (`router.routes()`) exposes a `.router`, in which case we patch each routed\n * middleware in its stack (in place) and leave the dispatch itself unwrapped;\n * everything else is a plain middleware.\n */\nfunction patchUse(middleware: KoaMiddleware, ignoreLayersType: KoaLayerType[]): KoaMiddleware {\n return middleware.router\n ? patchRouterDispatch(middleware, ignoreLayersType)\n : patchLayer(middleware, false, ignoreLayersType);\n}\n\n/**\n * Patches the dispatch function used by `@koa/router`, wrapping each routed\n * middleware in the router's stack so routed spans carry their matched path.\n */\nfunction patchRouterDispatch(dispatchLayer: KoaMiddleware, ignoreLayersType: KoaLayerType[]): KoaMiddleware {\n const router = dispatchLayer.router;\n const routesStack = router?.stack ?? [];\n for (const pathLayer of routesStack) {\n const path = pathLayer.path;\n const pathStack = pathLayer.stack;\n pathStack.forEach((routedMiddleware, j) => {\n pathStack[j] = patchLayer(routedMiddleware, true, ignoreLayersType, path);\n });\n }\n return dispatchLayer;\n}\n\n/**\n * Wraps an individual middleware layer so it opens a span when invoked. No span\n * is created when there is no active (parent) span, matching the vendored OTel\n * instrumentation's `api.trace.getSpan(api.context.active())` guard.\n */\nfunction patchLayer(\n middlewareLayer: KoaMiddleware,\n isRouter: boolean,\n ignoreLayersType: KoaLayerType[],\n layerPath?: string | RegExp,\n): KoaMiddleware {\n const layerType = isRouter ? LAYER_TYPE.ROUTER : LAYER_TYPE.MIDDLEWARE;\n // Skip patching the layer if it's ignored by config or already wrapped.\n if (middlewareLayer[kLayerPatched] === true || ignoreLayersType.includes(layerType)) {\n return middlewareLayer;\n }\n\n if (\n middlewareLayer.constructor.name === 'GeneratorFunction' ||\n middlewareLayer.constructor.name === 'AsyncGeneratorFunction'\n ) {\n return middlewareLayer;\n }\n\n middlewareLayer[kLayerPatched] = true;\n\n return (context: KoaContext, next: Next) => {\n if (!getActiveSpan()) {\n return middlewareLayer(context, next);\n }\n const metadata = getMiddlewareMetadata(context, middlewareLayer, isRouter, layerPath);\n\n if (context._matchedRoute) {\n setHttpServerSpanRouteAttribute(context._matchedRoute.toString());\n }\n\n // oxlint-disable-next-line typescript/no-deprecated\n const koaName = metadata.attributes[KOA_NAME];\n // Somehow, name is sometimes `''` for middleware spans.\n // See: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2220\n const name = typeof koaName === 'string' ? koaName || '< unknown >' : metadata.name;\n\n return startSpan(\n {\n name,\n op: `${layerType}.koa`,\n attributes: {\n ...metadata.attributes,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n },\n () => {\n const route = metadata.attributes[HTTP_ROUTE];\n if (getIsolationScope() === getDefaultIsolationScope()) {\n DEBUG_BUILD && debug.warn('Isolation scope is default isolation scope - skipping setting transactionName');\n } else if (route) {\n const method = context.request?.method?.toUpperCase() || 'GET';\n getIsolationScope().setTransactionName(`${method} ${route}`);\n }\n return middlewareLayer(context, next);\n },\n );\n };\n}\n\nfunction getMiddlewareMetadata(\n context: KoaContext,\n layer: KoaMiddleware,\n isRouter: boolean,\n layerPath?: string | RegExp,\n): KoaMiddlewareMetadata {\n if (isRouter) {\n return {\n attributes: {\n // oxlint-disable-next-line typescript/no-deprecated\n [KOA_NAME]: layerPath?.toString(), // TODO(v11): remove, replaced by http.route\n [KOA_TYPE]: LAYER_TYPE.ROUTER,\n [HTTP_ROUTE]: layerPath?.toString(),\n },\n name: context._matchedRouteName || `router - ${layerPath}`,\n };\n }\n return {\n attributes: {\n // oxlint-disable-next-line typescript/no-deprecated\n [KOA_NAME]: layer.name || 'middleware', // TODO(v11): remove, replaced by code.function.name\n [KOA_TYPE]: LAYER_TYPE.MIDDLEWARE,\n [CODE_FUNCTION_NAME]: layer.name || 'middleware',\n },\n name: `middleware - ${layer.name}`,\n };\n}\n\n/**\n * Set the `http.route` attribute on the root HTTP server span for the current trace.\n *\n * No-op when there is no active span, no root span, or the root span is not an\n * `http.server` span — so this can be called unconditionally without risking\n * attribute pollution on non-HTTP root spans.\n */\nfunction setHttpServerSpanRouteAttribute(route: string): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n const rootSpan = getRootSpan(activeSpan);\n if (!rootSpan) {\n return;\n }\n if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') {\n return;\n }\n rootSpan.setAttribute(HTTP_ROUTE, route);\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven koa integration. Subscribes to the\n * `orchestrion:koa:use` channel injected into `Application.prototype.use` and\n * wraps each registered middleware/router layer in a span-creating proxy.\n * Requires the orchestrion runtime hook or bundler plugin.\n */\nexport const koaChannelIntegration = defineIntegration(_koaChannelIntegration);\n"],"names":["DEBUG_BUILD","debug","CHANNELS","getActiveSpan","KOA_NAME","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","HTTP_ROUTE","getIsolationScope","getDefaultIsolationScope","KOA_TYPE","CODE_FUNCTION_NAME","getRootSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","defineIntegration"],"mappings":";;;;;;;;AAoBA,MAAM,gBAAA,GAAmB,KAAA;AAEzB,MAAM,MAAA,GAAS,2BAAA;AAEf,MAAM,UAAA,GAAa;AAAA,EACjB,MAAA,EAAQ,QAAA;AAAA,EACR,UAAA,EAAY;AACd,CAAA;AAKA,MAAM,aAAA,0BAAsC,0BAA0B,CAAA;AAKtE,IAAI,UAAA,GAAa,KAAA;AAyCjB,MAAM,sBAAA,IAA0B,CAAC,OAAA,GAAwC,EAAC,KAAM;AAC9E,EAAA,MAAM,gBAAA,GAAmB,OAAA,CAAQ,gBAAA,IAAoB,EAAC;AAEtD,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,kBAAA,CAAmB,cAAA,IAAkB,UAAA,EAAY;AACpD,QAAA;AAAA,MACF;AACA,MAAA,UAAA,GAAa,IAAA;AACb,MAAAA,sBAAA,IAAeC,UAAA,CAAM,GAAA,CAAI,CAAA,0CAAA,EAA6CC,iBAAA,CAAS,OAAO,CAAA,CAAA,CAAG,CAAA;AAEzF,MAAA,kBAAA,CAAmB,cAAA,CAAeA,iBAAA,CAAS,OAAO,CAAA,CAAE,SAAA,CAAU;AAAA,QAC5D,MAAM,MAAA,EAAQ;AACZ,UAAA,SAAA,CAAU,QAAyB,gBAAgB,CAAA;AAAA,QACrD,CAAA;AAAA,QACA,GAAA,GAAM;AAAA,QAAC,CAAA;AAAA,QACP,UAAA,GAAa;AAAA,QAAC,CAAA;AAAA,QACd,QAA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AAA,MAAM,QAAA,GAAWS,iBAAY,UAAU,CAAA;AACvC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA;AAAA,EACF;AACA,EAAA,IAAIC,gBAAW,QAAQ,CAAA,CAAE,IAAA,CAAKC,iCAA4B,MAAM,aAAA,EAAe;AAC7E,IAAA;AAAA,EACF;AACA,EAAA,QAAA,CAAS,YAAA,CAAaP,uBAAY,KAAK,CAAA;AACzC;AAQO,MAAM,qBAAA,GAAwBQ,uBAAkB,sBAAsB;;;;"}
@@ -0,0 +1,63 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const debugBuild = require('../../debug-build.js');
6
+ const channels = require('../../orchestrion/channels.js');
7
+ const langchain = require('../../orchestrion/config/langchain.js');
8
+ const tracingChannel = require('../../tracing-channel.js');
9
+
10
+ const INTEGRATION_NAME = core.LANGCHAIN_INTEGRATION_NAME;
11
+ const SKIPPED_PROVIDERS = [core.OPENAI_INTEGRATION_NAME, core.ANTHROPIC_AI_INTEGRATION_NAME, core.GOOGLE_GENAI_INTEGRATION_NAME];
12
+ let subscribed = false;
13
+ function markProvidersSkipped() {
14
+ core._INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);
15
+ }
16
+ const _langChainChannelIntegration = ((options = {}) => {
17
+ return {
18
+ name: INTEGRATION_NAME,
19
+ setupOnce() {
20
+ if (!diagnosticsChannel.tracingChannel || subscribed) {
21
+ return;
22
+ }
23
+ subscribed = true;
24
+ const sentryHandler = core.createLangChainCallbackHandler(options);
25
+ const injectHandler = (message) => {
26
+ markProvidersSkipped();
27
+ const args = message.arguments;
28
+ if (!Array.isArray(args)) {
29
+ return;
30
+ }
31
+ let callOptions = args[1];
32
+ if (!callOptions || typeof callOptions !== "object" || Array.isArray(callOptions)) {
33
+ callOptions = {};
34
+ args[1] = callOptions;
35
+ }
36
+ callOptions.callbacks = core._INTERNAL_mergeLangChainCallbackHandler(callOptions.callbacks, sentryHandler);
37
+ };
38
+ for (const channelName of [channels.CHANNELS.LANGCHAIN_CHAT_MODEL_INVOKE, channels.CHANNELS.LANGCHAIN_CHAT_MODEL_STREAM]) {
39
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:langchain] subscribing to channel "${channelName}"`);
40
+ diagnosticsChannel.tracingChannel(channelName).start.subscribe(injectHandler);
41
+ }
42
+ core.waitForTracingChannelBinding(() => {
43
+ for (const channelName of langchain.langchainEmbeddingsChannels) {
44
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:langchain] subscribing to channel "${channelName}"`);
45
+ tracingChannel.bindTracingChannelToSpan(
46
+ diagnosticsChannel.tracingChannel(channelName),
47
+ (data) => createEmbeddingsSpan(data, options),
48
+ { captureError: () => ({ mechanism: { handled: false, type: "auto.ai.langchain" } }) }
49
+ );
50
+ }
51
+ });
52
+ }
53
+ };
54
+ });
55
+ function createEmbeddingsSpan(data, options) {
56
+ markProvidersSkipped();
57
+ const input = (data.arguments ?? [])[0];
58
+ return core.startInactiveSpan(core._INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, input, options));
59
+ }
60
+ const langChainChannelIntegration = core.defineIntegration(_langChainChannelIntegration);
61
+
62
+ exports.langChainChannelIntegration = langChainChannelIntegration;
63
+ //# sourceMappingURL=langchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langchain.js","sources":["../../../../src/integrations/tracing-channel/langchain.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, LangChainOptions, Span } from '@sentry/core';\nimport {\n _INTERNAL_getLangChainEmbeddingsSpanOptions,\n _INTERNAL_mergeLangChainCallbackHandler,\n _INTERNAL_skipAiProviderWrapping,\n ANTHROPIC_AI_INTEGRATION_NAME,\n createLangChainCallbackHandler,\n debug,\n defineIntegration,\n GOOGLE_GENAI_INTEGRATION_NAME,\n LANGCHAIN_INTEGRATION_NAME,\n OPENAI_INTEGRATION_NAME,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { langchainEmbeddingsChannels } from '../../orchestrion/config/langchain';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design: when enabled, the OTel 'LangChain' integration is\n// dropped from the default set (see the Node opt-in loader).\nconst INTEGRATION_NAME = LANGCHAIN_INTEGRATION_NAME;\n\n// LangChain drives the underlying AI provider SDKs itself, so while it's active those providers must\n// not also instrument, or every call would produce two spans (mirrors the OTel path's skip list).\nconst SKIPPED_PROVIDERS = [OPENAI_INTEGRATION_NAME, ANTHROPIC_AI_INTEGRATION_NAME, GOOGLE_GENAI_INTEGRATION_NAME];\n\n// The chat-model channels carry the live args array of `invoke(input, options)` / `_streamIterator(input, options)`.\ninterface RunnableChannelContext {\n arguments: unknown[];\n}\n\n// The embeddings channels carry the instance (`self`) and the `embedQuery(text)` / `embedDocuments(texts)` args.\ninterface EmbeddingsChannelContext {\n self?: unknown;\n arguments: unknown[];\n}\n\nlet subscribed = false;\n\n// Registered lazily on the first LangChain call (not at `setupOnce`) so a direct provider call made\n// before any LangChain call still gets its own span — matches the OTel patch-on-import timing. It\n// also stops the underlying SDK from double-instrumenting embeddings, whose `embedQuery`/\n// `embedDocuments` call the provider SDK (e.g. `openai`) internally.\nfunction markProvidersSkipped(): void {\n _INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);\n}\n\nconst _langChainChannelIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19, and a second `init()` would double-subscribe.\n if (!diagnosticsChannel.tracingChannel || subscribed) {\n return;\n }\n subscribed = true;\n\n // One stateful handler tracks spans across the whole run tree, just like the OTel path.\n const sentryHandler = createLangChainCallbackHandler(options);\n\n // Chat models: inject the Sentry callback handler into the call options (arg 1). LangChain's own\n // callback dispatch then creates the spans, exactly as in the OTel path, so no span is opened\n // here — a `start` subscriber (which also makes orchestrion wrap the function) is enough.\n const injectHandler = (message: unknown): void => {\n markProvidersSkipped();\n\n const args = (message as RunnableChannelContext).arguments;\n if (!Array.isArray(args)) {\n return;\n }\n\n let callOptions = args[1] as Record<string, unknown> | undefined;\n if (!callOptions || typeof callOptions !== 'object' || Array.isArray(callOptions)) {\n callOptions = {};\n args[1] = callOptions;\n }\n\n callOptions.callbacks = _INTERNAL_mergeLangChainCallbackHandler(callOptions.callbacks, sentryHandler);\n };\n\n for (const channelName of [CHANNELS.LANGCHAIN_CHAT_MODEL_INVOKE, CHANNELS.LANGCHAIN_CHAT_MODEL_STREAM]) {\n DEBUG_BUILD && debug.log(`[orchestrion:langchain] subscribing to channel \"${channelName}\"`);\n diagnosticsChannel.tracingChannel<RunnableChannelContext>(channelName).start.subscribe(injectHandler);\n }\n\n // Embeddings don't use the callback system — the OTel path wraps the method in its own span, so\n // do the same here. `bindTracingChannelToSpan` needs the async-context binding that\n // `initOpenTelemetry()` registers after `setupOnce`, so wait for it before subscribing.\n waitForTracingChannelBinding(() => {\n for (const channelName of langchainEmbeddingsChannels) {\n DEBUG_BUILD && debug.log(`[orchestrion:langchain] subscribing to channel \"${channelName}\"`);\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<EmbeddingsChannelContext>(channelName),\n data => createEmbeddingsSpan(data, options),\n { captureError: () => ({ mechanism: { handled: false, type: 'auto.ai.langchain' } }) },\n );\n }\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction createEmbeddingsSpan(data: EmbeddingsChannelContext, options: LangChainOptions): Span {\n // `embedQuery`/`embedDocuments` call the provider SDK internally, so skip that SDK's own\n // instrumentation before its channel fires (the producer runs at the embeddings channel's `start`).\n markProvidersSkipped();\n\n const input = (data.arguments ?? [])[0];\n\n return startInactiveSpan(_INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, input, options));\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven LangChain integration. Subscribes to the diagnostics_channels\n * injected into `@langchain/core`'s `BaseChatModel` (to inject the Sentry callback handler) and into\n * `@langchain/openai`'s embedding methods, so it requires the orchestrion runtime hook or bundler plugin.\n */\nexport const langChainChannelIntegration = defineIntegration(_langChainChannelIntegration);\n"],"names":["LANGCHAIN_INTEGRATION_NAME","OPENAI_INTEGRATION_NAME","ANTHROPIC_AI_INTEGRATION_NAME","GOOGLE_GENAI_INTEGRATION_NAME","_INTERNAL_skipAiProviderWrapping","createLangChainCallbackHandler","_INTERNAL_mergeLangChainCallbackHandler","CHANNELS","DEBUG_BUILD","debug","waitForTracingChannelBinding","langchainEmbeddingsChannels","bindTracingChannelToSpan","startInactiveSpan","_INTERNAL_getLangChainEmbeddingsSpanOptions","defineIntegration"],"mappings":";;;;;;;;;AAuBA,MAAM,gBAAA,GAAmBA,+BAAA;AAIzB,MAAM,iBAAA,GAAoB,CAACC,4BAAA,EAAyBC,kCAAA,EAA+BC,kCAA6B,CAAA;AAahH,IAAI,UAAA,GAAa,KAAA;AAMjB,SAAS,oBAAA,GAA6B;AACpC,EAAAC,qCAAA,CAAiC,iBAAiB,CAAA;AACpD;AAEA,MAAM,4BAAA,IAAgC,CAAC,OAAA,GAA4B,EAAC,KAAM;AACxE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,kBAAA,CAAmB,cAAA,IAAkB,UAAA,EAAY;AACpD,QAAA;AAAA,MACF;AACA,MAAA,UAAA,GAAa,IAAA;AAGb,MAAA,MAAM,aAAA,GAAgBC,oCAA+B,OAAO,CAAA;AAK5D,MAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAA2B;AAChD,QAAA,oBAAA,EAAqB;AAErB,QAAA,MAAM,OAAQ,OAAA,CAAmC,SAAA;AACjD,QAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,EA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AA,EAAiC;AAG7F,EAAA,oBAAA,EAAqB;AAErB,EAAA,MAAM,KAAA,GAAA,CAAS,IAAA,CAAK,SAAA,IAAa,IAAI,CAAC,CAAA;AAEtC,EAAA,OAAOC,uBAAkBC,gDAAA,CAA4C,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,OAAO,CAAC,CAAA;AACjG;AAOO,MAAM,2BAAA,GAA8BC,uBAAkB,4BAA4B;;;;"}
@@ -0,0 +1,100 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const debugBuild = require('../../debug-build.js');
6
+ const channels = require('../../orchestrion/channels.js');
7
+ const tracingChannel = require('../../tracing-channel.js');
8
+
9
+ const INTEGRATION_NAME = core.LANGGRAPH_INTEGRATION_NAME;
10
+ let subscribed = false;
11
+ let insideCreateReactAgent = false;
12
+ const _langGraphChannelIntegration = ((options = {}) => {
13
+ return {
14
+ name: INTEGRATION_NAME,
15
+ setupOnce() {
16
+ if (!diagnosticsChannel.tracingChannel || subscribed) {
17
+ return;
18
+ }
19
+ subscribed = true;
20
+ const resolvedOptions = core.resolveAIRecordingOptions(options);
21
+ const sentryHandler = core.createLangChainCallbackHandler(resolvedOptions);
22
+ core.waitForTracingChannelBinding(() => {
23
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:langgraph] subscribing to channel "${channels.CHANNELS.LANGGRAPH_STATE_GRAPH_COMPILE}"`);
24
+ tracingChannel.bindTracingChannelToSpan(
25
+ diagnosticsChannel.tracingChannel(channels.CHANNELS.LANGGRAPH_STATE_GRAPH_COMPILE),
26
+ (data) => {
27
+ if (insideCreateReactAgent) {
28
+ return void 0;
29
+ }
30
+ const compileOptions = getFirstArgObject(data.arguments);
31
+ const name = typeof compileOptions?.name === "string" ? compileOptions.name : void 0;
32
+ return core.startInactiveSpan(core._INTERNAL_getLangGraphCreateAgentSpanOptions(name));
33
+ },
34
+ {
35
+ beforeSpanEnd: (_span, data) => {
36
+ wrapCompiledGraphInvoke(
37
+ data.result,
38
+ getFirstArgObject(data.arguments) ?? {},
39
+ resolvedOptions,
40
+ null,
41
+ sentryHandler
42
+ );
43
+ }
44
+ }
45
+ );
46
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:langgraph] subscribing to channel "${channels.CHANNELS.LANGGRAPH_CREATE_REACT_AGENT}"`);
47
+ const reactAgentChannel = diagnosticsChannel.tracingChannel(
48
+ channels.CHANNELS.LANGGRAPH_CREATE_REACT_AGENT
49
+ );
50
+ reactAgentChannel.start.subscribe((message) => {
51
+ insideCreateReactAgent = true;
52
+ try {
53
+ const { arguments: args } = message;
54
+ const params = getFirstArgObject(args);
55
+ if (params && Array.isArray(params.tools) && params.tools.length > 0) {
56
+ core.wrapToolsWithSpans(params.tools, resolvedOptions, core.extractAgentNameFromParams(args) ?? void 0);
57
+ }
58
+ } catch (error) {
59
+ debugBuild.DEBUG_BUILD && core.debug.error("[orchestrion:langgraph] failed to wrap createReactAgent tools", error);
60
+ }
61
+ });
62
+ reactAgentChannel.end.subscribe((message) => {
63
+ insideCreateReactAgent = false;
64
+ const { arguments: args, result } = message;
65
+ const agentName = core.extractAgentNameFromParams(args) ?? void 0;
66
+ const compileOptions = agentName ? { name: agentName } : {};
67
+ wrapCompiledGraphInvoke(result, compileOptions, resolvedOptions, core.extractLLMFromParams(args), sentryHandler);
68
+ });
69
+ reactAgentChannel.error.subscribe(() => {
70
+ insideCreateReactAgent = false;
71
+ });
72
+ });
73
+ }
74
+ };
75
+ });
76
+ function getFirstArgObject(args) {
77
+ const first = (args ?? [])[0];
78
+ return typeof first === "object" && first !== null ? first : void 0;
79
+ }
80
+ function wrapCompiledGraphInvoke(graph, compileOptions, options, llm, sentryHandler) {
81
+ if (!graph || typeof graph !== "object") {
82
+ return;
83
+ }
84
+ const compiledGraph = graph;
85
+ const originalInvoke = compiledGraph.invoke;
86
+ if (typeof originalInvoke === "function") {
87
+ compiledGraph.invoke = core.instrumentCompiledGraphInvoke(
88
+ originalInvoke.bind(compiledGraph),
89
+ compiledGraph,
90
+ compileOptions,
91
+ options,
92
+ llm,
93
+ sentryHandler
94
+ );
95
+ }
96
+ }
97
+ const langGraphChannelIntegration = core.defineIntegration(_langGraphChannelIntegration);
98
+
99
+ exports.langGraphChannelIntegration = langGraphChannelIntegration;
100
+ //# sourceMappingURL=langgraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langgraph.js","sources":["../../../../src/integrations/tracing-channel/langgraph.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { CompiledGraph, IntegrationFn, LangGraphOptions } from '@sentry/core';\nimport {\n _INTERNAL_getLangGraphCreateAgentSpanOptions,\n createLangChainCallbackHandler,\n debug,\n defineIntegration,\n extractAgentNameFromParams,\n extractLLMFromParams,\n instrumentCompiledGraphInvoke,\n LANGGRAPH_INTEGRATION_NAME,\n resolveAIRecordingOptions,\n startInactiveSpan,\n waitForTracingChannelBinding,\n wrapToolsWithSpans,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design: when enabled, the OTel 'LangGraph' integration is\n// dropped from the default set (see the Node opt-in loader).\nconst INTEGRATION_NAME = LANGGRAPH_INTEGRATION_NAME;\n\ninterface CompileChannelContext {\n arguments: unknown[];\n result?: unknown;\n}\n\ninterface CreateReactAgentChannelContext {\n arguments: unknown[];\n result?: unknown;\n}\n\nlet subscribed = false;\n\n// `createReactAgent` compiles a `StateGraph` internally; suppress the `create_agent` span for that\n// nested compile so a react agent gets a single `invoke_agent` span, matching the OTel path.\nlet insideCreateReactAgent = false;\n\nconst _langGraphChannelIntegration = ((options: LangGraphOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19, and a second `init()` would double-subscribe.\n if (!diagnosticsChannel.tracingChannel || subscribed) {\n return;\n }\n subscribed = true;\n\n const resolvedOptions = resolveAIRecordingOptions(options);\n const sentryHandler = createLangChainCallbackHandler(resolvedOptions);\n\n // `bindTracingChannelToSpan` needs the async-context binding that `initOpenTelemetry()` registers\n // after `setupOnce` runs, so wait for it before subscribing.\n waitForTracingChannelBinding(() => {\n // StateGraph.compile → `create_agent` span, then wrap the returned graph's `invoke`.\n DEBUG_BUILD &&\n debug.log(`[orchestrion:langgraph] subscribing to channel \"${CHANNELS.LANGGRAPH_STATE_GRAPH_COMPILE}\"`);\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<CompileChannelContext>(CHANNELS.LANGGRAPH_STATE_GRAPH_COMPILE),\n data => {\n if (insideCreateReactAgent) {\n return undefined;\n }\n const compileOptions = getFirstArgObject(data.arguments);\n const name = typeof compileOptions?.name === 'string' ? compileOptions.name : undefined;\n\n return startInactiveSpan(_INTERNAL_getLangGraphCreateAgentSpanOptions(name));\n },\n {\n beforeSpanEnd: (_span, data) => {\n wrapCompiledGraphInvoke(\n data.result,\n getFirstArgObject(data.arguments) ?? {},\n resolvedOptions,\n null,\n sentryHandler,\n );\n },\n },\n );\n\n // createReactAgent has no `create_agent` span of its own; it only wraps tools and the returned\n // graph's `invoke`. Tools are wrapped at `start` (before the agent runs), invoke at `end`.\n DEBUG_BUILD &&\n debug.log(`[orchestrion:langgraph] subscribing to channel \"${CHANNELS.LANGGRAPH_CREATE_REACT_AGENT}\"`);\n const reactAgentChannel = diagnosticsChannel.tracingChannel<CreateReactAgentChannelContext>(\n CHANNELS.LANGGRAPH_CREATE_REACT_AGENT,\n );\n reactAgentChannel.start.subscribe(message => {\n // `createReactAgent` runs synchronously and compiles a `StateGraph` internally, so the flag\n // must be on for the duration and off by `end`. It's set here (never in a branch that can\n // throw) and cleared in both `end` and `error`, so it can neither stick on across calls nor\n // stay off during this call's nested compile. Tool wrapping is guarded for the same reason.\n insideCreateReactAgent = true;\n try {\n const { arguments: args } = message as CreateReactAgentChannelContext;\n const params = getFirstArgObject(args);\n if (params && Array.isArray(params.tools) && params.tools.length > 0) {\n wrapToolsWithSpans(params.tools, resolvedOptions, extractAgentNameFromParams(args) ?? undefined);\n }\n } catch (error) {\n DEBUG_BUILD && debug.error('[orchestrion:langgraph] failed to wrap createReactAgent tools', error);\n }\n });\n reactAgentChannel.end.subscribe(message => {\n insideCreateReactAgent = false;\n const { arguments: args, result } = message as CreateReactAgentChannelContext;\n const agentName = extractAgentNameFromParams(args) ?? undefined;\n const compileOptions = agentName ? { name: agentName } : {};\n wrapCompiledGraphInvoke(result, compileOptions, resolvedOptions, extractLLMFromParams(args), sentryHandler);\n });\n // Make sure a thrown `createReactAgent` doesn't leave the suppression flag stuck on.\n reactAgentChannel.error.subscribe(() => {\n insideCreateReactAgent = false;\n });\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction getFirstArgObject(args: unknown[] | undefined): Record<string, unknown> | undefined {\n const first = (args ?? [])[0];\n\n return typeof first === 'object' && first !== null ? (first as Record<string, unknown>) : undefined;\n}\n\n/**\n * Wrap the compiled graph's `invoke` with the shared `invoke_agent` instrumentation, exactly as the\n * OTel path does on the returned graph.\n */\nfunction wrapCompiledGraphInvoke(\n graph: unknown,\n compileOptions: Record<string, unknown>,\n options: LangGraphOptions,\n llm: ReturnType<typeof extractLLMFromParams>,\n sentryHandler: unknown,\n): void {\n if (!graph || typeof graph !== 'object') {\n return;\n }\n\n const compiledGraph = graph as CompiledGraph;\n const originalInvoke = compiledGraph.invoke;\n if (typeof originalInvoke === 'function') {\n compiledGraph.invoke = instrumentCompiledGraphInvoke(\n originalInvoke.bind(compiledGraph),\n compiledGraph,\n compileOptions,\n options,\n llm,\n sentryHandler,\n );\n }\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven LangGraph integration. Subscribes to the diagnostics_channels\n * injected into `@langchain/langgraph`'s `StateGraph.compile` and `createReactAgent`, so it requires\n * the orchestrion runtime hook or bundler plugin.\n */\nexport const langGraphChannelIntegration = defineIntegration(_langGraphChannelIntegration);\n"],"names":["LANGGRAPH_INTEGRATION_NAME","resolveAIRecordingOptions","createLangChainCallbackHandler","waitForTracingChannelBinding","DEBUG_BUILD","debug","CHANNELS","bindTracingChannelToSpan","startInactiveSpan","_INTERNAL_getLangGraphCreateAgentSpanOptions","wrapToolsWithSpans","extractAgentNameFromParams","extractLLMFromParams","instrumentCompiledGraphInvoke","defineIntegration"],"mappings":";;;;;;;;AAsBA,MAAM,gBAAA,GAAmBA,+BAAA;AAYzB,IAAI,UAAA,GAAa,KAAA;AAIjB,IAAI,sBAAA,GAAyB,KAAA;AAE7B,MAAM,4BAAA,IAAgC,CAAC,OAAA,GAA4B,EAAC,KAAM;AACxE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,kBAAA,CAAmB,cAAA,IAAkB,UAAA,EAAY;AACpD,QAAA;AAAA,MACF;AACA,MAAA,UAAA,GAAa,IAAA;AAEb,MAAA,MAAM,eAAA,GAAkBC,+BAA0B,OAAO,CAAA;AACzD,MAAA,MAAM,aAAA,GAAgBC,oCAA+B,eAAe,CAAA;AAIpE,MAAAC,iCAAA,CAA6B,MAAM;AAEjC,QAAAC,sBAAA,IACEC,UAAA,CAAM,GAAA,CAAI,CAAA,gDAAA,EAAmDC,iBAAA,CAAS,6BAA6B,CAAA,CAAA,CAAG,CAAA;AACxG,QAAAC,uCAAA;AAAA,UACE,kBAAA,CAAmB,cAAA,CAAsCD,iBAAA,CAAS,6BAA6B,CAAA;AAAA,UAC/F,CAAA,IAAA,KAAQ;AACN,YAAA,IAAI,sBAAA,EAAwB;AAC1B,cAAA,OAAO,MAAA;AAAA,YACT;AACA,YAAA,MAAM,cAAA,GAAiB,iBAAA,CAAkB,IAAA,CAAK,SAAS,CAAA;AACvD,YAAA,MAAM,OAAO,OAAO,cAAA,EAAgB,IAAA,KAAS,QAAA,GAAW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,EACF;AACF;AAOO,MAAM,2BAAA,GAA8BC,uBAAkB,4BAA4B;;;;"}
@@ -0,0 +1,31 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const debugBuild = require('../../debug-build.js');
6
+ const channels = require('../../orchestrion/channels.js');
7
+ const tracingChannel = require('../../tracing-channel.js');
8
+
9
+ const INTEGRATION_NAME = "LruMemoizer";
10
+ const _lruMemoizerChannelIntegration = (() => {
11
+ return {
12
+ name: INTEGRATION_NAME,
13
+ setupOnce() {
14
+ if (!diagnosticsChannel.tracingChannel) {
15
+ return;
16
+ }
17
+ debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:lru-memoizer] subscribing to channel "${channels.CHANNELS.LRU_MEMOIZER_LOAD}"`);
18
+ core.waitForTracingChannelBinding(() => {
19
+ tracingChannel.bindTracingChannelToSpan(
20
+ diagnosticsChannel.tracingChannel(channels.CHANNELS.LRU_MEMOIZER_LOAD),
21
+ // We only want the helper's caller-context restore for the callback lru-memoizer fires from a detached `setImmediate`.
22
+ () => void 0
23
+ );
24
+ });
25
+ }
26
+ };
27
+ });
28
+ const lruMemoizerChannelIntegration = core.defineIntegration(_lruMemoizerChannelIntegration);
29
+
30
+ exports.lruMemoizerChannelIntegration = lruMemoizerChannelIntegration;
31
+ //# sourceMappingURL=lru-memoizer.js.map