autotel 3.6.0 → 4.0.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 (617) hide show
  1. package/dist/attribute-redacting-processor-DtTS9xxh.d.cts +175 -0
  2. package/dist/attribute-redacting-processor-DtTS9xxh.d.cts.map +1 -0
  3. package/dist/attribute-redacting-processor-DtTS9xxh.d.ts +175 -0
  4. package/dist/attribute-redacting-processor-DtTS9xxh.d.ts.map +1 -0
  5. package/dist/attribute-redacting-processor.cjs +374 -33
  6. package/dist/attribute-redacting-processor.cjs.map +1 -1
  7. package/dist/attribute-redacting-processor.d.cts +2 -207
  8. package/dist/attribute-redacting-processor.d.ts +2 -207
  9. package/dist/attribute-redacting-processor.js +368 -2
  10. package/dist/attribute-redacting-processor.js.map +1 -1
  11. package/dist/attributes-CmYpdqCN.js +591 -0
  12. package/dist/attributes-CmYpdqCN.js.map +1 -0
  13. package/dist/attributes-PZ5doLgw.cjs +704 -0
  14. package/dist/attributes-PZ5doLgw.cjs.map +1 -0
  15. package/dist/attributes.cjs +21 -85
  16. package/dist/attributes.d.cts +2 -20
  17. package/dist/attributes.d.ts +2 -20
  18. package/dist/attributes.js +3 -5
  19. package/dist/auto.cjs +50 -28
  20. package/dist/auto.cjs.map +1 -1
  21. package/dist/auto.d.cts +1 -2
  22. package/dist/auto.d.ts +1 -2
  23. package/dist/auto.js +49 -23
  24. package/dist/auto.js.map +1 -1
  25. package/dist/business-baggage.cjs +357 -13
  26. package/dist/business-baggage.cjs.map +1 -1
  27. package/dist/business-baggage.d.cts +106 -139
  28. package/dist/business-baggage.d.cts.map +1 -0
  29. package/dist/business-baggage.d.ts +106 -139
  30. package/dist/business-baggage.d.ts.map +1 -0
  31. package/dist/business-baggage.js +357 -2
  32. package/dist/business-baggage.js.map +1 -1
  33. package/dist/canonical-log-line-processor--RlFDHhm.cjs +377 -0
  34. package/dist/canonical-log-line-processor--RlFDHhm.cjs.map +1 -0
  35. package/dist/canonical-log-line-processor-BcRuAdRk.d.ts +147 -0
  36. package/dist/canonical-log-line-processor-BcRuAdRk.d.ts.map +1 -0
  37. package/dist/canonical-log-line-processor-DbBQT5vY.js +366 -0
  38. package/dist/canonical-log-line-processor-DbBQT5vY.js.map +1 -0
  39. package/dist/canonical-log-line-processor-xvjMgtpF.d.cts +147 -0
  40. package/dist/canonical-log-line-processor-xvjMgtpF.d.cts.map +1 -0
  41. package/dist/config.cjs +118 -22
  42. package/dist/config.cjs.map +1 -1
  43. package/dist/config.d.cts +33 -45
  44. package/dist/config.d.cts.map +1 -0
  45. package/dist/config.d.ts +33 -45
  46. package/dist/config.d.ts.map +1 -0
  47. package/dist/config.js +116 -3
  48. package/dist/config.js.map +1 -1
  49. package/dist/correlated-events-Bzh5y-UB.js +28 -0
  50. package/dist/correlated-events-Bzh5y-UB.js.map +1 -0
  51. package/dist/correlated-events-kSwLo3mi.cjs +34 -0
  52. package/dist/correlated-events-kSwLo3mi.cjs.map +1 -0
  53. package/dist/correlation-id.cjs +11 -54
  54. package/dist/correlation-id.d.cts +6 -5
  55. package/dist/correlation-id.d.cts.map +1 -0
  56. package/dist/correlation-id.d.ts +6 -5
  57. package/dist/correlation-id.d.ts.map +1 -0
  58. package/dist/correlation-id.js +3 -17
  59. package/dist/db.cjs +244 -209
  60. package/dist/db.cjs.map +1 -1
  61. package/dist/db.d.cts +28 -26
  62. package/dist/db.d.cts.map +1 -0
  63. package/dist/db.d.ts +28 -26
  64. package/dist/db.d.ts.map +1 -0
  65. package/dist/db.js +243 -207
  66. package/dist/db.js.map +1 -1
  67. package/dist/decorators.cjs +39 -66
  68. package/dist/decorators.cjs.map +1 -1
  69. package/dist/decorators.d.cts +10 -37
  70. package/dist/decorators.d.cts.map +1 -0
  71. package/dist/decorators.d.ts +10 -37
  72. package/dist/decorators.d.ts.map +1 -0
  73. package/dist/decorators.js +38 -64
  74. package/dist/decorators.js.map +1 -1
  75. package/dist/define-event-CreknLm3.d.ts +25 -0
  76. package/dist/define-event-CreknLm3.d.ts.map +1 -0
  77. package/dist/define-event-HZRizPwz.d.cts +25 -0
  78. package/dist/define-event-HZRizPwz.d.cts.map +1 -0
  79. package/dist/drain-pipeline.cjs +111 -9
  80. package/dist/drain-pipeline.cjs.map +1 -1
  81. package/dist/drain-pipeline.d.cts +27 -32
  82. package/dist/drain-pipeline.d.cts.map +1 -0
  83. package/dist/drain-pipeline.d.ts +27 -32
  84. package/dist/drain-pipeline.d.ts.map +1 -0
  85. package/dist/drain-pipeline.js +111 -2
  86. package/dist/drain-pipeline.js.map +1 -1
  87. package/dist/enrichers.cjs +59 -66
  88. package/dist/enrichers.cjs.map +1 -1
  89. package/dist/enrichers.d.cts +15 -13
  90. package/dist/enrichers.d.cts.map +1 -0
  91. package/dist/enrichers.d.ts +15 -13
  92. package/dist/enrichers.d.ts.map +1 -0
  93. package/dist/enrichers.js +58 -65
  94. package/dist/enrichers.js.map +1 -1
  95. package/dist/event-Dlqr4ZNL.cjs +778 -0
  96. package/dist/event-Dlqr4ZNL.cjs.map +1 -0
  97. package/dist/event-_58ryBjh.js +761 -0
  98. package/dist/event-_58ryBjh.js.map +1 -0
  99. package/dist/event-subscriber-D1XLkPzi.d.cts +223 -0
  100. package/dist/event-subscriber-D1XLkPzi.d.cts.map +1 -0
  101. package/dist/event-subscriber-D1XLkPzi.d.ts +223 -0
  102. package/dist/event-subscriber-D1XLkPzi.d.ts.map +1 -0
  103. package/dist/event-subscriber.cjs +0 -6
  104. package/dist/event-subscriber.d.cts +2 -221
  105. package/dist/event-subscriber.d.ts +2 -221
  106. package/dist/event-subscriber.js +1 -3
  107. package/dist/event-testing-BqRnI0z4.d.cts +106 -0
  108. package/dist/event-testing-BqRnI0z4.d.cts.map +1 -0
  109. package/dist/event-testing-CfFs3to2.d.ts +106 -0
  110. package/dist/event-testing-CfFs3to2.d.ts.map +1 -0
  111. package/dist/event-testing.cjs +93 -17
  112. package/dist/event-testing.cjs.map +1 -1
  113. package/dist/event-testing.d.cts +2 -110
  114. package/dist/event-testing.d.ts +2 -110
  115. package/dist/event-testing.js +91 -2
  116. package/dist/event-testing.js.map +1 -1
  117. package/dist/event.cjs +5 -37
  118. package/dist/event.d.cts +295 -340
  119. package/dist/event.d.cts.map +1 -0
  120. package/dist/event.d.ts +295 -340
  121. package/dist/event.d.ts.map +1 -0
  122. package/dist/event.js +3 -21
  123. package/dist/exporters.cjs +12 -16
  124. package/dist/exporters.d.cts +86 -111
  125. package/dist/exporters.d.cts.map +1 -0
  126. package/dist/exporters.d.ts +86 -111
  127. package/dist/exporters.d.ts.map +1 -0
  128. package/dist/exporters.js +4 -4
  129. package/dist/filtering-span-processor-B8R8B7Uk.d.cts +59 -0
  130. package/dist/filtering-span-processor-B8R8B7Uk.d.cts.map +1 -0
  131. package/dist/filtering-span-processor-B8R8B7Uk.d.ts +59 -0
  132. package/dist/filtering-span-processor-B8R8B7Uk.d.ts.map +1 -0
  133. package/dist/filtering-span-processor.cjs +49 -9
  134. package/dist/filtering-span-processor.cjs.map +1 -1
  135. package/dist/filtering-span-processor.d.cts +2 -80
  136. package/dist/filtering-span-processor.d.ts +2 -80
  137. package/dist/filtering-span-processor.js +49 -2
  138. package/dist/filtering-span-processor.js.map +1 -1
  139. package/dist/functional-BGkT8J-h.js +1265 -0
  140. package/dist/functional-BGkT8J-h.js.map +1 -0
  141. package/dist/functional-C4CzoVrX.cjs +1312 -0
  142. package/dist/functional-C4CzoVrX.cjs.map +1 -0
  143. package/dist/functional.cjs +11 -57
  144. package/dist/functional.d.cts +96 -97
  145. package/dist/functional.d.cts.map +1 -0
  146. package/dist/functional.d.ts +96 -97
  147. package/dist/functional.d.ts.map +1 -0
  148. package/dist/functional.js +3 -20
  149. package/dist/http.cjs +276 -176
  150. package/dist/http.cjs.map +1 -1
  151. package/dist/http.d.cts +17 -37
  152. package/dist/http.d.cts.map +1 -0
  153. package/dist/http.d.ts +17 -37
  154. package/dist/http.d.ts.map +1 -0
  155. package/dist/http.js +275 -174
  156. package/dist/http.js.map +1 -1
  157. package/dist/index-Ck06vlW2.d.ts +678 -0
  158. package/dist/index-Ck06vlW2.d.ts.map +1 -0
  159. package/dist/index-eKuioqT1.d.cts +678 -0
  160. package/dist/index-eKuioqT1.d.cts.map +1 -0
  161. package/dist/index.cjs +751 -1218
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +341 -659
  164. package/dist/index.d.cts.map +1 -0
  165. package/dist/index.d.ts +341 -659
  166. package/dist/index.d.ts.map +1 -0
  167. package/dist/index.js +606 -737
  168. package/dist/index.js.map +1 -1
  169. package/dist/init-CNp-ee80.d.cts +1157 -0
  170. package/dist/init-CNp-ee80.d.cts.map +1 -0
  171. package/dist/init-Ch6t7MNI.js +1015 -0
  172. package/dist/init-Ch6t7MNI.js.map +1 -0
  173. package/dist/init-DJQOdVlN.d.ts +1157 -0
  174. package/dist/init-DJQOdVlN.d.ts.map +1 -0
  175. package/dist/init-DvapOXCc.cjs +1092 -0
  176. package/dist/init-DvapOXCc.cjs.map +1 -0
  177. package/dist/instrumentation.cjs +159 -185
  178. package/dist/instrumentation.cjs.map +1 -1
  179. package/dist/instrumentation.d.cts +42 -40
  180. package/dist/instrumentation.d.cts.map +1 -0
  181. package/dist/instrumentation.d.ts +42 -40
  182. package/dist/instrumentation.d.ts.map +1 -0
  183. package/dist/instrumentation.js +158 -183
  184. package/dist/instrumentation.js.map +1 -1
  185. package/dist/logger-BauSUhUv.d.cts +313 -0
  186. package/dist/logger-BauSUhUv.d.cts.map +1 -0
  187. package/dist/logger-BauSUhUv.d.ts +313 -0
  188. package/dist/logger-BauSUhUv.d.ts.map +1 -0
  189. package/dist/logger.cjs +225 -25
  190. package/dist/logger.cjs.map +1 -1
  191. package/dist/logger.d.cts +2 -348
  192. package/dist/logger.d.ts +2 -348
  193. package/dist/logger.js +204 -4
  194. package/dist/logger.js.map +1 -1
  195. package/dist/messaging-adapters.cjs +292 -187
  196. package/dist/messaging-adapters.cjs.map +1 -1
  197. package/dist/messaging-adapters.d.cts +28 -66
  198. package/dist/messaging-adapters.d.cts.map +1 -0
  199. package/dist/messaging-adapters.d.ts +28 -66
  200. package/dist/messaging-adapters.d.ts.map +1 -0
  201. package/dist/messaging-adapters.js +291 -185
  202. package/dist/messaging-adapters.js.map +1 -1
  203. package/dist/messaging-testing.cjs +306 -372
  204. package/dist/messaging-testing.cjs.map +1 -1
  205. package/dist/messaging-testing.d.cts +194 -223
  206. package/dist/messaging-testing.d.cts.map +1 -0
  207. package/dist/messaging-testing.d.ts +194 -223
  208. package/dist/messaging-testing.d.ts.map +1 -0
  209. package/dist/messaging-testing.js +305 -371
  210. package/dist/messaging-testing.js.map +1 -1
  211. package/dist/messaging.cjs +757 -36
  212. package/dist/messaging.cjs.map +1 -1
  213. package/dist/messaging.d.cts +603 -644
  214. package/dist/messaging.d.cts.map +1 -0
  215. package/dist/messaging.d.ts +603 -644
  216. package/dist/messaging.d.ts.map +1 -0
  217. package/dist/messaging.js +756 -21
  218. package/dist/messaging.js.map +1 -1
  219. package/dist/metric-helpers.cjs +27 -27
  220. package/dist/metric-helpers.cjs.map +1 -1
  221. package/dist/metric-helpers.d.cts +4 -2
  222. package/dist/metric-helpers.d.cts.map +1 -0
  223. package/dist/metric-helpers.d.ts +4 -2
  224. package/dist/metric-helpers.d.ts.map +1 -0
  225. package/dist/metric-helpers.js +24 -4
  226. package/dist/metric-helpers.js.map +1 -1
  227. package/dist/metric-testing-DXdK3-Q3.d.ts +106 -0
  228. package/dist/metric-testing-DXdK3-Q3.d.ts.map +1 -0
  229. package/dist/metric-testing-MxvzChDp.d.cts +106 -0
  230. package/dist/metric-testing-MxvzChDp.d.cts.map +1 -0
  231. package/dist/metric-testing.cjs +93 -17
  232. package/dist/metric-testing.cjs.map +1 -1
  233. package/dist/metric-testing.d.cts +2 -110
  234. package/dist/metric-testing.d.ts +2 -110
  235. package/dist/metric-testing.js +91 -2
  236. package/dist/metric-testing.js.map +1 -1
  237. package/dist/metric.cjs +306 -22
  238. package/dist/metric.cjs.map +1 -1
  239. package/dist/metric.d.cts +170 -198
  240. package/dist/metric.d.cts.map +1 -0
  241. package/dist/metric.d.ts +170 -198
  242. package/dist/metric.d.ts.map +1 -0
  243. package/dist/metric.js +277 -7
  244. package/dist/metric.js.map +1 -1
  245. package/dist/node-require-DF5QBX6z.cjs +99 -0
  246. package/dist/node-require-DF5QBX6z.cjs.map +1 -0
  247. package/dist/node-require-Db1oDpLj.js +88 -0
  248. package/dist/node-require-Db1oDpLj.js.map +1 -0
  249. package/dist/operation-context-C-2hmmtP.js +59 -0
  250. package/dist/operation-context-C-2hmmtP.js.map +1 -0
  251. package/dist/operation-context-n4_obUwq.cjs +70 -0
  252. package/dist/operation-context-n4_obUwq.cjs.map +1 -0
  253. package/dist/parse-error.cjs +55 -9
  254. package/dist/parse-error.cjs.map +1 -1
  255. package/dist/parse-error.d.cts +12 -10
  256. package/dist/parse-error.d.cts.map +1 -0
  257. package/dist/parse-error.d.ts +12 -10
  258. package/dist/parse-error.d.ts.map +1 -0
  259. package/dist/parse-error.js +55 -2
  260. package/dist/parse-error.js.map +1 -1
  261. package/dist/pretty-console-exporter-CMzlrRNg.cjs +232 -0
  262. package/dist/pretty-console-exporter-CMzlrRNg.cjs.map +1 -0
  263. package/dist/pretty-console-exporter-DqKl_q9z.js +227 -0
  264. package/dist/pretty-console-exporter-DqKl_q9z.js.map +1 -0
  265. package/dist/processors.cjs +13 -17
  266. package/dist/processors.d.cts +3 -171
  267. package/dist/processors.d.ts +3 -171
  268. package/dist/processors.js +4 -4
  269. package/dist/register.cjs +35 -6
  270. package/dist/register.cjs.map +1 -1
  271. package/dist/register.d.cts +1 -2
  272. package/dist/register.d.ts +1 -2
  273. package/dist/register.js +36 -3
  274. package/dist/register.js.map +1 -1
  275. package/dist/registry-DVSmWg6Y.js +175 -0
  276. package/dist/registry-DVSmWg6Y.js.map +1 -0
  277. package/dist/registry-DYgvb62e.cjs +319 -0
  278. package/dist/registry-DYgvb62e.cjs.map +1 -0
  279. package/dist/sampling-CR0Va1VB.d.ts +351 -0
  280. package/dist/sampling-CR0Va1VB.d.ts.map +1 -0
  281. package/dist/sampling-DfYhDJij.d.cts +351 -0
  282. package/dist/sampling-DfYhDJij.d.cts.map +1 -0
  283. package/dist/sampling.cjs +452 -60
  284. package/dist/sampling.cjs.map +1 -1
  285. package/dist/sampling.d.cts +2 -379
  286. package/dist/sampling.d.ts +2 -379
  287. package/dist/sampling.js +441 -5
  288. package/dist/sampling.js.map +1 -1
  289. package/dist/security-schema.cjs +65 -46
  290. package/dist/security-schema.cjs.map +1 -1
  291. package/dist/security-schema.d.cts +23 -26
  292. package/dist/security-schema.d.cts.map +1 -0
  293. package/dist/security-schema.d.ts +23 -26
  294. package/dist/security-schema.d.ts.map +1 -0
  295. package/dist/security-schema.js +64 -45
  296. package/dist/security-schema.js.map +1 -1
  297. package/dist/semantic-conventions-FhSxv-bK.d.cts +32 -0
  298. package/dist/semantic-conventions-FhSxv-bK.d.cts.map +1 -0
  299. package/dist/semantic-conventions-FhSxv-bK.d.ts +32 -0
  300. package/dist/semantic-conventions-FhSxv-bK.d.ts.map +1 -0
  301. package/dist/semantic-conventions.cjs +15 -26
  302. package/dist/semantic-conventions.cjs.map +1 -1
  303. package/dist/semantic-conventions.d.cts +2 -29
  304. package/dist/semantic-conventions.d.ts +2 -29
  305. package/dist/semantic-conventions.js +12 -3
  306. package/dist/semantic-conventions.js.map +1 -1
  307. package/dist/semantic-helpers.cjs +327 -39
  308. package/dist/semantic-helpers.cjs.map +1 -1
  309. package/dist/semantic-helpers.d.cts +30 -150
  310. package/dist/semantic-helpers.d.cts.map +1 -0
  311. package/dist/semantic-helpers.d.ts +30 -150
  312. package/dist/semantic-helpers.d.ts.map +1 -0
  313. package/dist/semantic-helpers.js +326 -20
  314. package/dist/semantic-helpers.js.map +1 -1
  315. package/dist/span-name-normalizer-8ZOGJuwv.d.cts +70 -0
  316. package/dist/span-name-normalizer-8ZOGJuwv.d.cts.map +1 -0
  317. package/dist/span-name-normalizer-8ZOGJuwv.d.ts +70 -0
  318. package/dist/span-name-normalizer-8ZOGJuwv.d.ts.map +1 -0
  319. package/dist/span-name-normalizer.cjs +95 -17
  320. package/dist/span-name-normalizer.cjs.map +1 -1
  321. package/dist/span-name-normalizer.d.cts +2 -94
  322. package/dist/span-name-normalizer.d.ts +2 -94
  323. package/dist/span-name-normalizer.js +93 -2
  324. package/dist/span-name-normalizer.js.map +1 -1
  325. package/dist/stable-hash-BNTMrmdB.cjs +28 -0
  326. package/dist/stable-hash-BNTMrmdB.cjs.map +1 -0
  327. package/dist/stable-hash-Cg5cT34Q.js +23 -0
  328. package/dist/stable-hash-Cg5cT34Q.js.map +1 -0
  329. package/dist/structured-error-9--cxBay.js +143 -0
  330. package/dist/structured-error-9--cxBay.js.map +1 -0
  331. package/dist/structured-error-CHg7DoIQ.cjs +178 -0
  332. package/dist/structured-error-CHg7DoIQ.cjs.map +1 -0
  333. package/dist/tail-sampling-processor.cjs +26 -13
  334. package/dist/tail-sampling-processor.cjs.map +1 -1
  335. package/dist/tail-sampling-processor.d.cts +11 -23
  336. package/dist/tail-sampling-processor.d.cts.map +1 -0
  337. package/dist/tail-sampling-processor.d.ts +11 -23
  338. package/dist/tail-sampling-processor.d.ts.map +1 -0
  339. package/dist/tail-sampling-processor.js +27 -6
  340. package/dist/tail-sampling-processor.js.map +1 -1
  341. package/dist/test-span-collector.cjs +70 -72
  342. package/dist/test-span-collector.cjs.map +1 -1
  343. package/dist/test-span-collector.d.cts +25 -43
  344. package/dist/test-span-collector.d.cts.map +1 -0
  345. package/dist/test-span-collector.d.ts +25 -43
  346. package/dist/test-span-collector.d.ts.map +1 -0
  347. package/dist/test-span-collector.js +69 -70
  348. package/dist/test-span-collector.js.map +1 -1
  349. package/dist/testing.cjs +389 -278
  350. package/dist/testing.cjs.map +1 -1
  351. package/dist/testing.d.cts +39 -62
  352. package/dist/testing.d.cts.map +1 -0
  353. package/dist/testing.d.ts +39 -62
  354. package/dist/testing.d.ts.map +1 -0
  355. package/dist/testing.js +386 -265
  356. package/dist/testing.js.map +1 -1
  357. package/dist/trace-context-Cijqoi6e.d.cts +212 -0
  358. package/dist/trace-context-Cijqoi6e.d.cts.map +1 -0
  359. package/dist/trace-context-Cijqoi6e.d.ts +212 -0
  360. package/dist/trace-context-Cijqoi6e.d.ts.map +1 -0
  361. package/dist/trace-helpers.cjs +634 -54
  362. package/dist/trace-helpers.cjs.map +1 -1
  363. package/dist/trace-helpers.d.cts +17 -49
  364. package/dist/trace-helpers.d.cts.map +1 -0
  365. package/dist/trace-helpers.d.ts +17 -49
  366. package/dist/trace-helpers.d.ts.map +1 -0
  367. package/dist/trace-helpers.js +624 -3
  368. package/dist/trace-helpers.js.map +1 -1
  369. package/dist/tracer-provider.cjs +227 -16
  370. package/dist/tracer-provider.cjs.map +1 -1
  371. package/dist/tracer-provider.d.cts +5 -4
  372. package/dist/tracer-provider.d.cts.map +1 -0
  373. package/dist/tracer-provider.d.ts +5 -4
  374. package/dist/tracer-provider.d.ts.map +1 -0
  375. package/dist/tracer-provider.js +227 -2
  376. package/dist/tracer-provider.js.map +1 -1
  377. package/dist/track-3HY4NGV-.cjs +1212 -0
  378. package/dist/track-3HY4NGV-.cjs.map +1 -0
  379. package/dist/track-nsKVy-pj.js +1111 -0
  380. package/dist/track-nsKVy-pj.js.map +1 -0
  381. package/dist/validate.cjs +178 -115
  382. package/dist/validate.cjs.map +1 -1
  383. package/dist/validate.d.cts +40 -64
  384. package/dist/validate.d.cts.map +1 -0
  385. package/dist/validate.d.ts +40 -64
  386. package/dist/validate.d.ts.map +1 -0
  387. package/dist/validate.js +177 -113
  388. package/dist/validate.js.map +1 -1
  389. package/dist/validation-attributes.cjs +42 -17
  390. package/dist/validation-attributes.cjs.map +1 -1
  391. package/dist/validation-attributes.d.cts +13 -20
  392. package/dist/validation-attributes.d.cts.map +1 -0
  393. package/dist/validation-attributes.d.ts +13 -20
  394. package/dist/validation-attributes.d.ts.map +1 -0
  395. package/dist/validation-attributes.js +40 -2
  396. package/dist/validation-attributes.js.map +1 -1
  397. package/dist/webhook.cjs +286 -256
  398. package/dist/webhook.cjs.map +1 -1
  399. package/dist/webhook.d.cts +157 -192
  400. package/dist/webhook.d.cts.map +1 -0
  401. package/dist/webhook.d.ts +157 -192
  402. package/dist/webhook.d.ts.map +1 -0
  403. package/dist/webhook.js +285 -254
  404. package/dist/webhook.js.map +1 -1
  405. package/dist/workflow-distributed.cjs +498 -412
  406. package/dist/workflow-distributed.cjs.map +1 -1
  407. package/dist/workflow-distributed.d.cts +163 -173
  408. package/dist/workflow-distributed.d.cts.map +1 -0
  409. package/dist/workflow-distributed.d.ts +163 -173
  410. package/dist/workflow-distributed.d.ts.map +1 -0
  411. package/dist/workflow-distributed.js +497 -410
  412. package/dist/workflow-distributed.js.map +1 -1
  413. package/dist/workflow.cjs +405 -40
  414. package/dist/workflow.cjs.map +1 -1
  415. package/dist/workflow.d.cts +78 -131
  416. package/dist/workflow.d.cts.map +1 -0
  417. package/dist/workflow.d.ts +78 -131
  418. package/dist/workflow.d.ts.map +1 -0
  419. package/dist/workflow.js +403 -21
  420. package/dist/workflow.js.map +1 -1
  421. package/dist/yaml-config-B3dQ82GR.cjs +272 -0
  422. package/dist/yaml-config-B3dQ82GR.cjs.map +1 -0
  423. package/dist/yaml-config.cjs +5 -24
  424. package/dist/yaml-config.d.cts +30 -64
  425. package/dist/yaml-config.d.cts.map +1 -0
  426. package/dist/yaml-config.d.ts +30 -64
  427. package/dist/yaml-config.d.ts.map +1 -0
  428. package/dist/yaml-config.js +226 -7
  429. package/dist/yaml-config.js.map +1 -1
  430. package/package.json +4 -4
  431. package/skills/analyze-traces/SKILL.md +14 -12
  432. package/skills/review-otel-patterns/SKILL.md +4 -2
  433. package/skills/tune-sampling/SKILL.md +8 -3
  434. package/src/attributes/builders.ts +2 -20
  435. package/src/attributes/index.ts +0 -1
  436. package/src/attributes/registry.ts +2 -9
  437. package/src/attributes/types.ts +0 -8
  438. package/src/index.ts +7 -41
  439. package/src/request-logger.test.ts +53 -1
  440. package/src/request-logger.ts +58 -0
  441. package/src/semantic-helpers.test.ts +2 -87
  442. package/src/semantic-helpers.ts +0 -146
  443. package/src/validate.test.ts +3 -1
  444. package/src/validate.ts +9 -3
  445. package/dist/attributes.cjs.map +0 -1
  446. package/dist/attributes.js.map +0 -1
  447. package/dist/chunk-2ZKEORFN.cjs +0 -14
  448. package/dist/chunk-2ZKEORFN.cjs.map +0 -1
  449. package/dist/chunk-3QXBFGKP.js +0 -344
  450. package/dist/chunk-3QXBFGKP.js.map +0 -1
  451. package/dist/chunk-454CH4OV.js +0 -744
  452. package/dist/chunk-454CH4OV.js.map +0 -1
  453. package/dist/chunk-4A53YIAX.js +0 -180
  454. package/dist/chunk-4A53YIAX.js.map +0 -1
  455. package/dist/chunk-4IFSYQVX.js +0 -337
  456. package/dist/chunk-4IFSYQVX.js.map +0 -1
  457. package/dist/chunk-4P6ZOARG.cjs +0 -33
  458. package/dist/chunk-4P6ZOARG.cjs.map +0 -1
  459. package/dist/chunk-55ER2KD5.js +0 -228
  460. package/dist/chunk-55ER2KD5.js.map +0 -1
  461. package/dist/chunk-5ZN622AO.js +0 -73
  462. package/dist/chunk-5ZN622AO.js.map +0 -1
  463. package/dist/chunk-66YJ66GG.js +0 -1021
  464. package/dist/chunk-66YJ66GG.js.map +0 -1
  465. package/dist/chunk-6S5RUKU3.cjs +0 -347
  466. package/dist/chunk-6S5RUKU3.cjs.map +0 -1
  467. package/dist/chunk-6UQRVUN3.js +0 -222
  468. package/dist/chunk-6UQRVUN3.js.map +0 -1
  469. package/dist/chunk-7552UTQW.js +0 -11
  470. package/dist/chunk-7552UTQW.js.map +0 -1
  471. package/dist/chunk-7EQ4G4SI.cjs +0 -146
  472. package/dist/chunk-7EQ4G4SI.cjs.map +0 -1
  473. package/dist/chunk-7SAWIN74.js +0 -285
  474. package/dist/chunk-7SAWIN74.js.map +0 -1
  475. package/dist/chunk-A4E5AQFK.js +0 -30
  476. package/dist/chunk-A4E5AQFK.js.map +0 -1
  477. package/dist/chunk-ALPYR2GC.js +0 -1061
  478. package/dist/chunk-ALPYR2GC.js.map +0 -1
  479. package/dist/chunk-B7SWBE4P.cjs +0 -799
  480. package/dist/chunk-B7SWBE4P.cjs.map +0 -1
  481. package/dist/chunk-BZHG5IZ4.js +0 -73
  482. package/dist/chunk-BZHG5IZ4.js.map +0 -1
  483. package/dist/chunk-CEAQK2QY.cjs +0 -32
  484. package/dist/chunk-CEAQK2QY.cjs.map +0 -1
  485. package/dist/chunk-CMHVQR6P.js +0 -170
  486. package/dist/chunk-CMHVQR6P.js.map +0 -1
  487. package/dist/chunk-CU6IDACR.cjs +0 -224
  488. package/dist/chunk-CU6IDACR.cjs.map +0 -1
  489. package/dist/chunk-D4TM63S3.js +0 -795
  490. package/dist/chunk-D4TM63S3.js.map +0 -1
  491. package/dist/chunk-DCEDJQGG.js +0 -28
  492. package/dist/chunk-DCEDJQGG.js.map +0 -1
  493. package/dist/chunk-DPSA4QLA.js +0 -344
  494. package/dist/chunk-DPSA4QLA.js.map +0 -1
  495. package/dist/chunk-E6TERL5O.cjs +0 -23
  496. package/dist/chunk-E6TERL5O.cjs.map +0 -1
  497. package/dist/chunk-EE6CPXKH.cjs +0 -164
  498. package/dist/chunk-EE6CPXKH.cjs.map +0 -1
  499. package/dist/chunk-EOFB7XCL.cjs +0 -837
  500. package/dist/chunk-EOFB7XCL.cjs.map +0 -1
  501. package/dist/chunk-ESLWRGAG.cjs +0 -92
  502. package/dist/chunk-ESLWRGAG.cjs.map +0 -1
  503. package/dist/chunk-ESMHTKLJ.cjs +0 -206
  504. package/dist/chunk-ESMHTKLJ.cjs.map +0 -1
  505. package/dist/chunk-FMTHVSYY.cjs +0 -1039
  506. package/dist/chunk-FMTHVSYY.cjs.map +0 -1
  507. package/dist/chunk-FU6R566Y.cjs +0 -236
  508. package/dist/chunk-FU6R566Y.cjs.map +0 -1
  509. package/dist/chunk-GYR5K654.js +0 -91
  510. package/dist/chunk-GYR5K654.js.map +0 -1
  511. package/dist/chunk-HA2WBOGQ.js +0 -57
  512. package/dist/chunk-HA2WBOGQ.js.map +0 -1
  513. package/dist/chunk-HT5JQKN2.js +0 -118
  514. package/dist/chunk-HT5JQKN2.js.map +0 -1
  515. package/dist/chunk-INJD3G4K.cjs +0 -340
  516. package/dist/chunk-INJD3G4K.cjs.map +0 -1
  517. package/dist/chunk-IOYFAFHJ.cjs +0 -95
  518. package/dist/chunk-IOYFAFHJ.cjs.map +0 -1
  519. package/dist/chunk-J5QENANM.js +0 -87
  520. package/dist/chunk-J5QENANM.js.map +0 -1
  521. package/dist/chunk-J7VGRIAJ.js +0 -64
  522. package/dist/chunk-J7VGRIAJ.js.map +0 -1
  523. package/dist/chunk-KFOHQK7X.js +0 -144
  524. package/dist/chunk-KFOHQK7X.js.map +0 -1
  525. package/dist/chunk-KIL5CUN6.js +0 -31
  526. package/dist/chunk-KIL5CUN6.js.map +0 -1
  527. package/dist/chunk-KYXZS3EA.cjs +0 -100
  528. package/dist/chunk-KYXZS3EA.cjs.map +0 -1
  529. package/dist/chunk-LITNXTTT.js +0 -3
  530. package/dist/chunk-LITNXTTT.js.map +0 -1
  531. package/dist/chunk-LVIPBYFE.js +0 -157
  532. package/dist/chunk-LVIPBYFE.js.map +0 -1
  533. package/dist/chunk-M3LFHHTN.cjs +0 -764
  534. package/dist/chunk-M3LFHHTN.cjs.map +0 -1
  535. package/dist/chunk-N25JDZSC.js +0 -95
  536. package/dist/chunk-N25JDZSC.js.map +0 -1
  537. package/dist/chunk-NEIB3TLD.cjs +0 -360
  538. package/dist/chunk-NEIB3TLD.cjs.map +0 -1
  539. package/dist/chunk-NENU7E6V.cjs +0 -344
  540. package/dist/chunk-NENU7E6V.cjs.map +0 -1
  541. package/dist/chunk-NVAI5CCN.cjs +0 -39
  542. package/dist/chunk-NVAI5CCN.cjs.map +0 -1
  543. package/dist/chunk-NZ72VDNY.cjs +0 -4
  544. package/dist/chunk-NZ72VDNY.cjs.map +0 -1
  545. package/dist/chunk-OPPXYVEZ.cjs +0 -131
  546. package/dist/chunk-OPPXYVEZ.cjs.map +0 -1
  547. package/dist/chunk-Q4EULJQY.js +0 -35
  548. package/dist/chunk-Q4EULJQY.js.map +0 -1
  549. package/dist/chunk-QF7ARNUM.js +0 -339
  550. package/dist/chunk-QF7ARNUM.js.map +0 -1
  551. package/dist/chunk-QWW3E3JM.cjs +0 -178
  552. package/dist/chunk-QWW3E3JM.cjs.map +0 -1
  553. package/dist/chunk-R7QYGZUP.cjs +0 -1075
  554. package/dist/chunk-R7QYGZUP.cjs.map +0 -1
  555. package/dist/chunk-RUPKBKUF.js +0 -352
  556. package/dist/chunk-RUPKBKUF.js.map +0 -1
  557. package/dist/chunk-SEO6NAQT.js +0 -14
  558. package/dist/chunk-SEO6NAQT.js.map +0 -1
  559. package/dist/chunk-T4B5LB6E.cjs +0 -66
  560. package/dist/chunk-T4B5LB6E.cjs.map +0 -1
  561. package/dist/chunk-T5WRA76K.cjs +0 -32
  562. package/dist/chunk-T5WRA76K.cjs.map +0 -1
  563. package/dist/chunk-T7JO2TCP.js +0 -1233
  564. package/dist/chunk-T7JO2TCP.js.map +0 -1
  565. package/dist/chunk-TC5ZPWM4.cjs +0 -289
  566. package/dist/chunk-TC5ZPWM4.cjs.map +0 -1
  567. package/dist/chunk-TQ5UWA7S.js +0 -26
  568. package/dist/chunk-TQ5UWA7S.js.map +0 -1
  569. package/dist/chunk-UIKYE2QZ.js +0 -833
  570. package/dist/chunk-UIKYE2QZ.js.map +0 -1
  571. package/dist/chunk-UNPLAVE7.js +0 -21
  572. package/dist/chunk-UNPLAVE7.js.map +0 -1
  573. package/dist/chunk-UY3UYPBZ.cjs +0 -77
  574. package/dist/chunk-UY3UYPBZ.cjs.map +0 -1
  575. package/dist/chunk-V7UBMJAB.cjs +0 -1242
  576. package/dist/chunk-V7UBMJAB.cjs.map +0 -1
  577. package/dist/chunk-VH77IPJN.cjs +0 -358
  578. package/dist/chunk-VH77IPJN.cjs.map +0 -1
  579. package/dist/chunk-VQTCQKHQ.cjs +0 -17
  580. package/dist/chunk-VQTCQKHQ.cjs.map +0 -1
  581. package/dist/chunk-WGWSHJ2N.js +0 -38
  582. package/dist/chunk-WGWSHJ2N.js.map +0 -1
  583. package/dist/chunk-WJH6IYU2.cjs +0 -32
  584. package/dist/chunk-WJH6IYU2.cjs.map +0 -1
  585. package/dist/chunk-YREV3LGG.cjs +0 -61
  586. package/dist/chunk-YREV3LGG.cjs.map +0 -1
  587. package/dist/chunk-YTXEZ4SD.cjs +0 -77
  588. package/dist/chunk-YTXEZ4SD.cjs.map +0 -1
  589. package/dist/chunk-ZNMBW67B.cjs +0 -40
  590. package/dist/chunk-ZNMBW67B.cjs.map +0 -1
  591. package/dist/correlation-id.cjs.map +0 -1
  592. package/dist/correlation-id.js.map +0 -1
  593. package/dist/define-event-BL6Li7CM.d.ts +0 -23
  594. package/dist/define-event-ClP3T1Jx.d.cts +0 -23
  595. package/dist/event-subscriber.cjs.map +0 -1
  596. package/dist/event-subscriber.js.map +0 -1
  597. package/dist/event.cjs.map +0 -1
  598. package/dist/event.js.map +0 -1
  599. package/dist/exporters.cjs.map +0 -1
  600. package/dist/exporters.js.map +0 -1
  601. package/dist/functional.cjs.map +0 -1
  602. package/dist/functional.js.map +0 -1
  603. package/dist/init-DIowiiCh.d.ts +0 -1167
  604. package/dist/init-j-A1zI16.d.cts +0 -1167
  605. package/dist/processors.cjs.map +0 -1
  606. package/dist/processors.js.map +0 -1
  607. package/dist/trace-context-DbGKd1Rn.d.cts +0 -213
  608. package/dist/trace-context-DbGKd1Rn.d.ts +0 -213
  609. package/dist/utils-BahBCFtJ.d.cts +0 -712
  610. package/dist/utils-CLKwaUlG.d.ts +0 -712
  611. package/dist/yaml-config.cjs.map +0 -1
  612. package/src/gen-ai-cost.test.ts +0 -81
  613. package/src/gen-ai-cost.ts +0 -145
  614. package/src/gen-ai-events.test.ts +0 -135
  615. package/src/gen-ai-events.ts +0 -208
  616. package/src/gen-ai-metrics.test.ts +0 -96
  617. package/src/gen-ai-metrics.ts +0 -128
package/dist/index.cjs CHANGED
@@ -1,1278 +1,811 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_sampling = require('./sampling.cjs');
3
+ const require_init = require('./init-DvapOXCc.cjs');
4
+ const require_filtering_span_processor = require('./filtering-span-processor.cjs');
5
+ const require_span_name_normalizer = require('./span-name-normalizer.cjs');
6
+ const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
7
+ const require_canonical_log_line_processor = require('./canonical-log-line-processor--RlFDHhm.cjs');
8
+ const require_tracer_provider = require('./tracer-provider.cjs');
9
+ const require_track = require('./track-3HY4NGV-.cjs');
10
+ const require_structured_error = require('./structured-error-CHg7DoIQ.cjs');
11
+ const require_trace_helpers = require('./trace-helpers.cjs');
12
+ const require_operation_context = require('./operation-context-n4_obUwq.cjs');
13
+ const require_functional = require('./functional-C4CzoVrX.cjs');
14
+ const require_stable_hash = require('./stable-hash-BNTMrmdB.cjs');
15
+ const require_event = require('./event-Dlqr4ZNL.cjs');
16
+ const require_metric = require('./metric.cjs');
17
+ const require_correlated_events = require('./correlated-events-kSwLo3mi.cjs');
18
+ const require_parse_error = require('./parse-error.cjs');
19
+ const require_drain_pipeline = require('./drain-pipeline.cjs');
20
+ const require_metric_helpers = require('./metric-helpers.cjs');
21
+ const require_semantic_helpers = require('./semantic-helpers.cjs');
22
+ const require_registry = require('./registry-DYgvb62e.cjs');
23
+ const require_semantic_conventions = require('./semantic-conventions.cjs');
24
+ const require_attributes = require('./attributes-PZ5doLgw.cjs');
25
+ const require_messaging = require('./messaging.cjs');
26
+ const require_business_baggage = require('./business-baggage.cjs');
27
+ const require_workflow = require('./workflow.cjs');
28
+ let _opentelemetry_api = require("@opentelemetry/api");
29
+ let node_async_hooks = require("node:async_hooks");
2
30
 
3
- var chunk2ZKEORFN_cjs = require('./chunk-2ZKEORFN.cjs');
4
- var chunkT4B5LB6E_cjs = require('./chunk-T4B5LB6E.cjs');
5
- var chunk7EQ4G4SI_cjs = require('./chunk-7EQ4G4SI.cjs');
6
- var chunkNENU7E6V_cjs = require('./chunk-NENU7E6V.cjs');
7
- var chunkE6TERL5O_cjs = require('./chunk-E6TERL5O.cjs');
8
- var chunkM3LFHHTN_cjs = require('./chunk-M3LFHHTN.cjs');
9
- var chunkESMHTKLJ_cjs = require('./chunk-ESMHTKLJ.cjs');
10
- var chunkB7SWBE4P_cjs = require('./chunk-B7SWBE4P.cjs');
11
- var chunk4P6ZOARG_cjs = require('./chunk-4P6ZOARG.cjs');
12
- var chunkINJD3G4K_cjs = require('./chunk-INJD3G4K.cjs');
13
- var chunkTC5ZPWM4_cjs = require('./chunk-TC5ZPWM4.cjs');
14
- require('./chunk-YTXEZ4SD.cjs');
15
- var chunkWJH6IYU2_cjs = require('./chunk-WJH6IYU2.cjs');
16
- var chunkKYXZS3EA_cjs = require('./chunk-KYXZS3EA.cjs');
17
- var chunkV7UBMJAB_cjs = require('./chunk-V7UBMJAB.cjs');
18
- var chunkOPPXYVEZ_cjs = require('./chunk-OPPXYVEZ.cjs');
19
- var chunkEOFB7XCL_cjs = require('./chunk-EOFB7XCL.cjs');
20
- require('./chunk-NZ72VDNY.cjs');
21
- require('./chunk-UY3UYPBZ.cjs');
22
- var chunkVQTCQKHQ_cjs = require('./chunk-VQTCQKHQ.cjs');
23
- var chunkFMTHVSYY_cjs = require('./chunk-FMTHVSYY.cjs');
24
- var chunkEE6CPXKH_cjs = require('./chunk-EE6CPXKH.cjs');
25
- var chunkR7QYGZUP_cjs = require('./chunk-R7QYGZUP.cjs');
26
- require('./chunk-QWW3E3JM.cjs');
27
- require('./chunk-CEAQK2QY.cjs');
28
- var chunkZNMBW67B_cjs = require('./chunk-ZNMBW67B.cjs');
29
- var chunkIOYFAFHJ_cjs = require('./chunk-IOYFAFHJ.cjs');
30
- var chunkNEIB3TLD_cjs = require('./chunk-NEIB3TLD.cjs');
31
- require('./chunk-CU6IDACR.cjs');
32
- var chunk6S5RUKU3_cjs = require('./chunk-6S5RUKU3.cjs');
33
- require('./chunk-NVAI5CCN.cjs');
34
- var chunkVH77IPJN_cjs = require('./chunk-VH77IPJN.cjs');
35
- require('./chunk-FU6R566Y.cjs');
36
- require('./chunk-ESLWRGAG.cjs');
37
- var chunkYREV3LGG_cjs = require('./chunk-YREV3LGG.cjs');
38
- var api = require('@opentelemetry/api');
39
- var async_hooks = require('async_hooks');
40
- var sdkMetrics = require('@opentelemetry/sdk-metrics');
41
-
42
- var otelMethods = {
43
- // Class methods on TraceAPI — bind to the singleton.
44
- setGlobalTracerProvider: api.trace.setGlobalTracerProvider.bind(api.trace),
45
- getTracerProvider: api.trace.getTracerProvider.bind(api.trace),
46
- getTracer: api.trace.getTracer.bind(api.trace),
47
- disable: api.trace.disable.bind(api.trace),
48
- // Instance fields on TraceAPI — already standalone, copy by reference.
49
- wrapSpanContext: api.trace.wrapSpanContext,
50
- isSpanContextValid: api.trace.isSpanContextValid,
51
- deleteSpan: api.trace.deleteSpan,
52
- getSpan: api.trace.getSpan,
53
- getActiveSpan: api.trace.getActiveSpan,
54
- getSpanContext: api.trace.getSpanContext,
55
- setSpan: api.trace.setSpan,
56
- setSpanContext: api.trace.setSpanContext
31
+ //#region src/trace-hybrid.ts
32
+ /**
33
+ * Hybrid `trace` export: callable like autotel's `trace(fn)`, AND exposes the
34
+ * full `@opentelemetry/api` `TraceAPI` surface (`trace.getActiveSpan()`,
35
+ * `trace.getTracer()`, …) so existing OTel code "just works" when imported
36
+ * from `autotel`.
37
+ *
38
+ * Implementation: `Object.assign` mutates the autotel `trace` function to
39
+ * attach the OTel TraceAPI methods. Because every reference to `trace` across
40
+ * autotel resolves to the same function instance, this is a one-time, global
41
+ * augmentation.
42
+ */
43
+ const otelMethods = {
44
+ setGlobalTracerProvider: _opentelemetry_api.trace.setGlobalTracerProvider.bind(_opentelemetry_api.trace),
45
+ getTracerProvider: _opentelemetry_api.trace.getTracerProvider.bind(_opentelemetry_api.trace),
46
+ getTracer: _opentelemetry_api.trace.getTracer.bind(_opentelemetry_api.trace),
47
+ disable: _opentelemetry_api.trace.disable.bind(_opentelemetry_api.trace),
48
+ wrapSpanContext: _opentelemetry_api.trace.wrapSpanContext,
49
+ isSpanContextValid: _opentelemetry_api.trace.isSpanContextValid,
50
+ deleteSpan: _opentelemetry_api.trace.deleteSpan,
51
+ getSpan: _opentelemetry_api.trace.getSpan,
52
+ getActiveSpan: _opentelemetry_api.trace.getActiveSpan,
53
+ getSpanContext: _opentelemetry_api.trace.getSpanContext,
54
+ setSpan: _opentelemetry_api.trace.setSpan,
55
+ setSpanContext: _opentelemetry_api.trace.setSpanContext
57
56
  };
58
- var trace2 = Object.assign(
59
- chunkV7UBMJAB_cjs.trace,
60
- otelMethods
61
- );
57
+ const trace = Object.assign(require_functional.trace, otelMethods);
62
58
 
63
- // src/define-event.ts
59
+ //#endregion
60
+ //#region src/define-event.ts
64
61
  function defineEvent(name, schema, options = {}) {
65
- const jsonSchema = options.toJsonSchema?.(schema);
66
- const schemaMetadata = jsonSchema ? {
67
- source: "zod",
68
- jsonSchema,
69
- hash: chunkE6TERL5O_cjs.hashJson(jsonSchema)
70
- } : void 0;
71
- return {
72
- name,
73
- schemaMetadata,
74
- track(payload) {
75
- const parsed = schema.safeParse(payload);
76
- if (!parsed.success) {
77
- throw new Error(
78
- `Invalid payload for event "${name}". Schema validation failed.`
79
- );
80
- }
81
- chunkFMTHVSYY_cjs.track(
82
- name,
83
- parsed.data,
84
- schemaMetadata ? { schema: schemaMetadata } : void 0
85
- );
86
- }
87
- };
62
+ const jsonSchema = options.toJsonSchema?.(schema);
63
+ const schemaMetadata = jsonSchema ? {
64
+ source: "zod",
65
+ jsonSchema,
66
+ hash: require_stable_hash.hashJson(jsonSchema)
67
+ } : void 0;
68
+ return {
69
+ name,
70
+ schemaMetadata,
71
+ track(payload) {
72
+ const parsed = schema.safeParse(payload);
73
+ if (!parsed.success) throw new Error(`Invalid payload for event "${name}". Schema validation failed.`);
74
+ require_track.track(name, parsed.data, schemaMetadata ? { schema: schemaMetadata } : void 0);
75
+ }
76
+ };
88
77
  }
89
78
 
90
- // src/shutdown.ts
79
+ //#endregion
80
+ //#region src/shutdown.ts
81
+ /**
82
+ * Graceful shutdown with flush and cleanup
83
+ */
84
+ /**
85
+ * Flush all pending telemetry
86
+ *
87
+ * Flushes both events events and OpenTelemetry spans to their destinations.
88
+ * Includes timeout protection to prevent hanging in serverless environments.
89
+ *
90
+ * Safe to call multiple times.
91
+ *
92
+ * @param options - Optional configuration
93
+ * @param options.timeout - Timeout in milliseconds (default: 2000ms)
94
+ * @param options.forShutdown - If true, permanently disables the events queue after flush (used internally by shutdown())
95
+ *
96
+ * @example Manual flush in serverless
97
+ * ```typescript
98
+ * import { flush } from 'autotel';
99
+ *
100
+ * export const handler = async (event) => {
101
+ * // ... process event
102
+ * await flush(); // Flush before function returns
103
+ * return result;
104
+ * };
105
+ * ```
106
+ *
107
+ * @example With custom timeout
108
+ * ```typescript
109
+ * await flush({ timeout: 5000 }); // 5 second timeout
110
+ * ```
111
+ */
91
112
  async function flush(options) {
92
- const timeout = options?.timeout ?? 2e3;
93
- const forShutdown = options?.forShutdown ?? false;
94
- const doFlush = async () => {
95
- const eventsQueue = chunkFMTHVSYY_cjs.getEventQueue();
96
- if (eventsQueue) {
97
- if (forShutdown) {
98
- await eventsQueue.shutdown();
99
- } else {
100
- await eventsQueue.flush();
101
- }
102
- }
103
- const sdk = chunkR7QYGZUP_cjs.getSdk();
104
- if (sdk) {
105
- try {
106
- const sdkAny = sdk;
107
- if (typeof sdkAny.getTracerProvider === "function") {
108
- const tracerProvider = sdkAny.getTracerProvider();
109
- if (tracerProvider && typeof tracerProvider.forceFlush === "function") {
110
- await tracerProvider.forceFlush();
111
- }
112
- }
113
- } catch {
114
- }
115
- }
116
- };
117
- let timeoutHandle;
118
- try {
119
- await Promise.race([
120
- doFlush().finally(() => {
121
- if (timeoutHandle) {
122
- clearTimeout(timeoutHandle);
123
- }
124
- }),
125
- new Promise((_, reject) => {
126
- timeoutHandle = setTimeout(
127
- () => reject(new Error("Flush timeout")),
128
- timeout
129
- );
130
- timeoutHandle.unref();
131
- })
132
- ]);
133
- } catch (error) {
134
- if (timeoutHandle) {
135
- clearTimeout(timeoutHandle);
136
- }
137
- const logger = chunkR7QYGZUP_cjs.getLogger();
138
- logger.error(
139
- {
140
- err: error instanceof Error ? error : new Error(String(error))
141
- },
142
- "[autotel] Flush error"
143
- );
144
- throw error;
145
- }
146
- }
113
+ const timeout = options?.timeout ?? 2e3;
114
+ const forShutdown = options?.forShutdown ?? false;
115
+ const doFlush = async () => {
116
+ const eventsQueue = require_track.getEventQueue();
117
+ if (eventsQueue) if (forShutdown) await eventsQueue.shutdown();
118
+ else await eventsQueue.flush();
119
+ const sdk = require_init.getSdk();
120
+ if (sdk) try {
121
+ const sdkAny = sdk;
122
+ if (typeof sdkAny.getTracerProvider === "function") {
123
+ const tracerProvider = sdkAny.getTracerProvider();
124
+ if (tracerProvider && typeof tracerProvider.forceFlush === "function") await tracerProvider.forceFlush();
125
+ }
126
+ } catch {}
127
+ };
128
+ let timeoutHandle;
129
+ try {
130
+ await Promise.race([doFlush().finally(() => {
131
+ if (timeoutHandle) clearTimeout(timeoutHandle);
132
+ }), new Promise((_, reject) => {
133
+ timeoutHandle = setTimeout(() => reject(/* @__PURE__ */ new Error("Flush timeout")), timeout);
134
+ timeoutHandle.unref();
135
+ })]);
136
+ } catch (error) {
137
+ if (timeoutHandle) clearTimeout(timeoutHandle);
138
+ require_init.getLogger().error({ err: error instanceof Error ? error : new Error(String(error)) }, "[autotel] Flush error");
139
+ throw error;
140
+ }
141
+ }
142
+ /**
143
+ * Shutdown telemetry and cleanup resources
144
+ *
145
+ * - Flushes all pending data
146
+ * - Shuts down OpenTelemetry SDK
147
+ * - Cleans up resources
148
+ *
149
+ * Call this before process exit.
150
+ *
151
+ * Always performs cleanup even if flush fails, preventing resource leaks
152
+ * in serverless handlers or tests.
153
+ *
154
+ * @example Express server
155
+ * ```typescript
156
+ * const server = app.listen(3000)
157
+ *
158
+ * process.on('SIGTERM', async () => {
159
+ * await server.close()
160
+ * await shutdown()
161
+ * process.exit(0)
162
+ * })
163
+ * ```
164
+ */
147
165
  async function shutdown() {
148
- const logger = chunkR7QYGZUP_cjs.getLogger();
149
- let shutdownError = null;
150
- try {
151
- await flush({ forShutdown: true });
152
- } catch (error) {
153
- const err = error instanceof Error ? error : new Error(String(error));
154
- shutdownError = err;
155
- logger.error(
156
- {
157
- err
158
- },
159
- "[autotel] Flush failed during shutdown, continuing cleanup"
160
- );
161
- }
162
- try {
163
- const sdk = chunkR7QYGZUP_cjs.getSdk();
164
- if (sdk) {
165
- await sdk.shutdown();
166
- }
167
- } catch (error) {
168
- const err = error instanceof Error ? error : new Error(String(error));
169
- const isConnectionRefused = typeof error === "object" && error !== null && "code" in error && error.code === "ECONNREFUSED";
170
- if (!isConnectionRefused) {
171
- if (!shutdownError) {
172
- shutdownError = err;
173
- }
174
- logger.error({ err }, "[autotel] SDK shutdown failed");
175
- }
176
- } finally {
177
- await chunkR7QYGZUP_cjs._closeEmbeddedDevtools();
178
- const eventsQueue = chunkFMTHVSYY_cjs.getEventQueue();
179
- if (eventsQueue && typeof eventsQueue.cleanup === "function") {
180
- eventsQueue.cleanup();
181
- }
182
- chunkEOFB7XCL_cjs.resetEvents();
183
- chunkTC5ZPWM4_cjs.resetMetrics();
184
- chunkFMTHVSYY_cjs.resetEventQueue();
185
- }
186
- if (shutdownError) {
187
- throw shutdownError;
188
- }
189
- }
166
+ const logger = require_init.getLogger();
167
+ let shutdownError = null;
168
+ try {
169
+ await flush({ forShutdown: true });
170
+ } catch (error) {
171
+ const err = error instanceof Error ? error : new Error(String(error));
172
+ shutdownError = err;
173
+ logger.error({ err }, "[autotel] Flush failed during shutdown, continuing cleanup");
174
+ }
175
+ try {
176
+ const sdk = require_init.getSdk();
177
+ if (sdk) await sdk.shutdown();
178
+ } catch (error) {
179
+ const err = error instanceof Error ? error : new Error(String(error));
180
+ if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ECONNREFUSED")) {
181
+ if (!shutdownError) shutdownError = err;
182
+ logger.error({ err }, "[autotel] SDK shutdown failed");
183
+ }
184
+ } finally {
185
+ await require_init._closeEmbeddedDevtools();
186
+ const eventsQueue = require_track.getEventQueue();
187
+ if (eventsQueue && typeof eventsQueue.cleanup === "function") eventsQueue.cleanup();
188
+ require_event.resetEvents();
189
+ require_metric.resetMetrics();
190
+ require_track.resetEventQueue();
191
+ }
192
+ if (shutdownError) throw shutdownError;
193
+ }
194
+ /**
195
+ * Register automatic shutdown hooks for common signals
196
+ *
197
+ * Handles:
198
+ * - SIGTERM (Docker/K8s graceful shutdown)
199
+ * - SIGINT (Ctrl+C)
200
+ *
201
+ * @internal Called automatically on module load
202
+ */
190
203
  function registerShutdownHooks() {
191
- if (typeof process === "undefined") return;
192
- const signals = ["SIGTERM", "SIGINT"];
193
- let shuttingDown = false;
194
- for (const signal of signals) {
195
- process.on(signal, async () => {
196
- if (shuttingDown) return;
197
- shuttingDown = true;
198
- if (process.env.NODE_ENV !== "test") {
199
- chunkR7QYGZUP_cjs.getLogger().info(
200
- {},
201
- `[autotel] Received ${signal}, flushing telemetry...`
202
- );
203
- }
204
- try {
205
- await shutdown();
206
- } catch (error) {
207
- chunkR7QYGZUP_cjs.getLogger().error(
208
- {
209
- err: error instanceof Error ? error : void 0
210
- },
211
- "[autotel] Error during shutdown"
212
- );
213
- } finally {
214
- process.exit(0);
215
- }
216
- });
217
- }
204
+ if (typeof process === "undefined") return;
205
+ const signals = ["SIGTERM", "SIGINT"];
206
+ let shuttingDown = false;
207
+ for (const signal of signals) process.on(signal, async () => {
208
+ if (shuttingDown) return;
209
+ shuttingDown = true;
210
+ if (process.env.NODE_ENV !== "test") require_init.getLogger().info({}, `[autotel] Received ${signal}, flushing telemetry...`);
211
+ try {
212
+ await shutdown();
213
+ } catch (error) {
214
+ require_init.getLogger().error({ err: error instanceof Error ? error : void 0 }, "[autotel] Error during shutdown");
215
+ } finally {
216
+ process.exit(0);
217
+ }
218
+ });
218
219
  }
219
220
  registerShutdownHooks();
220
- var POST_EMIT_FORK_HINT = "For intentional background work tied to this request, use log.fork('label', fn) when available.";
221
+
222
+ //#endregion
223
+ //#region src/request-logger.ts
224
+ const POST_EMIT_FORK_HINT = "For intentional background work tied to this request, use log.fork('label', fn) when available.";
221
225
  function warnPostEmit(method, detail) {
222
- console.warn(
223
- `[autotel] ${method} called after the wide event was emitted \u2014 ${detail} This data will not appear in observability. ${POST_EMIT_FORK_HINT}`
224
- );
225
- }
226
- function mergeInto(target, source) {
227
- for (const key in source) {
228
- const sourceVal = source[key];
229
- if (sourceVal === void 0) continue;
230
- const targetVal = target[key];
231
- if (sourceVal !== null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal !== null && typeof targetVal === "object" && !Array.isArray(targetVal)) {
232
- mergeInto(
233
- targetVal,
234
- sourceVal
235
- );
236
- } else if (Array.isArray(targetVal) && Array.isArray(sourceVal)) {
237
- target[key] = [...targetVal, ...sourceVal];
238
- } else {
239
- target[key] = sourceVal;
240
- }
241
- }
242
- }
243
- var requestContextStore = new async_hooks.AsyncLocalStorage();
244
- function runWithRequestContext(ctx2, fn) {
245
- return requestContextStore.run(ctx2, fn);
246
- }
247
- function resolveContext(ctx2) {
248
- if (ctx2) return ctx2;
249
- const stored = requestContextStore.getStore();
250
- if (stored) return stored;
251
- const span2 = api.trace.getActiveSpan();
252
- if (!span2) {
253
- throw new Error(
254
- "[autotel] getRequestLogger() requires an active span or runWithRequestContext(). Wrap your handler with trace() or use runWithRequestContext()."
255
- );
256
- }
257
- return chunkFMTHVSYY_cjs.createTraceContext(span2);
258
- }
259
- function getRequestLogger(ctx2, options) {
260
- const activeContext = resolveContext(ctx2);
261
- let contextState = {};
262
- let emitted = false;
263
- let lastSnapshot = null;
264
- const addLogEvent = (level, message, fields) => {
265
- const attrs2 = fields ? chunkEE6CPXKH_cjs.flattenToAttributes(fields) : void 0;
266
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(activeContext, `log.${level}`, {
267
- message,
268
- ...attrs2 ?? {}
269
- });
270
- };
271
- const sealCheck = (method, keys) => {
272
- if (emitted) {
273
- warnPostEmit(
274
- method,
275
- `Keys dropped: ${keys.length ? keys.join(", ") : "(empty)"}.`
276
- );
277
- }
278
- };
279
- return {
280
- set(fields) {
281
- sealCheck("log.set()", Object.keys(fields));
282
- if (emitted) return;
283
- mergeInto(contextState, fields);
284
- activeContext.setAttributes(chunkEE6CPXKH_cjs.flattenToAttributes(fields));
285
- },
286
- info(message, fields) {
287
- const keys = fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"];
288
- sealCheck("log.info()", keys);
289
- if (emitted) return;
290
- addLogEvent("info", message, fields);
291
- if (fields) {
292
- mergeInto(contextState, fields);
293
- activeContext.setAttributes(chunkEE6CPXKH_cjs.flattenToAttributes(fields));
294
- }
295
- },
296
- warn(message, fields) {
297
- const keys = fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"];
298
- sealCheck("log.warn()", keys);
299
- if (emitted) return;
300
- addLogEvent("warn", message, fields);
301
- activeContext.setAttribute("autotel.log.level", "warn");
302
- if (fields) {
303
- mergeInto(contextState, fields);
304
- activeContext.setAttributes(chunkEE6CPXKH_cjs.flattenToAttributes(fields));
305
- }
306
- },
307
- error(error, fields) {
308
- const keys = fields ? [...Object.keys(fields), "error"] : ["error"];
309
- sealCheck("log.error()", keys);
310
- if (emitted) return;
311
- const err = typeof error === "string" ? new Error(error) : error;
312
- chunkEE6CPXKH_cjs.recordStructuredError(activeContext, err);
313
- addLogEvent("error", err.message, fields);
314
- if (fields) {
315
- mergeInto(contextState, fields);
316
- activeContext.setAttributes(chunkEE6CPXKH_cjs.flattenToAttributes(fields));
317
- }
318
- activeContext.setAttribute("autotel.log.level", "error");
319
- },
320
- getContext() {
321
- return { ...contextState };
322
- },
323
- emitNow(overrides) {
324
- if (emitted) {
325
- warnPostEmit("log.emitNow()", "Ignoring duplicate emit.");
326
- return lastSnapshot;
327
- }
328
- const mergedContext = {
329
- ...contextState,
330
- ...overrides ?? {}
331
- };
332
- const flattened = chunkEE6CPXKH_cjs.flattenToAttributes(mergedContext);
333
- activeContext.setAttributes(flattened);
334
- const snapshot = {
335
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
336
- traceId: activeContext.traceId,
337
- spanId: activeContext.spanId,
338
- correlationId: activeContext.correlationId,
339
- context: mergedContext
340
- };
341
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(activeContext, "log.emit.manual", {
342
- ...flattened
343
- });
344
- if (options?.onEmit) {
345
- Promise.resolve(options.onEmit(snapshot)).catch((error) => {
346
- console.warn("[autotel] request logger onEmit failed:", error);
347
- });
348
- }
349
- emitted = true;
350
- lastSnapshot = snapshot;
351
- return snapshot;
352
- },
353
- fork(label, fn, forkOptions) {
354
- const parentRequestId = activeContext.correlationId;
355
- if (typeof parentRequestId !== "string" || parentRequestId.length === 0) {
356
- throw new Error(
357
- "[autotel] log.fork() requires the parent logger to have a correlationId. Ensure the request was created by autotel middleware."
358
- );
359
- }
360
- const tracer = api.trace.getTracer("autotel.request-logger");
361
- const lifecycle = forkOptions?.lifecycle;
362
- void tracer.startActiveSpan(`request.fork:${label}`, (childSpan) => {
363
- const childContext = {
364
- ...chunkFMTHVSYY_cjs.createTraceContext(childSpan),
365
- correlationId: crypto.randomUUID()
366
- };
367
- requestContextStore.run(childContext, () => {
368
- const childLog = getRequestLogger(childContext);
369
- childLog.set({
370
- operation: label,
371
- _parentCorrelationId: parentRequestId
372
- });
373
- lifecycle?.onChildEnter?.(childLog);
374
- void Promise.resolve().then(() => fn()).then(() => {
375
- childLog.emitNow();
376
- }).catch((err) => {
377
- const error = err instanceof Error ? err : new Error(String(err));
378
- childLog.error(error);
379
- childLog.emitNow();
380
- }).finally(() => {
381
- try {
382
- lifecycle?.onChildExit?.(childLog);
383
- } catch (hookError) {
384
- console.warn(
385
- "[autotel] fork onChildExit hook threw:",
386
- hookError
387
- );
388
- }
389
- childSpan.end();
390
- });
391
- });
392
- });
393
- }
394
- };
226
+ console.warn(`[autotel] ${method} called after the wide event was emitted — ${detail} This data will not appear in observability. ${POST_EMIT_FORK_HINT}`);
227
+ }
228
+ function mergeInto$1(target, source) {
229
+ for (const key in source) {
230
+ const sourceVal = source[key];
231
+ if (sourceVal === void 0) continue;
232
+ const targetVal = target[key];
233
+ if (sourceVal !== null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal !== null && typeof targetVal === "object" && !Array.isArray(targetVal)) mergeInto$1(targetVal, sourceVal);
234
+ else if (Array.isArray(targetVal) && Array.isArray(sourceVal)) target[key] = [...targetVal, ...sourceVal];
235
+ else target[key] = sourceVal;
236
+ }
237
+ }
238
+ const requestContextStore = new node_async_hooks.AsyncLocalStorage();
239
+ function runWithRequestContext(ctx, fn) {
240
+ return requestContextStore.run(ctx, fn);
241
+ }
242
+ function resolveContext(ctx) {
243
+ if (ctx) return ctx;
244
+ const stored = requestContextStore.getStore();
245
+ if (stored) return stored;
246
+ const span = _opentelemetry_api.trace.getActiveSpan();
247
+ if (!span) throw new Error("[autotel] getRequestLogger() requires an active span or runWithRequestContext(). Wrap your handler with trace() or use runWithRequestContext().");
248
+ return require_track.createTraceContext(span);
249
+ }
250
+ function getRequestLogger(ctx, options) {
251
+ const activeContext = resolveContext(ctx);
252
+ let contextState = {};
253
+ let emitted = false;
254
+ let lastSnapshot = null;
255
+ const addLogEvent = (level, message, fields) => {
256
+ const attrs = fields ? require_structured_error.flattenToAttributes(fields) : void 0;
257
+ require_correlated_events.emitCorrelatedEvent(activeContext, `log.${level}`, {
258
+ message,
259
+ ...attrs ?? {}
260
+ });
261
+ };
262
+ const sealCheck = (method, keys) => {
263
+ if (emitted) warnPostEmit(method, `Keys dropped: ${keys.length ? keys.join(", ") : "(empty)"}.`);
264
+ };
265
+ return {
266
+ set(fields) {
267
+ sealCheck("log.set()", Object.keys(fields));
268
+ if (emitted) return;
269
+ mergeInto$1(contextState, fields);
270
+ activeContext.setAttributes(require_structured_error.flattenToAttributes(fields));
271
+ },
272
+ info(message, fields) {
273
+ sealCheck("log.info()", fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"]);
274
+ if (emitted) return;
275
+ addLogEvent("info", message, fields);
276
+ if (fields) {
277
+ mergeInto$1(contextState, fields);
278
+ activeContext.setAttributes(require_structured_error.flattenToAttributes(fields));
279
+ }
280
+ },
281
+ warn(message, fields) {
282
+ sealCheck("log.warn()", fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"]);
283
+ if (emitted) return;
284
+ addLogEvent("warn", message, fields);
285
+ activeContext.setAttribute("autotel.log.level", "warn");
286
+ if (fields) {
287
+ mergeInto$1(contextState, fields);
288
+ activeContext.setAttributes(require_structured_error.flattenToAttributes(fields));
289
+ }
290
+ },
291
+ error(error, fields) {
292
+ sealCheck("log.error()", fields ? [...Object.keys(fields), "error"] : ["error"]);
293
+ if (emitted) return;
294
+ const err = typeof error === "string" ? new Error(error) : error;
295
+ require_structured_error.recordStructuredError(activeContext, err);
296
+ addLogEvent("error", err.message, fields);
297
+ if (fields) {
298
+ mergeInto$1(contextState, fields);
299
+ activeContext.setAttributes(require_structured_error.flattenToAttributes(fields));
300
+ }
301
+ activeContext.setAttribute("autotel.log.level", "error");
302
+ },
303
+ getContext() {
304
+ return { ...contextState };
305
+ },
306
+ emitNow(overrides) {
307
+ if (emitted) {
308
+ warnPostEmit("log.emitNow()", "Ignoring duplicate emit.");
309
+ return lastSnapshot;
310
+ }
311
+ const mergedContext = {
312
+ ...contextState,
313
+ ...overrides ?? {}
314
+ };
315
+ const flattened = require_structured_error.flattenToAttributes(mergedContext);
316
+ activeContext.setAttributes(flattened);
317
+ const snapshot = {
318
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
319
+ traceId: activeContext.traceId,
320
+ spanId: activeContext.spanId,
321
+ correlationId: activeContext.correlationId,
322
+ context: mergedContext
323
+ };
324
+ require_correlated_events.emitCorrelatedEvent(activeContext, "log.emit.manual", { ...flattened });
325
+ if (options?.onEmit) Promise.resolve(options.onEmit(snapshot)).catch((error) => {
326
+ console.warn("[autotel] request logger onEmit failed:", error);
327
+ });
328
+ emitted = true;
329
+ lastSnapshot = snapshot;
330
+ return snapshot;
331
+ },
332
+ fork(label, fn, forkOptions) {
333
+ const parentRequestId = activeContext.correlationId;
334
+ if (typeof parentRequestId !== "string" || parentRequestId.length === 0) throw new Error("[autotel] log.fork() requires the parent logger to have a correlationId. Ensure the request was created by autotel middleware.");
335
+ const tracer = _opentelemetry_api.trace.getTracer("autotel.request-logger");
336
+ const lifecycle = forkOptions?.lifecycle;
337
+ tracer.startActiveSpan(`request.fork:${label}`, (childSpan) => {
338
+ const childContext = {
339
+ ...require_track.createTraceContext(childSpan),
340
+ correlationId: crypto.randomUUID()
341
+ };
342
+ requestContextStore.run(childContext, () => {
343
+ const childLog = getRequestLogger(childContext);
344
+ childLog.set({
345
+ operation: label,
346
+ _parentCorrelationId: parentRequestId
347
+ });
348
+ lifecycle?.onChildEnter?.(childLog);
349
+ Promise.resolve().then(() => fn()).then(() => {
350
+ childLog.emitNow();
351
+ }).catch((err) => {
352
+ const error = err instanceof Error ? err : new Error(String(err));
353
+ childLog.error(error);
354
+ childLog.emitNow();
355
+ }).finally(() => {
356
+ try {
357
+ lifecycle?.onChildExit?.(childLog);
358
+ } catch (hookError) {
359
+ console.warn("[autotel] fork onChildExit hook threw:", hookError);
360
+ }
361
+ childSpan.end();
362
+ });
363
+ });
364
+ });
365
+ }
366
+ };
367
+ }
368
+ /**
369
+ * Returns `true` when a request-logger context can be resolved without throwing —
370
+ * i.e. an explicit `ctx` was provided, a `runWithRequestContext()` scope is active,
371
+ * or there is an active OpenTelemetry span.
372
+ *
373
+ * Use this to branch on observability availability instead of wrapping
374
+ * {@link getRequestLogger} in try/catch.
375
+ */
376
+ function hasRequestContext(ctx) {
377
+ if (ctx) return true;
378
+ if (requestContextStore.getStore()) return true;
379
+ return _opentelemetry_api.trace.getActiveSpan() != null;
380
+ }
381
+ /**
382
+ * Like {@link getRequestLogger}, but returns `null` instead of throwing when no
383
+ * request context is available. Intended for best-effort instrumentation where a
384
+ * missing telemetry context must never crash business logic.
385
+ */
386
+ function getRequestLoggerSafe(ctx, options) {
387
+ if (!hasRequestContext(ctx)) return null;
388
+ return getRequestLogger(ctx, options);
389
+ }
390
+ /**
391
+ * A no-op {@link RequestLogger} whose methods do nothing. Used as a fallback by
392
+ * best-effort instrumentation so wrapped handlers can run un-instrumented without
393
+ * branching on logger presence.
394
+ */
395
+ function createNoopRequestLogger() {
396
+ const snapshot = () => ({
397
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
398
+ traceId: "",
399
+ spanId: "",
400
+ correlationId: "",
401
+ context: {}
402
+ });
403
+ return {
404
+ set() {},
405
+ info() {},
406
+ warn() {},
407
+ error() {},
408
+ getContext() {
409
+ return {};
410
+ },
411
+ emitNow() {
412
+ return snapshot();
413
+ },
414
+ fork(_label, fn) {
415
+ Promise.resolve().then(() => fn());
416
+ }
417
+ };
395
418
  }
396
419
 
397
- // src/error-catalog.ts
398
- var catalogCodeKey = /* @__PURE__ */ Symbol.for("autotel.catalog.code");
420
+ //#endregion
421
+ //#region src/error-catalog.ts
422
+ /**
423
+ * Typed error and audit catalogs.
424
+ *
425
+ * Group related errors into one catalog and get a refactor-safe builder per
426
+ * code, with autocomplete at every call site and typed message parameters.
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * import { defineErrorCatalog } from 'autotel';
431
+ *
432
+ * export const billing = defineErrorCatalog('billing', {
433
+ * PAYMENT_DECLINED: {
434
+ * status: 402,
435
+ * message: 'Card declined',
436
+ * why: 'The issuer rejected the charge',
437
+ * fix: 'Try a different payment method',
438
+ * },
439
+ * INSUFFICIENT_FUNDS: {
440
+ * status: 402,
441
+ * message: ({ available, required }: { available: number; required: number }) =>
442
+ * `Insufficient funds: $${available} of $${required}`,
443
+ * },
444
+ * });
445
+ *
446
+ * throw billing.PAYMENT_DECLINED({ cause: stripeError });
447
+ * throw billing.INSUFFICIENT_FUNDS({ available: 5, required: 100 });
448
+ *
449
+ * // In a catch block — refactor-safe, no magic strings:
450
+ * if (billing.PAYMENT_DECLINED.match(err)) { ... }
451
+ * ```
452
+ */
453
+ const catalogCodeKey = Symbol.for("autotel.catalog.code");
399
454
  function readCatalogCode(error) {
400
- if (error === null || typeof error !== "object") return void 0;
401
- return error[catalogCodeKey];
455
+ if (error === null || typeof error !== "object") return void 0;
456
+ return error[catalogCodeKey];
402
457
  }
458
+ /** True when `error` was produced by any autotel error catalog. */
403
459
  function isCatalogError(error) {
404
- return readCatalogCode(error) !== void 0;
460
+ return readCatalogCode(error) !== void 0;
405
461
  }
462
+ /** Returns the catalog code of `error`, or `undefined` if it has none. */
406
463
  function getCatalogCode(error) {
407
- return readCatalogCode(error);
464
+ return readCatalogCode(error);
408
465
  }
466
+ /**
467
+ * Define a typed error catalog. Returns an object whose keys are error
468
+ * builders. Each builder produces a {@link StructuredError} carrying the
469
+ * entry's message, status, code, why, fix, and link.
470
+ */
409
471
  function defineErrorCatalog(namespace, entries) {
410
- const catalog = {};
411
- for (const [key, entry] of Object.entries(entries)) {
412
- const code = entry.code ?? `${namespace}.${key}`;
413
- const usesParams = typeof entry.message === "function" || typeof entry.why === "function";
414
- const builder = ((paramsOrOptions, maybeOptions) => {
415
- const params = usesParams ? paramsOrOptions : void 0;
416
- const options = usesParams ? maybeOptions : paramsOrOptions;
417
- const message = typeof entry.message === "function" ? entry.message(params) : entry.message;
418
- const why = typeof entry.why === "function" ? entry.why(params) : entry.why;
419
- const error = chunkEE6CPXKH_cjs.createStructuredError({
420
- message,
421
- name: entry.name ?? key,
422
- code,
423
- ...entry.status === void 0 ? {} : { status: entry.status },
424
- ...why === void 0 ? {} : { why },
425
- ...entry.fix === void 0 ? {} : { fix: entry.fix },
426
- ...entry.link === void 0 ? {} : { link: entry.link },
427
- ...options?.cause === void 0 ? {} : { cause: options.cause },
428
- ...options?.details === void 0 ? {} : { details: options.details },
429
- ...options?.internal === void 0 ? {} : { internal: options.internal }
430
- });
431
- Object.defineProperty(error, catalogCodeKey, {
432
- value: code,
433
- enumerable: false,
434
- writable: false,
435
- configurable: true
436
- });
437
- return error;
438
- });
439
- Object.defineProperty(builder, "code", {
440
- value: code,
441
- enumerable: true
442
- });
443
- Object.defineProperty(builder, "match", {
444
- value: (error) => readCatalogCode(error) === code,
445
- enumerable: false
446
- });
447
- catalog[key] = builder;
448
- }
449
- return Object.freeze(catalog);
450
- }
472
+ const catalog = {};
473
+ for (const [key, entry] of Object.entries(entries)) {
474
+ const code = entry.code ?? `${namespace}.${key}`;
475
+ const usesParams = typeof entry.message === "function" || typeof entry.why === "function";
476
+ const builder = ((paramsOrOptions, maybeOptions) => {
477
+ const params = usesParams ? paramsOrOptions : void 0;
478
+ const options = usesParams ? maybeOptions : paramsOrOptions;
479
+ const message = typeof entry.message === "function" ? entry.message(params) : entry.message;
480
+ const why = typeof entry.why === "function" ? entry.why(params) : entry.why;
481
+ const error = require_structured_error.createStructuredError({
482
+ message,
483
+ name: entry.name ?? key,
484
+ code,
485
+ ...entry.status === void 0 ? {} : { status: entry.status },
486
+ ...why === void 0 ? {} : { why },
487
+ ...entry.fix === void 0 ? {} : { fix: entry.fix },
488
+ ...entry.link === void 0 ? {} : { link: entry.link },
489
+ ...options?.cause === void 0 ? {} : { cause: options.cause },
490
+ ...options?.details === void 0 ? {} : { details: options.details },
491
+ ...options?.internal === void 0 ? {} : { internal: options.internal }
492
+ });
493
+ Object.defineProperty(error, catalogCodeKey, {
494
+ value: code,
495
+ enumerable: false,
496
+ writable: false,
497
+ configurable: true
498
+ });
499
+ return error;
500
+ });
501
+ Object.defineProperty(builder, "code", {
502
+ value: code,
503
+ enumerable: true
504
+ });
505
+ Object.defineProperty(builder, "match", {
506
+ value: (error) => readCatalogCode(error) === code,
507
+ enumerable: false
508
+ });
509
+ catalog[key] = builder;
510
+ }
511
+ return Object.freeze(catalog);
512
+ }
513
+ /**
514
+ * Define a typed audit catalog. Returns typed action descriptors you can pass
515
+ * to `track()` or audit helpers without scattering magic strings.
516
+ */
451
517
  function defineAuditCatalog(namespace, entries) {
452
- const catalog = {};
453
- for (const [key, entry] of Object.entries(entries)) {
454
- const action = entry.action ?? `${namespace}.${key}`;
455
- const severity = entry.severity ?? "info";
456
- const descriptor = ((params) => {
457
- const message = typeof entry.message === "function" ? entry.message(params) : entry.message;
458
- return Object.freeze({
459
- action,
460
- severity,
461
- ...message === void 0 ? {} : { message }
462
- });
463
- });
464
- Object.defineProperty(descriptor, "action", {
465
- value: action,
466
- enumerable: true
467
- });
468
- Object.defineProperty(descriptor, "severity", {
469
- value: severity,
470
- enumerable: true
471
- });
472
- catalog[key] = descriptor;
473
- }
474
- return Object.freeze(catalog);
518
+ const catalog = {};
519
+ for (const [key, entry] of Object.entries(entries)) {
520
+ const action = entry.action ?? `${namespace}.${key}`;
521
+ const severity = entry.severity ?? "info";
522
+ const descriptor = ((params) => {
523
+ const message = typeof entry.message === "function" ? entry.message(params) : entry.message;
524
+ return Object.freeze({
525
+ action,
526
+ severity,
527
+ ...message === void 0 ? {} : { message }
528
+ });
529
+ });
530
+ Object.defineProperty(descriptor, "action", {
531
+ value: action,
532
+ enumerable: true
533
+ });
534
+ Object.defineProperty(descriptor, "severity", {
535
+ value: severity,
536
+ enumerable: true
537
+ });
538
+ catalog[key] = descriptor;
539
+ }
540
+ return Object.freeze(catalog);
475
541
  }
476
542
 
477
- // src/drain-toolkit.ts
478
- var DEFAULT_TIMEOUT_MS = 5e3;
479
- var DEFAULT_RETRIES = 2;
543
+ //#endregion
544
+ //#region src/drain-toolkit.ts
545
+ const DEFAULT_TIMEOUT_MS = 5e3;
546
+ const DEFAULT_RETRIES = 2;
480
547
  function delay(ms) {
481
- return new Promise((resolve) => {
482
- const t = setTimeout(resolve, ms);
483
- t.unref?.();
484
- });
548
+ return new Promise((resolve) => {
549
+ setTimeout(resolve, ms).unref?.();
550
+ });
485
551
  }
486
552
  async function postWithRetry(options) {
487
- const { name, request: request2, timeoutMs, retries } = options;
488
- const attempts = Math.max(1, retries);
489
- let lastError;
490
- for (let attempt = 1; attempt <= attempts; attempt++) {
491
- const controller = new AbortController();
492
- const timeout = setTimeout(() => controller.abort(), timeoutMs);
493
- timeout.unref?.();
494
- try {
495
- const response = await fetch(request2.url, {
496
- method: "POST",
497
- headers: request2.headers,
498
- body: request2.body,
499
- signal: controller.signal
500
- });
501
- if (!response.ok) {
502
- throw new Error(
503
- `[autotel/${name}] HTTP ${response.status} draining ${request2.url}`
504
- );
505
- }
506
- return;
507
- } catch (error) {
508
- lastError = error;
509
- if (attempt < attempts) {
510
- await delay(100 * attempt);
511
- }
512
- } finally {
513
- clearTimeout(timeout);
514
- }
515
- }
516
- throw lastError;
553
+ const { name, request, timeoutMs, retries } = options;
554
+ const attempts = Math.max(1, retries);
555
+ let lastError;
556
+ for (let attempt = 1; attempt <= attempts; attempt++) {
557
+ const controller = new AbortController();
558
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
559
+ timeout.unref?.();
560
+ try {
561
+ const response = await fetch(request.url, {
562
+ method: "POST",
563
+ headers: request.headers,
564
+ body: request.body,
565
+ signal: controller.signal
566
+ });
567
+ if (!response.ok) throw new Error(`[autotel/${name}] HTTP ${response.status} draining ${request.url}`);
568
+ return;
569
+ } catch (error) {
570
+ lastError = error;
571
+ if (attempt < attempts) await delay(100 * attempt);
572
+ } finally {
573
+ clearTimeout(timeout);
574
+ }
575
+ }
576
+ throw lastError;
517
577
  }
518
578
  function defineDrain(options) {
519
- return async (ctx2) => {
520
- const contexts = Array.isArray(ctx2) ? ctx2 : [ctx2];
521
- if (contexts.length === 0) return;
522
- const config = await options.resolve();
523
- if (!config) return;
524
- const payloads = options.transform ? options.transform(contexts) : contexts;
525
- if (payloads.length === 0) return;
526
- try {
527
- await options.send(payloads, config);
528
- } catch (error) {
529
- console.error(`[autotel/${options.name}] drain failed:`, error);
530
- }
531
- };
579
+ return async (ctx) => {
580
+ const contexts = Array.isArray(ctx) ? ctx : [ctx];
581
+ if (contexts.length === 0) return;
582
+ const config = await options.resolve();
583
+ if (!config) return;
584
+ const payloads = options.transform ? options.transform(contexts) : contexts;
585
+ if (payloads.length === 0) return;
586
+ try {
587
+ await options.send(payloads, config);
588
+ } catch (error) {
589
+ console.error(`[autotel/${options.name}] drain failed:`, error);
590
+ }
591
+ };
532
592
  }
533
593
  function defineHttpDrain(options) {
534
- return defineDrain({
535
- name: options.name,
536
- resolve: options.resolve,
537
- transform: options.transform,
538
- send: async (payloads, config) => {
539
- const request2 = options.encode(payloads, config);
540
- if (!request2) return;
541
- const timeoutMs = options.resolveTimeoutMs?.(config) ?? options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
542
- const retries = options.resolveRetries?.(config) ?? options.retries ?? DEFAULT_RETRIES;
543
- await postWithRetry({
544
- name: options.name,
545
- request: request2,
546
- timeoutMs,
547
- retries
548
- });
549
- }
550
- });
594
+ return defineDrain({
595
+ name: options.name,
596
+ resolve: options.resolve,
597
+ transform: options.transform,
598
+ send: async (payloads, config) => {
599
+ const request = options.encode(payloads, config);
600
+ if (!request) return;
601
+ const timeoutMs = options.resolveTimeoutMs?.(config) ?? options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
602
+ const retries = options.resolveRetries?.(config) ?? options.retries ?? DEFAULT_RETRIES;
603
+ await postWithRetry({
604
+ name: options.name,
605
+ request,
606
+ timeoutMs,
607
+ retries
608
+ });
609
+ }
610
+ });
551
611
  }
552
612
 
553
- // src/enricher-toolkit.ts
613
+ //#endregion
614
+ //#region src/enricher-toolkit.ts
554
615
  function isPlainObject(value) {
555
- return value !== null && typeof value === "object" && !Array.isArray(value);
616
+ return value !== null && typeof value === "object" && !Array.isArray(value);
556
617
  }
557
- function mergeInto2(target, source) {
558
- for (const key in source) {
559
- const sourceVal = source[key];
560
- if (sourceVal === void 0) continue;
561
- const targetVal = target[key];
562
- if (isPlainObject(sourceVal) && isPlainObject(targetVal)) {
563
- mergeInto2(targetVal, sourceVal);
564
- } else {
565
- target[key] = sourceVal;
566
- }
567
- }
618
+ function mergeInto(target, source) {
619
+ for (const key in source) {
620
+ const sourceVal = source[key];
621
+ if (sourceVal === void 0) continue;
622
+ const targetVal = target[key];
623
+ if (isPlainObject(sourceVal) && isPlainObject(targetVal)) mergeInto(targetVal, sourceVal);
624
+ else target[key] = sourceVal;
625
+ }
568
626
  }
569
627
  function defineEnricher(def, options = {}) {
570
- return (ctx2) => {
571
- let computed;
572
- try {
573
- computed = def.compute(ctx2);
574
- } catch (error) {
575
- console.error(`[autotel/${def.name}] enrich failed:`, error);
576
- return;
577
- }
578
- if (!computed) return;
579
- if (options.overwrite || !isPlainObject(ctx2.event[def.field])) {
580
- ctx2.event[def.field] = computed;
581
- return;
582
- }
583
- mergeInto2(
584
- ctx2.event[def.field],
585
- computed
586
- );
587
- };
588
- }
589
- var GEN_AI_DURATION_BUCKETS_SECONDS = Object.freeze(
590
- [0.01, 0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 20, 30, 60, 120, 300]
591
- );
592
- var GEN_AI_TOKEN_USAGE_BUCKETS = Object.freeze([
593
- 1,
594
- 4,
595
- 16,
596
- 64,
597
- 256,
598
- 1024,
599
- 4096,
600
- 16384,
601
- 65536,
602
- 262144,
603
- 1048576,
604
- 4194304
605
- ]);
606
- var GEN_AI_COST_USD_BUCKETS = Object.freeze([
607
- 1e-5,
608
- 1e-4,
609
- 1e-3,
610
- 5e-3,
611
- 0.01,
612
- 0.05,
613
- 0.1,
614
- 0.5,
615
- 1,
616
- 5,
617
- 10,
618
- 50
619
- ]);
620
- function llmHistogramAdvice(kind) {
621
- const boundaries = kind === "duration" ? GEN_AI_DURATION_BUCKETS_SECONDS : kind === "tokens" ? GEN_AI_TOKEN_USAGE_BUCKETS : GEN_AI_COST_USD_BUCKETS;
622
- return { advice: { explicitBucketBoundaries: [...boundaries] } };
623
- }
624
- function genAiMetricViews(extra = []) {
625
- const defaults = [
626
- { instrumentName: "gen_ai.client.operation.duration", kind: "duration" },
627
- { instrumentName: "gen_ai.client.token.usage", kind: "tokens" },
628
- // Autotel-emitted cost metric. No-op if you don't emit it.
629
- { instrumentName: "gen_ai.client.cost.usd", kind: "cost" }
630
- ];
631
- return [...defaults, ...extra].map(
632
- ({ instrumentName, kind }) => ({
633
- instrumentName,
634
- aggregation: {
635
- type: sdkMetrics.AggregationType.EXPLICIT_BUCKET_HISTOGRAM,
636
- options: {
637
- boundaries: kind === "duration" ? [...GEN_AI_DURATION_BUCKETS_SECONDS] : kind === "tokens" ? [...GEN_AI_TOKEN_USAGE_BUCKETS] : [...GEN_AI_COST_USD_BUCKETS]
638
- }
639
- }
640
- })
641
- );
628
+ return (ctx) => {
629
+ let computed;
630
+ try {
631
+ computed = def.compute(ctx);
632
+ } catch (error) {
633
+ console.error(`[autotel/${def.name}] enrich failed:`, error);
634
+ return;
635
+ }
636
+ if (!computed) return;
637
+ if (options.overwrite || !isPlainObject(ctx.event[def.field])) {
638
+ ctx.event[def.field] = computed;
639
+ return;
640
+ }
641
+ mergeInto(ctx.event[def.field], computed);
642
+ };
642
643
  }
643
644
 
644
- // src/gen-ai-events.ts
645
- function recordPromptSent(ctx2, event = {}) {
646
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(ctx2, "gen_ai.prompt.sent", buildPromptSentAttrs(event));
647
- }
648
- function recordResponseReceived(ctx2, event = {}) {
649
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(
650
- ctx2,
651
- "gen_ai.response.received",
652
- buildResponseAttrs(event)
653
- );
654
- }
655
- function recordRetry(ctx2, event) {
656
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(ctx2, "gen_ai.retry", buildRetryAttrs(event));
657
- }
658
- function recordToolCall(ctx2, event) {
659
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(ctx2, "gen_ai.tool.call", buildToolCallAttrs(event));
660
- }
661
- function recordStreamFirstToken(ctx2, event = {}) {
662
- chunk4P6ZOARG_cjs.emitCorrelatedEvent(
663
- ctx2,
664
- "gen_ai.stream.first_token",
665
- buildStreamFirstTokenAttrs(event)
666
- );
667
- }
668
- function buildPromptSentAttrs(event) {
669
- const attrs2 = {};
670
- if (event.model) attrs2["gen_ai.request.model"] = event.model;
671
- if (event.promptTokens !== void 0)
672
- attrs2["gen_ai.usage.input_tokens"] = event.promptTokens;
673
- if (event.messageCount !== void 0)
674
- attrs2["gen_ai.request.message_count"] = event.messageCount;
675
- if (event.operation) attrs2["gen_ai.operation.name"] = event.operation;
676
- return attrs2;
677
- }
678
- function buildResponseAttrs(event) {
679
- const attrs2 = {};
680
- if (event.model) attrs2["gen_ai.response.model"] = event.model;
681
- if (event.promptTokens !== void 0)
682
- attrs2["gen_ai.usage.input_tokens"] = event.promptTokens;
683
- if (event.completionTokens !== void 0)
684
- attrs2["gen_ai.usage.output_tokens"] = event.completionTokens;
685
- if (event.totalTokens !== void 0)
686
- attrs2["gen_ai.usage.total_tokens"] = event.totalTokens;
687
- if (event.finishReasons && event.finishReasons.length > 0) {
688
- attrs2["gen_ai.response.finish_reasons"] = event.finishReasons.join(",");
645
+ //#endregion
646
+ exports.AUTOTEL_SAMPLING_TAIL_EVALUATED = require_sampling.AUTOTEL_SAMPLING_TAIL_EVALUATED;
647
+ exports.AUTOTEL_SAMPLING_TAIL_KEEP = require_sampling.AUTOTEL_SAMPLING_TAIL_KEEP;
648
+ exports.AdaptiveSampler = require_sampling.AdaptiveSampler;
649
+ exports.AlwaysSampler = require_sampling.AlwaysSampler;
650
+ exports.AttributeRedactingProcessor = require_attribute_redacting_processor.AttributeRedactingProcessor;
651
+ exports.BaggageSpanProcessor = require_init.BaggageSpanProcessor;
652
+ exports.BusinessBaggage = require_business_baggage.BusinessBaggage;
653
+ exports.CORRELATION_ID_BAGGAGE_KEY = require_track.CORRELATION_ID_BAGGAGE_KEY;
654
+ exports.Event = require_event.Event;
655
+ exports.FilteringSpanProcessor = require_filtering_span_processor.FilteringSpanProcessor;
656
+ exports.HTTPAttributes = require_registry.HTTPAttributes;
657
+ exports.Metric = require_metric.Metric;
658
+ exports.NORMALIZER_PATTERNS = require_span_name_normalizer.NORMALIZER_PATTERNS;
659
+ exports.NORMALIZER_PRESETS = require_span_name_normalizer.NORMALIZER_PRESETS;
660
+ exports.NeverSampler = require_sampling.NeverSampler;
661
+ exports.REDACTOR_PATTERNS = require_attribute_redacting_processor.REDACTOR_PATTERNS;
662
+ exports.REDACTOR_PRESETS = require_attribute_redacting_processor.REDACTOR_PRESETS;
663
+ Object.defineProperty(exports, 'ROOT_CONTEXT', {
664
+ enumerable: true,
665
+ get: function () {
666
+ return _opentelemetry_api.ROOT_CONTEXT;
689
667
  }
690
- return attrs2;
691
- }
692
- function buildRetryAttrs(event) {
693
- const attrs2 = { "retry.attempt": event.attempt };
694
- if (event.reason) attrs2["retry.reason"] = event.reason;
695
- if (event.delayMs !== void 0) attrs2["retry.delay_ms"] = event.delayMs;
696
- if (event.statusCode !== void 0)
697
- attrs2["http.response.status_code"] = event.statusCode;
698
- return attrs2;
699
- }
700
- function buildToolCallAttrs(event) {
701
- const attrs2 = { "gen_ai.tool.name": event.toolName };
702
- if (event.toolCallId) attrs2["gen_ai.tool.call.id"] = event.toolCallId;
703
- if (event.arguments) attrs2["gen_ai.tool.arguments"] = event.arguments;
704
- return attrs2;
705
- }
706
- function buildStreamFirstTokenAttrs(event) {
707
- const attrs2 = {};
708
- if (event.tokensSoFar !== void 0)
709
- attrs2["gen_ai.stream.tokens_so_far"] = event.tokensSoFar;
710
- return attrs2;
711
- }
712
-
713
- // src/gen-ai-cost.ts
714
- var GEN_AI_COST_ATTRIBUTE = "gen_ai.usage.cost.usd";
715
- var MODEL_PRICING = {
716
- // OpenAI
717
- "gpt-4o": { inputPer1M: 2.5, outputPer1M: 10 },
718
- "gpt-4o-mini": { inputPer1M: 0.15, outputPer1M: 0.6 },
719
- "gpt-4.1": { inputPer1M: 2, outputPer1M: 8 },
720
- "gpt-4.1-mini": { inputPer1M: 0.4, outputPer1M: 1.6 },
721
- "gpt-4.1-nano": { inputPer1M: 0.1, outputPer1M: 0.4 },
722
- "o3-mini": { inputPer1M: 1.1, outputPer1M: 4.4 },
723
- // Anthropic Claude
724
- "claude-opus-4": { inputPer1M: 15, outputPer1M: 75 },
725
- "claude-sonnet-4": { inputPer1M: 3, outputPer1M: 15 },
726
- "claude-3-5-sonnet": { inputPer1M: 3, outputPer1M: 15 },
727
- "claude-3-5-haiku": { inputPer1M: 0.8, outputPer1M: 4 },
728
- "claude-3-opus": { inputPer1M: 15, outputPer1M: 75 },
729
- "claude-3-haiku": { inputPer1M: 0.25, outputPer1M: 1.25 },
730
- // Google Gemini
731
- "gemini-1.5-pro": { inputPer1M: 1.25, outputPer1M: 5 },
732
- "gemini-1.5-flash": { inputPer1M: 0.075, outputPer1M: 0.3 },
733
- "gemini-2.0-flash": { inputPer1M: 0.1, outputPer1M: 0.4 }
734
- };
735
- function resolvePricing(table, model) {
736
- const exact = table[model];
737
- if (exact) return exact;
738
- let best;
739
- let bestLength = 0;
740
- for (const key of Object.keys(table)) {
741
- if (model.startsWith(key) && key.length > bestLength) {
742
- best = table[key];
743
- bestLength = key.length;
744
- }
745
- }
746
- return best;
747
- }
748
- function round(value) {
749
- return Math.round(value * 1e6) / 1e6;
750
- }
751
- function estimateLLMCost(model, usage, options) {
752
- const table = options?.pricing ? { ...MODEL_PRICING, ...options.pricing } : MODEL_PRICING;
753
- const price = resolvePricing(table, model);
754
- if (!price) return void 0;
755
- const cachedInput = usage.cachedInputTokens ?? 0;
756
- const billedInput = Math.max(0, (usage.inputTokens ?? 0) - cachedInput);
757
- const output = usage.outputTokens ?? 0;
758
- const cachedRate = price.cachedInputPer1M ?? price.inputPer1M;
759
- const cost = billedInput / 1e6 * price.inputPer1M + cachedInput / 1e6 * cachedRate + output / 1e6 * price.outputPer1M;
760
- return round(cost);
761
- }
762
- function recordLLMCost(ctx2, model, usage, options) {
763
- const cost = estimateLLMCost(model, usage, options);
764
- if (cost !== void 0) {
765
- ctx2.setAttribute(GEN_AI_COST_ATTRIBUTE, cost);
766
- }
767
- return cost;
768
- }
769
-
770
- Object.defineProperty(exports, "httpRequestHeaderAttribute", {
771
- enumerable: true,
772
- get: function () { return chunk2ZKEORFN_cjs.httpRequestHeaderAttribute; }
773
- });
774
- Object.defineProperty(exports, "httpResponseHeaderAttribute", {
775
- enumerable: true,
776
- get: function () { return chunk2ZKEORFN_cjs.httpResponseHeaderAttribute; }
777
- });
778
- Object.defineProperty(exports, "parseError", {
779
- enumerable: true,
780
- get: function () { return chunkT4B5LB6E_cjs.parseError; }
781
- });
782
- Object.defineProperty(exports, "createDrainPipeline", {
783
- enumerable: true,
784
- get: function () { return chunk7EQ4G4SI_cjs.createDrainPipeline; }
785
- });
786
- Object.defineProperty(exports, "getCurrentWorkflowContext", {
787
- enumerable: true,
788
- get: function () { return chunkNENU7E6V_cjs.getCurrentWorkflowContext; }
789
- });
790
- Object.defineProperty(exports, "isInWorkflow", {
791
- enumerable: true,
792
- get: function () { return chunkNENU7E6V_cjs.isInWorkflow; }
793
- });
794
- Object.defineProperty(exports, "traceStep", {
795
- enumerable: true,
796
- get: function () { return chunkNENU7E6V_cjs.traceStep; }
797
- });
798
- Object.defineProperty(exports, "traceWorkflow", {
799
- enumerable: true,
800
- get: function () { return chunkNENU7E6V_cjs.traceWorkflow; }
801
- });
802
- Object.defineProperty(exports, "attrs", {
803
- enumerable: true,
804
- get: function () { return chunkM3LFHHTN_cjs.attrs; }
805
- });
806
- Object.defineProperty(exports, "autoRedactPII", {
807
- enumerable: true,
808
- get: function () { return chunkM3LFHHTN_cjs.autoRedactPII; }
809
- });
810
- Object.defineProperty(exports, "dbClient", {
811
- enumerable: true,
812
- get: function () { return chunkM3LFHHTN_cjs.dbClient; }
813
- });
814
- Object.defineProperty(exports, "httpClient", {
815
- enumerable: true,
816
- get: function () { return chunkM3LFHHTN_cjs.httpClient; }
817
- });
818
- Object.defineProperty(exports, "httpServer", {
819
- enumerable: true,
820
- get: function () { return chunkM3LFHHTN_cjs.httpServer; }
821
- });
822
- Object.defineProperty(exports, "identify", {
823
- enumerable: true,
824
- get: function () { return chunkM3LFHHTN_cjs.identify; }
825
- });
826
- Object.defineProperty(exports, "mergeAttrs", {
827
- enumerable: true,
828
- get: function () { return chunkM3LFHHTN_cjs.mergeAttrs; }
829
- });
830
- Object.defineProperty(exports, "mergeServiceResource", {
831
- enumerable: true,
832
- get: function () { return chunkM3LFHHTN_cjs.mergeServiceResource; }
833
- });
834
- Object.defineProperty(exports, "request", {
835
- enumerable: true,
836
- get: function () { return chunkM3LFHHTN_cjs.request; }
837
- });
838
- Object.defineProperty(exports, "safeSetAttributes", {
839
- enumerable: true,
840
- get: function () { return chunkM3LFHHTN_cjs.safeSetAttributes; }
841
- });
842
- Object.defineProperty(exports, "setDevice", {
843
- enumerable: true,
844
- get: function () { return chunkM3LFHHTN_cjs.setDevice; }
845
- });
846
- Object.defineProperty(exports, "setError", {
847
- enumerable: true,
848
- get: function () { return chunkM3LFHHTN_cjs.setError; }
849
- });
850
- Object.defineProperty(exports, "setException", {
851
- enumerable: true,
852
- get: function () { return chunkM3LFHHTN_cjs.setException; }
853
- });
854
- Object.defineProperty(exports, "setSession", {
855
- enumerable: true,
856
- get: function () { return chunkM3LFHHTN_cjs.setSession; }
857
- });
858
- Object.defineProperty(exports, "setUser", {
859
- enumerable: true,
860
- get: function () { return chunkM3LFHHTN_cjs.setUser; }
861
- });
862
- Object.defineProperty(exports, "validateAttribute", {
863
- enumerable: true,
864
- get: function () { return chunkM3LFHHTN_cjs.validateAttribute; }
865
- });
866
- Object.defineProperty(exports, "HTTPAttributes", {
867
- enumerable: true,
868
- get: function () { return chunkESMHTKLJ_cjs.HTTPAttributes; }
869
- });
870
- Object.defineProperty(exports, "ServiceAttributes", {
871
- enumerable: true,
872
- get: function () { return chunkESMHTKLJ_cjs.ServiceAttributes; }
873
- });
874
- Object.defineProperty(exports, "URLAttributes", {
875
- enumerable: true,
876
- get: function () { return chunkESMHTKLJ_cjs.URLAttributes; }
877
- });
878
- Object.defineProperty(exports, "traceConsumer", {
879
- enumerable: true,
880
- get: function () { return chunkB7SWBE4P_cjs.traceConsumer; }
881
- });
882
- Object.defineProperty(exports, "traceProducer", {
883
- enumerable: true,
884
- get: function () { return chunkB7SWBE4P_cjs.traceProducer; }
885
- });
886
- Object.defineProperty(exports, "BusinessBaggage", {
887
- enumerable: true,
888
- get: function () { return chunkINJD3G4K_cjs.BusinessBaggage; }
889
- });
890
- Object.defineProperty(exports, "createSafeBaggageSchema", {
891
- enumerable: true,
892
- get: function () { return chunkINJD3G4K_cjs.createSafeBaggageSchema; }
893
- });
894
- Object.defineProperty(exports, "Metric", {
895
- enumerable: true,
896
- get: function () { return chunkTC5ZPWM4_cjs.Metric; }
897
- });
898
- Object.defineProperty(exports, "getMetrics", {
899
- enumerable: true,
900
- get: function () { return chunkTC5ZPWM4_cjs.getMetrics; }
901
- });
902
- Object.defineProperty(exports, "resetMetrics", {
903
- enumerable: true,
904
- get: function () { return chunkTC5ZPWM4_cjs.resetMetrics; }
905
- });
906
- Object.defineProperty(exports, "createCounter", {
907
- enumerable: true,
908
- get: function () { return chunkWJH6IYU2_cjs.createCounter; }
909
- });
910
- Object.defineProperty(exports, "createHistogram", {
911
- enumerable: true,
912
- get: function () { return chunkWJH6IYU2_cjs.createHistogram; }
913
- });
914
- Object.defineProperty(exports, "createObservableGauge", {
915
- enumerable: true,
916
- get: function () { return chunkWJH6IYU2_cjs.createObservableGauge; }
917
- });
918
- Object.defineProperty(exports, "createUpDownCounter", {
919
- enumerable: true,
920
- get: function () { return chunkWJH6IYU2_cjs.createUpDownCounter; }
921
- });
922
- Object.defineProperty(exports, "getMeter", {
923
- enumerable: true,
924
- get: function () { return chunkWJH6IYU2_cjs.getMeter; }
925
- });
926
- Object.defineProperty(exports, "traceDB", {
927
- enumerable: true,
928
- get: function () { return chunkKYXZS3EA_cjs.traceDB; }
929
- });
930
- Object.defineProperty(exports, "traceHTTP", {
931
- enumerable: true,
932
- get: function () { return chunkKYXZS3EA_cjs.traceHTTP; }
933
- });
934
- Object.defineProperty(exports, "traceLLM", {
935
- enumerable: true,
936
- get: function () { return chunkKYXZS3EA_cjs.traceLLM; }
937
- });
938
- Object.defineProperty(exports, "traceMessaging", {
939
- enumerable: true,
940
- get: function () { return chunkKYXZS3EA_cjs.traceMessaging; }
941
- });
942
- Object.defineProperty(exports, "ctx", {
943
- enumerable: true,
944
- get: function () { return chunkV7UBMJAB_cjs.ctx; }
945
- });
946
- Object.defineProperty(exports, "instrument", {
947
- enumerable: true,
948
- get: function () { return chunkV7UBMJAB_cjs.instrument; }
949
- });
950
- Object.defineProperty(exports, "markAsImmediate", {
951
- enumerable: true,
952
- get: function () { return chunkV7UBMJAB_cjs.markAsImmediate; }
953
- });
954
- Object.defineProperty(exports, "span", {
955
- enumerable: true,
956
- get: function () { return chunkV7UBMJAB_cjs.span; }
957
- });
958
- Object.defineProperty(exports, "withBaggage", {
959
- enumerable: true,
960
- get: function () { return chunkV7UBMJAB_cjs.withBaggage; }
961
- });
962
- Object.defineProperty(exports, "withNewContext", {
963
- enumerable: true,
964
- get: function () { return chunkV7UBMJAB_cjs.withNewContext; }
965
- });
966
- Object.defineProperty(exports, "withTracing", {
967
- enumerable: true,
968
- get: function () { return chunkV7UBMJAB_cjs.withTracing; }
969
668
  });
970
- Object.defineProperty(exports, "createDeterministicTraceId", {
669
+ exports.RandomSampler = require_sampling.RandomSampler;
670
+ exports.ServiceAttributes = require_registry.ServiceAttributes;
671
+ Object.defineProperty(exports, 'SpanKind', {
971
672
  enumerable: true,
972
- get: function () { return chunkOPPXYVEZ_cjs.createDeterministicTraceId; }
973
- });
974
- Object.defineProperty(exports, "enrichWithTraceContext", {
975
- enumerable: true,
976
- get: function () { return chunkOPPXYVEZ_cjs.enrichWithTraceContext; }
977
- });
978
- Object.defineProperty(exports, "finalizeSpan", {
979
- enumerable: true,
980
- get: function () { return chunkOPPXYVEZ_cjs.finalizeSpan; }
981
- });
982
- Object.defineProperty(exports, "flattenMetadata", {
983
- enumerable: true,
984
- get: function () { return chunkOPPXYVEZ_cjs.flattenMetadata; }
985
- });
986
- Object.defineProperty(exports, "getActiveContext", {
987
- enumerable: true,
988
- get: function () { return chunkOPPXYVEZ_cjs.getActiveContext; }
989
- });
990
- Object.defineProperty(exports, "getActiveSpan", {
991
- enumerable: true,
992
- get: function () { return chunkOPPXYVEZ_cjs.getActiveSpan; }
993
- });
994
- Object.defineProperty(exports, "getTraceContext", {
995
- enumerable: true,
996
- get: function () { return chunkOPPXYVEZ_cjs.getTraceContext; }
997
- });
998
- Object.defineProperty(exports, "getTracer", {
999
- enumerable: true,
1000
- get: function () { return chunkOPPXYVEZ_cjs.getTracer; }
1001
- });
1002
- Object.defineProperty(exports, "isTracing", {
1003
- enumerable: true,
1004
- get: function () { return chunkOPPXYVEZ_cjs.isTracing; }
1005
- });
1006
- Object.defineProperty(exports, "resolveTraceUrl", {
1007
- enumerable: true,
1008
- get: function () { return chunkOPPXYVEZ_cjs.resolveTraceUrl; }
1009
- });
1010
- Object.defineProperty(exports, "runWithSpan", {
1011
- enumerable: true,
1012
- get: function () { return chunkOPPXYVEZ_cjs.runWithSpan; }
1013
- });
1014
- Object.defineProperty(exports, "Event", {
1015
- enumerable: true,
1016
- get: function () { return chunkEOFB7XCL_cjs.Event; }
1017
- });
1018
- Object.defineProperty(exports, "getEvents", {
1019
- enumerable: true,
1020
- get: function () { return chunkEOFB7XCL_cjs.getEvents; }
1021
- });
1022
- Object.defineProperty(exports, "resetEvents", {
1023
- enumerable: true,
1024
- get: function () { return chunkEOFB7XCL_cjs.resetEvents; }
1025
- });
1026
- Object.defineProperty(exports, "getOperationContext", {
1027
- enumerable: true,
1028
- get: function () { return chunkVQTCQKHQ_cjs.getOperationContext; }
1029
- });
1030
- Object.defineProperty(exports, "runInOperationContext", {
1031
- enumerable: true,
1032
- get: function () { return chunkVQTCQKHQ_cjs.runInOperationContext; }
1033
- });
1034
- Object.defineProperty(exports, "CORRELATION_ID_BAGGAGE_KEY", {
1035
- enumerable: true,
1036
- get: function () { return chunkFMTHVSYY_cjs.CORRELATION_ID_BAGGAGE_KEY; }
1037
- });
1038
- Object.defineProperty(exports, "defineBaggageSchema", {
1039
- enumerable: true,
1040
- get: function () { return chunkFMTHVSYY_cjs.defineBaggageSchema; }
1041
- });
1042
- Object.defineProperty(exports, "generateCorrelationId", {
1043
- enumerable: true,
1044
- get: function () { return chunkFMTHVSYY_cjs.generateCorrelationId; }
1045
- });
1046
- Object.defineProperty(exports, "getCorrelationId", {
1047
- enumerable: true,
1048
- get: function () { return chunkFMTHVSYY_cjs.getCorrelationId; }
1049
- });
1050
- Object.defineProperty(exports, "getEventQueue", {
1051
- enumerable: true,
1052
- get: function () { return chunkFMTHVSYY_cjs.getEventQueue; }
1053
- });
1054
- Object.defineProperty(exports, "getOrCreateCorrelationId", {
1055
- enumerable: true,
1056
- get: function () { return chunkFMTHVSYY_cjs.getOrCreateCorrelationId; }
1057
- });
1058
- Object.defineProperty(exports, "runWithCorrelationId", {
1059
- enumerable: true,
1060
- get: function () { return chunkFMTHVSYY_cjs.runWithCorrelationId; }
1061
- });
1062
- Object.defineProperty(exports, "setCorrelationId", {
1063
- enumerable: true,
1064
- get: function () { return chunkFMTHVSYY_cjs.setCorrelationId; }
1065
- });
1066
- Object.defineProperty(exports, "setCorrelationIdInBaggage", {
1067
- enumerable: true,
1068
- get: function () { return chunkFMTHVSYY_cjs.setCorrelationIdInBaggage; }
1069
- });
1070
- Object.defineProperty(exports, "track", {
1071
- enumerable: true,
1072
- get: function () { return chunkFMTHVSYY_cjs.track; }
1073
- });
1074
- Object.defineProperty(exports, "createStructuredError", {
1075
- enumerable: true,
1076
- get: function () { return chunkEE6CPXKH_cjs.createStructuredError; }
1077
- });
1078
- Object.defineProperty(exports, "flattenToAttributes", {
1079
- enumerable: true,
1080
- get: function () { return chunkEE6CPXKH_cjs.flattenToAttributes; }
1081
- });
1082
- Object.defineProperty(exports, "getStructuredErrorAttributes", {
1083
- enumerable: true,
1084
- get: function () { return chunkEE6CPXKH_cjs.getStructuredErrorAttributes; }
1085
- });
1086
- Object.defineProperty(exports, "recordStructuredError", {
1087
- enumerable: true,
1088
- get: function () { return chunkEE6CPXKH_cjs.recordStructuredError; }
1089
- });
1090
- Object.defineProperty(exports, "structuredErrorToJSON", {
1091
- enumerable: true,
1092
- get: function () { return chunkEE6CPXKH_cjs.structuredErrorToJSON; }
1093
- });
1094
- Object.defineProperty(exports, "toAttributeValue", {
1095
- enumerable: true,
1096
- get: function () { return chunkEE6CPXKH_cjs.toAttributeValue; }
1097
- });
1098
- Object.defineProperty(exports, "BaggageSpanProcessor", {
1099
- enumerable: true,
1100
- get: function () { return chunkR7QYGZUP_cjs.BaggageSpanProcessor; }
1101
- });
1102
- Object.defineProperty(exports, "createStringRedactor", {
1103
- enumerable: true,
1104
- get: function () { return chunkR7QYGZUP_cjs.createStringRedactor; }
1105
- });
1106
- Object.defineProperty(exports, "init", {
1107
- enumerable: true,
1108
- get: function () { return chunkR7QYGZUP_cjs.init; }
1109
- });
1110
- Object.defineProperty(exports, "isInitialized", {
1111
- enumerable: true,
1112
- get: function () { return chunkR7QYGZUP_cjs.isInitialized; }
1113
- });
1114
- Object.defineProperty(exports, "isLoggerLocked", {
1115
- enumerable: true,
1116
- get: function () { return chunkR7QYGZUP_cjs.isLoggerLocked; }
1117
- });
1118
- Object.defineProperty(exports, "lockLogger", {
1119
- enumerable: true,
1120
- get: function () { return chunkR7QYGZUP_cjs.lockLogger; }
1121
- });
1122
- Object.defineProperty(exports, "FilteringSpanProcessor", {
1123
- enumerable: true,
1124
- get: function () { return chunkZNMBW67B_cjs.FilteringSpanProcessor; }
1125
- });
1126
- Object.defineProperty(exports, "NORMALIZER_PATTERNS", {
1127
- enumerable: true,
1128
- get: function () { return chunkIOYFAFHJ_cjs.NORMALIZER_PATTERNS; }
1129
- });
1130
- Object.defineProperty(exports, "NORMALIZER_PRESETS", {
1131
- enumerable: true,
1132
- get: function () { return chunkIOYFAFHJ_cjs.NORMALIZER_PRESETS; }
1133
- });
1134
- Object.defineProperty(exports, "SpanNameNormalizingProcessor", {
1135
- enumerable: true,
1136
- get: function () { return chunkIOYFAFHJ_cjs.SpanNameNormalizingProcessor; }
1137
- });
1138
- Object.defineProperty(exports, "AttributeRedactingProcessor", {
1139
- enumerable: true,
1140
- get: function () { return chunkNEIB3TLD_cjs.AttributeRedactingProcessor; }
1141
- });
1142
- Object.defineProperty(exports, "REDACTOR_PATTERNS", {
1143
- enumerable: true,
1144
- get: function () { return chunkNEIB3TLD_cjs.REDACTOR_PATTERNS; }
1145
- });
1146
- Object.defineProperty(exports, "REDACTOR_PRESETS", {
1147
- enumerable: true,
1148
- get: function () { return chunkNEIB3TLD_cjs.REDACTOR_PRESETS; }
1149
- });
1150
- Object.defineProperty(exports, "builtinPatterns", {
1151
- enumerable: true,
1152
- get: function () { return chunkNEIB3TLD_cjs.builtinPatterns; }
1153
- });
1154
- Object.defineProperty(exports, "createAttributeRedactor", {
1155
- enumerable: true,
1156
- get: function () { return chunkNEIB3TLD_cjs.createAttributeRedactor; }
1157
- });
1158
- Object.defineProperty(exports, "createRedactedSpan", {
1159
- enumerable: true,
1160
- get: function () { return chunkNEIB3TLD_cjs.createRedactedSpan; }
1161
- });
1162
- Object.defineProperty(exports, "normalizeAttributeRedactorConfig", {
1163
- enumerable: true,
1164
- get: function () { return chunkNEIB3TLD_cjs.normalizeAttributeRedactorConfig; }
1165
- });
1166
- Object.defineProperty(exports, "formatDuration", {
1167
- enumerable: true,
1168
- get: function () { return chunk6S5RUKU3_cjs.formatDuration; }
1169
- });
1170
- Object.defineProperty(exports, "AUTOTEL_SAMPLING_TAIL_EVALUATED", {
1171
- enumerable: true,
1172
- get: function () { return chunkVH77IPJN_cjs.AUTOTEL_SAMPLING_TAIL_EVALUATED; }
1173
- });
1174
- Object.defineProperty(exports, "AUTOTEL_SAMPLING_TAIL_KEEP", {
1175
- enumerable: true,
1176
- get: function () { return chunkVH77IPJN_cjs.AUTOTEL_SAMPLING_TAIL_KEEP; }
1177
- });
1178
- Object.defineProperty(exports, "AdaptiveSampler", {
1179
- enumerable: true,
1180
- get: function () { return chunkVH77IPJN_cjs.AdaptiveSampler; }
1181
- });
1182
- Object.defineProperty(exports, "AlwaysSampler", {
1183
- enumerable: true,
1184
- get: function () { return chunkVH77IPJN_cjs.AlwaysSampler; }
1185
- });
1186
- Object.defineProperty(exports, "NeverSampler", {
1187
- enumerable: true,
1188
- get: function () { return chunkVH77IPJN_cjs.NeverSampler; }
1189
- });
1190
- Object.defineProperty(exports, "RandomSampler", {
1191
- enumerable: true,
1192
- get: function () { return chunkVH77IPJN_cjs.RandomSampler; }
1193
- });
1194
- Object.defineProperty(exports, "UserIdSampler", {
1195
- enumerable: true,
1196
- get: function () { return chunkVH77IPJN_cjs.UserIdSampler; }
1197
- });
1198
- Object.defineProperty(exports, "createLinkFromHeaders", {
1199
- enumerable: true,
1200
- get: function () { return chunkVH77IPJN_cjs.createLinkFromHeaders; }
1201
- });
1202
- Object.defineProperty(exports, "extractLinksFromBatch", {
1203
- enumerable: true,
1204
- get: function () { return chunkVH77IPJN_cjs.extractLinksFromBatch; }
1205
- });
1206
- Object.defineProperty(exports, "resolveSamplingPreset", {
1207
- enumerable: true,
1208
- get: function () { return chunkVH77IPJN_cjs.resolveSamplingPreset; }
1209
- });
1210
- Object.defineProperty(exports, "samplingPresets", {
1211
- enumerable: true,
1212
- get: function () { return chunkVH77IPJN_cjs.samplingPresets; }
1213
- });
1214
- Object.defineProperty(exports, "getAutotelTracer", {
1215
- enumerable: true,
1216
- get: function () { return chunkYREV3LGG_cjs.getAutotelTracer; }
1217
- });
1218
- Object.defineProperty(exports, "getAutotelTracerProvider", {
1219
- enumerable: true,
1220
- get: function () { return chunkYREV3LGG_cjs.getAutotelTracerProvider; }
1221
- });
1222
- Object.defineProperty(exports, "setAutotelTracerProvider", {
1223
- enumerable: true,
1224
- get: function () { return chunkYREV3LGG_cjs.setAutotelTracerProvider; }
1225
- });
1226
- Object.defineProperty(exports, "ROOT_CONTEXT", {
1227
- enumerable: true,
1228
- get: function () { return api.ROOT_CONTEXT; }
1229
- });
1230
- Object.defineProperty(exports, "SpanKind", {
1231
- enumerable: true,
1232
- get: function () { return api.SpanKind; }
1233
- });
1234
- Object.defineProperty(exports, "SpanStatusCode", {
1235
- enumerable: true,
1236
- get: function () { return api.SpanStatusCode; }
1237
- });
1238
- Object.defineProperty(exports, "context", {
1239
- enumerable: true,
1240
- get: function () { return api.context; }
673
+ get: function () {
674
+ return _opentelemetry_api.SpanKind;
675
+ }
1241
676
  });
1242
- Object.defineProperty(exports, "otelTrace", {
677
+ exports.SpanNameNormalizingProcessor = require_span_name_normalizer.SpanNameNormalizingProcessor;
678
+ Object.defineProperty(exports, 'SpanStatusCode', {
1243
679
  enumerable: true,
1244
- get: function () { return api.trace; }
680
+ get: function () {
681
+ return _opentelemetry_api.SpanStatusCode;
682
+ }
1245
683
  });
1246
- Object.defineProperty(exports, "propagation", {
684
+ exports.URLAttributes = require_registry.URLAttributes;
685
+ exports.UserIdSampler = require_sampling.UserIdSampler;
686
+ exports.attrs = require_attributes.attrs;
687
+ exports.autoRedactPII = require_attributes.autoRedactPII;
688
+ exports.builtinPatterns = require_attribute_redacting_processor.builtinPatterns;
689
+ Object.defineProperty(exports, 'context', {
1247
690
  enumerable: true,
1248
- get: function () { return api.propagation; }
691
+ get: function () {
692
+ return _opentelemetry_api.context;
693
+ }
1249
694
  });
1250
- exports.GEN_AI_COST_ATTRIBUTE = GEN_AI_COST_ATTRIBUTE;
1251
- exports.GEN_AI_COST_USD_BUCKETS = GEN_AI_COST_USD_BUCKETS;
1252
- exports.GEN_AI_DURATION_BUCKETS_SECONDS = GEN_AI_DURATION_BUCKETS_SECONDS;
1253
- exports.GEN_AI_TOKEN_USAGE_BUCKETS = GEN_AI_TOKEN_USAGE_BUCKETS;
1254
- exports.MODEL_PRICING = MODEL_PRICING;
695
+ exports.createAttributeRedactor = require_attribute_redacting_processor.createAttributeRedactor;
696
+ exports.createCounter = require_metric_helpers.createCounter;
697
+ exports.createDeterministicTraceId = require_trace_helpers.createDeterministicTraceId;
698
+ exports.createDrainPipeline = require_drain_pipeline.createDrainPipeline;
699
+ exports.createHistogram = require_metric_helpers.createHistogram;
700
+ exports.createLinkFromHeaders = require_sampling.createLinkFromHeaders;
701
+ exports.createNoopRequestLogger = createNoopRequestLogger;
702
+ exports.createObservableGauge = require_metric_helpers.createObservableGauge;
703
+ exports.createRedactedSpan = require_attribute_redacting_processor.createRedactedSpan;
704
+ exports.createSafeBaggageSchema = require_business_baggage.createSafeBaggageSchema;
705
+ exports.createStringRedactor = require_init.createStringRedactor;
706
+ exports.createStructuredError = require_structured_error.createStructuredError;
707
+ exports.createUpDownCounter = require_metric_helpers.createUpDownCounter;
708
+ exports.ctx = require_functional.ctx;
709
+ exports.dbClient = require_attributes.dbClient;
1255
710
  exports.defineAuditCatalog = defineAuditCatalog;
711
+ exports.defineBaggageSchema = require_track.defineBaggageSchema;
1256
712
  exports.defineDrain = defineDrain;
1257
713
  exports.defineEnricher = defineEnricher;
1258
714
  exports.defineErrorCatalog = defineErrorCatalog;
1259
715
  exports.defineEvent = defineEvent;
1260
716
  exports.defineHttpDrain = defineHttpDrain;
1261
- exports.estimateLLMCost = estimateLLMCost;
717
+ exports.enrichWithTraceContext = require_trace_helpers.enrichWithTraceContext;
718
+ exports.extractLinksFromBatch = require_sampling.extractLinksFromBatch;
719
+ exports.finalizeSpan = require_trace_helpers.finalizeSpan;
720
+ exports.flattenMetadata = require_trace_helpers.flattenMetadata;
721
+ exports.flattenToAttributes = require_structured_error.flattenToAttributes;
1262
722
  exports.flush = flush;
1263
- exports.genAiMetricViews = genAiMetricViews;
723
+ exports.formatDuration = require_canonical_log_line_processor.formatDuration;
724
+ exports.generateCorrelationId = require_track.generateCorrelationId;
725
+ exports.getActiveContext = require_trace_helpers.getActiveContext;
726
+ exports.getActiveSpan = require_trace_helpers.getActiveSpan;
727
+ exports.getAutotelTracer = require_tracer_provider.getAutotelTracer;
728
+ exports.getAutotelTracerProvider = require_tracer_provider.getAutotelTracerProvider;
1264
729
  exports.getCatalogCode = getCatalogCode;
730
+ exports.getCorrelationId = require_track.getCorrelationId;
731
+ exports.getCurrentWorkflowContext = require_workflow.getCurrentWorkflowContext;
732
+ exports.getEventQueue = require_track.getEventQueue;
733
+ exports.getEvents = require_event.getEvents;
734
+ exports.getMeter = require_metric_helpers.getMeter;
735
+ exports.getMetrics = require_metric.getMetrics;
736
+ exports.getOperationContext = require_operation_context.getOperationContext;
737
+ exports.getOrCreateCorrelationId = require_track.getOrCreateCorrelationId;
1265
738
  exports.getRequestLogger = getRequestLogger;
739
+ exports.getRequestLoggerSafe = getRequestLoggerSafe;
740
+ exports.getStructuredErrorAttributes = require_structured_error.getStructuredErrorAttributes;
741
+ exports.getTraceContext = require_trace_helpers.getTraceContext;
742
+ exports.getTracer = require_trace_helpers.getTracer;
743
+ exports.hasRequestContext = hasRequestContext;
744
+ exports.httpClient = require_attributes.httpClient;
745
+ exports.httpRequestHeaderAttribute = require_semantic_conventions.httpRequestHeaderAttribute;
746
+ exports.httpResponseHeaderAttribute = require_semantic_conventions.httpResponseHeaderAttribute;
747
+ exports.httpServer = require_attributes.httpServer;
748
+ exports.identify = require_attributes.identify;
749
+ exports.init = require_init.init;
750
+ exports.instrument = require_functional.instrument;
1266
751
  exports.isCatalogError = isCatalogError;
1267
- exports.llmHistogramAdvice = llmHistogramAdvice;
1268
- exports.recordLLMCost = recordLLMCost;
1269
- exports.recordPromptSent = recordPromptSent;
1270
- exports.recordResponseReceived = recordResponseReceived;
1271
- exports.recordRetry = recordRetry;
1272
- exports.recordStreamFirstToken = recordStreamFirstToken;
1273
- exports.recordToolCall = recordToolCall;
752
+ exports.isInWorkflow = require_workflow.isInWorkflow;
753
+ exports.isInitialized = require_init.isInitialized;
754
+ exports.isLoggerLocked = require_init.isLoggerLocked;
755
+ exports.isTracing = require_trace_helpers.isTracing;
756
+ exports.lockLogger = require_init.lockLogger;
757
+ exports.markAsImmediate = require_functional.markAsImmediate;
758
+ exports.mergeAttrs = require_attributes.mergeAttrs;
759
+ exports.mergeServiceResource = require_attributes.mergeServiceResource;
760
+ exports.normalizeAttributeRedactorConfig = require_attribute_redacting_processor.normalizeAttributeRedactorConfig;
761
+ Object.defineProperty(exports, 'otelTrace', {
762
+ enumerable: true,
763
+ get: function () {
764
+ return _opentelemetry_api.trace;
765
+ }
766
+ });
767
+ exports.parseError = require_parse_error.parseError;
768
+ Object.defineProperty(exports, 'propagation', {
769
+ enumerable: true,
770
+ get: function () {
771
+ return _opentelemetry_api.propagation;
772
+ }
773
+ });
774
+ exports.recordStructuredError = require_structured_error.recordStructuredError;
775
+ exports.request = require_attributes.request;
776
+ exports.resetEvents = require_event.resetEvents;
777
+ exports.resetMetrics = require_metric.resetMetrics;
778
+ exports.resolveSamplingPreset = require_sampling.resolveSamplingPreset;
779
+ exports.resolveTraceUrl = require_trace_helpers.resolveTraceUrl;
780
+ exports.runInOperationContext = require_operation_context.runInOperationContext;
781
+ exports.runWithCorrelationId = require_track.runWithCorrelationId;
1274
782
  exports.runWithRequestContext = runWithRequestContext;
783
+ exports.runWithSpan = require_trace_helpers.runWithSpan;
784
+ exports.safeSetAttributes = require_attributes.safeSetAttributes;
785
+ exports.samplingPresets = require_sampling.samplingPresets;
786
+ exports.setAutotelTracerProvider = require_tracer_provider.setAutotelTracerProvider;
787
+ exports.setCorrelationId = require_track.setCorrelationId;
788
+ exports.setCorrelationIdInBaggage = require_track.setCorrelationIdInBaggage;
789
+ exports.setDevice = require_attributes.setDevice;
790
+ exports.setError = require_attributes.setError;
791
+ exports.setException = require_attributes.setException;
792
+ exports.setSession = require_attributes.setSession;
793
+ exports.setUser = require_attributes.setUser;
1275
794
  exports.shutdown = shutdown;
1276
- exports.trace = trace2;
1277
- //# sourceMappingURL=index.cjs.map
795
+ exports.span = require_functional.span;
796
+ exports.structuredErrorToJSON = require_structured_error.structuredErrorToJSON;
797
+ exports.toAttributeValue = require_structured_error.toAttributeValue;
798
+ exports.trace = trace;
799
+ exports.traceConsumer = require_messaging.traceConsumer;
800
+ exports.traceDB = require_semantic_helpers.traceDB;
801
+ exports.traceHTTP = require_semantic_helpers.traceHTTP;
802
+ exports.traceMessaging = require_semantic_helpers.traceMessaging;
803
+ exports.traceProducer = require_messaging.traceProducer;
804
+ exports.traceStep = require_workflow.traceStep;
805
+ exports.traceWorkflow = require_workflow.traceWorkflow;
806
+ exports.track = require_track.track;
807
+ exports.validateAttribute = require_attributes.validateAttribute;
808
+ exports.withBaggage = require_functional.withBaggage;
809
+ exports.withNewContext = require_functional.withNewContext;
810
+ exports.withTracing = require_functional.withTracing;
1278
811
  //# sourceMappingURL=index.cjs.map