@depup/sentry__node 10.44.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/build/cjs/debug-build.js +11 -0
  4. package/build/cjs/debug-build.js.map +1 -0
  5. package/build/cjs/index.js +216 -0
  6. package/build/cjs/index.js.map +1 -0
  7. package/build/cjs/init.js +10 -0
  8. package/build/cjs/init.js.map +1 -0
  9. package/build/cjs/integrations/featureFlagShims/growthbook.js +12 -0
  10. package/build/cjs/integrations/featureFlagShims/growthbook.js.map +1 -0
  11. package/build/cjs/integrations/featureFlagShims/launchDarkly.js +43 -0
  12. package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -0
  13. package/build/cjs/integrations/featureFlagShims/openFeature.js +55 -0
  14. package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -0
  15. package/build/cjs/integrations/featureFlagShims/statsig.js +23 -0
  16. package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -0
  17. package/build/cjs/integrations/featureFlagShims/unleash.js +23 -0
  18. package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -0
  19. package/build/cjs/integrations/fs.js +142 -0
  20. package/build/cjs/integrations/fs.js.map +1 -0
  21. package/build/cjs/integrations/http.js +224 -0
  22. package/build/cjs/integrations/http.js.map +1 -0
  23. package/build/cjs/integrations/node-fetch.js +108 -0
  24. package/build/cjs/integrations/node-fetch.js.map +1 -0
  25. package/build/cjs/integrations/tracing/amqplib.js +47 -0
  26. package/build/cjs/integrations/tracing/amqplib.js.map +1 -0
  27. package/build/cjs/integrations/tracing/anthropic-ai/index.js +79 -0
  28. package/build/cjs/integrations/tracing/anthropic-ai/index.js.map +1 -0
  29. package/build/cjs/integrations/tracing/anthropic-ai/instrumentation.js +95 -0
  30. package/build/cjs/integrations/tracing/anthropic-ai/instrumentation.js.map +1 -0
  31. package/build/cjs/integrations/tracing/connect.js +110 -0
  32. package/build/cjs/integrations/tracing/connect.js.map +1 -0
  33. package/build/cjs/integrations/tracing/dataloader.js +72 -0
  34. package/build/cjs/integrations/tracing/dataloader.js.map +1 -0
  35. package/build/cjs/integrations/tracing/express.js +166 -0
  36. package/build/cjs/integrations/tracing/express.js.map +1 -0
  37. package/build/cjs/integrations/tracing/fastify/index.js +270 -0
  38. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -0
  39. package/build/cjs/integrations/tracing/fastify/v3/constants.js +23 -0
  40. package/build/cjs/integrations/tracing/fastify/v3/constants.js.map +1 -0
  41. package/build/cjs/integrations/tracing/fastify/v3/enums/AttributeNames.js +37 -0
  42. package/build/cjs/integrations/tracing/fastify/v3/enums/AttributeNames.js.map +1 -0
  43. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +304 -0
  44. package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -0
  45. package/build/cjs/integrations/tracing/fastify/v3/utils.js +135 -0
  46. package/build/cjs/integrations/tracing/fastify/v3/utils.js.map +1 -0
  47. package/build/cjs/integrations/tracing/firebase/firebase.js +50 -0
  48. package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -0
  49. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js +44 -0
  50. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -0
  51. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +297 -0
  52. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -0
  53. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +265 -0
  54. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -0
  55. package/build/cjs/integrations/tracing/genericPool.js +59 -0
  56. package/build/cjs/integrations/tracing/genericPool.js.map +1 -0
  57. package/build/cjs/integrations/tracing/google-genai/index.js +78 -0
  58. package/build/cjs/integrations/tracing/google-genai/index.js.map +1 -0
  59. package/build/cjs/integrations/tracing/google-genai/instrumentation.js +88 -0
  60. package/build/cjs/integrations/tracing/google-genai/instrumentation.js.map +1 -0
  61. package/build/cjs/integrations/tracing/graphql.js +127 -0
  62. package/build/cjs/integrations/tracing/graphql.js.map +1 -0
  63. package/build/cjs/integrations/tracing/hapi/index.js +135 -0
  64. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -0
  65. package/build/cjs/integrations/tracing/hono/constants.js +15 -0
  66. package/build/cjs/integrations/tracing/hono/constants.js.map +1 -0
  67. package/build/cjs/integrations/tracing/hono/index.js +137 -0
  68. package/build/cjs/integrations/tracing/hono/index.js.map +1 -0
  69. package/build/cjs/integrations/tracing/hono/instrumentation.js +236 -0
  70. package/build/cjs/integrations/tracing/hono/instrumentation.js.map +1 -0
  71. package/build/cjs/integrations/tracing/index.js +110 -0
  72. package/build/cjs/integrations/tracing/index.js.map +1 -0
  73. package/build/cjs/integrations/tracing/kafka.js +48 -0
  74. package/build/cjs/integrations/tracing/kafka.js.map +1 -0
  75. package/build/cjs/integrations/tracing/knex.js +57 -0
  76. package/build/cjs/integrations/tracing/knex.js.map +1 -0
  77. package/build/cjs/integrations/tracing/koa.js +138 -0
  78. package/build/cjs/integrations/tracing/koa.js.map +1 -0
  79. package/build/cjs/integrations/tracing/langchain/index.js +116 -0
  80. package/build/cjs/integrations/tracing/langchain/index.js.map +1 -0
  81. package/build/cjs/integrations/tracing/langchain/instrumentation.js +220 -0
  82. package/build/cjs/integrations/tracing/langchain/instrumentation.js.map +1 -0
  83. package/build/cjs/integrations/tracing/langgraph/index.js +93 -0
  84. package/build/cjs/integrations/tracing/langgraph/index.js.map +1 -0
  85. package/build/cjs/integrations/tracing/langgraph/instrumentation.js +60 -0
  86. package/build/cjs/integrations/tracing/langgraph/instrumentation.js.map +1 -0
  87. package/build/cjs/integrations/tracing/lrumemoizer.js +37 -0
  88. package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -0
  89. package/build/cjs/integrations/tracing/mongo.js +93 -0
  90. package/build/cjs/integrations/tracing/mongo.js.map +1 -0
  91. package/build/cjs/integrations/tracing/mongoose.js +46 -0
  92. package/build/cjs/integrations/tracing/mongoose.js.map +1 -0
  93. package/build/cjs/integrations/tracing/mysql.js +38 -0
  94. package/build/cjs/integrations/tracing/mysql.js.map +1 -0
  95. package/build/cjs/integrations/tracing/mysql2.js +46 -0
  96. package/build/cjs/integrations/tracing/mysql2.js.map +1 -0
  97. package/build/cjs/integrations/tracing/openai/index.js +78 -0
  98. package/build/cjs/integrations/tracing/openai/index.js.map +1 -0
  99. package/build/cjs/integrations/tracing/openai/instrumentation.js +104 -0
  100. package/build/cjs/integrations/tracing/openai/instrumentation.js.map +1 -0
  101. package/build/cjs/integrations/tracing/postgres.js +48 -0
  102. package/build/cjs/integrations/tracing/postgres.js.map +1 -0
  103. package/build/cjs/integrations/tracing/postgresjs.js +378 -0
  104. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -0
  105. package/build/cjs/integrations/tracing/prisma.js +203 -0
  106. package/build/cjs/integrations/tracing/prisma.js.map +1 -0
  107. package/build/cjs/integrations/tracing/redis.js +121 -0
  108. package/build/cjs/integrations/tracing/redis.js.map +1 -0
  109. package/build/cjs/integrations/tracing/tedious.js +67 -0
  110. package/build/cjs/integrations/tracing/tedious.js.map +1 -0
  111. package/build/cjs/integrations/tracing/vercelai/constants.js +6 -0
  112. package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -0
  113. package/build/cjs/integrations/tracing/vercelai/index.js +82 -0
  114. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -0
  115. package/build/cjs/integrations/tracing/vercelai/instrumentation.js +274 -0
  116. package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -0
  117. package/build/cjs/preload.js +21 -0
  118. package/build/cjs/preload.js.map +1 -0
  119. package/build/cjs/sdk/index.js +78 -0
  120. package/build/cjs/sdk/index.js.map +1 -0
  121. package/build/cjs/sdk/initOtel.js +126 -0
  122. package/build/cjs/sdk/initOtel.js.map +1 -0
  123. package/build/cjs/utils/redisCache.js +122 -0
  124. package/build/cjs/utils/redisCache.js.map +1 -0
  125. package/build/esm/debug-build.js +9 -0
  126. package/build/esm/debug-build.js.map +1 -0
  127. package/build/esm/index.js +44 -0
  128. package/build/esm/index.js.map +1 -0
  129. package/build/esm/init.js +10 -0
  130. package/build/esm/init.js.map +1 -0
  131. package/build/esm/integrations/featureFlagShims/growthbook.js +10 -0
  132. package/build/esm/integrations/featureFlagShims/growthbook.js.map +1 -0
  133. package/build/esm/integrations/featureFlagShims/launchDarkly.js +40 -0
  134. package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -0
  135. package/build/esm/integrations/featureFlagShims/openFeature.js +52 -0
  136. package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -0
  137. package/build/esm/integrations/featureFlagShims/statsig.js +21 -0
  138. package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -0
  139. package/build/esm/integrations/featureFlagShims/unleash.js +21 -0
  140. package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -0
  141. package/build/esm/integrations/fs.js +140 -0
  142. package/build/esm/integrations/fs.js.map +1 -0
  143. package/build/esm/integrations/http.js +219 -0
  144. package/build/esm/integrations/http.js.map +1 -0
  145. package/build/esm/integrations/node-fetch.js +105 -0
  146. package/build/esm/integrations/node-fetch.js.map +1 -0
  147. package/build/esm/integrations/tracing/amqplib.js +44 -0
  148. package/build/esm/integrations/tracing/amqplib.js.map +1 -0
  149. package/build/esm/integrations/tracing/anthropic-ai/index.js +76 -0
  150. package/build/esm/integrations/tracing/anthropic-ai/index.js.map +1 -0
  151. package/build/esm/integrations/tracing/anthropic-ai/instrumentation.js +93 -0
  152. package/build/esm/integrations/tracing/anthropic-ai/instrumentation.js.map +1 -0
  153. package/build/esm/integrations/tracing/connect.js +106 -0
  154. package/build/esm/integrations/tracing/connect.js.map +1 -0
  155. package/build/esm/integrations/tracing/dataloader.js +69 -0
  156. package/build/esm/integrations/tracing/dataloader.js.map +1 -0
  157. package/build/esm/integrations/tracing/express.js +161 -0
  158. package/build/esm/integrations/tracing/express.js.map +1 -0
  159. package/build/esm/integrations/tracing/fastify/index.js +265 -0
  160. package/build/esm/integrations/tracing/fastify/index.js.map +1 -0
  161. package/build/esm/integrations/tracing/fastify/v3/constants.js +21 -0
  162. package/build/esm/integrations/tracing/fastify/v3/constants.js.map +1 -0
  163. package/build/esm/integrations/tracing/fastify/v3/enums/AttributeNames.js +37 -0
  164. package/build/esm/integrations/tracing/fastify/v3/enums/AttributeNames.js.map +1 -0
  165. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +302 -0
  166. package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -0
  167. package/build/esm/integrations/tracing/fastify/v3/utils.js +131 -0
  168. package/build/esm/integrations/tracing/fastify/v3/utils.js.map +1 -0
  169. package/build/esm/integrations/tracing/firebase/firebase.js +47 -0
  170. package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -0
  171. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js +42 -0
  172. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -0
  173. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +294 -0
  174. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -0
  175. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +262 -0
  176. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -0
  177. package/build/esm/integrations/tracing/genericPool.js +56 -0
  178. package/build/esm/integrations/tracing/genericPool.js.map +1 -0
  179. package/build/esm/integrations/tracing/google-genai/index.js +75 -0
  180. package/build/esm/integrations/tracing/google-genai/index.js.map +1 -0
  181. package/build/esm/integrations/tracing/google-genai/instrumentation.js +86 -0
  182. package/build/esm/integrations/tracing/google-genai/instrumentation.js.map +1 -0
  183. package/build/esm/integrations/tracing/graphql.js +124 -0
  184. package/build/esm/integrations/tracing/graphql.js.map +1 -0
  185. package/build/esm/integrations/tracing/hapi/index.js +130 -0
  186. package/build/esm/integrations/tracing/hapi/index.js.map +1 -0
  187. package/build/esm/integrations/tracing/hono/constants.js +12 -0
  188. package/build/esm/integrations/tracing/hono/constants.js.map +1 -0
  189. package/build/esm/integrations/tracing/hono/index.js +133 -0
  190. package/build/esm/integrations/tracing/hono/index.js.map +1 -0
  191. package/build/esm/integrations/tracing/hono/instrumentation.js +234 -0
  192. package/build/esm/integrations/tracing/hono/instrumentation.js.map +1 -0
  193. package/build/esm/integrations/tracing/index.js +107 -0
  194. package/build/esm/integrations/tracing/index.js.map +1 -0
  195. package/build/esm/integrations/tracing/kafka.js +45 -0
  196. package/build/esm/integrations/tracing/kafka.js.map +1 -0
  197. package/build/esm/integrations/tracing/knex.js +54 -0
  198. package/build/esm/integrations/tracing/knex.js.map +1 -0
  199. package/build/esm/integrations/tracing/koa.js +134 -0
  200. package/build/esm/integrations/tracing/koa.js.map +1 -0
  201. package/build/esm/integrations/tracing/langchain/index.js +113 -0
  202. package/build/esm/integrations/tracing/langchain/index.js.map +1 -0
  203. package/build/esm/integrations/tracing/langchain/instrumentation.js +218 -0
  204. package/build/esm/integrations/tracing/langchain/instrumentation.js.map +1 -0
  205. package/build/esm/integrations/tracing/langgraph/index.js +90 -0
  206. package/build/esm/integrations/tracing/langgraph/index.js.map +1 -0
  207. package/build/esm/integrations/tracing/langgraph/instrumentation.js +58 -0
  208. package/build/esm/integrations/tracing/langgraph/instrumentation.js.map +1 -0
  209. package/build/esm/integrations/tracing/lrumemoizer.js +34 -0
  210. package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -0
  211. package/build/esm/integrations/tracing/mongo.js +89 -0
  212. package/build/esm/integrations/tracing/mongo.js.map +1 -0
  213. package/build/esm/integrations/tracing/mongoose.js +43 -0
  214. package/build/esm/integrations/tracing/mongoose.js.map +1 -0
  215. package/build/esm/integrations/tracing/mysql.js +35 -0
  216. package/build/esm/integrations/tracing/mysql.js.map +1 -0
  217. package/build/esm/integrations/tracing/mysql2.js +43 -0
  218. package/build/esm/integrations/tracing/mysql2.js.map +1 -0
  219. package/build/esm/integrations/tracing/openai/index.js +75 -0
  220. package/build/esm/integrations/tracing/openai/index.js.map +1 -0
  221. package/build/esm/integrations/tracing/openai/instrumentation.js +102 -0
  222. package/build/esm/integrations/tracing/openai/instrumentation.js.map +1 -0
  223. package/build/esm/integrations/tracing/postgres.js +45 -0
  224. package/build/esm/integrations/tracing/postgres.js.map +1 -0
  225. package/build/esm/integrations/tracing/postgresjs.js +374 -0
  226. package/build/esm/integrations/tracing/postgresjs.js.map +1 -0
  227. package/build/esm/integrations/tracing/prisma.js +200 -0
  228. package/build/esm/integrations/tracing/prisma.js.map +1 -0
  229. package/build/esm/integrations/tracing/redis.js +117 -0
  230. package/build/esm/integrations/tracing/redis.js.map +1 -0
  231. package/build/esm/integrations/tracing/tedious.js +64 -0
  232. package/build/esm/integrations/tracing/tedious.js.map +1 -0
  233. package/build/esm/integrations/tracing/vercelai/constants.js +4 -0
  234. package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -0
  235. package/build/esm/integrations/tracing/vercelai/index.js +79 -0
  236. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -0
  237. package/build/esm/integrations/tracing/vercelai/instrumentation.js +269 -0
  238. package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -0
  239. package/build/esm/package.json +1 -0
  240. package/build/esm/preload.js +21 -0
  241. package/build/esm/preload.js.map +1 -0
  242. package/build/esm/sdk/index.js +73 -0
  243. package/build/esm/sdk/index.js.map +1 -0
  244. package/build/esm/sdk/initOtel.js +121 -0
  245. package/build/esm/sdk/initOtel.js.map +1 -0
  246. package/build/esm/utils/redisCache.js +114 -0
  247. package/build/esm/utils/redisCache.js.map +1 -0
  248. package/build/import-hook.mjs +5 -0
  249. package/build/loader-hook.mjs +1 -0
  250. package/build/types/debug-build.d.ts +7 -0
  251. package/build/types/debug-build.d.ts.map +1 -0
  252. package/build/types/index.d.ts +42 -0
  253. package/build/types/index.d.ts.map +1 -0
  254. package/build/types/init.d.ts +2 -0
  255. package/build/types/init.d.ts.map +1 -0
  256. package/build/types/integrations/featureFlagShims/growthbook.d.ts +6 -0
  257. package/build/types/integrations/featureFlagShims/growthbook.d.ts.map +1 -0
  258. package/build/types/integrations/featureFlagShims/index.d.ts +6 -0
  259. package/build/types/integrations/featureFlagShims/index.d.ts.map +1 -0
  260. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +10 -0
  261. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -0
  262. package/build/types/integrations/featureFlagShims/openFeature.d.ts +23 -0
  263. package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -0
  264. package/build/types/integrations/featureFlagShims/statsig.d.ts +6 -0
  265. package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -0
  266. package/build/types/integrations/featureFlagShims/unleash.d.ts +6 -0
  267. package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -0
  268. package/build/types/integrations/fs.d.ts +24 -0
  269. package/build/types/integrations/fs.d.ts.map +1 -0
  270. package/build/types/integrations/http.d.ts +136 -0
  271. package/build/types/integrations/http.d.ts.map +1 -0
  272. package/build/types/integrations/node-fetch.d.ts +36 -0
  273. package/build/types/integrations/node-fetch.d.ts.map +1 -0
  274. package/build/types/integrations/tracing/amqplib.d.ts +20 -0
  275. package/build/types/integrations/tracing/amqplib.d.ts.map +1 -0
  276. package/build/types/integrations/tracing/anthropic-ai/index.d.ts +59 -0
  277. package/build/types/integrations/tracing/anthropic-ai/index.d.ts.map +1 -0
  278. package/build/types/integrations/tracing/anthropic-ai/instrumentation.d.ts +19 -0
  279. package/build/types/integrations/tracing/anthropic-ai/instrumentation.d.ts.map +1 -0
  280. package/build/types/integrations/tracing/connect.d.ts +46 -0
  281. package/build/types/integrations/tracing/connect.d.ts.map +1 -0
  282. package/build/types/integrations/tracing/dataloader.d.ts +20 -0
  283. package/build/types/integrations/tracing/dataloader.d.ts.map +1 -0
  284. package/build/types/integrations/tracing/express.d.ts +72 -0
  285. package/build/types/integrations/tracing/express.d.ts.map +1 -0
  286. package/build/types/integrations/tracing/fastify/index.d.ts +119 -0
  287. package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -0
  288. package/build/types/integrations/tracing/fastify/types.d.ts +33 -0
  289. package/build/types/integrations/tracing/fastify/types.d.ts.map +1 -0
  290. package/build/types/integrations/tracing/fastify/v3/constants.d.ts +3 -0
  291. package/build/types/integrations/tracing/fastify/v3/constants.d.ts.map +1 -0
  292. package/build/types/integrations/tracing/fastify/v3/enums/AttributeNames.d.ts +15 -0
  293. package/build/types/integrations/tracing/fastify/v3/enums/AttributeNames.d.ts.map +1 -0
  294. package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts +16 -0
  295. package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -0
  296. package/build/types/integrations/tracing/fastify/v3/internal-types.d.ts +7 -0
  297. package/build/types/integrations/tracing/fastify/v3/internal-types.d.ts.map +1 -0
  298. package/build/types/integrations/tracing/fastify/v3/types.d.ts +21 -0
  299. package/build/types/integrations/tracing/fastify/v3/types.d.ts.map +1 -0
  300. package/build/types/integrations/tracing/fastify/v3/utils.d.ts +28 -0
  301. package/build/types/integrations/tracing/fastify/v3/utils.d.ts.map +1 -0
  302. package/build/types/integrations/tracing/firebase/firebase.d.ts +6 -0
  303. package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -0
  304. package/build/types/integrations/tracing/firebase/index.d.ts +2 -0
  305. package/build/types/integrations/tracing/firebase/index.d.ts.map +1 -0
  306. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts +19 -0
  307. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts.map +1 -0
  308. package/build/types/integrations/tracing/firebase/otel/index.d.ts +3 -0
  309. package/build/types/integrations/tracing/firebase/otel/index.d.ts.map +1 -0
  310. package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts +25 -0
  311. package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts.map +1 -0
  312. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts +23 -0
  313. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts.map +1 -0
  314. package/build/types/integrations/tracing/firebase/otel/types.d.ts +120 -0
  315. package/build/types/integrations/tracing/firebase/otel/types.d.ts.map +1 -0
  316. package/build/types/integrations/tracing/genericPool.d.ts +20 -0
  317. package/build/types/integrations/tracing/genericPool.d.ts.map +1 -0
  318. package/build/types/integrations/tracing/google-genai/index.d.ts +59 -0
  319. package/build/types/integrations/tracing/google-genai/index.d.ts.map +1 -0
  320. package/build/types/integrations/tracing/google-genai/instrumentation.d.ts +20 -0
  321. package/build/types/integrations/tracing/google-genai/instrumentation.d.ts.map +1 -0
  322. package/build/types/integrations/tracing/graphql.d.ts +48 -0
  323. package/build/types/integrations/tracing/graphql.d.ts.map +1 -0
  324. package/build/types/integrations/tracing/hapi/index.d.ts +50 -0
  325. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -0
  326. package/build/types/integrations/tracing/hapi/types.d.ts +166 -0
  327. package/build/types/integrations/tracing/hapi/types.d.ts.map +1 -0
  328. package/build/types/integrations/tracing/hono/constants.d.ts +11 -0
  329. package/build/types/integrations/tracing/hono/constants.d.ts.map +1 -0
  330. package/build/types/integrations/tracing/hono/index.d.ts +52 -0
  331. package/build/types/integrations/tracing/hono/index.d.ts.map +1 -0
  332. package/build/types/integrations/tracing/hono/instrumentation.d.ts +55 -0
  333. package/build/types/integrations/tracing/hono/instrumentation.d.ts.map +1 -0
  334. package/build/types/integrations/tracing/hono/types.d.ts +36 -0
  335. package/build/types/integrations/tracing/hono/types.d.ts.map +1 -0
  336. package/build/types/integrations/tracing/index.d.ts +12 -0
  337. package/build/types/integrations/tracing/index.d.ts.map +1 -0
  338. package/build/types/integrations/tracing/kafka.d.ts +19 -0
  339. package/build/types/integrations/tracing/kafka.d.ts.map +1 -0
  340. package/build/types/integrations/tracing/knex.d.ts +20 -0
  341. package/build/types/integrations/tracing/knex.d.ts.map +1 -0
  342. package/build/types/integrations/tracing/koa.d.ts +70 -0
  343. package/build/types/integrations/tracing/koa.d.ts.map +1 -0
  344. package/build/types/integrations/tracing/langchain/index.d.ts +97 -0
  345. package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -0
  346. package/build/types/integrations/tracing/langchain/instrumentation.d.ts +29 -0
  347. package/build/types/integrations/tracing/langchain/instrumentation.d.ts.map +1 -0
  348. package/build/types/integrations/tracing/langgraph/index.d.ts +74 -0
  349. package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -0
  350. package/build/types/integrations/tracing/langgraph/instrumentation.d.ts +19 -0
  351. package/build/types/integrations/tracing/langgraph/instrumentation.d.ts.map +1 -0
  352. package/build/types/integrations/tracing/lrumemoizer.d.ts +19 -0
  353. package/build/types/integrations/tracing/lrumemoizer.d.ts.map +1 -0
  354. package/build/types/integrations/tracing/mongo.d.ts +24 -0
  355. package/build/types/integrations/tracing/mongo.d.ts.map +1 -0
  356. package/build/types/integrations/tracing/mongoose.d.ts +20 -0
  357. package/build/types/integrations/tracing/mongoose.d.ts.map +1 -0
  358. package/build/types/integrations/tracing/mysql.d.ts +20 -0
  359. package/build/types/integrations/tracing/mysql.d.ts.map +1 -0
  360. package/build/types/integrations/tracing/mysql2.d.ts +20 -0
  361. package/build/types/integrations/tracing/mysql2.d.ts.map +1 -0
  362. package/build/types/integrations/tracing/openai/index.d.ts +59 -0
  363. package/build/types/integrations/tracing/openai/index.d.ts.map +1 -0
  364. package/build/types/integrations/tracing/openai/instrumentation.d.ts +26 -0
  365. package/build/types/integrations/tracing/openai/instrumentation.d.ts.map +1 -0
  366. package/build/types/integrations/tracing/postgres.d.ts +24 -0
  367. package/build/types/integrations/tracing/postgres.d.ts.map +1 -0
  368. package/build/types/integrations/tracing/postgresjs.d.ts +101 -0
  369. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -0
  370. package/build/types/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts +38 -0
  371. package/build/types/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts.map +1 -0
  372. package/build/types/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts +31 -0
  373. package/build/types/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts.map +1 -0
  374. package/build/types/integrations/tracing/prisma.d.ts +50 -0
  375. package/build/types/integrations/tracing/prisma.d.ts.map +1 -0
  376. package/build/types/integrations/tracing/redis.d.ts +41 -0
  377. package/build/types/integrations/tracing/redis.d.ts.map +1 -0
  378. package/build/types/integrations/tracing/tedious.d.ts +20 -0
  379. package/build/types/integrations/tracing/tedious.d.ts.map +1 -0
  380. package/build/types/integrations/tracing/vercelai/constants.d.ts +2 -0
  381. package/build/types/integrations/tracing/vercelai/constants.d.ts.map +1 -0
  382. package/build/types/integrations/tracing/vercelai/index.d.ts +43 -0
  383. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -0
  384. package/build/types/integrations/tracing/vercelai/instrumentation.d.ts +56 -0
  385. package/build/types/integrations/tracing/vercelai/instrumentation.d.ts.map +1 -0
  386. package/build/types/integrations/tracing/vercelai/types.d.ts +59 -0
  387. package/build/types/integrations/tracing/vercelai/types.d.ts.map +1 -0
  388. package/build/types/preload.d.ts +2 -0
  389. package/build/types/preload.d.ts.map +1 -0
  390. package/build/types/sdk/index.d.ts +18 -0
  391. package/build/types/sdk/index.d.ts.map +1 -0
  392. package/build/types/sdk/initOtel.d.ts +28 -0
  393. package/build/types/sdk/initOtel.d.ts.map +1 -0
  394. package/build/types/types.d.ts +89 -0
  395. package/build/types/types.d.ts.map +1 -0
  396. package/build/types/utils/redisCache.d.ts +16 -0
  397. package/build/types/utils/redisCache.d.ts.map +1 -0
  398. package/build/types-ts3.8/debug-build.d.ts +7 -0
  399. package/build/types-ts3.8/index.d.ts +42 -0
  400. package/build/types-ts3.8/init.d.ts +2 -0
  401. package/build/types-ts3.8/integrations/featureFlagShims/growthbook.d.ts +6 -0
  402. package/build/types-ts3.8/integrations/featureFlagShims/index.d.ts +6 -0
  403. package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +10 -0
  404. package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +23 -0
  405. package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +6 -0
  406. package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +6 -0
  407. package/build/types-ts3.8/integrations/fs.d.ts +24 -0
  408. package/build/types-ts3.8/integrations/http.d.ts +139 -0
  409. package/build/types-ts3.8/integrations/node-fetch.d.ts +36 -0
  410. package/build/types-ts3.8/integrations/tracing/amqplib.d.ts +20 -0
  411. package/build/types-ts3.8/integrations/tracing/anthropic-ai/index.d.ts +59 -0
  412. package/build/types-ts3.8/integrations/tracing/anthropic-ai/instrumentation.d.ts +19 -0
  413. package/build/types-ts3.8/integrations/tracing/connect.d.ts +46 -0
  414. package/build/types-ts3.8/integrations/tracing/dataloader.d.ts +20 -0
  415. package/build/types-ts3.8/integrations/tracing/express.d.ts +72 -0
  416. package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +119 -0
  417. package/build/types-ts3.8/integrations/tracing/fastify/types.d.ts +33 -0
  418. package/build/types-ts3.8/integrations/tracing/fastify/v3/constants.d.ts +3 -0
  419. package/build/types-ts3.8/integrations/tracing/fastify/v3/enums/AttributeNames.d.ts +15 -0
  420. package/build/types-ts3.8/integrations/tracing/fastify/v3/instrumentation.d.ts +16 -0
  421. package/build/types-ts3.8/integrations/tracing/fastify/v3/internal-types.d.ts +7 -0
  422. package/build/types-ts3.8/integrations/tracing/fastify/v3/types.d.ts +21 -0
  423. package/build/types-ts3.8/integrations/tracing/fastify/v3/utils.d.ts +28 -0
  424. package/build/types-ts3.8/integrations/tracing/firebase/firebase.d.ts +6 -0
  425. package/build/types-ts3.8/integrations/tracing/firebase/index.d.ts +2 -0
  426. package/build/types-ts3.8/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts +19 -0
  427. package/build/types-ts3.8/integrations/tracing/firebase/otel/index.d.ts +3 -0
  428. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/firestore.d.ts +25 -0
  429. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/functions.d.ts +23 -0
  430. package/build/types-ts3.8/integrations/tracing/firebase/otel/types.d.ts +120 -0
  431. package/build/types-ts3.8/integrations/tracing/genericPool.d.ts +20 -0
  432. package/build/types-ts3.8/integrations/tracing/google-genai/index.d.ts +59 -0
  433. package/build/types-ts3.8/integrations/tracing/google-genai/instrumentation.d.ts +20 -0
  434. package/build/types-ts3.8/integrations/tracing/graphql.d.ts +48 -0
  435. package/build/types-ts3.8/integrations/tracing/hapi/index.d.ts +50 -0
  436. package/build/types-ts3.8/integrations/tracing/hapi/types.d.ts +166 -0
  437. package/build/types-ts3.8/integrations/tracing/hono/constants.d.ts +11 -0
  438. package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +52 -0
  439. package/build/types-ts3.8/integrations/tracing/hono/instrumentation.d.ts +55 -0
  440. package/build/types-ts3.8/integrations/tracing/hono/types.d.ts +36 -0
  441. package/build/types-ts3.8/integrations/tracing/index.d.ts +12 -0
  442. package/build/types-ts3.8/integrations/tracing/kafka.d.ts +19 -0
  443. package/build/types-ts3.8/integrations/tracing/knex.d.ts +20 -0
  444. package/build/types-ts3.8/integrations/tracing/koa.d.ts +70 -0
  445. package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +97 -0
  446. package/build/types-ts3.8/integrations/tracing/langchain/instrumentation.d.ts +29 -0
  447. package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +74 -0
  448. package/build/types-ts3.8/integrations/tracing/langgraph/instrumentation.d.ts +19 -0
  449. package/build/types-ts3.8/integrations/tracing/lrumemoizer.d.ts +19 -0
  450. package/build/types-ts3.8/integrations/tracing/mongo.d.ts +24 -0
  451. package/build/types-ts3.8/integrations/tracing/mongoose.d.ts +20 -0
  452. package/build/types-ts3.8/integrations/tracing/mysql.d.ts +20 -0
  453. package/build/types-ts3.8/integrations/tracing/mysql2.d.ts +20 -0
  454. package/build/types-ts3.8/integrations/tracing/openai/index.d.ts +59 -0
  455. package/build/types-ts3.8/integrations/tracing/openai/instrumentation.d.ts +26 -0
  456. package/build/types-ts3.8/integrations/tracing/postgres.d.ts +24 -0
  457. package/build/types-ts3.8/integrations/tracing/postgresjs.d.ts +101 -0
  458. package/build/types-ts3.8/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts +44 -0
  459. package/build/types-ts3.8/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts +34 -0
  460. package/build/types-ts3.8/integrations/tracing/prisma.d.ts +50 -0
  461. package/build/types-ts3.8/integrations/tracing/redis.d.ts +41 -0
  462. package/build/types-ts3.8/integrations/tracing/tedious.d.ts +20 -0
  463. package/build/types-ts3.8/integrations/tracing/vercelai/constants.d.ts +2 -0
  464. package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +43 -0
  465. package/build/types-ts3.8/integrations/tracing/vercelai/instrumentation.d.ts +56 -0
  466. package/build/types-ts3.8/integrations/tracing/vercelai/types.d.ts +59 -0
  467. package/build/types-ts3.8/preload.d.ts +2 -0
  468. package/build/types-ts3.8/sdk/index.d.ts +18 -0
  469. package/build/types-ts3.8/sdk/initOtel.d.ts +31 -0
  470. package/build/types-ts3.8/types.d.ts +89 -0
  471. package/build/types-ts3.8/utils/redisCache.d.ts +16 -0
  472. package/changes.json +10 -0
  473. package/package.json +150 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/fastify/v3/instrumentation.ts"],"sourcesContent":["// Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/407f61591ba69a39a6908264379d4d98a48dbec4/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-this-alias */\n/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Attributes, context, SpanStatusCode, trace } from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport type { Span } from '@sentry/core';\nimport {\n getClient,\n getIsolationScope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport type {\n FastifyErrorCodes,\n FastifyInstance,\n FastifyReply,\n FastifyRequest,\n HandlerOriginal,\n HookHandlerDoneFunction,\n} from '../types';\nimport { AttributeNames, FastifyNames, FastifyTypes } from './enums/AttributeNames';\nimport type { PluginFastifyReply } from './internal-types';\nimport type { FastifyInstrumentationConfig } from './types';\nimport { endSpan, safeExecuteInTheMiddleMaybePromise, startSpan } from './utils';\n/** @knipignore */\n\nconst PACKAGE_VERSION = '0.1.0';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-fastify-v3';\nconst ANONYMOUS_NAME = 'anonymous';\n\n// The instrumentation creates a span for invocations of lifecycle hook handlers\n// that take `(request, reply, ...[, done])` arguments. Currently this is all\n// lifecycle hooks except `onRequestAbort`.\n// https://fastify.dev/docs/latest/Reference/Hooks\nconst hooksNamesToWrap = new Set([\n 'onTimeout',\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preSerialization',\n 'preHandler',\n 'onSend',\n 'onResponse',\n 'onError',\n]);\n\n/**\n * Fastify instrumentation for OpenTelemetry\n */\nexport class FastifyInstrumentationV3 extends InstrumentationBase<FastifyInstrumentationConfig> {\n public constructor(config: FastifyInstrumentationConfig = {}) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n }\n\n public init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition('fastify', ['>=3.0.0 <4'], moduleExports => {\n return this._patchConstructor(moduleExports);\n }),\n ];\n }\n\n private _hookOnRequest() {\n const instrumentation = this;\n\n return function onRequest(request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) {\n if (!instrumentation.isEnabled()) {\n return done();\n }\n instrumentation._wrap(reply, 'send', instrumentation._patchSend());\n\n const anyRequest = request as any;\n\n const rpcMetadata = getRPCMetadata(context.active());\n const routeName = anyRequest.routeOptions\n ? anyRequest.routeOptions.url // since fastify@4.10.0\n : request.routerPath;\n if (routeName && rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = routeName;\n }\n\n const method = request.method || 'GET';\n\n getIsolationScope().setTransactionName(`${method} ${routeName}`);\n done();\n };\n }\n\n private _wrapHandler(\n pluginName: string,\n hookName: string,\n original: HandlerOriginal,\n syncFunctionWithDone: boolean,\n ): () => Promise<unknown> {\n const instrumentation = this;\n this._diag.debug('Patching fastify route.handler function');\n\n return function (this: any, ...args: unknown[]): Promise<unknown> {\n if (!instrumentation.isEnabled()) {\n return original.apply(this, args);\n }\n\n const name = original.name || pluginName || ANONYMOUS_NAME;\n const spanName = `${FastifyNames.MIDDLEWARE} - ${name}`;\n\n const reply = args[1] as PluginFastifyReply;\n\n const span = startSpan(reply, instrumentation.tracer, spanName, {\n [AttributeNames.FASTIFY_TYPE]: FastifyTypes.MIDDLEWARE,\n [AttributeNames.PLUGIN_NAME]: pluginName,\n [AttributeNames.HOOK_NAME]: hookName,\n });\n\n const origDone = syncFunctionWithDone && (args[args.length - 1] as HookHandlerDoneFunction);\n if (origDone) {\n args[args.length - 1] = function (...doneArgs: Parameters<HookHandlerDoneFunction>) {\n endSpan(reply);\n origDone.apply(this, doneArgs);\n };\n }\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddleMaybePromise(\n () => {\n return original.apply(this, args);\n },\n err => {\n if (err instanceof Error) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n // async hooks should end the span as soon as the promise is resolved\n if (!syncFunctionWithDone) {\n endSpan(reply);\n }\n },\n );\n });\n };\n }\n\n private _wrapAddHook(): (original: FastifyInstance['addHook']) => () => FastifyInstance {\n const instrumentation = this;\n this._diag.debug('Patching fastify server.addHook function');\n\n // biome-ignore lint/complexity/useArrowFunction: <explanation>\n return function (original: FastifyInstance['addHook']): () => FastifyInstance {\n return function wrappedAddHook(this: any, ...args: any) {\n const name = args[0] as string;\n const handler = args[1] as HandlerOriginal;\n const pluginName = this.pluginName;\n if (!hooksNamesToWrap.has(name)) {\n return original.apply(this, args);\n }\n\n const syncFunctionWithDone =\n typeof args[args.length - 1] === 'function' && handler.constructor.name !== 'AsyncFunction';\n\n return original.apply(this, [\n name,\n instrumentation._wrapHandler(pluginName, name, handler, syncFunctionWithDone),\n ] as never);\n };\n };\n }\n\n private _patchConstructor(moduleExports: {\n fastify: () => FastifyInstance;\n errorCodes: FastifyErrorCodes | undefined;\n }): () => FastifyInstance {\n const instrumentation = this;\n\n function fastify(this: FastifyInstance, ...args: any) {\n const app: FastifyInstance = moduleExports.fastify.apply(this, args);\n app.addHook('onRequest', instrumentation._hookOnRequest());\n app.addHook('preHandler', instrumentation._hookPreHandler());\n\n instrumentClient();\n\n instrumentation._wrap(app, 'addHook', instrumentation._wrapAddHook());\n\n return app;\n }\n\n if (moduleExports.errorCodes !== undefined) {\n fastify.errorCodes = moduleExports.errorCodes;\n }\n fastify.fastify = fastify;\n fastify.default = fastify;\n return fastify;\n }\n\n private _patchSend() {\n const instrumentation = this;\n this._diag.debug('Patching fastify reply.send function');\n\n return function patchSend(original: () => FastifyReply): () => FastifyReply {\n return function send(this: FastifyReply, ...args: any) {\n const maybeError: any = args[0];\n\n if (!instrumentation.isEnabled()) {\n return original.apply(this, args);\n }\n\n return safeExecuteInTheMiddle<FastifyReply>(\n () => {\n return original.apply(this, args);\n },\n err => {\n if (!err && maybeError instanceof Error) {\n // eslint-disable-next-line no-param-reassign\n err = maybeError;\n }\n endSpan(this, err);\n },\n );\n };\n };\n }\n\n private _hookPreHandler() {\n const instrumentation = this;\n this._diag.debug('Patching fastify preHandler function');\n\n return function preHandler(this: any, request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) {\n if (!instrumentation.isEnabled()) {\n return done();\n }\n const anyRequest = request as any;\n\n const handler = anyRequest.routeOptions?.handler || anyRequest.context?.handler;\n const handlerName = handler?.name.startsWith('bound ') ? handler.name.substring(6) : handler?.name;\n const spanName = `${FastifyNames.REQUEST_HANDLER} - ${handlerName || this.pluginName || ANONYMOUS_NAME}`;\n\n const spanAttributes: Attributes = {\n [AttributeNames.PLUGIN_NAME]: this.pluginName,\n [AttributeNames.FASTIFY_TYPE]: FastifyTypes.REQUEST_HANDLER,\n // eslint-disable-next-line deprecation/deprecation\n [SEMATTRS_HTTP_ROUTE]: anyRequest.routeOptions\n ? anyRequest.routeOptions.url // since fastify@4.10.0\n : request.routerPath,\n };\n if (handlerName) {\n spanAttributes[AttributeNames.FASTIFY_NAME] = handlerName;\n }\n const span = startSpan(reply, instrumentation.tracer, spanName, spanAttributes);\n\n addFastifyV3SpanAttributes(span);\n\n const { requestHook } = instrumentation.getConfig();\n if (requestHook) {\n safeExecuteInTheMiddle(\n () => requestHook(span, { request }),\n e => {\n if (e) {\n instrumentation._diag.error('request hook failed', e);\n }\n },\n true,\n );\n }\n\n return context.with(trace.setSpan(context.active(), span), () => {\n done();\n });\n };\n }\n}\n\nfunction instrumentClient(): void {\n const client = getClient();\n if (client) {\n client.on('spanStart', (span: Span) => {\n addFastifyV3SpanAttributes(span);\n });\n }\n}\n\nfunction addFastifyV3SpanAttributes(span: Span): void {\n const attributes = spanToJSON(span).data;\n\n // this is one of: middleware, request_handler\n const type = attributes['fastify.type'];\n\n // If this is already set, or we have no fastify span, no need to process again...\n if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) {\n return;\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.fastify',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.fastify`,\n });\n\n // Also update the name, we don't need to \"middleware - \" prefix\n const name = attributes['fastify.name'] || attributes['plugin.name'] || attributes['hook.name'];\n if (typeof name === 'string') {\n // Try removing `fastify -> ` and `@fastify/otel -> ` prefixes\n // This is a bit of a hack, and not always working for all spans\n // But it's the best we can do without a proper API\n const updatedName = name.replace(/^fastify -> /, '').replace(/^@fastify\\/otel -> /, '');\n\n span.updateName(updatedName);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AA8CA;;AAEA,MAAM,eAAA,GAAkB,OAAO;;AAE/B,MAAM,YAAA,GAAe,oCAAoC;AACzD,MAAM,cAAA,GAAiB,WAAW;;AAElC;AACA;AACA;AACA;AACA,MAAM,gBAAA,GAAmB,IAAI,GAAG,CAAC;AACjC,EAAE,WAAW;AACb,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,eAAe;AACjB,EAAE,kBAAkB;AACpB,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,SAAS;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AACO,MAAM,wBAAA,SAAiC,mBAAmB,CAA+B;AAChG,GAAS,WAAW,CAAC,MAAM,GAAiC,EAAE,EAAE;AAChE,IAAI,KAAK,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,CAAC;AAChD,EAAE;;AAEF,GAAS,IAAI,GAA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,CAAA;AACA,EAAA;AACA;;AAEA,SAAA,0BAAA,CAAA,IAAA,EAAA;AACA,EAAA,MAAA,UAAA,GAAA,UAAA,CAAA,IAAA,CAAA,CAAA,IAAA;;AAEA;AACA,EAAA,MAAA,IAAA,GAAA,UAAA,CAAA,cAAA,CAAA;;AAEA;AACA,EAAA,IAAA,UAAA,CAAA,4BAAA,CAAA,IAAA,CAAA,IAAA,EAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,aAAA,CAAA;AACA,IAAA,CAAA,gCAAA,GAAA,wBAAA;AACA,IAAA,CAAA,4BAAA,GAAA,CAAA,EAAA,IAAA,CAAA,QAAA,CAAA;AACA,GAAA,CAAA;;AAEA;AACA,EAAA,MAAA,IAAA,GAAA,UAAA,CAAA,cAAA,CAAA,IAAA,UAAA,CAAA,aAAA,CAAA,IAAA,UAAA,CAAA,WAAA,CAAA;AACA,EAAA,IAAA,OAAA,IAAA,KAAA,QAAA,EAAA;AACA;AACA;AACA;AACA,IAAA,MAAA,WAAA,GAAA,IAAA,CAAA,OAAA,CAAA,cAAA,EAAA,EAAA,CAAA,CAAA,OAAA,CAAA,qBAAA,EAAA,EAAA,CAAA;;AAEA,IAAA,IAAA,CAAA,UAAA,CAAA,WAAA,CAAA;AACA,EAAA;AACA;;;;"}
@@ -0,0 +1,131 @@
1
+ import { SpanStatusCode } from '@opentelemetry/api';
2
+ import { spanRequestSymbol } from './constants.js';
3
+
4
+ // Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/407f61591ba69a39a6908264379d4d98a48dbec4/plugins/node/opentelemetry-instrumentation-fastify/src/utils.ts
5
+ /* eslint-disable jsdoc/require-jsdoc */
6
+ /* eslint-disable @typescript-eslint/no-dynamic-delete */
7
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
8
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+ /*
11
+ * Copyright The OpenTelemetry Authors
12
+ *
13
+ * Licensed under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License.
15
+ * You may obtain a copy of the License at
16
+ *
17
+ * https://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ * See the License for the specific language governing permissions and
23
+ * limitations under the License.
24
+ */
25
+
26
+
27
+ /**
28
+ * Starts Span
29
+ * @param reply - reply function
30
+ * @param tracer - tracer
31
+ * @param spanName - span name
32
+ * @param spanAttributes - span attributes
33
+ */
34
+ function startSpan(
35
+ reply,
36
+ tracer,
37
+ spanName,
38
+ spanAttributes = {},
39
+ ) {
40
+ const span = tracer.startSpan(spanName, { attributes: spanAttributes });
41
+
42
+ const spans = reply[spanRequestSymbol] || [];
43
+ spans.push(span);
44
+
45
+ Object.defineProperty(reply, spanRequestSymbol, {
46
+ enumerable: false,
47
+ configurable: true,
48
+ value: spans,
49
+ });
50
+
51
+ return span;
52
+ }
53
+
54
+ /**
55
+ * Ends span
56
+ * @param reply - reply function
57
+ * @param err - error
58
+ */
59
+ function endSpan(reply, err) {
60
+ const spans = reply[spanRequestSymbol] || [];
61
+ // there is no active span, or it has already ended
62
+ if (!spans.length) {
63
+ return;
64
+ }
65
+ // biome-ignore lint/complexity/noForEach: <explanation>
66
+ spans.forEach((span) => {
67
+ if (err) {
68
+ span.setStatus({
69
+ code: SpanStatusCode.ERROR,
70
+ message: err.message,
71
+ });
72
+ span.recordException(err);
73
+ }
74
+ span.end();
75
+ });
76
+ delete reply[spanRequestSymbol];
77
+ }
78
+
79
+ // @TODO after approve add this to instrumentation package and replace usage
80
+ // when it will be released
81
+
82
+ /**
83
+ * This function handles the missing case from instrumentation package when
84
+ * execute can either return a promise or void. And using async is not an
85
+ * option as it is producing unwanted side effects.
86
+ * @param execute - function to be executed
87
+ * @param onFinish - function called when function executed
88
+ * @param preventThrowingError - prevent to throw error when execute
89
+ * function fails
90
+ */
91
+
92
+ function safeExecuteInTheMiddleMaybePromise(
93
+ execute,
94
+ onFinish,
95
+ preventThrowingError,
96
+ ) {
97
+ let error;
98
+ let result = undefined;
99
+ try {
100
+ result = execute();
101
+
102
+ if (isPromise(result)) {
103
+ result.then(
104
+ res => onFinish(undefined, res),
105
+ err => onFinish(err),
106
+ );
107
+ }
108
+ } catch (e) {
109
+ error = e;
110
+ } finally {
111
+ if (!isPromise(result)) {
112
+ onFinish(error, result);
113
+ if (error && true) {
114
+ // eslint-disable-next-line no-unsafe-finally
115
+ throw error;
116
+ }
117
+ }
118
+ // eslint-disable-next-line no-unsafe-finally
119
+ return result;
120
+ }
121
+ }
122
+
123
+ function isPromise(val) {
124
+ return (
125
+ (typeof val === 'object' && val && typeof Object.getOwnPropertyDescriptor(val, 'then')?.value === 'function') ||
126
+ false
127
+ );
128
+ }
129
+
130
+ export { endSpan, safeExecuteInTheMiddleMaybePromise, startSpan };
131
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/fastify/v3/utils.ts"],"sourcesContent":["// Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/407f61591ba69a39a6908264379d4d98a48dbec4/plugins/node/opentelemetry-instrumentation-fastify/src/utils.ts\n/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable @typescript-eslint/no-dynamic-delete */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Attributes, type Span, SpanStatusCode, type Tracer } from '@opentelemetry/api';\nimport { spanRequestSymbol } from './constants';\nimport type { PluginFastifyReply } from './internal-types';\n\n/**\n * Starts Span\n * @param reply - reply function\n * @param tracer - tracer\n * @param spanName - span name\n * @param spanAttributes - span attributes\n */\nexport function startSpan(\n reply: PluginFastifyReply,\n tracer: Tracer,\n spanName: string,\n spanAttributes: Attributes = {},\n) {\n const span = tracer.startSpan(spanName, { attributes: spanAttributes });\n\n const spans: Span[] = reply[spanRequestSymbol] || [];\n spans.push(span);\n\n Object.defineProperty(reply, spanRequestSymbol, {\n enumerable: false,\n configurable: true,\n value: spans,\n });\n\n return span;\n}\n\n/**\n * Ends span\n * @param reply - reply function\n * @param err - error\n */\nexport function endSpan(reply: PluginFastifyReply, err?: any) {\n const spans = reply[spanRequestSymbol] || [];\n // there is no active span, or it has already ended\n if (!spans.length) {\n return;\n }\n // biome-ignore lint/complexity/noForEach: <explanation>\n spans.forEach((span: Span) => {\n if (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n span.end();\n });\n delete reply[spanRequestSymbol];\n}\n\n// @TODO after approve add this to instrumentation package and replace usage\n// when it will be released\n\n/**\n * This function handles the missing case from instrumentation package when\n * execute can either return a promise or void. And using async is not an\n * option as it is producing unwanted side effects.\n * @param execute - function to be executed\n * @param onFinish - function called when function executed\n * @param preventThrowingError - prevent to throw error when execute\n * function fails\n */\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean,\n): Promise<T>;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean,\n): T;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T | Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean,\n): T | Promise<T> | undefined {\n let error: unknown;\n let result: T | Promise<T> | undefined = undefined;\n try {\n result = execute();\n\n if (isPromise(result)) {\n result.then(\n res => onFinish(undefined, res),\n err => onFinish(err),\n );\n }\n } catch (e) {\n error = e;\n } finally {\n if (!isPromise(result)) {\n onFinish(error, result);\n if (error && !preventThrowingError) {\n // eslint-disable-next-line no-unsafe-finally\n throw error;\n }\n }\n // eslint-disable-next-line no-unsafe-finally\n return result;\n }\n}\n\nfunction isPromise<T>(val: T | Promise<T>): val is Promise<T> {\n return (\n (typeof val === 'object' && val && typeof Object.getOwnPropertyDescriptor(val, 'then')?.value === 'function') ||\n false\n );\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS;AACzB,EAAE,KAAK;AACP,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,cAAc,GAAe,EAAE;AACjC,EAAE;AACF,EAAE,MAAM,IAAA,GAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,cAAA,EAAgB,CAAC;;AAEzE,EAAE,MAAM,KAAK,GAAW,KAAK,CAAC,iBAAiB,CAAA,IAAK,EAAE;AACtD,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;;AAElB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,iBAAiB,EAAE;AAClD,IAAI,UAAU,EAAE,KAAK;AACrB,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,KAAK,EAAE,KAAK;AAChB,GAAG,CAAC;;AAEJ,EAAE,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,KAAK,EAAsB,GAAG,EAA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,KAAA,IAAS,IAAqB,EAAE;AAC1C;AACA,QAAQ,MAAM,KAAK;AACnB,MAAM;AACN,IAAI;AACJ;AACA,IAAI,OAAO,MAAM;AACjB,EAAE;AACF;;AAEA,SAAS,SAAS,CAAI,GAAG,EAAqC;AAC9D,EAAE;AACF,IAAI,CAAC,OAAO,GAAA,KAAQ,YAAY,GAAA,IAAO,OAAO,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,KAAA,KAAU,UAAU;AAChH,IAAI;AACJ;AACA;;;;"}
@@ -0,0 +1,47 @@
1
+ import { defineIntegration, captureException, flush, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
2
+ import { generateInstrumentOnce, addOriginToSpan } from '@sentry/node-core';
3
+ import { FirebaseInstrumentation } from './otel/firebaseInstrumentation.js';
4
+
5
+ const INTEGRATION_NAME = 'Firebase';
6
+
7
+ const config = {
8
+ firestoreSpanCreationHook: span => {
9
+ addOriginToSpan(span, 'auto.firebase.otel.firestore');
10
+
11
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'db.query');
12
+ },
13
+ functions: {
14
+ requestHook: span => {
15
+ addOriginToSpan(span, 'auto.firebase.otel.functions');
16
+
17
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.request');
18
+ },
19
+ errorHook: async (_, error) => {
20
+ if (error) {
21
+ captureException(error, {
22
+ mechanism: {
23
+ type: 'auto.firebase.otel.functions',
24
+ handled: false,
25
+ },
26
+ });
27
+ await flush(2000);
28
+ }
29
+ },
30
+ },
31
+ };
32
+
33
+ const instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME, () => new FirebaseInstrumentation(config));
34
+
35
+ const _firebaseIntegration = (() => {
36
+ return {
37
+ name: INTEGRATION_NAME,
38
+ setupOnce() {
39
+ instrumentFirebase();
40
+ },
41
+ };
42
+ }) ;
43
+
44
+ const firebaseIntegration = defineIntegration(_firebaseIntegration);
45
+
46
+ export { firebaseIntegration, instrumentFirebase };
47
+ //# sourceMappingURL=firebase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.js","sources":["../../../../../src/integrations/tracing/firebase/firebase.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { captureException, defineIntegration, flush, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\nimport { FirebaseInstrumentation, type FirebaseInstrumentationConfig } from './otel';\n\nconst INTEGRATION_NAME = 'Firebase';\n\nconst config: FirebaseInstrumentationConfig = {\n firestoreSpanCreationHook: span => {\n addOriginToSpan(span, 'auto.firebase.otel.firestore');\n\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'db.query');\n },\n functions: {\n requestHook: span => {\n addOriginToSpan(span, 'auto.firebase.otel.functions');\n\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.request');\n },\n errorHook: async (_, error) => {\n if (error) {\n captureException(error, {\n mechanism: {\n type: 'auto.firebase.otel.functions',\n handled: false,\n },\n });\n await flush(2000);\n }\n },\n },\n};\n\nexport const instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME, () => new FirebaseInstrumentation(config));\n\nconst _firebaseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentFirebase();\n },\n };\n}) satisfies IntegrationFn;\n\nexport const firebaseIntegration = defineIntegration(_firebaseIntegration);\n"],"names":[],"mappings":";;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAEnC,MAAM,MAAM,GAAkC;AAC9C,EAAE,yBAAyB,EAAE,IAAA,IAAQ;AACrC,IAAI,eAAe,CAAC,IAAI,EAAE,8BAA8B,CAAC;;AAEzD,IAAI,IAAI,CAAC,YAAY,CAAC,4BAA4B,EAAE,UAAU,CAAC;AAC/D,EAAE,CAAC;AACH,EAAE,SAAS,EAAE;AACb,IAAI,WAAW,EAAE,IAAA,IAAQ;AACzB,MAAM,eAAe,CAAC,IAAI,EAAE,8BAA8B,CAAC;;AAE3D,MAAM,IAAI,CAAC,YAAY,CAAC,4BAA4B,EAAE,cAAc,CAAC;AACrE,IAAI,CAAC;AACL,IAAI,SAAS,EAAE,OAAO,CAAC,EAAE,KAAK,KAAK;AACnC,MAAM,IAAI,KAAK,EAAE;AACjB,QAAQ,gBAAgB,CAAC,KAAK,EAAE;AAChC,UAAU,SAAS,EAAE;AACrB,YAAY,IAAI,EAAE,8BAA8B;AAChD,YAAY,OAAO,EAAE,KAAK;AAC1B,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,MAAM,KAAK,CAAC,IAAI,CAAC;AACzB,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH,CAAC;;AAEM,MAAM,kBAAA,GAAqB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC;;AAEpH,MAAM,oBAAA,IAAwB,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;MAEY,mBAAA,GAAsB,iBAAiB,CAAC,oBAAoB;;;;"}
@@ -0,0 +1,42 @@
1
+ import { InstrumentationBase } from '@opentelemetry/instrumentation';
2
+ import { SDK_VERSION } from '@sentry/core';
3
+ import { patchFirestore } from './patches/firestore.js';
4
+ import { patchFunctions } from './patches/functions.js';
5
+
6
+ const DefaultFirebaseInstrumentationConfig = {};
7
+ const firestoreSupportedVersions = ['>=3.0.0 <5']; // firebase 9+
8
+ const functionsSupportedVersions = ['>=6.0.0 <7']; // firebase-functions v2
9
+
10
+ /**
11
+ * Instrumentation for Firebase services, specifically Firestore.
12
+ */
13
+ class FirebaseInstrumentation extends InstrumentationBase {
14
+ constructor(config = DefaultFirebaseInstrumentationConfig) {
15
+ super('@sentry/instrumentation-firebase', SDK_VERSION, config);
16
+ }
17
+
18
+ /**
19
+ * sets config
20
+ * @param config
21
+ */
22
+ setConfig(config = {}) {
23
+ super.setConfig({ ...DefaultFirebaseInstrumentationConfig, ...config });
24
+ }
25
+
26
+ /**
27
+ *
28
+ * @protected
29
+ */
30
+ // eslint-disable-next-line @typescript-eslint/naming-convention
31
+ init() {
32
+ const modules = [];
33
+
34
+ modules.push(patchFirestore(this.tracer, firestoreSupportedVersions, this._wrap, this._unwrap, this.getConfig()));
35
+ modules.push(patchFunctions(this.tracer, functionsSupportedVersions, this._wrap, this._unwrap, this.getConfig()));
36
+
37
+ return modules;
38
+ }
39
+ }
40
+
41
+ export { FirebaseInstrumentation };
42
+ //# sourceMappingURL=firebaseInstrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebaseInstrumentation.js","sources":["../../../../../../src/integrations/tracing/firebase/otel/firebaseInstrumentation.ts"],"sourcesContent":["import { InstrumentationBase, type InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport { patchFirestore } from './patches/firestore';\nimport { patchFunctions } from './patches/functions';\nimport type { FirebaseInstrumentationConfig } from './types';\n\nconst DefaultFirebaseInstrumentationConfig: FirebaseInstrumentationConfig = {};\nconst firestoreSupportedVersions = ['>=3.0.0 <5']; // firebase 9+\nconst functionsSupportedVersions = ['>=6.0.0 <7']; // firebase-functions v2\n\n/**\n * Instrumentation for Firebase services, specifically Firestore.\n */\nexport class FirebaseInstrumentation extends InstrumentationBase<FirebaseInstrumentationConfig> {\n public constructor(config: FirebaseInstrumentationConfig = DefaultFirebaseInstrumentationConfig) {\n super('@sentry/instrumentation-firebase', SDK_VERSION, config);\n }\n\n /**\n * sets config\n * @param config\n */\n public override setConfig(config: FirebaseInstrumentationConfig = {}): void {\n super.setConfig({ ...DefaultFirebaseInstrumentationConfig, ...config });\n }\n\n /**\n *\n * @protected\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected init(): InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition[] | void {\n const modules: InstrumentationNodeModuleDefinition[] = [];\n\n modules.push(patchFirestore(this.tracer, firestoreSupportedVersions, this._wrap, this._unwrap, this.getConfig()));\n modules.push(patchFunctions(this.tracer, functionsSupportedVersions, this._wrap, this._unwrap, this.getConfig()));\n\n return modules;\n }\n}\n"],"names":[],"mappings":";;;;;AAMA,MAAM,oCAAoC,GAAkC,EAAE;AAC9E,MAAM,0BAAA,GAA6B,CAAC,YAAY,CAAC,CAAA;AACjD,MAAM,0BAAA,GAA6B,CAAC,YAAY,CAAC,CAAA;;AAEjD;AACA;AACA;AACO,MAAM,uBAAA,SAAgC,mBAAmB,CAAgC;AAChG,GAAS,WAAW,CAAC,MAAM,GAAkC,oCAAoC,EAAE;AACnG,IAAI,KAAK,CAAC,kCAAkC,EAAE,WAAW,EAAE,MAAM,CAAC;AAClE,EAAE;;AAEF;AACA;AACA;AACA;AACA,IAAkB,SAAS,CAAC,MAAM,GAAkC,EAAE,EAAQ;AAC9E,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,oCAAoC,EAAE,GAAG,MAAA,EAAQ,CAAC;AAC3E,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,GAAY,IAAI,GAAuF;AACvG,IAAI,MAAM,OAAO,GAA0C,EAAE;;AAE7D,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,0BAA0B,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;AACrH,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,0BAA0B,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;;AAErH,IAAI,OAAO,OAAO;AAClB,EAAE;AACF;;;;"}
@@ -0,0 +1,294 @@
1
+ import * as net from 'node:net';
2
+ import { SpanKind, context, trace, diag } from '@opentelemetry/api';
3
+ import { InstrumentationNodeModuleDefinition, InstrumentationNodeModuleFile, isWrapped, safeExecuteInTheMiddle } from '@opentelemetry/instrumentation';
4
+ import { ATTR_DB_OPERATION_NAME, ATTR_DB_NAMESPACE, ATTR_DB_COLLECTION_NAME, ATTR_DB_SYSTEM_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT } from '@opentelemetry/semantic-conventions';
5
+
6
+ // Inline minimal types used from `shimmer` to avoid importing shimmer's types directly.
7
+ // We only need the shape for `wrap` and `unwrap` used in this file.
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+
10
+ /**
11
+ *
12
+ * @param tracer - Opentelemetry Tracer
13
+ * @param firestoreSupportedVersions - supported version of firebase/firestore
14
+ * @param wrap - reference to native instrumentation wrap function
15
+ * @param unwrap - reference to native instrumentation wrap function
16
+ */
17
+ function patchFirestore(
18
+ tracer,
19
+ firestoreSupportedVersions,
20
+ wrap,
21
+ unwrap,
22
+ config,
23
+ ) {
24
+ const defaultFirestoreSpanCreationHook = () => {};
25
+
26
+ let firestoreSpanCreationHook = defaultFirestoreSpanCreationHook;
27
+ const configFirestoreSpanCreationHook = config.firestoreSpanCreationHook;
28
+
29
+ if (typeof configFirestoreSpanCreationHook === 'function') {
30
+ firestoreSpanCreationHook = (span) => {
31
+ safeExecuteInTheMiddle(
32
+ () => configFirestoreSpanCreationHook(span),
33
+ error => {
34
+ if (!error) {
35
+ return;
36
+ }
37
+ diag.error(error?.message);
38
+ },
39
+ true,
40
+ );
41
+ };
42
+ }
43
+
44
+ const moduleFirestoreCJS = new InstrumentationNodeModuleDefinition(
45
+ '@firebase/firestore',
46
+ firestoreSupportedVersions,
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ (moduleExports) => wrapMethods(moduleExports, wrap, unwrap, tracer, firestoreSpanCreationHook),
49
+ );
50
+ const files = [
51
+ '@firebase/firestore/dist/lite/index.node.cjs.js',
52
+ '@firebase/firestore/dist/lite/index.node.mjs.js',
53
+ '@firebase/firestore/dist/lite/index.rn.esm2017.js',
54
+ '@firebase/firestore/dist/lite/index.cjs.js',
55
+ ];
56
+
57
+ for (const file of files) {
58
+ moduleFirestoreCJS.files.push(
59
+ new InstrumentationNodeModuleFile(
60
+ file,
61
+ firestoreSupportedVersions,
62
+ moduleExports => wrapMethods(moduleExports, wrap, unwrap, tracer, firestoreSpanCreationHook),
63
+ moduleExports => unwrapMethods(moduleExports, unwrap),
64
+ ),
65
+ );
66
+ }
67
+
68
+ return moduleFirestoreCJS;
69
+ }
70
+
71
+ function wrapMethods(
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ moduleExports,
74
+ wrap,
75
+ unwrap,
76
+ tracer,
77
+ firestoreSpanCreationHook,
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
+ ) {
80
+ unwrapMethods(moduleExports, unwrap);
81
+
82
+ wrap(moduleExports, 'addDoc', patchAddDoc(tracer, firestoreSpanCreationHook));
83
+ wrap(moduleExports, 'getDocs', patchGetDocs(tracer, firestoreSpanCreationHook));
84
+ wrap(moduleExports, 'setDoc', patchSetDoc(tracer, firestoreSpanCreationHook));
85
+ wrap(moduleExports, 'deleteDoc', patchDeleteDoc(tracer, firestoreSpanCreationHook));
86
+
87
+ return moduleExports;
88
+ }
89
+
90
+ function unwrapMethods(
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ moduleExports,
93
+ unwrap,
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
+ ) {
96
+ for (const method of ['addDoc', 'getDocs', 'setDoc', 'deleteDoc']) {
97
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
98
+ if (isWrapped(moduleExports[method])) {
99
+ unwrap(moduleExports, method);
100
+ }
101
+ }
102
+ return moduleExports;
103
+ }
104
+
105
+ function patchAddDoc(
106
+ tracer,
107
+ firestoreSpanCreationHook,
108
+ )
109
+
110
+ {
111
+ return function addDoc(original) {
112
+ return function (
113
+ reference,
114
+ data,
115
+ ) {
116
+ const span = startDBSpan(tracer, 'addDoc', reference);
117
+ firestoreSpanCreationHook(span);
118
+ return executeContextWithSpan(span, () => {
119
+ return original(reference, data);
120
+ });
121
+ };
122
+ };
123
+ }
124
+
125
+ function patchDeleteDoc(
126
+ tracer,
127
+ firestoreSpanCreationHook,
128
+ )
129
+
130
+ {
131
+ return function deleteDoc(original) {
132
+ return function (reference) {
133
+ const span = startDBSpan(tracer, 'deleteDoc', reference.parent || reference);
134
+ firestoreSpanCreationHook(span);
135
+ return executeContextWithSpan(span, () => {
136
+ return original(reference);
137
+ });
138
+ };
139
+ };
140
+ }
141
+
142
+ function patchGetDocs(
143
+ tracer,
144
+ firestoreSpanCreationHook,
145
+ )
146
+
147
+ {
148
+ return function getDocs(original) {
149
+ return function (
150
+ reference,
151
+ ) {
152
+ const span = startDBSpan(tracer, 'getDocs', reference);
153
+ firestoreSpanCreationHook(span);
154
+ return executeContextWithSpan(span, () => {
155
+ return original(reference);
156
+ });
157
+ };
158
+ };
159
+ }
160
+
161
+ function patchSetDoc(
162
+ tracer,
163
+ firestoreSpanCreationHook,
164
+ )
165
+
166
+ {
167
+ return function setDoc(original) {
168
+ return function (
169
+ reference,
170
+ data,
171
+ options,
172
+ ) {
173
+ const span = startDBSpan(tracer, 'setDoc', reference.parent || reference);
174
+ firestoreSpanCreationHook(span);
175
+
176
+ return executeContextWithSpan(span, () => {
177
+ return typeof options !== 'undefined' ? original(reference, data, options) : original(reference, data);
178
+ });
179
+ };
180
+ };
181
+ }
182
+
183
+ function executeContextWithSpan(span, callback) {
184
+ return context.with(trace.setSpan(context.active(), span), () => {
185
+ return safeExecuteInTheMiddle(
186
+ () => {
187
+ return callback();
188
+ },
189
+ err => {
190
+ if (err) {
191
+ span.recordException(err);
192
+ }
193
+ span.end();
194
+ },
195
+ true,
196
+ );
197
+ });
198
+ }
199
+
200
+ function startDBSpan(
201
+ tracer,
202
+ spanName,
203
+ reference,
204
+ ) {
205
+ const span = tracer.startSpan(`${spanName} ${reference.path}`, { kind: SpanKind.CLIENT });
206
+ addAttributes(span, reference);
207
+ span.setAttribute(ATTR_DB_OPERATION_NAME, spanName);
208
+ return span;
209
+ }
210
+
211
+ /**
212
+ * Gets the server address and port attributes from the Firestore settings.
213
+ * It's best effort to extract the address and port from the settings, especially for IPv6.
214
+ * @param span - The span to set attributes on.
215
+ * @param settings - The Firestore settings containing host information.
216
+ */
217
+ function getPortAndAddress(settings)
218
+
219
+ {
220
+ let address;
221
+ let port;
222
+
223
+ if (typeof settings.host === 'string') {
224
+ if (settings.host.startsWith('[')) {
225
+ // IPv6 addresses can be enclosed in square brackets, e.g., [2001:db8::1]:8080
226
+ if (settings.host.endsWith(']')) {
227
+ // IPv6 with square brackets without port
228
+ address = settings.host.replace(/^\[|\]$/g, '');
229
+ } else if (settings.host.includes(']:')) {
230
+ // IPv6 with square brackets with port
231
+ const lastColonIndex = settings.host.lastIndexOf(':');
232
+ if (lastColonIndex !== -1) {
233
+ address = settings.host.slice(1, lastColonIndex).replace(/^\[|\]$/g, '');
234
+ port = settings.host.slice(lastColonIndex + 1);
235
+ }
236
+ }
237
+ } else {
238
+ // IPv4 or IPv6 without square brackets
239
+ // If it's an IPv6 address without square brackets, we assume it does not have a port.
240
+ if (net.isIPv6(settings.host)) {
241
+ address = settings.host;
242
+ }
243
+ // If it's an IPv4 address, we can extract the port if it exists.
244
+ else {
245
+ const lastColonIndex = settings.host.lastIndexOf(':');
246
+ if (lastColonIndex !== -1) {
247
+ address = settings.host.slice(0, lastColonIndex);
248
+ port = settings.host.slice(lastColonIndex + 1);
249
+ } else {
250
+ address = settings.host;
251
+ }
252
+ }
253
+ }
254
+ }
255
+ return {
256
+ address: address,
257
+ port: port ? parseInt(port, 10) : undefined,
258
+ };
259
+ }
260
+
261
+ function addAttributes(
262
+ span,
263
+ reference,
264
+ ) {
265
+ const firestoreApp = reference.firestore.app;
266
+ const firestoreOptions = firestoreApp.options;
267
+ const json = reference.firestore.toJSON() || {};
268
+ const settings = json.settings || {};
269
+
270
+ const attributes = {
271
+ [ATTR_DB_COLLECTION_NAME]: reference.path,
272
+ [ATTR_DB_NAMESPACE]: firestoreApp.name,
273
+ [ATTR_DB_SYSTEM_NAME]: 'firebase.firestore',
274
+ 'firebase.firestore.type': reference.type,
275
+ 'firebase.firestore.options.projectId': firestoreOptions.projectId,
276
+ 'firebase.firestore.options.appId': firestoreOptions.appId,
277
+ 'firebase.firestore.options.messagingSenderId': firestoreOptions.messagingSenderId,
278
+ 'firebase.firestore.options.storageBucket': firestoreOptions.storageBucket,
279
+ };
280
+
281
+ const { address, port } = getPortAndAddress(settings);
282
+
283
+ if (address) {
284
+ attributes[ATTR_SERVER_ADDRESS] = address;
285
+ }
286
+ if (port) {
287
+ attributes[ATTR_SERVER_PORT] = port;
288
+ }
289
+
290
+ span.setAttributes(attributes);
291
+ }
292
+
293
+ export { getPortAndAddress, patchFirestore };
294
+ //# sourceMappingURL=firestore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore.js","sources":["../../../../../../../src/integrations/tracing/firebase/otel/patches/firestore.ts"],"sourcesContent":["import * as net from 'node:net';\nimport type { Span, Tracer } from '@opentelemetry/api';\nimport { context, diag, SpanKind, trace } from '@opentelemetry/api';\nimport {\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n isWrapped,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_COLLECTION_NAME,\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_SYSTEM_NAME,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport type { SpanAttributes } from '@sentry/core';\nimport type { FirebaseInstrumentation } from '../firebaseInstrumentation';\nimport type {\n AddDocType,\n CollectionReference,\n DeleteDocType,\n DocumentData,\n DocumentReference,\n FirebaseApp,\n FirebaseInstrumentationConfig,\n FirebaseOptions,\n FirestoreSettings,\n FirestoreSpanCreationHook,\n GetDocsType,\n PartialWithFieldValue,\n QuerySnapshot,\n SetDocType,\n SetOptions,\n WithFieldValue,\n} from '../types';\n\n// Inline minimal types used from `shimmer` to avoid importing shimmer's types directly.\n// We only need the shape for `wrap` and `unwrap` used in this file.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ShimmerWrap = (target: any, name: string, wrapper: (...args: any[]) => any) => void;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ShimmerUnwrap = (target: any, name: string) => void;\n\n/**\n *\n * @param tracer - Opentelemetry Tracer\n * @param firestoreSupportedVersions - supported version of firebase/firestore\n * @param wrap - reference to native instrumentation wrap function\n * @param unwrap - reference to native instrumentation wrap function\n */\nexport function patchFirestore(\n tracer: Tracer,\n firestoreSupportedVersions: string[],\n wrap: ShimmerWrap,\n unwrap: ShimmerUnwrap,\n config: FirebaseInstrumentationConfig,\n): InstrumentationNodeModuleDefinition {\n const defaultFirestoreSpanCreationHook: FirestoreSpanCreationHook = () => {};\n\n let firestoreSpanCreationHook: FirestoreSpanCreationHook = defaultFirestoreSpanCreationHook;\n const configFirestoreSpanCreationHook = config.firestoreSpanCreationHook;\n\n if (typeof configFirestoreSpanCreationHook === 'function') {\n firestoreSpanCreationHook = (span: Span) => {\n safeExecuteInTheMiddle(\n () => configFirestoreSpanCreationHook(span),\n error => {\n if (!error) {\n return;\n }\n diag.error(error?.message);\n },\n true,\n );\n };\n }\n\n const moduleFirestoreCJS = new InstrumentationNodeModuleDefinition(\n '@firebase/firestore',\n firestoreSupportedVersions,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (moduleExports: any) => wrapMethods(moduleExports, wrap, unwrap, tracer, firestoreSpanCreationHook),\n );\n const files: string[] = [\n '@firebase/firestore/dist/lite/index.node.cjs.js',\n '@firebase/firestore/dist/lite/index.node.mjs.js',\n '@firebase/firestore/dist/lite/index.rn.esm2017.js',\n '@firebase/firestore/dist/lite/index.cjs.js',\n ];\n\n for (const file of files) {\n moduleFirestoreCJS.files.push(\n new InstrumentationNodeModuleFile(\n file,\n firestoreSupportedVersions,\n moduleExports => wrapMethods(moduleExports, wrap, unwrap, tracer, firestoreSpanCreationHook),\n moduleExports => unwrapMethods(moduleExports, unwrap),\n ),\n );\n }\n\n return moduleFirestoreCJS;\n}\n\nfunction wrapMethods(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n moduleExports: any,\n wrap: ShimmerWrap,\n unwrap: ShimmerUnwrap,\n tracer: Tracer,\n firestoreSpanCreationHook: FirestoreSpanCreationHook,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n unwrapMethods(moduleExports, unwrap);\n\n wrap(moduleExports, 'addDoc', patchAddDoc(tracer, firestoreSpanCreationHook));\n wrap(moduleExports, 'getDocs', patchGetDocs(tracer, firestoreSpanCreationHook));\n wrap(moduleExports, 'setDoc', patchSetDoc(tracer, firestoreSpanCreationHook));\n wrap(moduleExports, 'deleteDoc', patchDeleteDoc(tracer, firestoreSpanCreationHook));\n\n return moduleExports;\n}\n\nfunction unwrapMethods(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n moduleExports: any,\n unwrap: ShimmerUnwrap,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n for (const method of ['addDoc', 'getDocs', 'setDoc', 'deleteDoc']) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (isWrapped(moduleExports[method])) {\n unwrap(moduleExports, method);\n }\n }\n return moduleExports;\n}\n\nfunction patchAddDoc<AppModelType, DbModelType extends DocumentData>(\n tracer: Tracer,\n firestoreSpanCreationHook: FirestoreSpanCreationHook,\n): (\n original: AddDocType<AppModelType, DbModelType>,\n) => (\n this: FirebaseInstrumentation,\n reference: CollectionReference<AppModelType, DbModelType>,\n data: WithFieldValue<AppModelType>,\n) => Promise<DocumentReference<AppModelType, DbModelType>> {\n return function addDoc(original: AddDocType<AppModelType, DbModelType>) {\n return function (\n reference: CollectionReference<AppModelType, DbModelType>,\n data: WithFieldValue<AppModelType>,\n ): Promise<DocumentReference<AppModelType, DbModelType>> {\n const span = startDBSpan(tracer, 'addDoc', reference);\n firestoreSpanCreationHook(span);\n return executeContextWithSpan<Promise<DocumentReference<AppModelType, DbModelType>>>(span, () => {\n return original(reference, data);\n });\n };\n };\n}\n\nfunction patchDeleteDoc<AppModelType, DbModelType extends DocumentData>(\n tracer: Tracer,\n firestoreSpanCreationHook: FirestoreSpanCreationHook,\n): (\n original: DeleteDocType<AppModelType, DbModelType>,\n) => (this: FirebaseInstrumentation, reference: DocumentReference<AppModelType, DbModelType>) => Promise<void> {\n return function deleteDoc(original: DeleteDocType<AppModelType, DbModelType>) {\n return function (reference: DocumentReference<AppModelType, DbModelType>): Promise<void> {\n const span = startDBSpan(tracer, 'deleteDoc', reference.parent || reference);\n firestoreSpanCreationHook(span);\n return executeContextWithSpan<Promise<void>>(span, () => {\n return original(reference);\n });\n };\n };\n}\n\nfunction patchGetDocs<AppModelType, DbModelType extends DocumentData>(\n tracer: Tracer,\n firestoreSpanCreationHook: FirestoreSpanCreationHook,\n): (\n original: GetDocsType<AppModelType, DbModelType>,\n) => (\n this: FirebaseInstrumentation,\n reference: CollectionReference<AppModelType, DbModelType>,\n) => Promise<QuerySnapshot<AppModelType, DbModelType>> {\n return function getDocs(original: GetDocsType<AppModelType, DbModelType>) {\n return function (\n reference: CollectionReference<AppModelType, DbModelType>,\n ): Promise<QuerySnapshot<AppModelType, DbModelType>> {\n const span = startDBSpan(tracer, 'getDocs', reference);\n firestoreSpanCreationHook(span);\n return executeContextWithSpan<Promise<QuerySnapshot<AppModelType, DbModelType>>>(span, () => {\n return original(reference);\n });\n };\n };\n}\n\nfunction patchSetDoc<AppModelType, DbModelType extends DocumentData>(\n tracer: Tracer,\n firestoreSpanCreationHook: FirestoreSpanCreationHook,\n): (\n original: SetDocType<AppModelType, DbModelType>,\n) => (\n this: FirebaseInstrumentation,\n reference: DocumentReference<AppModelType, DbModelType>,\n data: WithFieldValue<AppModelType> & PartialWithFieldValue<AppModelType>,\n options?: SetOptions,\n) => Promise<void> {\n return function setDoc(original: SetDocType<AppModelType, DbModelType>) {\n return function (\n reference: DocumentReference<AppModelType, DbModelType>,\n data: WithFieldValue<AppModelType> & PartialWithFieldValue<AppModelType>,\n options?: SetOptions,\n ): Promise<void> {\n const span = startDBSpan(tracer, 'setDoc', reference.parent || reference);\n firestoreSpanCreationHook(span);\n\n return executeContextWithSpan<Promise<void>>(span, () => {\n return typeof options !== 'undefined' ? original(reference, data, options) : original(reference, data);\n });\n };\n };\n}\n\nfunction executeContextWithSpan<T>(span: Span, callback: () => T): T {\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddle(\n (): T => {\n return callback();\n },\n err => {\n if (err) {\n span.recordException(err);\n }\n span.end();\n },\n true,\n );\n });\n}\n\nfunction startDBSpan<AppModelType, DbModelType extends DocumentData>(\n tracer: Tracer,\n spanName: string,\n reference: CollectionReference<AppModelType, DbModelType> | DocumentReference<AppModelType, DbModelType>,\n): Span {\n const span = tracer.startSpan(`${spanName} ${reference.path}`, { kind: SpanKind.CLIENT });\n addAttributes(span, reference);\n span.setAttribute(ATTR_DB_OPERATION_NAME, spanName);\n return span;\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 span - The span to set attributes on.\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 addAttributes<AppModelType, DbModelType extends DocumentData>(\n span: Span,\n reference: CollectionReference<AppModelType, DbModelType> | DocumentReference<AppModelType, DbModelType>,\n): void {\n const firestoreApp: FirebaseApp = reference.firestore.app;\n const firestoreOptions: FirebaseOptions = firestoreApp.options;\n const json: { settings?: FirestoreSettings } = reference.firestore.toJSON() || {};\n const settings: FirestoreSettings = json.settings || {};\n\n const attributes: SpanAttributes = {\n [ATTR_DB_COLLECTION_NAME]: reference.path,\n [ATTR_DB_NAMESPACE]: firestoreApp.name,\n [ATTR_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[ATTR_SERVER_ADDRESS] = address;\n }\n if (port) {\n attributes[ATTR_SERVER_PORT] = port;\n }\n\n span.setAttributes(attributes);\n}\n"],"names":[],"mappings":";;;;;AAsCA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc;AAC9B,E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