@sentry/server-utils 10.66.0 → 10.68.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 (562) hide show
  1. package/build/cjs/index.js +7 -0
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js +16 -0
  4. package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
  5. package/build/cjs/integrations/tracing-channel/aws-sdk/index.js +154 -0
  6. package/build/cjs/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
  7. package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +46 -0
  8. package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
  9. package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +47 -0
  10. package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
  11. package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +419 -0
  12. package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
  13. package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js +131 -0
  14. package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
  15. package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js +21 -0
  16. package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
  17. package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js +64 -0
  18. package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
  19. package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js +21 -0
  20. package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
  21. package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +27 -0
  22. package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
  23. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js +63 -0
  24. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
  25. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js +116 -0
  26. package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
  27. package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +25 -0
  28. package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
  29. package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js +30 -0
  30. package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
  31. package/build/cjs/integrations/tracing-channel/dataloader.js +17 -7
  32. package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -1
  33. package/build/cjs/integrations/tracing-channel/express/instrumentation.js +1 -6
  34. package/build/cjs/integrations/tracing-channel/express/instrumentation.js.map +1 -1
  35. package/build/cjs/integrations/tracing-channel/fastify/index.js +2 -4
  36. package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -1
  37. package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -1
  38. package/build/cjs/integrations/tracing-channel/firebase/firestore.js +78 -0
  39. package/build/cjs/integrations/tracing-channel/firebase/firestore.js.map +1 -0
  40. package/build/cjs/integrations/tracing-channel/firebase/functions.js +67 -0
  41. package/build/cjs/integrations/tracing-channel/firebase/functions.js.map +1 -0
  42. package/build/cjs/integrations/tracing-channel/firebase/index.js +24 -0
  43. package/build/cjs/integrations/tracing-channel/firebase/index.js.map +1 -0
  44. package/build/cjs/integrations/tracing-channel/firebase/instrumentation.js +66 -0
  45. package/build/cjs/integrations/tracing-channel/firebase/instrumentation.js.map +1 -0
  46. package/build/cjs/integrations/tracing-channel/koa.js +146 -0
  47. package/build/cjs/integrations/tracing-channel/koa.js.map +1 -0
  48. package/build/cjs/integrations/tracing-channel/langchain.js +63 -0
  49. package/build/cjs/integrations/tracing-channel/langchain.js.map +1 -0
  50. package/build/cjs/integrations/tracing-channel/langgraph.js +100 -0
  51. package/build/cjs/integrations/tracing-channel/langgraph.js.map +1 -0
  52. package/build/cjs/integrations/tracing-channel/mongodb.js +104 -0
  53. package/build/cjs/integrations/tracing-channel/mongodb.js.map +1 -0
  54. package/build/cjs/integrations/tracing-channel/mongoose.js +110 -0
  55. package/build/cjs/integrations/tracing-channel/mongoose.js.map +1 -0
  56. package/build/cjs/integrations/tracing-channel/openai.js +1 -3
  57. package/build/cjs/integrations/tracing-channel/openai.js.map +1 -1
  58. package/build/cjs/integrations/tracing-channel/redis.js +25 -34
  59. package/build/cjs/integrations/tracing-channel/redis.js.map +1 -1
  60. package/build/cjs/integrations/tracing-channel/tedious.js +145 -0
  61. package/build/cjs/integrations/tracing-channel/tedious.js.map +1 -0
  62. package/build/cjs/mongodb/mongodb-span.js +133 -0
  63. package/build/cjs/mongodb/mongodb-span.js.map +1 -0
  64. package/build/cjs/mongoose/index.js.map +1 -1
  65. package/build/cjs/mongoose/mongoose-legacy-span.js +40 -0
  66. package/build/cjs/mongoose/mongoose-legacy-span.js.map +1 -0
  67. package/build/cjs/orchestrion/bundler/esbuild.js +28 -1
  68. package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -1
  69. package/build/cjs/orchestrion/bundler/options.js +24 -1
  70. package/build/cjs/orchestrion/bundler/options.js.map +1 -1
  71. package/build/cjs/orchestrion/bundler/rollup.js +15 -1
  72. package/build/cjs/orchestrion/bundler/rollup.js.map +1 -1
  73. package/build/cjs/orchestrion/bundler/subscribeInjection.js +40 -0
  74. package/build/cjs/orchestrion/bundler/subscribeInjection.js.map +1 -0
  75. package/build/cjs/orchestrion/bundler/vite.js +18 -1
  76. package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
  77. package/build/cjs/orchestrion/bundler/webpack.js +39 -4
  78. package/build/cjs/orchestrion/bundler/webpack.js.map +1 -1
  79. package/build/cjs/orchestrion/channels.js +4 -4
  80. package/build/cjs/orchestrion/channels.js.map +1 -1
  81. package/build/cjs/orchestrion/config/amqplib.js +4 -0
  82. package/build/cjs/orchestrion/config/amqplib.js.map +1 -1
  83. package/build/cjs/orchestrion/config/anthropic-ai.js +4 -0
  84. package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
  85. package/build/cjs/orchestrion/config/aws-sdk.js +32 -0
  86. package/build/cjs/orchestrion/config/aws-sdk.js.map +1 -0
  87. package/build/cjs/orchestrion/config/channel-integration-definitions.js +29 -0
  88. package/build/cjs/orchestrion/config/channel-integration-definitions.js.map +1 -0
  89. package/build/cjs/orchestrion/config/dataloader.js +4 -0
  90. package/build/cjs/orchestrion/config/dataloader.js.map +1 -1
  91. package/build/cjs/orchestrion/config/express.js +13 -8
  92. package/build/cjs/orchestrion/config/express.js.map +1 -1
  93. package/build/cjs/orchestrion/config/firebase.js +79 -2
  94. package/build/cjs/orchestrion/config/firebase.js.map +1 -1
  95. package/build/cjs/orchestrion/config/generic-pool.js +4 -0
  96. package/build/cjs/orchestrion/config/generic-pool.js.map +1 -1
  97. package/build/cjs/orchestrion/config/google-genai.js +4 -0
  98. package/build/cjs/orchestrion/config/google-genai.js.map +1 -1
  99. package/build/cjs/orchestrion/config/graphql.js +4 -0
  100. package/build/cjs/orchestrion/config/graphql.js.map +1 -1
  101. package/build/cjs/orchestrion/config/hapi.js +4 -0
  102. package/build/cjs/orchestrion/config/hapi.js.map +1 -1
  103. package/build/cjs/orchestrion/config/index.js +42 -5
  104. package/build/cjs/orchestrion/config/index.js.map +1 -1
  105. package/build/cjs/orchestrion/config/ioredis.js +4 -0
  106. package/build/cjs/orchestrion/config/ioredis.js.map +1 -1
  107. package/build/cjs/orchestrion/config/kafkajs.js +4 -0
  108. package/build/cjs/orchestrion/config/kafkajs.js.map +1 -1
  109. package/build/cjs/orchestrion/config/knex.js +4 -0
  110. package/build/cjs/orchestrion/config/knex.js.map +1 -1
  111. package/build/cjs/orchestrion/config/koa.js +20 -0
  112. package/build/cjs/orchestrion/config/koa.js.map +1 -0
  113. package/build/cjs/orchestrion/config/langchain.js +50 -2
  114. package/build/cjs/orchestrion/config/langchain.js.map +1 -1
  115. package/build/cjs/orchestrion/config/langgraph.js +26 -2
  116. package/build/cjs/orchestrion/config/langgraph.js.map +1 -1
  117. package/build/cjs/orchestrion/config/lru-memoizer.js +4 -0
  118. package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -1
  119. package/build/cjs/orchestrion/config/mongodb.js +65 -2
  120. package/build/cjs/orchestrion/config/mongodb.js.map +1 -1
  121. package/build/cjs/orchestrion/config/mongoose.js +105 -2
  122. package/build/cjs/orchestrion/config/mongoose.js.map +1 -1
  123. package/build/cjs/orchestrion/config/mysql.js +4 -0
  124. package/build/cjs/orchestrion/config/mysql.js.map +1 -1
  125. package/build/cjs/orchestrion/config/mysql2.js +4 -0
  126. package/build/cjs/orchestrion/config/mysql2.js.map +1 -1
  127. package/build/cjs/orchestrion/config/nestjs.js +4 -0
  128. package/build/cjs/orchestrion/config/nestjs.js.map +1 -1
  129. package/build/cjs/orchestrion/config/openai.js +9 -5
  130. package/build/cjs/orchestrion/config/openai.js.map +1 -1
  131. package/build/cjs/orchestrion/config/pg.js +4 -0
  132. package/build/cjs/orchestrion/config/pg.js.map +1 -1
  133. package/build/cjs/orchestrion/config/postgres.js +4 -0
  134. package/build/cjs/orchestrion/config/postgres.js.map +1 -1
  135. package/build/cjs/orchestrion/config/redis.js +4 -0
  136. package/build/cjs/orchestrion/config/redis.js.map +1 -1
  137. package/build/cjs/orchestrion/config/remix.js +52 -2
  138. package/build/cjs/orchestrion/config/remix.js.map +1 -1
  139. package/build/cjs/orchestrion/config/subscribe-injection.js +25 -0
  140. package/build/cjs/orchestrion/config/subscribe-injection.js.map +1 -0
  141. package/build/cjs/orchestrion/config/tedious.js +22 -2
  142. package/build/cjs/orchestrion/config/tedious.js.map +1 -1
  143. package/build/cjs/orchestrion/config/vercel-ai.js +4 -0
  144. package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -1
  145. package/build/cjs/orchestrion/index.js +37 -9
  146. package/build/cjs/orchestrion/index.js.map +1 -1
  147. package/build/cjs/orchestrion/registerChannelIntegration.js +13 -0
  148. package/build/cjs/orchestrion/registerChannelIntegration.js.map +1 -0
  149. package/build/cjs/orchestrion/runtime/register.js +25 -12
  150. package/build/cjs/orchestrion/runtime/register.js.map +1 -1
  151. package/build/cjs/redis/redis-dc-subscriber.js +27 -38
  152. package/build/cjs/redis/redis-dc-subscriber.js.map +1 -1
  153. package/build/cjs/vercel-ai/index.js.map +1 -1
  154. package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js +16 -3
  155. package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
  156. package/build/esm/index.js +2 -0
  157. package/build/esm/index.js.map +1 -1
  158. package/build/esm/integrations/tracing-channel/aws-sdk/constants.js +9 -0
  159. package/build/esm/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
  160. package/build/esm/integrations/tracing-channel/aws-sdk/index.js +152 -0
  161. package/build/esm/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
  162. package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +41 -0
  163. package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
  164. package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +45 -0
  165. package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
  166. package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +417 -0
  167. package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
  168. package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js +129 -0
  169. package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
  170. package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js +19 -0
  171. package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
  172. package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js +62 -0
  173. package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
  174. package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js +19 -0
  175. package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
  176. package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +25 -0
  177. package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
  178. package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js +61 -0
  179. package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
  180. package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js +114 -0
  181. package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
  182. package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +23 -0
  183. package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
  184. package/build/esm/integrations/tracing-channel/aws-sdk/utils.js +26 -0
  185. package/build/esm/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
  186. package/build/esm/integrations/tracing-channel/dataloader.js +17 -7
  187. package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -1
  188. package/build/esm/integrations/tracing-channel/express/instrumentation.js +1 -6
  189. package/build/esm/integrations/tracing-channel/express/instrumentation.js.map +1 -1
  190. package/build/esm/integrations/tracing-channel/fastify/index.js +2 -4
  191. package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -1
  192. package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -1
  193. package/build/esm/integrations/tracing-channel/firebase/firestore.js +75 -0
  194. package/build/esm/integrations/tracing-channel/firebase/firestore.js.map +1 -0
  195. package/build/esm/integrations/tracing-channel/firebase/functions.js +65 -0
  196. package/build/esm/integrations/tracing-channel/firebase/functions.js.map +1 -0
  197. package/build/esm/integrations/tracing-channel/firebase/index.js +22 -0
  198. package/build/esm/integrations/tracing-channel/firebase/index.js.map +1 -0
  199. package/build/esm/integrations/tracing-channel/firebase/instrumentation.js +64 -0
  200. package/build/esm/integrations/tracing-channel/firebase/instrumentation.js.map +1 -0
  201. package/build/esm/integrations/tracing-channel/koa.js +144 -0
  202. package/build/esm/integrations/tracing-channel/koa.js.map +1 -0
  203. package/build/esm/integrations/tracing-channel/langchain.js +61 -0
  204. package/build/esm/integrations/tracing-channel/langchain.js.map +1 -0
  205. package/build/esm/integrations/tracing-channel/langgraph.js +98 -0
  206. package/build/esm/integrations/tracing-channel/langgraph.js.map +1 -0
  207. package/build/esm/integrations/tracing-channel/mongodb.js +102 -0
  208. package/build/esm/integrations/tracing-channel/mongodb.js.map +1 -0
  209. package/build/esm/integrations/tracing-channel/mongoose.js +108 -0
  210. package/build/esm/integrations/tracing-channel/mongoose.js.map +1 -0
  211. package/build/esm/integrations/tracing-channel/openai.js +1 -3
  212. package/build/esm/integrations/tracing-channel/openai.js.map +1 -1
  213. package/build/esm/integrations/tracing-channel/redis.js +25 -34
  214. package/build/esm/integrations/tracing-channel/redis.js.map +1 -1
  215. package/build/esm/integrations/tracing-channel/tedious.js +143 -0
  216. package/build/esm/integrations/tracing-channel/tedious.js.map +1 -0
  217. package/build/esm/mongodb/mongodb-span.js +126 -0
  218. package/build/esm/mongodb/mongodb-span.js.map +1 -0
  219. package/build/esm/mongoose/index.js.map +1 -1
  220. package/build/esm/mongoose/mongoose-legacy-span.js +38 -0
  221. package/build/esm/mongoose/mongoose-legacy-span.js.map +1 -0
  222. package/build/esm/orchestrion/bundler/esbuild.js +25 -2
  223. package/build/esm/orchestrion/bundler/esbuild.js.map +1 -1
  224. package/build/esm/orchestrion/bundler/options.js +23 -2
  225. package/build/esm/orchestrion/bundler/options.js.map +1 -1
  226. package/build/esm/orchestrion/bundler/rollup.js +12 -2
  227. package/build/esm/orchestrion/bundler/rollup.js.map +1 -1
  228. package/build/esm/orchestrion/bundler/subscribeInjection.js +38 -0
  229. package/build/esm/orchestrion/bundler/subscribeInjection.js.map +1 -0
  230. package/build/esm/orchestrion/bundler/vite.js +14 -1
  231. package/build/esm/orchestrion/bundler/vite.js.map +1 -1
  232. package/build/esm/orchestrion/bundler/webpack.js +35 -5
  233. package/build/esm/orchestrion/bundler/webpack.js.map +1 -1
  234. package/build/esm/orchestrion/channels.js +4 -4
  235. package/build/esm/orchestrion/channels.js.map +1 -1
  236. package/build/esm/orchestrion/config/amqplib.js +4 -1
  237. package/build/esm/orchestrion/config/amqplib.js.map +1 -1
  238. package/build/esm/orchestrion/config/anthropic-ai.js +4 -1
  239. package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
  240. package/build/esm/orchestrion/config/aws-sdk.js +28 -0
  241. package/build/esm/orchestrion/config/aws-sdk.js.map +1 -0
  242. package/build/esm/orchestrion/config/channel-integration-definitions.js +26 -0
  243. package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -0
  244. package/build/esm/orchestrion/config/dataloader.js +4 -1
  245. package/build/esm/orchestrion/config/dataloader.js.map +1 -1
  246. package/build/esm/orchestrion/config/express.js +13 -9
  247. package/build/esm/orchestrion/config/express.js.map +1 -1
  248. package/build/esm/orchestrion/config/firebase.js +79 -3
  249. package/build/esm/orchestrion/config/firebase.js.map +1 -1
  250. package/build/esm/orchestrion/config/generic-pool.js +4 -1
  251. package/build/esm/orchestrion/config/generic-pool.js.map +1 -1
  252. package/build/esm/orchestrion/config/google-genai.js +4 -1
  253. package/build/esm/orchestrion/config/google-genai.js.map +1 -1
  254. package/build/esm/orchestrion/config/graphql.js +4 -1
  255. package/build/esm/orchestrion/config/graphql.js.map +1 -1
  256. package/build/esm/orchestrion/config/hapi.js +4 -1
  257. package/build/esm/orchestrion/config/hapi.js.map +1 -1
  258. package/build/esm/orchestrion/config/index.js +69 -33
  259. package/build/esm/orchestrion/config/index.js.map +1 -1
  260. package/build/esm/orchestrion/config/ioredis.js +4 -1
  261. package/build/esm/orchestrion/config/ioredis.js.map +1 -1
  262. package/build/esm/orchestrion/config/kafkajs.js +4 -1
  263. package/build/esm/orchestrion/config/kafkajs.js.map +1 -1
  264. package/build/esm/orchestrion/config/knex.js +4 -1
  265. package/build/esm/orchestrion/config/knex.js.map +1 -1
  266. package/build/esm/orchestrion/config/koa.js +16 -0
  267. package/build/esm/orchestrion/config/koa.js.map +1 -0
  268. package/build/esm/orchestrion/config/langchain.js +49 -3
  269. package/build/esm/orchestrion/config/langchain.js.map +1 -1
  270. package/build/esm/orchestrion/config/langgraph.js +26 -3
  271. package/build/esm/orchestrion/config/langgraph.js.map +1 -1
  272. package/build/esm/orchestrion/config/lru-memoizer.js +4 -1
  273. package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -1
  274. package/build/esm/orchestrion/config/mongodb.js +65 -3
  275. package/build/esm/orchestrion/config/mongodb.js.map +1 -1
  276. package/build/esm/orchestrion/config/mongoose.js +104 -3
  277. package/build/esm/orchestrion/config/mongoose.js.map +1 -1
  278. package/build/esm/orchestrion/config/mysql.js +4 -1
  279. package/build/esm/orchestrion/config/mysql.js.map +1 -1
  280. package/build/esm/orchestrion/config/mysql2.js +4 -1
  281. package/build/esm/orchestrion/config/mysql2.js.map +1 -1
  282. package/build/esm/orchestrion/config/nestjs.js +4 -1
  283. package/build/esm/orchestrion/config/nestjs.js.map +1 -1
  284. package/build/esm/orchestrion/config/openai.js +9 -6
  285. package/build/esm/orchestrion/config/openai.js.map +1 -1
  286. package/build/esm/orchestrion/config/pg.js +4 -1
  287. package/build/esm/orchestrion/config/pg.js.map +1 -1
  288. package/build/esm/orchestrion/config/postgres.js +4 -1
  289. package/build/esm/orchestrion/config/postgres.js.map +1 -1
  290. package/build/esm/orchestrion/config/redis.js +4 -1
  291. package/build/esm/orchestrion/config/redis.js.map +1 -1
  292. package/build/esm/orchestrion/config/remix.js +52 -3
  293. package/build/esm/orchestrion/config/remix.js.map +1 -1
  294. package/build/esm/orchestrion/config/subscribe-injection.js +22 -0
  295. package/build/esm/orchestrion/config/subscribe-injection.js.map +1 -0
  296. package/build/esm/orchestrion/config/tedious.js +22 -3
  297. package/build/esm/orchestrion/config/tedious.js.map +1 -1
  298. package/build/esm/orchestrion/config/vercel-ai.js +4 -1
  299. package/build/esm/orchestrion/config/vercel-ai.js.map +1 -1
  300. package/build/esm/orchestrion/index.js +20 -2
  301. package/build/esm/orchestrion/index.js.map +1 -1
  302. package/build/esm/orchestrion/registerChannelIntegration.js +11 -0
  303. package/build/esm/orchestrion/registerChannelIntegration.js.map +1 -0
  304. package/build/esm/orchestrion/runtime/register.js +25 -12
  305. package/build/esm/orchestrion/runtime/register.js.map +1 -1
  306. package/build/esm/package.json +1 -1
  307. package/build/esm/redis/redis-dc-subscriber.js +27 -38
  308. package/build/esm/redis/redis-dc-subscriber.js.map +1 -1
  309. package/build/esm/vercel-ai/index.js.map +1 -1
  310. package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js +17 -4
  311. package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -1
  312. package/build/types/index.d.ts +6 -2
  313. package/build/types/index.d.ts.map +1 -1
  314. package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
  315. package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts.map +1 -0
  316. package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
  317. package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts.map +1 -0
  318. package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
  319. package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts.map +1 -0
  320. package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
  321. package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts.map +1 -0
  322. package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
  323. package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts.map +1 -0
  324. package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
  325. package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts.map +1 -0
  326. package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
  327. package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts.map +1 -0
  328. package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
  329. package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts.map +1 -0
  330. package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
  331. package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts.map +1 -0
  332. package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
  333. package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts.map +1 -0
  334. package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
  335. package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts.map +1 -0
  336. package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
  337. package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts.map +1 -0
  338. package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
  339. package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts.map +1 -0
  340. package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
  341. package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts.map +1 -0
  342. package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
  343. package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts.map +1 -0
  344. package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
  345. package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts.map +1 -0
  346. package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
  347. package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts.map +1 -0
  348. package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
  349. package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts.map +1 -0
  350. package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -1
  351. package/build/types/integrations/tracing-channel/express/instrumentation.d.ts.map +1 -1
  352. package/build/types/integrations/tracing-channel/fastify/index.d.ts +2 -2
  353. package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -1
  354. package/build/types/integrations/tracing-channel/fastify/utils.d.ts +1 -1
  355. package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -1
  356. package/build/types/integrations/tracing-channel/firebase/firestore-types.d.ts +38 -0
  357. package/build/types/integrations/tracing-channel/firebase/firestore-types.d.ts.map +1 -0
  358. package/build/types/integrations/tracing-channel/firebase/firestore.d.ts +18 -0
  359. package/build/types/integrations/tracing-channel/firebase/firestore.d.ts.map +1 -0
  360. package/build/types/integrations/tracing-channel/firebase/functions.d.ts +15 -0
  361. package/build/types/integrations/tracing-channel/firebase/functions.d.ts.map +1 -0
  362. package/build/types/integrations/tracing-channel/firebase/index.d.ts +15 -0
  363. package/build/types/integrations/tracing-channel/firebase/index.d.ts.map +1 -0
  364. package/build/types/integrations/tracing-channel/firebase/instrumentation.d.ts +2 -0
  365. package/build/types/integrations/tracing-channel/firebase/instrumentation.d.ts.map +1 -0
  366. package/build/types/integrations/tracing-channel/koa.d.ts +14 -0
  367. package/build/types/integrations/tracing-channel/koa.d.ts.map +1 -0
  368. package/build/types/integrations/tracing-channel/langchain.d.ts +10 -0
  369. package/build/types/integrations/tracing-channel/langchain.d.ts.map +1 -0
  370. package/build/types/integrations/tracing-channel/langgraph.d.ts +10 -0
  371. package/build/types/integrations/tracing-channel/langgraph.d.ts.map +1 -0
  372. package/build/types/integrations/tracing-channel/mongodb.d.ts +12 -0
  373. package/build/types/integrations/tracing-channel/mongodb.d.ts.map +1 -0
  374. package/build/types/integrations/tracing-channel/mongoose.d.ts +15 -0
  375. package/build/types/integrations/tracing-channel/mongoose.d.ts.map +1 -0
  376. package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -1
  377. package/build/types/integrations/tracing-channel/redis.d.ts.map +1 -1
  378. package/build/types/integrations/tracing-channel/tedious.d.ts +11 -0
  379. package/build/types/integrations/tracing-channel/tedious.d.ts.map +1 -0
  380. package/build/types/integrations/tracing-channel/vercel-ai.d.ts +1 -5
  381. package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -1
  382. package/build/types/mongodb/mongodb-span.d.ts +66 -0
  383. package/build/types/mongodb/mongodb-span.d.ts.map +1 -0
  384. package/build/types/mongoose/index.d.ts +2 -0
  385. package/build/types/mongoose/index.d.ts.map +1 -1
  386. package/build/types/mongoose/mongoose-legacy-span.d.ts +29 -0
  387. package/build/types/mongoose/mongoose-legacy-span.d.ts.map +1 -0
  388. package/build/types/orchestrion/bundler/esbuild.d.ts +2 -3
  389. package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -1
  390. package/build/types/orchestrion/bundler/options.d.ts +47 -3
  391. package/build/types/orchestrion/bundler/options.d.ts.map +1 -1
  392. package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -1
  393. package/build/types/orchestrion/bundler/subscribeInjection.d.ts +13 -0
  394. package/build/types/orchestrion/bundler/subscribeInjection.d.ts.map +1 -0
  395. package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
  396. package/build/types/orchestrion/bundler/webpack.d.ts +10 -5
  397. package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -1
  398. package/build/types/orchestrion/channels.d.ts +51 -6
  399. package/build/types/orchestrion/channels.d.ts.map +1 -1
  400. package/build/types/orchestrion/config/amqplib.d.ts +2 -0
  401. package/build/types/orchestrion/config/amqplib.d.ts.map +1 -1
  402. package/build/types/orchestrion/config/anthropic-ai.d.ts +2 -0
  403. package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -1
  404. package/build/types/orchestrion/config/aws-sdk.d.ts +21 -0
  405. package/build/types/orchestrion/config/aws-sdk.d.ts.map +1 -0
  406. package/build/types/orchestrion/config/channel-integration-definitions.d.ts +81 -0
  407. package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -0
  408. package/build/types/orchestrion/config/dataloader.d.ts +2 -0
  409. package/build/types/orchestrion/config/dataloader.d.ts.map +1 -1
  410. package/build/types/orchestrion/config/express.d.ts +4 -4
  411. package/build/types/orchestrion/config/express.d.ts.map +1 -1
  412. package/build/types/orchestrion/config/firebase.d.ts +42 -3
  413. package/build/types/orchestrion/config/firebase.d.ts.map +1 -1
  414. package/build/types/orchestrion/config/generic-pool.d.ts +2 -0
  415. package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -1
  416. package/build/types/orchestrion/config/google-genai.d.ts +2 -0
  417. package/build/types/orchestrion/config/google-genai.d.ts.map +1 -1
  418. package/build/types/orchestrion/config/graphql.d.ts +2 -0
  419. package/build/types/orchestrion/config/graphql.d.ts.map +1 -1
  420. package/build/types/orchestrion/config/hapi.d.ts +2 -0
  421. package/build/types/orchestrion/config/hapi.d.ts.map +1 -1
  422. package/build/types/orchestrion/config/index.d.ts +13 -1
  423. package/build/types/orchestrion/config/index.d.ts.map +1 -1
  424. package/build/types/orchestrion/config/ioredis.d.ts +2 -1
  425. package/build/types/orchestrion/config/ioredis.d.ts.map +1 -1
  426. package/build/types/orchestrion/config/kafkajs.d.ts +2 -0
  427. package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -1
  428. package/build/types/orchestrion/config/knex.d.ts +2 -1
  429. package/build/types/orchestrion/config/knex.d.ts.map +1 -1
  430. package/build/types/orchestrion/config/koa.d.ts +19 -0
  431. package/build/types/orchestrion/config/koa.d.ts.map +1 -0
  432. package/build/types/orchestrion/config/langchain.d.ts +19 -3
  433. package/build/types/orchestrion/config/langchain.d.ts.map +1 -1
  434. package/build/types/orchestrion/config/langgraph.d.ts +22 -3
  435. package/build/types/orchestrion/config/langgraph.d.ts.map +1 -1
  436. package/build/types/orchestrion/config/lru-memoizer.d.ts +2 -0
  437. package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -1
  438. package/build/types/orchestrion/config/mongodb.d.ts +60 -3
  439. package/build/types/orchestrion/config/mongodb.d.ts.map +1 -1
  440. package/build/types/orchestrion/config/mongoose.d.ts +41 -3
  441. package/build/types/orchestrion/config/mongoose.d.ts.map +1 -1
  442. package/build/types/orchestrion/config/mysql.d.ts +2 -0
  443. package/build/types/orchestrion/config/mysql.d.ts.map +1 -1
  444. package/build/types/orchestrion/config/mysql2.d.ts +2 -0
  445. package/build/types/orchestrion/config/mysql2.d.ts.map +1 -1
  446. package/build/types/orchestrion/config/nestjs.d.ts +2 -1
  447. package/build/types/orchestrion/config/nestjs.d.ts.map +1 -1
  448. package/build/types/orchestrion/config/openai.d.ts +2 -2
  449. package/build/types/orchestrion/config/openai.d.ts.map +1 -1
  450. package/build/types/orchestrion/config/pg.d.ts +2 -0
  451. package/build/types/orchestrion/config/pg.d.ts.map +1 -1
  452. package/build/types/orchestrion/config/postgres.d.ts +2 -1
  453. package/build/types/orchestrion/config/postgres.d.ts.map +1 -1
  454. package/build/types/orchestrion/config/redis.d.ts +2 -0
  455. package/build/types/orchestrion/config/redis.d.ts.map +1 -1
  456. package/build/types/orchestrion/config/remix.d.ts +8 -2
  457. package/build/types/orchestrion/config/remix.d.ts.map +1 -1
  458. package/build/types/orchestrion/config/subscribe-injection.d.ts +31 -0
  459. package/build/types/orchestrion/config/subscribe-injection.d.ts.map +1 -0
  460. package/build/types/orchestrion/config/tedious.d.ts +11 -2
  461. package/build/types/orchestrion/config/tedious.d.ts.map +1 -1
  462. package/build/types/orchestrion/config/vercel-ai.d.ts +2 -1
  463. package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -1
  464. package/build/types/orchestrion/index.d.ts +38 -6
  465. package/build/types/orchestrion/index.d.ts.map +1 -1
  466. package/build/types/orchestrion/registerChannelIntegration.d.ts +33 -0
  467. package/build/types/orchestrion/registerChannelIntegration.d.ts.map +1 -0
  468. package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
  469. package/build/types/vercel-ai/index.d.ts +2 -3
  470. package/build/types/vercel-ai/index.d.ts.map +1 -1
  471. package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -1
  472. package/build/types-ts3.8/index.d.ts +6 -2
  473. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
  474. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
  475. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
  476. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
  477. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
  478. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
  479. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
  480. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
  481. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
  482. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
  483. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
  484. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
  485. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
  486. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
  487. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
  488. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
  489. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
  490. package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
  491. package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +2 -2
  492. package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +1 -1
  493. package/build/types-ts3.8/integrations/tracing-channel/firebase/firestore-types.d.ts +38 -0
  494. package/build/types-ts3.8/integrations/tracing-channel/firebase/firestore.d.ts +18 -0
  495. package/build/types-ts3.8/integrations/tracing-channel/firebase/functions.d.ts +15 -0
  496. package/build/types-ts3.8/integrations/tracing-channel/firebase/index.d.ts +15 -0
  497. package/build/types-ts3.8/integrations/tracing-channel/firebase/instrumentation.d.ts +2 -0
  498. package/build/types-ts3.8/integrations/tracing-channel/koa.d.ts +14 -0
  499. package/build/types-ts3.8/integrations/tracing-channel/langchain.d.ts +10 -0
  500. package/build/types-ts3.8/integrations/tracing-channel/langgraph.d.ts +10 -0
  501. package/build/types-ts3.8/integrations/tracing-channel/mongodb.d.ts +12 -0
  502. package/build/types-ts3.8/integrations/tracing-channel/mongoose.d.ts +15 -0
  503. package/build/types-ts3.8/integrations/tracing-channel/tedious.d.ts +11 -0
  504. package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +1 -5
  505. package/build/types-ts3.8/mongodb/mongodb-span.d.ts +66 -0
  506. package/build/types-ts3.8/mongoose/index.d.ts +2 -0
  507. package/build/types-ts3.8/mongoose/mongoose-legacy-span.d.ts +29 -0
  508. package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +2 -3
  509. package/build/types-ts3.8/orchestrion/bundler/options.d.ts +47 -3
  510. package/build/types-ts3.8/orchestrion/bundler/subscribeInjection.d.ts +13 -0
  511. package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +10 -5
  512. package/build/types-ts3.8/orchestrion/channels.d.ts +51 -6
  513. package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +2 -0
  514. package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +2 -0
  515. package/build/types-ts3.8/orchestrion/config/aws-sdk.d.ts +21 -0
  516. package/build/types-ts3.8/orchestrion/config/channel-integration-definitions.d.ts +139 -0
  517. package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +2 -0
  518. package/build/types-ts3.8/orchestrion/config/express.d.ts +4 -4
  519. package/build/types-ts3.8/orchestrion/config/firebase.d.ts +42 -3
  520. package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +2 -0
  521. package/build/types-ts3.8/orchestrion/config/google-genai.d.ts +2 -0
  522. package/build/types-ts3.8/orchestrion/config/graphql.d.ts +2 -0
  523. package/build/types-ts3.8/orchestrion/config/hapi.d.ts +2 -0
  524. package/build/types-ts3.8/orchestrion/config/index.d.ts +13 -1
  525. package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +2 -1
  526. package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +2 -0
  527. package/build/types-ts3.8/orchestrion/config/knex.d.ts +2 -1
  528. package/build/types-ts3.8/orchestrion/config/koa.d.ts +19 -0
  529. package/build/types-ts3.8/orchestrion/config/langchain.d.ts +19 -3
  530. package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +22 -3
  531. package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +2 -0
  532. package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +60 -3
  533. package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +41 -3
  534. package/build/types-ts3.8/orchestrion/config/mysql.d.ts +2 -0
  535. package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +2 -0
  536. package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +2 -1
  537. package/build/types-ts3.8/orchestrion/config/openai.d.ts +2 -2
  538. package/build/types-ts3.8/orchestrion/config/pg.d.ts +2 -0
  539. package/build/types-ts3.8/orchestrion/config/postgres.d.ts +2 -1
  540. package/build/types-ts3.8/orchestrion/config/redis.d.ts +2 -0
  541. package/build/types-ts3.8/orchestrion/config/remix.d.ts +8 -2
  542. package/build/types-ts3.8/orchestrion/config/subscribe-injection.d.ts +31 -0
  543. package/build/types-ts3.8/orchestrion/config/tedious.d.ts +11 -2
  544. package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +2 -1
  545. package/build/types-ts3.8/orchestrion/index.d.ts +38 -6
  546. package/build/types-ts3.8/orchestrion/registerChannelIntegration.d.ts +33 -0
  547. package/build/types-ts3.8/vercel-ai/index.d.ts +2 -3
  548. package/package.json +4 -4
  549. package/build/cjs/orchestrion/config/prisma.js +0 -8
  550. package/build/cjs/orchestrion/config/prisma.js.map +0 -1
  551. package/build/cjs/orchestrion/config/react-router.js +0 -8
  552. package/build/cjs/orchestrion/config/react-router.js.map +0 -1
  553. package/build/esm/orchestrion/config/prisma.js +0 -5
  554. package/build/esm/orchestrion/config/prisma.js.map +0 -1
  555. package/build/esm/orchestrion/config/react-router.js +0 -5
  556. package/build/esm/orchestrion/config/react-router.js.map +0 -1
  557. package/build/types/orchestrion/config/prisma.d.ts +0 -4
  558. package/build/types/orchestrion/config/prisma.d.ts.map +0 -1
  559. package/build/types/orchestrion/config/react-router.d.ts +0 -4
  560. package/build/types/orchestrion/config/react-router.d.ts.map +0 -1
  561. package/build/types-ts3.8/orchestrion/config/prisma.d.ts +0 -4
  562. package/build/types-ts3.8/orchestrion/config/react-router.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing-channel/express/instrumentation.ts"],"sourcesContent":["import type * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { HTTP_ROUTE } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport {\n debug,\n getActiveSpan,\n getDefaultIsolationScope,\n getIsolationScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n startInactiveSpan,\n stringMatchesSomePattern,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../../tracing-channel';\nimport {\n getActualMatchedRoute,\n getConstructedRoute,\n getLayerPath,\n getLayerRegisteredPath,\n popLayerPath,\n pushLayerPath,\n setLayerRegisteredPath,\n} from './route';\nimport type {\n ExpressIntegrationOptions,\n ExpressLayer,\n ExpressLayerType,\n ExpressRequest,\n ExpressResponse,\n HandleChannelContext,\n RegistrationChannelContext,\n} from './types';\n\nconst ORIGIN = 'auto.http.express';\n\n// `express.name`/`express.type` are Sentry-internal Express attributes (not part\n// of `@sentry/conventions`); kept in sync with `@sentry/core`'s OTel-derived\n// Express integration so the emitted spans are identical across both code paths.\nconst ATTR_EXPRESS_NAME = 'express.name';\nconst ATTR_EXPRESS_TYPE = 'express.type';\n\nconst NOOP = (): void => {};\n\nlet _isInstrumented = false;\n\nexport function instrumentExpress(\n options: ExpressIntegrationOptions,\n tracingChannel: typeof diagnosticsChannel.tracingChannel,\n): void {\n if (_isInstrumented) {\n return;\n }\n _isInstrumented = true;\n\n // Record each layer's registered path *pattern* as it is registered, so the\n // matched route can be reconstructed with its parameters intact at request\n // time. Only the `end` event matters (the layer is on the router's stack by\n // then); the others are required by the subscriber type, so no-op them.\n for (const channelName of [\n CHANNELS.EXPRESS_ROUTE,\n CHANNELS.EXPRESS_USE,\n CHANNELS.ROUTER_ROUTE,\n CHANNELS.ROUTER_USE,\n ]) {\n tracingChannel<RegistrationChannelContext>(channelName).subscribe({\n start: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n end: captureRegisteredLayerPath,\n });\n }\n\n for (const channelName of [CHANNELS.EXPRESS_HANDLE, CHANNELS.ROUTER_HANDLE]) {\n DEBUG_BUILD && debug.log(`[orchestrion:express] subscribing to channel \"${channelName}\"`);\n\n const channel = tracingChannel<HandleChannelContext>(channelName);\n\n bindTracingChannelToSpan(channel, data => getSpanForLayer(data, options), {\n beforeSpanEnd(_span, data) {\n data._sentryCleanup?.();\n },\n });\n\n // Pop the layer path when the layer hands off via `next`. `asyncStart` fires\n // when `next` is called and *before* the downstream layer runs, so the\n // per-request path chain reflects only the current chain when each layer\n // reconstructs its route. Only `asyncStart` is relevant here.\n channel.subscribe({\n start: NOOP,\n asyncEnd: NOOP,\n end: NOOP,\n error: NOOP,\n asyncStart: popLayerPathForLayer,\n });\n }\n}\n\n/** Record the freshly-registered layer's path pattern from a `route`/`use` call. */\nfunction captureRegisteredLayerPath(data: RegistrationChannelContext): void {\n const stack = data.self?.stack;\n if (!Array.isArray(stack)) {\n return;\n }\n const layer = stack[stack.length - 1];\n if (layer) {\n setLayerRegisteredPath(layer, getLayerPath(data.arguments ?? []));\n }\n}\n\n/** Pop the path a layer pushed once it hands control onward via `next`. */\nfunction popLayerPathForLayer(data: HandleChannelContext): void {\n if (!data._sentryStoredLayer) {\n return;\n }\n // Clear the marker first so a layer that (incorrectly) calls `next` more than\n // once can't pop again and take a parent's entry off the stack with it.\n data._sentryStoredLayer = false;\n const req = data.arguments?.[0] as ExpressRequest | undefined;\n if (req) {\n popLayerPath(req);\n }\n}\n\n/**\n * Open a span for one layer invocation. Returns `undefined` to opt the layer\n * out (error handlers, or a layer with no active parent trace) — the helper\n * then leaves the active context untouched.\n */\nfunction getSpanForLayer(data: HandleChannelContext, options: ExpressIntegrationOptions): Span | undefined {\n const layer = data.self;\n const args = data.arguments;\n if (!layer || !Array.isArray(args)) {\n return undefined;\n }\n\n // Express only treats a 4-arg handler as an error handler and skips it in\n // the normal request pipeline; match the OTel integration and don't trace it.\n if (layer.handle?.length === 4) {\n return undefined;\n }\n\n // A Route dispatches to its handlers via the same `handle_request` method,\n // but those inner layers already run inside the route-dispatch layer's\n // `request_handler` span. They carry `.method` (and no `.route`); skip them\n // so we emit one span per route, matching the OTel Express integration.\n if (layer.method && !layer.route) {\n return undefined;\n }\n\n const req = args[0] as ExpressRequest | undefined;\n const res = args[1] as ExpressResponse | undefined;\n if (!req) {\n return undefined;\n }\n\n // No active parent span means this request is being ignored (unsampled /\n // filtered), so don't open a span\n if (!getActiveSpan()) {\n return undefined;\n }\n\n const type = getLayerType(layer);\n\n // Push this layer's registered path onto the request's chain so a\n // `request_handler` can reconstruct the full route with parameters intact\n // (`req.baseUrl` only exposes the *resolved* mount prefix). The matching pop\n // happens on `asyncStart` when the layer hands off via `next`.\n const registeredPath = getLayerRegisteredPath(layer);\n if (registeredPath != null) {\n pushLayerPath(req, registeredPath);\n data._sentryStoredLayer = true;\n }\n\n // `constructedRoute` (the full registered pattern) names the span/transaction;\n // `matchedRoute` (validated against the request URL) is the `http.route`.\n const constructedRoute = type === 'request_handler' ? getConstructedRoute(req) : undefined;\n const matchedRoute =\n type === 'request_handler' && constructedRoute != null ? getActualMatchedRoute(req, constructedRoute) : undefined;\n\n const name =\n type === 'request_handler'\n ? constructedRoute || 'request handler'\n : type === 'router'\n ? (layer.path ?? '/')\n : (layer.name ?? '<anonymous>');\n\n // Propagate the route to the root `http.server` span *before* the ignore\n // check, so the transaction is still named even when the layer's own span is\n // ignored — matches the OTel Express integration's `onRouteResolved` timing.\n if (matchedRoute) {\n setHttpServerSpanRoute(matchedRoute);\n }\n\n if (type === 'request_handler' && constructedRoute) {\n const isolationScope = getIsolationScope();\n if (isolationScope !== getDefaultIsolationScope()) {\n const method = typeof req.method === 'string' ? req.method.toUpperCase() : 'GET';\n isolationScope.setTransactionName(`${method} ${constructedRoute}`);\n } else {\n DEBUG_BUILD &&\n debug.warn(\n '[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name',\n );\n }\n }\n\n // Honor `ignoreLayers`/`ignoreLayersType`: skip the span for matching layers.\n // We intentionally do NOT pop the pushed path here (unlike OTel Express, which\n // pops on ignore): the path is still popped on `asyncStart` when the layer\n // calls `next`, so a following sibling isn't polluted, while an ignored\n // *router* keeps its mount prefix on the stack for the sub-stack it dispatches\n // — so routes under an ignored router stay correct. The only entries that\n // never pop come from layers that end the response without `next()`, and those\n // sit on a per-request store that is discarded when the request ends.\n if (isLayerIgnored(name, type, options)) {\n return undefined;\n }\n\n const span = startInactiveSpan({\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.express`,\n [ATTR_EXPRESS_NAME]: name,\n [ATTR_EXPRESS_TYPE]: type,\n ...(matchedRoute ? { [HTTP_ROUTE]: matchedRoute } : {}),\n },\n });\n\n // A layer that sends the response (route handlers, typically) never calls\n // `next`, so the channel's `asyncEnd` never fires. End on the response's\n // `finish` in that case. When `next` *is* called, the helper ends the span\n // (via `asyncEnd`) and `beforeSpanEnd` removes this now-redundant listener.\n if (res && typeof res.once === 'function') {\n const onFinish = (): void => {\n span.end();\n };\n res.once('finish', onFinish);\n data._sentryCleanup = () => res.removeListener('finish', onFinish);\n }\n\n return span;\n}\n\nfunction getLayerType(layer: ExpressLayer): ExpressLayerType {\n if (layer.name === 'router') {\n return 'router';\n }\n // `bound dispatch` (v4) / `handle` — the route-dispatch layer created by `router.route()`.\n if (layer.name === 'bound dispatch' || layer.name === 'handle') {\n return 'request_handler';\n }\n return 'middleware';\n}\n\n/**\n * Propagate the resolved route to the root `http.server` span so the\n * transaction gets a parameterized `http.route`. Mirrors `@sentry/node`'s\n * `setHttpServerSpanRouteAttribute`; inlined to keep this package free of\n * `@sentry/node` deps. No-op unless the root span is an `http.server` span.\n */\nfunction setHttpServerSpanRoute(route: string): void {\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && 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 * Whether a layer should be skipped per the `ignoreLayers`/`ignoreLayersType`\n * options. Matches `@sentry/core`'s Express `isLayerIgnored`: `ignoreLayersType`\n * filters by layer type, `ignoreLayers` matches the layer's name against\n * string/RegExp/predicate patterns (exact string match).\n */\nfunction isLayerIgnored(name: string, type: ExpressLayerType, options: ExpressIntegrationOptions): boolean {\n const { ignoreLayers, ignoreLayersType } = options;\n\n if (Array.isArray(ignoreLayersType) && ignoreLayersType.includes(type)) {\n return true;\n }\n\n if (!Array.isArray(ignoreLayers)) {\n return false;\n }\n\n try {\n return stringMatchesSomePattern(name, ignoreLayers, true);\n } catch {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAqCA,MAAM,MAAA,GAAS,mBAAA;AAKf,MAAM,iBAAA,GAAoB,cAAA;AAC1B,MAAM,iBAAA,GAAoB,cAAA;AAE1B,MAAM,OAAO,MAAY;AAAC,CAAA;AAE1B,IAAI,eAAA,GAAkB,KAAA;AAEf,SAAS,iBAAA,CACd,SACA,cAAA,EACM;AACN,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA;AAAA,EACF;AACA,EAAA,eAAA,GAAkB,IAAA;AAMlB,EAAA,KAAA,MAAW,WAAA,IAAe;AAAA,IACxB,QAAA,CAAS,aAAA;AAAA,IACT,QAAA,CAAS,WAAA;AAAA,IACT,QAAA,CAAS,YAAA;AAAA,IACT,QAAA,CAAS;AAAA,GACX,EAAG;AACD,IAAA,cAAA,CAA2C,WAAW,EAAE,SAAA,CAAU;AAAA,MAChE,KAAA,EAAO,IAAA;AAAA,MACP,UAAA,EAAY,IAAA;AAAA,MACZ,QAAA,EAAU,IAAA;AAAA,MACV,KAAA,EAAO,IAAA;AAAA,MACP,GAAA,EAAK;AAAA,KACN,CAAA;AAAA,EACH;AAEA,EAAA,KAAA,MAAW,eAAe,CAAC,QAAA,CAAS,cAAA,EAAgB,QAAA,CAAS,aAAa,CAAA,EAAG;AAC3E,IAAA,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,CAAA,8CAAA,EAAiD,WAAW,CAAA,CAAA,CAAG,CAAA;AAExF,IAAA,MAAM,OAAA,GAAU,eAAqC,WAAW,CAAA;AAEhE,IAAA,wBAAA,CAAyB,O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":["../../../../../src/integrations/tracing-channel/express/instrumentation.ts"],"sourcesContent":["import type * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { HTTP_ROUTE } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport {\n debug,\n getActiveSpan,\n getDefaultIsolationScope,\n getIsolationScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n startInactiveSpan,\n stringMatchesSomePattern,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../../tracing-channel';\nimport {\n getActualMatchedRoute,\n getConstructedRoute,\n getLayerPath,\n getLayerRegisteredPath,\n popLayerPath,\n pushLayerPath,\n setLayerRegisteredPath,\n} from './route';\nimport type {\n ExpressIntegrationOptions,\n ExpressLayer,\n ExpressLayerType,\n ExpressRequest,\n ExpressResponse,\n HandleChannelContext,\n RegistrationChannelContext,\n} from './types';\n\nconst ORIGIN = 'auto.http.express';\n\n// `express.name`/`express.type` are Sentry-internal Express attributes (not part\n// of `@sentry/conventions`); kept in sync with `@sentry/core`'s OTel-derived\n// Express integration so the emitted spans are identical across both code paths.\nconst ATTR_EXPRESS_NAME = 'express.name';\nconst ATTR_EXPRESS_TYPE = 'express.type';\n\nconst NOOP = (): void => {};\n\nlet _isInstrumented = false;\n\nexport function instrumentExpress(\n options: ExpressIntegrationOptions,\n tracingChannel: typeof diagnosticsChannel.tracingChannel,\n): void {\n if (_isInstrumented) {\n return;\n }\n _isInstrumented = true;\n\n // Record each layer's registered path *pattern* as it is registered, so the\n // matched route can be reconstructed with its parameters intact at request\n // time. Only the `end` event matters (the layer is on the router's stack by\n // then); the others are required by the subscriber type, so no-op them.\n for (const channelName of [CHANNELS.EXPRESS_REGISTER, CHANNELS.ROUTER_REGISTER]) {\n tracingChannel<RegistrationChannelContext>(channelName).subscribe({\n start: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n end: captureRegisteredLayerPath,\n });\n }\n\n for (const channelName of [CHANNELS.EXPRESS_HANDLE, CHANNELS.ROUTER_HANDLE]) {\n DEBUG_BUILD && debug.log(`[orchestrion:express] subscribing to channel \"${channelName}\"`);\n\n const channel = tracingChannel<HandleChannelContext>(channelName);\n\n bindTracingChannelToSpan(channel, data => getSpanForLayer(data, options), {\n beforeSpanEnd(_span, data) {\n data._sentryCleanup?.();\n },\n });\n\n // Pop the layer path when the layer hands off via `next`. `asyncStart` fires\n // when `next` is called and *before* the downstream layer runs, so the\n // per-request path chain reflects only the current chain when each layer\n // reconstructs its route. Only `asyncStart` is relevant here.\n channel.subscribe({\n start: NOOP,\n asyncEnd: NOOP,\n end: NOOP,\n error: NOOP,\n asyncStart: popLayerPathForLayer,\n });\n }\n}\n\n/** Record the freshly-registered layer's path pattern from a `route`/`use` call. */\nfunction captureRegisteredLayerPath(data: RegistrationChannelContext): void {\n const stack = data.self?.stack;\n if (!Array.isArray(stack)) {\n return;\n }\n const layer = stack[stack.length - 1];\n if (layer) {\n setLayerRegisteredPath(layer, getLayerPath(data.arguments ?? []));\n }\n}\n\n/** Pop the path a layer pushed once it hands control onward via `next`. */\nfunction popLayerPathForLayer(data: HandleChannelContext): void {\n if (!data._sentryStoredLayer) {\n return;\n }\n // Clear the marker first so a layer that (incorrectly) calls `next` more than\n // once can't pop again and take a parent's entry off the stack with it.\n data._sentryStoredLayer = false;\n const req = data.arguments?.[0] as ExpressRequest | undefined;\n if (req) {\n popLayerPath(req);\n }\n}\n\n/**\n * Open a span for one layer invocation. Returns `undefined` to opt the layer\n * out (error handlers, or a layer with no active parent trace) — the helper\n * then leaves the active context untouched.\n */\nfunction getSpanForLayer(data: HandleChannelContext, options: ExpressIntegrationOptions): Span | undefined {\n const layer = data.self;\n const args = data.arguments;\n if (!layer || !Array.isArray(args)) {\n return undefined;\n }\n\n // Express only treats a 4-arg handler as an error handler and skips it in\n // the normal request pipeline; match the OTel integration and don't trace it.\n if (layer.handle?.length === 4) {\n return undefined;\n }\n\n // A Route dispatches to its handlers via the same `handle_request` method,\n // but those inner layers already run inside the route-dispatch layer's\n // `request_handler` span. They carry `.method` (and no `.route`); skip them\n // so we emit one span per route, matching the OTel Express integration.\n if (layer.method && !layer.route) {\n return undefined;\n }\n\n const req = args[0] as ExpressRequest | undefined;\n const res = args[1] as ExpressResponse | undefined;\n if (!req) {\n return undefined;\n }\n\n // No active parent span means this request is being ignored (unsampled /\n // filtered), so don't open a span\n if (!getActiveSpan()) {\n return undefined;\n }\n\n const type = getLayerType(layer);\n\n // Push this layer's registered path onto the request's chain so a\n // `request_handler` can reconstruct the full route with parameters intact\n // (`req.baseUrl` only exposes the *resolved* mount prefix). The matching pop\n // happens on `asyncStart` when the layer hands off via `next`.\n const registeredPath = getLayerRegisteredPath(layer);\n if (registeredPath != null) {\n pushLayerPath(req, registeredPath);\n data._sentryStoredLayer = true;\n }\n\n // `constructedRoute` (the full registered pattern) names the span/transaction;\n // `matchedRoute` (validated against the request URL) is the `http.route`.\n const constructedRoute = type === 'request_handler' ? getConstructedRoute(req) : undefined;\n const matchedRoute =\n type === 'request_handler' && constructedRoute != null ? getActualMatchedRoute(req, constructedRoute) : undefined;\n\n const name =\n type === 'request_handler'\n ? constructedRoute || 'request handler'\n : type === 'router'\n ? (layer.path ?? '/')\n : (layer.name ?? '<anonymous>');\n\n // Propagate the route to the root `http.server` span *before* the ignore\n // check, so the transaction is still named even when the layer's own span is\n // ignored — matches the OTel Express integration's `onRouteResolved` timing.\n if (matchedRoute) {\n setHttpServerSpanRoute(matchedRoute);\n }\n\n if (type === 'request_handler' && constructedRoute) {\n const isolationScope = getIsolationScope();\n if (isolationScope !== getDefaultIsolationScope()) {\n const method = typeof req.method === 'string' ? req.method.toUpperCase() : 'GET';\n isolationScope.setTransactionName(`${method} ${constructedRoute}`);\n } else {\n DEBUG_BUILD &&\n debug.warn(\n '[orchestrion:express] Isolation scope is still default isolation scope - skipping transaction name',\n );\n }\n }\n\n // Honor `ignoreLayers`/`ignoreLayersType`: skip the span for matching layers.\n // We intentionally do NOT pop the pushed path here (unlike OTel Express, which\n // pops on ignore): the path is still popped on `asyncStart` when the layer\n // calls `next`, so a following sibling isn't polluted, while an ignored\n // *router* keeps its mount prefix on the stack for the sub-stack it dispatches\n // — so routes under an ignored router stay correct. The only entries that\n // never pop come from layers that end the response without `next()`, and those\n // sit on a per-request store that is discarded when the request ends.\n if (isLayerIgnored(name, type, options)) {\n return undefined;\n }\n\n const span = startInactiveSpan({\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.express`,\n [ATTR_EXPRESS_NAME]: name,\n [ATTR_EXPRESS_TYPE]: type,\n ...(matchedRoute ? { [HTTP_ROUTE]: matchedRoute } : {}),\n },\n });\n\n // A layer that sends the response (route handlers, typically) never calls\n // `next`, so the channel's `asyncEnd` never fires. End on the response's\n // `finish` in that case. When `next` *is* called, the helper ends the span\n // (via `asyncEnd`) and `beforeSpanEnd` removes this now-redundant listener.\n if (res && typeof res.once === 'function') {\n const onFinish = (): void => {\n span.end();\n };\n res.once('finish', onFinish);\n data._sentryCleanup = () => res.removeListener('finish', onFinish);\n }\n\n return span;\n}\n\nfunction getLayerType(layer: ExpressLayer): ExpressLayerType {\n if (layer.name === 'router') {\n return 'router';\n }\n // `bound dispatch` (v4) / `handle` — the route-dispatch layer created by `router.route()`.\n if (layer.name === 'bound dispatch' || layer.name === 'handle') {\n return 'request_handler';\n }\n return 'middleware';\n}\n\n/**\n * Propagate the resolved route to the root `http.server` span so the\n * transaction gets a parameterized `http.route`. Mirrors `@sentry/node`'s\n * `setHttpServerSpanRouteAttribute`; inlined to keep this package free of\n * `@sentry/node` deps. No-op unless the root span is an `http.server` span.\n */\nfunction setHttpServerSpanRoute(route: string): void {\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && 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 * Whether a layer should be skipped per the `ignoreLayers`/`ignoreLayersType`\n * options. Matches `@sentry/core`'s Express `isLayerIgnored`: `ignoreLayersType`\n * filters by layer type, `ignoreLayers` matches the layer's name against\n * string/RegExp/predicate patterns (exact string match).\n */\nfunction isLayerIgnored(name: string, type: ExpressLayerType, options: ExpressIntegrationOptions): boolean {\n const { ignoreLayers, ignoreLayersType } = options;\n\n if (Array.isArray(ignoreLayersType) && ignoreLayersType.includes(type)) {\n return true;\n }\n\n if (!Array.isArray(ignoreLayers)) {\n return false;\n }\n\n try {\n return stringMatchesSomePattern(name, ignoreLayers, true);\n } catch {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAqCA,MAAM,MAAA,GAAS,mBAAA;AAKf,MAAM,iBAAA,GAAoB,cAAA;AAC1B,MAAM,iBAAA,GAAoB,cAAA;AAE1B,MAAM,OAAO,MAAY;AAAC,CAAA;AAE1B,IAAI,eAAA,GAAkB,KAAA;AAEf,SAAS,iBAAA,CACd,SACA,cAAA,EACM;AACN,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA;AAAA,EACF;AACA,EAAA,eAAA,GAAkB,IAAA;AAMlB,EAAA,KAAA,MAAW,eAAe,CAAC,QAAA,CAAS,gBAAA,EAAkB,QAAA,CAAS,eAAe,CAAA,EAAG;AAC/E,IAAA,cAAA,CAA2C,WAAW,EAAE,SAAA,CAAU;AAAA,MAChE,KAAA,EAAO,IAAA;AAAA,MACP,UAAA,EAAY,IAAA;AAAA,MACZ,QAAA,EAAU,IAAA;AAAA,MACV,KAAA,EAAO,IAAA;AAAA,MACP,GAAA,EAAK;AAAA,KACN,CAAA;AAAA,EACH;AAEA,EAAA,KAAA,MAAW,eAAe,CAAC,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EAAG;AAChC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,OAAO,wBAAA,CAAyB,IAAA,EAAM,YAAA,EAAc,IAAI,CAAA;AAAA,EAC1D,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;;;;"}
@@ -3,7 +3,7 @@ import { instrumentFastify as instrumentFastify$1 } from './instrumentation.js';
3
3
  import { INTEGRATION_NAME, defaultShouldHandleError } from './utils.js';
4
4
  import { subscribeToFastifyErrorChannel, handleFastifyError as handleFastifyError$1 } from './errors.js';
5
5
 
6
- const _fastifyIntegration = (({ shouldHandleError }) => {
6
+ const _fastifyIntegration = (({ shouldHandleError } = {}) => {
7
7
  let _shouldHandleError;
8
8
  return {
9
9
  name: INTEGRATION_NAME,
@@ -20,9 +20,7 @@ const _fastifyIntegration = (({ shouldHandleError }) => {
20
20
  }
21
21
  };
22
22
  });
23
- const fastifyIntegration = defineIntegration(
24
- (options = {}) => _fastifyIntegration(options)
25
- );
23
+ const fastifyIntegration = defineIntegration(_fastifyIntegration);
26
24
  const instrumentFastify = instrumentFastify$1;
27
25
  const handleFastifyError = handleFastifyError$1;
28
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\n\nimport { instrumentFastify as _instrumentFastify } from './instrumentation';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\nimport { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions>) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n subscribeToFastifyErrorChannel();\n _instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) {\n _shouldHandleError = shouldHandleError;\n },\n } satisfies FastifyIntegration;\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n * This integration supports Fastify v5 only.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const instrumentFastify = _instrumentFastify;\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const handleFastifyError = _handleFastifyError;\n"],"names":["_instrumentFastify","shouldHandleError","_handleFastifyError"],"mappings":";;;;;AA2CA,MAAM,mBAAA,IAAuB,CAAC,EAAE,iBAAA,EAAkB,KAA0C;AAC1F,EAAA,IAAI,kBAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,GAAqB,iBAAA,IAAqB,wBAAA;AAE1C,MAAA,8BAAA,EAA+B;AAC/B,MAAAA,mBAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IACA,oBAAA,GAAuB;AACrB,MAAA,OAAO,kBAAA;AAAA,IACT,CAAA;AAAA,IACA,qBAAqBC,kBAAAA,EAA4F;AAC/G,MAAA,kBAAA,GAAqBA,kBAAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqB,iBAAA;AAAA,EAAkB,CAAC,OAAA,GAA8C,EAAC,KAClG,oBAAoB,OAAO;AAC7B;AAKO,MAAM,iBAAA,GAAoBD;AAK1B,MAAM,kBAAA,GAAqBE;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\nimport { instrumentFastify as _instrumentFastify } from './instrumentation';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\nimport { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions> = {}) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n subscribeToFastifyErrorChannel();\n _instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) {\n _shouldHandleError = shouldHandleError;\n },\n } satisfies FastifyIntegration;\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n * This integration supports Fastify v5 only.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration(_fastifyIntegration);\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const instrumentFastify = _instrumentFastify;\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const handleFastifyError = _handleFastifyError;\n"],"names":["_instrumentFastify","shouldHandleError","_handleFastifyError"],"mappings":";;;;;AA0CA,MAAM,uBAAuB,CAAC,EAAE,iBAAA,EAAkB,GAAwC,EAAC,KAAM;AAC/F,EAAA,IAAI,kBAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,GAAqB,iBAAA,IAAqB,wBAAA;AAE1C,MAAA,8BAAA,EAA+B;AAC/B,MAAAA,mBAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IACA,oBAAA,GAAuB;AACrB,MAAA,OAAO,kBAAA;AAAA,IACT,CAAA;AAAA,IACA,qBAAqBC,kBAAAA,EAA4F;AAC/G,MAAA,kBAAA,GAAqBA,kBAAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqB,kBAAkB,mBAAmB;AAKhE,MAAM,iBAAA,GAAoBD;AAK1B,MAAM,kBAAA,GAAqBE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify';\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify' as const;\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;"}
@@ -0,0 +1,75 @@
1
+ import * as net from 'node:net';
2
+ import { DB_OPERATION_NAME, DB_NAMESPACE, DB_COLLECTION_NAME, DB_SYSTEM_NAME, SERVER_ADDRESS, SERVER_PORT } from '@sentry/conventions/attributes';
3
+ import { startInactiveSpan, SPAN_KIND, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
4
+
5
+ function startFirestoreSpan(spanName, reference) {
6
+ return startInactiveSpan({
7
+ name: `${spanName} ${reference.path}`,
8
+ op: "db.query",
9
+ kind: SPAN_KIND.CLIENT,
10
+ attributes: {
11
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.firebase.orchestrion.firestore",
12
+ [DB_OPERATION_NAME]: spanName,
13
+ ...buildAttributes(reference)
14
+ }
15
+ });
16
+ }
17
+ function getPortAndAddress(settings) {
18
+ let address;
19
+ let port;
20
+ if (typeof settings.host === "string") {
21
+ if (settings.host.startsWith("[")) {
22
+ if (settings.host.endsWith("]")) {
23
+ address = settings.host.replace(/^\[|\]$/g, "");
24
+ } else if (settings.host.includes("]:")) {
25
+ const lastColonIndex = settings.host.lastIndexOf(":");
26
+ if (lastColonIndex !== -1) {
27
+ address = settings.host.slice(1, lastColonIndex).replace(/^\[|\]$/g, "");
28
+ port = settings.host.slice(lastColonIndex + 1);
29
+ }
30
+ }
31
+ } else {
32
+ if (net.isIPv6(settings.host)) {
33
+ address = settings.host;
34
+ } else {
35
+ const lastColonIndex = settings.host.lastIndexOf(":");
36
+ if (lastColonIndex !== -1) {
37
+ address = settings.host.slice(0, lastColonIndex);
38
+ port = settings.host.slice(lastColonIndex + 1);
39
+ } else {
40
+ address = settings.host;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ return {
46
+ address,
47
+ port: port ? parseInt(port, 10) : void 0
48
+ };
49
+ }
50
+ function buildAttributes(reference) {
51
+ const firestoreApp = reference.firestore.app;
52
+ const firestoreOptions = firestoreApp.options;
53
+ const settings = reference.firestore.toJSON()?.settings || {};
54
+ const attributes = {
55
+ [DB_COLLECTION_NAME]: reference.path,
56
+ [DB_NAMESPACE]: firestoreApp.name,
57
+ [DB_SYSTEM_NAME]: "firebase.firestore",
58
+ "firebase.firestore.type": reference.type,
59
+ "firebase.firestore.options.projectId": firestoreOptions.projectId,
60
+ "firebase.firestore.options.appId": firestoreOptions.appId,
61
+ "firebase.firestore.options.messagingSenderId": firestoreOptions.messagingSenderId,
62
+ "firebase.firestore.options.storageBucket": firestoreOptions.storageBucket
63
+ };
64
+ const { address, port } = getPortAndAddress(settings);
65
+ if (address) {
66
+ attributes[SERVER_ADDRESS] = address;
67
+ }
68
+ if (port) {
69
+ attributes[SERVER_PORT] = port;
70
+ }
71
+ return attributes;
72
+ }
73
+
74
+ export { getPortAndAddress, startFirestoreSpan };
75
+ //# sourceMappingURL=firestore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore.js","sources":["../../../../../src/integrations/tracing-channel/firebase/firestore.ts"],"sourcesContent":["import * as net from 'node:net';\nimport {\n DB_COLLECTION_NAME,\n DB_NAMESPACE,\n DB_OPERATION_NAME,\n DB_SYSTEM_NAME,\n SERVER_ADDRESS,\n SERVER_PORT,\n} from '@sentry/conventions/attributes';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_KIND, startInactiveSpan } from '@sentry/core';\nimport type { FirebaseApp, FirebaseOptions, FirestoreReference, FirestoreSettings } from './firestore-types';\n\n/**\n * Opens the inactive `db.query` span for a Firestore operation. `bindTracingChannelToSpan` makes it the\n * active span for the traced call and ends it when the call settles. Mirrors the OTel integration's span,\n * with a distinct `auto.firebase.orchestrion.firestore` origin.\n */\nexport function startFirestoreSpan(spanName: string, reference: FirestoreReference): Span {\n return startInactiveSpan({\n name: `${spanName} ${reference.path}`,\n op: 'db.query',\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.firebase.orchestrion.firestore',\n [DB_OPERATION_NAME]: spanName,\n ...buildAttributes(reference),\n },\n });\n}\n\n/**\n * Gets the server address and port attributes from the Firestore settings.\n * It's best effort to extract the address and port from the settings, especially for IPv6.\n * @param settings - The Firestore settings containing host information.\n */\nexport function getPortAndAddress(settings: FirestoreSettings): {\n address?: string;\n port?: number;\n} {\n let address: string | undefined;\n let port: string | undefined;\n\n if (typeof settings.host === 'string') {\n if (settings.host.startsWith('[')) {\n // IPv6 addresses can be enclosed in square brackets, e.g., [2001:db8::1]:8080\n if (settings.host.endsWith(']')) {\n // IPv6 with square brackets without port\n address = settings.host.replace(/^\\[|\\]$/g, '');\n } else if (settings.host.includes(']:')) {\n // IPv6 with square brackets with port\n const lastColonIndex = settings.host.lastIndexOf(':');\n if (lastColonIndex !== -1) {\n address = settings.host.slice(1, lastColonIndex).replace(/^\\[|\\]$/g, '');\n port = settings.host.slice(lastColonIndex + 1);\n }\n }\n } else {\n // IPv4 or IPv6 without square brackets\n // If it's an IPv6 address without square brackets, we assume it does not have a port.\n if (net.isIPv6(settings.host)) {\n address = settings.host;\n }\n // If it's an IPv4 address, we can extract the port if it exists.\n else {\n const lastColonIndex = settings.host.lastIndexOf(':');\n if (lastColonIndex !== -1) {\n address = settings.host.slice(0, lastColonIndex);\n port = settings.host.slice(lastColonIndex + 1);\n } else {\n address = settings.host;\n }\n }\n }\n }\n return {\n address: address,\n port: port ? parseInt(port, 10) : undefined,\n };\n}\n\nfunction buildAttributes(reference: FirestoreReference): SpanAttributes {\n const firestoreApp: FirebaseApp = reference.firestore.app;\n const firestoreOptions: FirebaseOptions = firestoreApp.options;\n const settings: FirestoreSettings = reference.firestore.toJSON()?.settings || {};\n\n const attributes: SpanAttributes = {\n [DB_COLLECTION_NAME]: reference.path,\n [DB_NAMESPACE]: firestoreApp.name,\n [DB_SYSTEM_NAME]: 'firebase.firestore',\n 'firebase.firestore.type': reference.type,\n 'firebase.firestore.options.projectId': firestoreOptions.projectId,\n 'firebase.firestore.options.appId': firestoreOptions.appId,\n 'firebase.firestore.options.messagingSenderId': firestoreOptions.messagingSenderId,\n 'firebase.firestore.options.storageBucket': firestoreOptions.storageBucket,\n };\n\n const { address, port } = getPortAndAddress(settings);\n\n if (address) {\n attributes[SERVER_ADDRESS] = address;\n }\n if (port) {\n attributes[SERVER_PORT] = port;\n }\n\n return attributes;\n}\n"],"names":[],"mappings":";;;;AAkBO,SAAS,kBAAA,CAAmB,UAAkB,SAAA,EAAqC;AACxF,EAAA,OAAO,iBAAA,CAAkB;AAAA,IACvB,IAAA,EAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,UAAU,IAAI,CAAA,CAAA;AAAA,IACnC,EAAA,EAAI,UAAA;AAAA,IACJ,MAAM,SAAA,CAAU,MAAA;AAAA,IAChB,UAAA,EAAY;AAAA,MACV,CAAC,gCAAgC,GAAG,qCAAA;AAAA,MACpC,CAAC,iBAAiB,GAAG,QAAA;AAAA,MACrB,GAAG,gBAAgB,SAAS;AAAA;AAC9B,GACD,CAAA;AACH;AAOO,SAAS,kBAAkB,QAAA,EAGhC;AACA,EAAA,IAAI,OAAA;AACJ,EAAA,IAAI,IAAA;AAEJ,EAAA,IAAI,OAAO,QAAA,CAAS,IAAA,KAAS,QAAA,EAAU;AACrC,IAAA,IAAI,QAAA,CAAS,IAAA,CAAK,UAAA,CAAW,GAAG,CAA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CAAS,IAAA,EAAM,EAAE,CAAA,GAAI;AAAA,GACpC;AACF;AAEA,SAAS,gBAAgB,SAAA,EAA+C;AACtE,EAAA,MAAM,YAAA,GAA4B,UAAU,SAAA,CAAU,GAAA;AACtD,EAAA,MAAM,mBAAoC,YAAA,CAAa,OAAA;AACvD,EAAA,MAAM,WAA8B,SAAA,CAAU,SAAA,CAAU,MAAA,EAAO,EAAG,YAAY,EAAC;AAE/E,EAAA,MAAM,UAAA,GAA6B;AAAA,IACjC,CAAC,kBAAkB,GAAG,SAAA,CAAU,IAAA;AAAA,IAChC,CAAC,YAAY,GAAG,YAAA,CAAa,IAAA;AAAA,IAC7B,CAAC,cAAc,GAAG,oBAAA;AAAA,IAClB,2BAA2B,SAAA,CAAU,IAAA;AAAA,IACrC,wCAAwC,gBAAA,CAAiB,SAAA;AAAA,IACzD,oCAAoC,gBAAA,CAAiB,KAAA;AAAA,IACrD,gDAAgD,gBAAA,CAAiB,iBAAA;AAAA,IACjE,4CAA4C,gBAAA,CAAiB;AAAA,GAC/D;AAEA,EAAA,MAAM,EAAE,OAAA,EAAS,IAAA,EAAK,GAAI,kBAAkB,QAAQ,CAAA;AAEpD,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,UAAA,CAAW,cAAc,CAAA,GAAI,OAAA;AAAA,EAC/B;AACA,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,UAAA,CAAW,WAAW,CAAA,GAAI,IAAA;AAAA,EAC5B;AAEA,EAAA,OAAO,UAAA;AACT;;;;"}
@@ -0,0 +1,65 @@
1
+ import { FAAS_TRIGGER, FAAS_NAME } from '@sentry/conventions/attributes';
2
+ import { startSpanManual, SPAN_KIND, SPAN_STATUS_ERROR, captureException, flush, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
3
+
4
+ const FUNCTIONS_ORIGIN = "auto.firebase.orchestrion.functions";
5
+ const WRAPPED = "__sentryFirebaseWrapped";
6
+ function wrapFunctionsRegistration(data, triggerType) {
7
+ const args = data.arguments;
8
+ if (!Array.isArray(args) || args.length === 0) {
9
+ return;
10
+ }
11
+ const handlerIndex = typeof args[0] === "function" ? 0 : 1;
12
+ const handler = args[handlerIndex];
13
+ if (typeof handler !== "function" || handler[WRAPPED]) {
14
+ return;
15
+ }
16
+ args[handlerIndex] = wrapHandler(handler, triggerType);
17
+ }
18
+ function wrapHandler(handler, triggerType) {
19
+ const wrapped = async function(...handlerArgs) {
20
+ const functionName = process.env.FUNCTION_TARGET || process.env.K_SERVICE || "unknown";
21
+ const attributes = {
22
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FUNCTIONS_ORIGIN,
23
+ [FAAS_NAME]: functionName,
24
+ [FAAS_TRIGGER]: triggerType,
25
+ "faas.provider": "firebase"
26
+ };
27
+ if (process.env.GCLOUD_PROJECT) {
28
+ attributes["cloud.project_id"] = process.env.GCLOUD_PROJECT;
29
+ }
30
+ if (process.env.EVENTARC_CLOUD_EVENT_SOURCE) {
31
+ attributes["cloud.event_source"] = process.env.EVENTARC_CLOUD_EVENT_SOURCE;
32
+ }
33
+ return startSpanManual(
34
+ {
35
+ name: `firebase.function.${triggerType}`,
36
+ op: "function.firebase",
37
+ kind: SPAN_KIND.SERVER,
38
+ attributes
39
+ },
40
+ async (span) => {
41
+ try {
42
+ const result = await handler.apply(this, handlerArgs);
43
+ span.end();
44
+ return result;
45
+ } catch (error) {
46
+ span.setStatus({ code: SPAN_STATUS_ERROR });
47
+ captureException(error, {
48
+ mechanism: {
49
+ type: FUNCTIONS_ORIGIN,
50
+ handled: false
51
+ }
52
+ });
53
+ span.end();
54
+ await flush(2e3);
55
+ throw error;
56
+ }
57
+ }
58
+ );
59
+ };
60
+ wrapped[WRAPPED] = true;
61
+ return wrapped;
62
+ }
63
+
64
+ export { wrapFunctionsRegistration };
65
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sources":["../../../../../src/integrations/tracing-channel/firebase/functions.ts"],"sourcesContent":["import { FAAS_NAME, FAAS_TRIGGER } from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n captureException,\n flush,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\n\nconst FUNCTIONS_ORIGIN = 'auto.firebase.orchestrion.functions';\n\n// Set on a wrapped handler so re-entrant `start` events don't double-wrap it.\nconst WRAPPED = '__sentryFirebaseWrapped';\n\ntype Handler = (this: unknown, ...args: unknown[]) => unknown;\n\ninterface FunctionsChannelContext {\n // The live args of the `onX(...)` registration call. firebase-functions accepts either\n // `onX(handler)` or `onX(documentOrOptions, handler)`, so the handler is `arguments[0]` when it's a\n // function, otherwise `arguments[1]`. Mutating the entry here swaps in the wrapped handler.\n arguments: unknown[];\n self?: unknown;\n}\n\n/**\n * Rewrap the handler argument of a firebase-functions `onX(...)` registration so the returned cloud\n * function opens a `SERVER` span (and error boundary) each time it's invoked. Runs as the tracing\n * channel's `start` subscriber, before orchestrion forwards the (mutated) arguments to the real call.\n *\n * The registration call itself is trivial and synchronous, so — unlike the firestore path — this does\n * not bind a span to the channel; it only uses the channel as an injection point.\n */\nexport function wrapFunctionsRegistration(data: FunctionsChannelContext, triggerType: string): void {\n const args = data.arguments;\n if (!Array.isArray(args) || args.length === 0) {\n return;\n }\n\n const handlerIndex = typeof args[0] === 'function' ? 0 : 1;\n const handler = args[handlerIndex];\n\n if (typeof handler !== 'function' || (handler as unknown as Record<string, unknown>)[WRAPPED]) {\n return;\n }\n\n args[handlerIndex] = wrapHandler(handler as Handler, triggerType);\n}\n\nfunction wrapHandler(handler: Handler, triggerType: string): Handler {\n const wrapped = async function (this: unknown, ...handlerArgs: unknown[]): Promise<unknown> {\n const functionName = process.env.FUNCTION_TARGET || process.env.K_SERVICE || 'unknown';\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FUNCTIONS_ORIGIN,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: triggerType,\n 'faas.provider': 'firebase',\n };\n\n if (process.env.GCLOUD_PROJECT) {\n attributes['cloud.project_id'] = process.env.GCLOUD_PROJECT;\n }\n\n if (process.env.EVENTARC_CLOUD_EVENT_SOURCE) {\n attributes['cloud.event_source'] = process.env.EVENTARC_CLOUD_EVENT_SOURCE;\n }\n\n // `startSpanManual` keeps the span active while still allowing us to end it before flushing on error.\n return startSpanManual(\n {\n name: `firebase.function.${triggerType}`,\n op: 'function.firebase',\n kind: SPAN_KIND.SERVER,\n attributes,\n },\n async span => {\n try {\n const result = await handler.apply(this, handlerArgs);\n span.end();\n return result;\n } catch (error) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n captureException(error, {\n mechanism: {\n type: FUNCTIONS_ORIGIN,\n handled: false,\n },\n });\n span.end();\n await flush(2000);\n throw error;\n }\n },\n );\n };\n\n (wrapped as unknown as Record<string, unknown>)[WRAPPED] = true;\n return wrapped;\n}\n"],"names":[],"mappings":";;;AAWA,MAAM,gBAAA,GAAmB,qCAAA;AAGzB,MAAM,OAAA,GAAU,yBAAA;AAoBT,SAAS,yBAAA,CAA0B,MAA+B,WAAA,EAA2B;AAClG,EAAA,MAAM,OAAO,IAAA,CAAK,SAAA;AAClB,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,IAAK,IAAA,CAAK,WAAW,CAAA,EAAG;AAC7C,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,eAAe,OAAO,IAAA,CAAK,CAAC,CAAA,KAAM,aAAa,CAAA,GAAI,CAAA;AACzD,EAAA,MAAM,OAAA,GAAU,KAAK,YAAY,CAAA;AAEjC,EAAA,IAAI,OAAO,OAAA,KAAY,UAAA,IAAe,OAAA,CAA+C,OAAO,CAAA,EAAG;AAC7F,IAAA;AAAA,EACF;AAEA,EAAA,IAAA,CAAK,YAAY,CAAA,GAAI,WAAA,CAAY,OAAA,EAAoB,WA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AAAA,cACN,OAAA,EAAS;AAAA;AACX,WACD,CAAA;AACD,UAAA,IAAA,CAAK,GAAA,EAAI;AACT,UAAA,MAAM,MAAM,GAAI,CAAA;AAChB,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF;AAAA,KACF;AAAA,EACF,CAAA;AAEA,EAAC,OAAA,CAA+C,OAAO,CAAA,GAAI,IAAA;AAC3D,EAAA,OAAO,OAAA;AACT;;;;"}
@@ -0,0 +1,22 @@
1
+ import * as diagnosticsChannel from 'node:diagnostics_channel';
2
+ import { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';
3
+ import { instrumentFirebase } from './instrumentation.js';
4
+
5
+ const INTEGRATION_NAME = "Firebase";
6
+ const _firebaseChannelIntegration = (() => {
7
+ return {
8
+ name: INTEGRATION_NAME,
9
+ setupOnce() {
10
+ if (!diagnosticsChannel.tracingChannel) {
11
+ return;
12
+ }
13
+ waitForTracingChannelBinding(() => {
14
+ instrumentFirebase();
15
+ });
16
+ }
17
+ };
18
+ });
19
+ const firebaseChannelIntegration = defineIntegration(_firebaseChannelIntegration);
20
+
21
+ export { firebaseChannelIntegration };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/firebase/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';\nimport { instrumentFirebase } from './instrumentation';\n\nconst INTEGRATION_NAME = 'Firebase' as const;\n\nconst _firebaseChannelIntegration = (() => {\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 waitForTracingChannelBinding(() => {\n instrumentFirebase();\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven firebase integration.\n *\n * Subscribes to the `orchestrion:@firebase/firestore:*` and `orchestrion:firebase-functions:*`\n * diagnostics_channels the orchestrion code transform injects into firestore's `addDoc`/`getDocs`/\n * `setDoc`/`deleteDoc` and firebase-functions' `onX` registration functions, emitting spans identical\n * to the OTel integration — with a distinct `auto.firebase.orchestrion.*` origin. Requires the\n * orchestrion runtime hook or bundler plugin — wire it up via `experimentalUseDiagnosticsChannelInjection()`.\n *\n * @experimental\n */\nexport const firebaseChannelIntegration = defineIntegration(_firebaseChannelIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,UAAA;AAEzB,MAAM,+BAA+B,MAAM;AACzC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAA,4BAAA,CAA6B,MAAM;AACjC,QAAA,kBAAA,EAAmB;AAAA,MACrB,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAaO,MAAM,0BAAA,GAA6B,kBAAkB,2BAA2B;;;;"}
@@ -0,0 +1,64 @@
1
+ import * as diagnosticsChannel from 'node:diagnostics_channel';
2
+ import { debug } from '@sentry/core';
3
+ import { DEBUG_BUILD } from '../../../debug-build.js';
4
+ import { CHANNELS } from '../../../orchestrion/channels.js';
5
+ import { bindTracingChannelToSpan } from '../../../tracing-channel.js';
6
+ import { startFirestoreSpan } from './firestore.js';
7
+ import { wrapFunctionsRegistration } from './functions.js';
8
+
9
+ const FIRESTORE_OPERATIONS = [
10
+ { channel: CHANNELS.FIREBASE_FIRESTORE_ADD_DOC, spanName: "addDoc", useParent: false },
11
+ { channel: CHANNELS.FIREBASE_FIRESTORE_GET_DOCS, spanName: "getDocs", useParent: false },
12
+ { channel: CHANNELS.FIREBASE_FIRESTORE_SET_DOC, spanName: "setDoc", useParent: true },
13
+ { channel: CHANNELS.FIREBASE_FIRESTORE_DELETE_DOC, spanName: "deleteDoc", useParent: true }
14
+ ];
15
+ const FUNCTIONS_TRIGGERS = [
16
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_HTTP_REQUEST, triggerType: "http.request" },
17
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_HTTP_CALL, triggerType: "http.call" },
18
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_CREATED, triggerType: "firestore.document.created" },
19
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED, triggerType: "firestore.document.updated" },
20
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_DELETED, triggerType: "firestore.document.deleted" },
21
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN, triggerType: "firestore.document.written" },
22
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_SCHEDULER, triggerType: "scheduler.scheduled" },
23
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_FINALIZED, triggerType: "storage.object.finalized" },
24
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED, triggerType: "storage.object.archived" },
25
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_DELETED, triggerType: "storage.object.deleted" },
26
+ { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED, triggerType: "storage.object.metadataUpdated" }
27
+ ];
28
+ const NOOP = () => {
29
+ };
30
+ function safe(fn) {
31
+ try {
32
+ return fn();
33
+ } catch (error) {
34
+ DEBUG_BUILD && debug.warn("[orchestrion:firebase] error handling channel event", error);
35
+ return void 0;
36
+ }
37
+ }
38
+ function instrumentFirebase() {
39
+ for (const { channel, spanName, useParent } of FIRESTORE_OPERATIONS) {
40
+ bindTracingChannelToSpan(
41
+ diagnosticsChannel.tracingChannel(channel),
42
+ (data) => safe(() => {
43
+ const reference = data.arguments[0];
44
+ if (!reference) {
45
+ return void 0;
46
+ }
47
+ const spanReference = useParent ? reference.parent || reference : reference;
48
+ return startFirestoreSpan(spanName, spanReference);
49
+ })
50
+ );
51
+ }
52
+ for (const { channel, triggerType } of FUNCTIONS_TRIGGERS) {
53
+ diagnosticsChannel.tracingChannel(channel).subscribe({
54
+ start: (data) => void safe(() => wrapFunctionsRegistration(data, triggerType)),
55
+ end: NOOP,
56
+ asyncStart: NOOP,
57
+ asyncEnd: NOOP,
58
+ error: NOOP
59
+ });
60
+ }
61
+ }
62
+
63
+ export { instrumentFirebase };
64
+ //# sourceMappingURL=instrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing-channel/firebase/instrumentation.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../../tracing-channel';\nimport type { FirestoreReference } from './firestore-types';\nimport { startFirestoreSpan } from './firestore';\nimport { wrapFunctionsRegistration } from './functions';\n\n// The context orchestrion's transform attaches to each firestore channel: `arguments` is the live args\n// of the wrapped `addDoc`/`getDocs`/`setDoc`/`deleteDoc` call, `arguments[0]` the reference.\ninterface FirestoreChannelContext {\n arguments: unknown[];\n self?: unknown;\n result?: unknown;\n error?: unknown;\n}\n\n// The firestore operations, keyed by channel. `useParent` mirrors the OTel integration: `setDoc`/\n// `deleteDoc` take a *document* reference but the span is named after its parent *collection*.\nconst FIRESTORE_OPERATIONS: Array<{ channel: string; spanName: string; useParent: boolean }> = [\n { channel: CHANNELS.FIREBASE_FIRESTORE_ADD_DOC, spanName: 'addDoc', useParent: false },\n { channel: CHANNELS.FIREBASE_FIRESTORE_GET_DOCS, spanName: 'getDocs', useParent: false },\n { channel: CHANNELS.FIREBASE_FIRESTORE_SET_DOC, spanName: 'setDoc', useParent: true },\n { channel: CHANNELS.FIREBASE_FIRESTORE_DELETE_DOC, spanName: 'deleteDoc', useParent: true },\n];\n\n// The firebase-functions triggers, keyed by channel. The value is the faas trigger type used for the\n// span name (`firebase.function.<trigger>`) and `faas.trigger` attribute.\nconst FUNCTIONS_TRIGGERS: Array<{ channel: string; triggerType: string }> = [\n { channel: CHANNELS.FIREBASE_FUNCTIONS_HTTP_REQUEST, triggerType: 'http.request' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_HTTP_CALL, triggerType: 'http.call' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_CREATED, triggerType: 'firestore.document.created' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED, triggerType: 'firestore.document.updated' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_DELETED, triggerType: 'firestore.document.deleted' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN, triggerType: 'firestore.document.written' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_SCHEDULER, triggerType: 'scheduler.scheduled' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_FINALIZED, triggerType: 'storage.object.finalized' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED, triggerType: 'storage.object.archived' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_DELETED, triggerType: 'storage.object.deleted' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED, triggerType: 'storage.object.metadataUpdated' },\n];\n\nconst NOOP = (): void => {};\n\n/**\n * Runs a span-building callback so a throw inside it can never break the user's firebase call: these run\n * inside the `tracingChannel(...)` machinery wrapping the real function, where an unguarded throw would\n * propagate into the traced call.\n */\nfunction safe<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[orchestrion:firebase] error handling channel event', error);\n return undefined;\n }\n}\n\nexport function instrumentFirebase() {\n for (const { channel, spanName, useParent } of FIRESTORE_OPERATIONS) {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<FirestoreChannelContext>(channel), data =>\n safe(() => {\n const reference = data.arguments[0] as FirestoreReference | undefined;\n if (!reference) {\n return undefined;\n }\n const spanReference = useParent ? reference.parent || reference : reference;\n return startFirestoreSpan(spanName, spanReference);\n }),\n );\n }\n\n for (const { channel, triggerType } of FUNCTIONS_TRIGGERS) {\n // Functions are wrapped, not span-bound: the handler runs long after this synchronous\n // registration call, so we only rewrap the handler argument here (in `start`) and open the\n // span inside that wrapper. The other lifecycle events are irrelevant, so no-op them.\n diagnosticsChannel.tracingChannel(channel).subscribe({\n start: data => void safe(() => wrapFunctionsRegistration(data as { arguments: unknown[] }, triggerType)),\n end: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAoBA,MAAM,oBAAA,GAAyF;AAAA,EAC7F,EAAE,OAAA,EAAS,QAAA,CAAS,4BAA4B,QAAA,EAAU,QAAA,EAAU,WAAW,KAAA,EAAM;AAAA,EACrF,EAAE,OAAA,EAAS,QAAA,CAAS,6BAA6B,QAAA,EAAU,SAAA,EAAW,WAAW,KAAA,EAAM;AAAA,EACvF,EAAE,OAAA,EAAS,QAAA,CAAS,4BAA4B,QAAA,EAAU,QAAA,EAAU,WAAW,IAAA,EAAK;AAAA,EACpF,EAAE,OAAA,EAAS,QAAA,CAAS,+BAA+B,QAAA,EAAU,WAAA,EAAa,WAAW,IAAA;AACvF,CAAA;AAIA,MAAM,kBAAA,GAAsE;AAAA,EAC1E,EAAE,OAAA,EAAS,QAAA,CAAS,+BAAA,EAAiC,aAAa,cAAA,EAAe;AAAA,EACjF,EAAE,OAAA,EAAS,QAAA,CAAS,4BAAA,EAA8B,aAAa,WAAA,EAAY;AAAA,EAC3E,EAAE,OAAA,EAAS,QAAA,CAAS,oCAAA,EAAsC,aAAa,4BAAA,EAA6B;AAAA,EACpG,EAAE,OAAA,EAAS,QAAA,CAAS,oCAAA,EAAsC,aAAa,4B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AA,IAAU,SAAA,GAAY,SAAA;AAClE,QAAA,OAAO,kBAAA,CAAmB,UAAU,aAAa,CAAA;AAAA,MACnD,CAAC;AAAA,KACH;AAAA,EACF;AAEA,EAAA,KAAA,MAAW,EAAE,OAAA,EAAS,WAAA,EAAY,IAAK,kBAAA,EAAoB;AAIzD,IAAA,kBAAA,CAAmB,cAAA,CAAe,OAAO,CAAA,CAAE,SAAA,CAAU;AAAA,MACnD,KAAA,EAAO,UAAQ,KAAK,IAAA,CAAK,MAAM,yBAAA,CAA0B,IAAA,EAAkC,WAAW,CAAC,CAAA;AAAA,MACvG,GAAA,EAAK,IAAA;AAAA,MACL,UAAA,EAAY,IAAA;AAAA,MACZ,QAAA,EAAU,IAAA;AAAA,MACV,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,EACH;AACF;;;;"}
@@ -0,0 +1,144 @@
1
+ import * as diagnosticsChannel from 'node:diagnostics_channel';
2
+ import { defineIntegration, debug, getActiveSpan, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getIsolationScope, getDefaultIsolationScope, getRootSpan, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
3
+ import { KOA_NAME, HTTP_ROUTE, KOA_TYPE, CODE_FUNCTION_NAME } from '@sentry/conventions/attributes';
4
+ import { DEBUG_BUILD } from '../../debug-build.js';
5
+ import { CHANNELS } from '../../orchestrion/channels.js';
6
+
7
+ const INTEGRATION_NAME = "Koa";
8
+ const ORIGIN = "auto.http.orchestrion.koa";
9
+ const LAYER_TYPE = {
10
+ ROUTER: "router",
11
+ MIDDLEWARE: "middleware"
12
+ };
13
+ const kLayerPatched = /* @__PURE__ */ Symbol("sentry.koa.layer-patched");
14
+ let subscribed = false;
15
+ const _koaChannelIntegration = ((options = {}) => {
16
+ const ignoreLayersType = options.ignoreLayersType ?? [];
17
+ return {
18
+ name: INTEGRATION_NAME,
19
+ setupOnce() {
20
+ if (!diagnosticsChannel.tracingChannel || subscribed) {
21
+ return;
22
+ }
23
+ subscribed = true;
24
+ DEBUG_BUILD && debug.log(`[orchestrion:koa] subscribing to channel "${CHANNELS.KOA_USE}"`);
25
+ diagnosticsChannel.tracingChannel(CHANNELS.KOA_USE).subscribe({
26
+ start(rawCtx) {
27
+ handleUse(rawCtx, ignoreLayersType);
28
+ },
29
+ end() {
30
+ },
31
+ asyncStart() {
32
+ },
33
+ asyncEnd() {
34
+ },
35
+ error() {
36
+ }
37
+ });
38
+ }
39
+ };
40
+ });
41
+ function handleUse(ctx, ignoreLayersType) {
42
+ const middleware = ctx.arguments[0];
43
+ if (typeof middleware === "function") {
44
+ ctx.arguments[0] = patchUse(middleware, ignoreLayersType);
45
+ }
46
+ }
47
+ function patchUse(middleware, ignoreLayersType) {
48
+ return middleware.router ? patchRouterDispatch(middleware, ignoreLayersType) : patchLayer(middleware, false, ignoreLayersType);
49
+ }
50
+ function patchRouterDispatch(dispatchLayer, ignoreLayersType) {
51
+ const router = dispatchLayer.router;
52
+ const routesStack = router?.stack ?? [];
53
+ for (const pathLayer of routesStack) {
54
+ const path = pathLayer.path;
55
+ const pathStack = pathLayer.stack;
56
+ pathStack.forEach((routedMiddleware, j) => {
57
+ pathStack[j] = patchLayer(routedMiddleware, true, ignoreLayersType, path);
58
+ });
59
+ }
60
+ return dispatchLayer;
61
+ }
62
+ function patchLayer(middlewareLayer, isRouter, ignoreLayersType, layerPath) {
63
+ const layerType = isRouter ? LAYER_TYPE.ROUTER : LAYER_TYPE.MIDDLEWARE;
64
+ if (middlewareLayer[kLayerPatched] === true || ignoreLayersType.includes(layerType)) {
65
+ return middlewareLayer;
66
+ }
67
+ if (middlewareLayer.constructor.name === "GeneratorFunction" || middlewareLayer.constructor.name === "AsyncGeneratorFunction") {
68
+ return middlewareLayer;
69
+ }
70
+ middlewareLayer[kLayerPatched] = true;
71
+ return (context, next) => {
72
+ if (!getActiveSpan()) {
73
+ return middlewareLayer(context, next);
74
+ }
75
+ const metadata = getMiddlewareMetadata(context, middlewareLayer, isRouter, layerPath);
76
+ if (context._matchedRoute) {
77
+ setHttpServerSpanRouteAttribute(context._matchedRoute.toString());
78
+ }
79
+ const koaName = metadata.attributes[KOA_NAME];
80
+ const name = typeof koaName === "string" ? koaName || "< unknown >" : metadata.name;
81
+ return startSpan(
82
+ {
83
+ name,
84
+ op: `${layerType}.koa`,
85
+ attributes: {
86
+ ...metadata.attributes,
87
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
88
+ }
89
+ },
90
+ () => {
91
+ const route = metadata.attributes[HTTP_ROUTE];
92
+ if (getIsolationScope() === getDefaultIsolationScope()) {
93
+ DEBUG_BUILD && debug.warn("Isolation scope is default isolation scope - skipping setting transactionName");
94
+ } else if (route) {
95
+ const method = context.request?.method?.toUpperCase() || "GET";
96
+ getIsolationScope().setTransactionName(`${method} ${route}`);
97
+ }
98
+ return middlewareLayer(context, next);
99
+ }
100
+ );
101
+ };
102
+ }
103
+ function getMiddlewareMetadata(context, layer, isRouter, layerPath) {
104
+ if (isRouter) {
105
+ return {
106
+ attributes: {
107
+ // oxlint-disable-next-line typescript/no-deprecated
108
+ [KOA_NAME]: layerPath?.toString(),
109
+ // TODO(v11): remove, replaced by http.route
110
+ [KOA_TYPE]: LAYER_TYPE.ROUTER,
111
+ [HTTP_ROUTE]: layerPath?.toString()
112
+ },
113
+ name: context._matchedRouteName || `router - ${layerPath}`
114
+ };
115
+ }
116
+ return {
117
+ attributes: {
118
+ // oxlint-disable-next-line typescript/no-deprecated
119
+ [KOA_NAME]: layer.name || "middleware",
120
+ // TODO(v11): remove, replaced by code.function.name
121
+ [KOA_TYPE]: LAYER_TYPE.MIDDLEWARE,
122
+ [CODE_FUNCTION_NAME]: layer.name || "middleware"
123
+ },
124
+ name: `middleware - ${layer.name}`
125
+ };
126
+ }
127
+ function setHttpServerSpanRouteAttribute(route) {
128
+ const activeSpan = getActiveSpan();
129
+ if (!activeSpan) {
130
+ return;
131
+ }
132
+ const rootSpan = getRootSpan(activeSpan);
133
+ if (!rootSpan) {
134
+ return;
135
+ }
136
+ if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== "http.server") {
137
+ return;
138
+ }
139
+ rootSpan.setAttribute(HTTP_ROUTE, route);
140
+ }
141
+ const koaChannelIntegration = defineIntegration(_koaChannelIntegration);
142
+
143
+ export { koaChannelIntegration };
144
+ //# 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":[],"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,MAAA,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,CAAA,0CAAA,EAA6C,QAAA,CAAS,OAAO,CAAA,CAAA,CAAG,CAAA;AAEzF,MAAA,kBAAA,CAAmB,cAAA,CAAe,QAAA,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,QAAA,GAAW;AAAA,QAAC,CAAA;AAAA,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