autotel 3.6.0 → 3.7.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 (602) 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-D3etyRVc.cjs +713 -0
  12. package/dist/attributes-D3etyRVc.cjs.map +1 -0
  13. package/dist/attributes-ksn4HVbd.js +600 -0
  14. package/dist/attributes-ksn4HVbd.js.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-CX0aG1Uh.d.ts +708 -0
  158. package/dist/index-CX0aG1Uh.d.ts.map +1 -0
  159. package/dist/index-DIWZFKUS.d.cts +708 -0
  160. package/dist/index-DIWZFKUS.d.cts.map +1 -0
  161. package/dist/index.cjs +1049 -1172
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +401 -551
  164. package/dist/index.d.cts.map +1 -0
  165. package/dist/index.d.ts +401 -551
  166. package/dist/index.d.ts.map +1 -0
  167. package/dist/index.js +912 -714
  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-DfXA3R1L.js +184 -0
  276. package/dist/registry-DfXA3R1L.js.map +1 -0
  277. package/dist/registry-JZg2J3RZ.cjs +334 -0
  278. package/dist/registry-JZg2J3RZ.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 +440 -39
  308. package/dist/semantic-helpers.cjs.map +1 -1
  309. package/dist/semantic-helpers.d.cts +38 -45
  310. package/dist/semantic-helpers.d.cts.map +1 -0
  311. package/dist/semantic-helpers.d.ts +38 -45
  312. package/dist/semantic-helpers.d.ts.map +1 -0
  313. package/dist/semantic-helpers.js +438 -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/src/index.ts +3 -0
  432. package/src/request-logger.test.ts +53 -1
  433. package/src/request-logger.ts +58 -0
  434. package/src/validate.test.ts +3 -1
  435. package/src/validate.ts +9 -3
  436. package/dist/attributes.cjs.map +0 -1
  437. package/dist/attributes.js.map +0 -1
  438. package/dist/chunk-2ZKEORFN.cjs +0 -14
  439. package/dist/chunk-2ZKEORFN.cjs.map +0 -1
  440. package/dist/chunk-3QXBFGKP.js +0 -344
  441. package/dist/chunk-3QXBFGKP.js.map +0 -1
  442. package/dist/chunk-454CH4OV.js +0 -744
  443. package/dist/chunk-454CH4OV.js.map +0 -1
  444. package/dist/chunk-4A53YIAX.js +0 -180
  445. package/dist/chunk-4A53YIAX.js.map +0 -1
  446. package/dist/chunk-4IFSYQVX.js +0 -337
  447. package/dist/chunk-4IFSYQVX.js.map +0 -1
  448. package/dist/chunk-4P6ZOARG.cjs +0 -33
  449. package/dist/chunk-4P6ZOARG.cjs.map +0 -1
  450. package/dist/chunk-55ER2KD5.js +0 -228
  451. package/dist/chunk-55ER2KD5.js.map +0 -1
  452. package/dist/chunk-5ZN622AO.js +0 -73
  453. package/dist/chunk-5ZN622AO.js.map +0 -1
  454. package/dist/chunk-66YJ66GG.js +0 -1021
  455. package/dist/chunk-66YJ66GG.js.map +0 -1
  456. package/dist/chunk-6S5RUKU3.cjs +0 -347
  457. package/dist/chunk-6S5RUKU3.cjs.map +0 -1
  458. package/dist/chunk-6UQRVUN3.js +0 -222
  459. package/dist/chunk-6UQRVUN3.js.map +0 -1
  460. package/dist/chunk-7552UTQW.js +0 -11
  461. package/dist/chunk-7552UTQW.js.map +0 -1
  462. package/dist/chunk-7EQ4G4SI.cjs +0 -146
  463. package/dist/chunk-7EQ4G4SI.cjs.map +0 -1
  464. package/dist/chunk-7SAWIN74.js +0 -285
  465. package/dist/chunk-7SAWIN74.js.map +0 -1
  466. package/dist/chunk-A4E5AQFK.js +0 -30
  467. package/dist/chunk-A4E5AQFK.js.map +0 -1
  468. package/dist/chunk-ALPYR2GC.js +0 -1061
  469. package/dist/chunk-ALPYR2GC.js.map +0 -1
  470. package/dist/chunk-B7SWBE4P.cjs +0 -799
  471. package/dist/chunk-B7SWBE4P.cjs.map +0 -1
  472. package/dist/chunk-BZHG5IZ4.js +0 -73
  473. package/dist/chunk-BZHG5IZ4.js.map +0 -1
  474. package/dist/chunk-CEAQK2QY.cjs +0 -32
  475. package/dist/chunk-CEAQK2QY.cjs.map +0 -1
  476. package/dist/chunk-CMHVQR6P.js +0 -170
  477. package/dist/chunk-CMHVQR6P.js.map +0 -1
  478. package/dist/chunk-CU6IDACR.cjs +0 -224
  479. package/dist/chunk-CU6IDACR.cjs.map +0 -1
  480. package/dist/chunk-D4TM63S3.js +0 -795
  481. package/dist/chunk-D4TM63S3.js.map +0 -1
  482. package/dist/chunk-DCEDJQGG.js +0 -28
  483. package/dist/chunk-DCEDJQGG.js.map +0 -1
  484. package/dist/chunk-DPSA4QLA.js +0 -344
  485. package/dist/chunk-DPSA4QLA.js.map +0 -1
  486. package/dist/chunk-E6TERL5O.cjs +0 -23
  487. package/dist/chunk-E6TERL5O.cjs.map +0 -1
  488. package/dist/chunk-EE6CPXKH.cjs +0 -164
  489. package/dist/chunk-EE6CPXKH.cjs.map +0 -1
  490. package/dist/chunk-EOFB7XCL.cjs +0 -837
  491. package/dist/chunk-EOFB7XCL.cjs.map +0 -1
  492. package/dist/chunk-ESLWRGAG.cjs +0 -92
  493. package/dist/chunk-ESLWRGAG.cjs.map +0 -1
  494. package/dist/chunk-ESMHTKLJ.cjs +0 -206
  495. package/dist/chunk-ESMHTKLJ.cjs.map +0 -1
  496. package/dist/chunk-FMTHVSYY.cjs +0 -1039
  497. package/dist/chunk-FMTHVSYY.cjs.map +0 -1
  498. package/dist/chunk-FU6R566Y.cjs +0 -236
  499. package/dist/chunk-FU6R566Y.cjs.map +0 -1
  500. package/dist/chunk-GYR5K654.js +0 -91
  501. package/dist/chunk-GYR5K654.js.map +0 -1
  502. package/dist/chunk-HA2WBOGQ.js +0 -57
  503. package/dist/chunk-HA2WBOGQ.js.map +0 -1
  504. package/dist/chunk-HT5JQKN2.js +0 -118
  505. package/dist/chunk-HT5JQKN2.js.map +0 -1
  506. package/dist/chunk-INJD3G4K.cjs +0 -340
  507. package/dist/chunk-INJD3G4K.cjs.map +0 -1
  508. package/dist/chunk-IOYFAFHJ.cjs +0 -95
  509. package/dist/chunk-IOYFAFHJ.cjs.map +0 -1
  510. package/dist/chunk-J5QENANM.js +0 -87
  511. package/dist/chunk-J5QENANM.js.map +0 -1
  512. package/dist/chunk-J7VGRIAJ.js +0 -64
  513. package/dist/chunk-J7VGRIAJ.js.map +0 -1
  514. package/dist/chunk-KFOHQK7X.js +0 -144
  515. package/dist/chunk-KFOHQK7X.js.map +0 -1
  516. package/dist/chunk-KIL5CUN6.js +0 -31
  517. package/dist/chunk-KIL5CUN6.js.map +0 -1
  518. package/dist/chunk-KYXZS3EA.cjs +0 -100
  519. package/dist/chunk-KYXZS3EA.cjs.map +0 -1
  520. package/dist/chunk-LITNXTTT.js +0 -3
  521. package/dist/chunk-LITNXTTT.js.map +0 -1
  522. package/dist/chunk-LVIPBYFE.js +0 -157
  523. package/dist/chunk-LVIPBYFE.js.map +0 -1
  524. package/dist/chunk-M3LFHHTN.cjs +0 -764
  525. package/dist/chunk-M3LFHHTN.cjs.map +0 -1
  526. package/dist/chunk-N25JDZSC.js +0 -95
  527. package/dist/chunk-N25JDZSC.js.map +0 -1
  528. package/dist/chunk-NEIB3TLD.cjs +0 -360
  529. package/dist/chunk-NEIB3TLD.cjs.map +0 -1
  530. package/dist/chunk-NENU7E6V.cjs +0 -344
  531. package/dist/chunk-NENU7E6V.cjs.map +0 -1
  532. package/dist/chunk-NVAI5CCN.cjs +0 -39
  533. package/dist/chunk-NVAI5CCN.cjs.map +0 -1
  534. package/dist/chunk-NZ72VDNY.cjs +0 -4
  535. package/dist/chunk-NZ72VDNY.cjs.map +0 -1
  536. package/dist/chunk-OPPXYVEZ.cjs +0 -131
  537. package/dist/chunk-OPPXYVEZ.cjs.map +0 -1
  538. package/dist/chunk-Q4EULJQY.js +0 -35
  539. package/dist/chunk-Q4EULJQY.js.map +0 -1
  540. package/dist/chunk-QF7ARNUM.js +0 -339
  541. package/dist/chunk-QF7ARNUM.js.map +0 -1
  542. package/dist/chunk-QWW3E3JM.cjs +0 -178
  543. package/dist/chunk-QWW3E3JM.cjs.map +0 -1
  544. package/dist/chunk-R7QYGZUP.cjs +0 -1075
  545. package/dist/chunk-R7QYGZUP.cjs.map +0 -1
  546. package/dist/chunk-RUPKBKUF.js +0 -352
  547. package/dist/chunk-RUPKBKUF.js.map +0 -1
  548. package/dist/chunk-SEO6NAQT.js +0 -14
  549. package/dist/chunk-SEO6NAQT.js.map +0 -1
  550. package/dist/chunk-T4B5LB6E.cjs +0 -66
  551. package/dist/chunk-T4B5LB6E.cjs.map +0 -1
  552. package/dist/chunk-T5WRA76K.cjs +0 -32
  553. package/dist/chunk-T5WRA76K.cjs.map +0 -1
  554. package/dist/chunk-T7JO2TCP.js +0 -1233
  555. package/dist/chunk-T7JO2TCP.js.map +0 -1
  556. package/dist/chunk-TC5ZPWM4.cjs +0 -289
  557. package/dist/chunk-TC5ZPWM4.cjs.map +0 -1
  558. package/dist/chunk-TQ5UWA7S.js +0 -26
  559. package/dist/chunk-TQ5UWA7S.js.map +0 -1
  560. package/dist/chunk-UIKYE2QZ.js +0 -833
  561. package/dist/chunk-UIKYE2QZ.js.map +0 -1
  562. package/dist/chunk-UNPLAVE7.js +0 -21
  563. package/dist/chunk-UNPLAVE7.js.map +0 -1
  564. package/dist/chunk-UY3UYPBZ.cjs +0 -77
  565. package/dist/chunk-UY3UYPBZ.cjs.map +0 -1
  566. package/dist/chunk-V7UBMJAB.cjs +0 -1242
  567. package/dist/chunk-V7UBMJAB.cjs.map +0 -1
  568. package/dist/chunk-VH77IPJN.cjs +0 -358
  569. package/dist/chunk-VH77IPJN.cjs.map +0 -1
  570. package/dist/chunk-VQTCQKHQ.cjs +0 -17
  571. package/dist/chunk-VQTCQKHQ.cjs.map +0 -1
  572. package/dist/chunk-WGWSHJ2N.js +0 -38
  573. package/dist/chunk-WGWSHJ2N.js.map +0 -1
  574. package/dist/chunk-WJH6IYU2.cjs +0 -32
  575. package/dist/chunk-WJH6IYU2.cjs.map +0 -1
  576. package/dist/chunk-YREV3LGG.cjs +0 -61
  577. package/dist/chunk-YREV3LGG.cjs.map +0 -1
  578. package/dist/chunk-YTXEZ4SD.cjs +0 -77
  579. package/dist/chunk-YTXEZ4SD.cjs.map +0 -1
  580. package/dist/chunk-ZNMBW67B.cjs +0 -40
  581. package/dist/chunk-ZNMBW67B.cjs.map +0 -1
  582. package/dist/correlation-id.cjs.map +0 -1
  583. package/dist/correlation-id.js.map +0 -1
  584. package/dist/define-event-BL6Li7CM.d.ts +0 -23
  585. package/dist/define-event-ClP3T1Jx.d.cts +0 -23
  586. package/dist/event-subscriber.cjs.map +0 -1
  587. package/dist/event-subscriber.js.map +0 -1
  588. package/dist/event.cjs.map +0 -1
  589. package/dist/event.js.map +0 -1
  590. package/dist/exporters.cjs.map +0 -1
  591. package/dist/exporters.js.map +0 -1
  592. package/dist/functional.cjs.map +0 -1
  593. package/dist/functional.js.map +0 -1
  594. package/dist/init-DIowiiCh.d.ts +0 -1167
  595. package/dist/init-j-A1zI16.d.cts +0 -1167
  596. package/dist/processors.cjs.map +0 -1
  597. package/dist/processors.js.map +0 -1
  598. package/dist/trace-context-DbGKd1Rn.d.cts +0 -213
  599. package/dist/trace-context-DbGKd1Rn.d.ts +0 -213
  600. package/dist/utils-BahBCFtJ.d.cts +0 -712
  601. package/dist/utils-CLKwaUlG.d.ts +0 -712
  602. package/dist/yaml-config.cjs.map +0 -1
@@ -1,57 +1,637 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_node_require = require('./node-require-DF5QBX6z.cjs');
3
+ let _opentelemetry_api = require("@opentelemetry/api");
2
4
 
3
- var chunkOPPXYVEZ_cjs = require('./chunk-OPPXYVEZ.cjs');
4
- require('./chunk-NVAI5CCN.cjs');
5
+ //#region src/trace-helpers.ts
6
+ /**
7
+ * Trace context helpers - Core primitives for trace correlation
8
+ *
9
+ * These are the building blocks that allow users to bring their own logger
10
+ * (bunyan, log4js, custom, etc.) and add trace correlation.
11
+ *
12
+ * @example Using with bunyan
13
+ * ```typescript
14
+ * import bunyan from 'bunyan';
15
+ * import { enrichWithTraceContext } from 'autotel/trace-helpers';
16
+ *
17
+ * const bunyanLogger = bunyan.createLogger({ name: 'myapp' });
18
+ *
19
+ * const logger = {
20
+ * info: (msg: string, extra?: object) => {
21
+ * bunyanLogger.info(enrichWithTraceContext(extra || {}), msg);
22
+ * }
23
+ * };
24
+ * ```
25
+ *
26
+ * @example Using with log4js
27
+ * ```typescript
28
+ * import log4js from 'log4js';
29
+ * import { getTraceContext } from 'autotel/trace-helpers';
30
+ *
31
+ * const log4jsLogger = log4js.getLogger();
32
+ *
33
+ * function logWithTrace(level: string, msg: string, extra?: object) {
34
+ * const context = getTraceContext();
35
+ * log4jsLogger[level](msg, { ...extra, ...context });
36
+ * }
37
+ * ```
38
+ */
39
+ /**
40
+ * WeakMap to store span names for active spans
41
+ * This allows us to retrieve the span name even though OpenTelemetry
42
+ * doesn't expose it through the public API
43
+ */
44
+ const spanNameMap = /* @__PURE__ */ new WeakMap();
45
+ /**
46
+ * Store span name for a given span
47
+ * Called internally when spans are created
48
+ */
49
+ function setSpanName(span, name) {
50
+ spanNameMap.set(span, name);
51
+ }
52
+ /**
53
+ * Convert hex string to decimal string representation
54
+ * Handles 64-bit unsigned integers for Datadog correlation
55
+ *
56
+ * @param hex - Hex string (up to 16 characters for 64-bit)
57
+ * @returns Decimal string representation
58
+ */
59
+ function hexToDecimal(hex) {
60
+ return BigInt("0x" + hex).toString(10);
61
+ }
62
+ /**
63
+ * Get current trace context from active span
64
+ *
65
+ * Returns null if no span is active (e.g., outside of trace operation)
66
+ *
67
+ * Includes both OpenTelemetry standard fields (hex) and Datadog-specific
68
+ * fields (decimal) for maximum compatibility.
69
+ *
70
+ * @returns Trace context with traceId, spanId, correlationId, and Datadog decimal IDs, or null
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import { getTraceContext } from 'autotel/trace-helpers';
75
+ *
76
+ * const context = getTraceContext();
77
+ * if (context) {
78
+ * console.log('Current trace:', context.traceId);
79
+ * // Current trace: 4bf92f3577b34da6a3ce929d0e0e4736
80
+ * console.log('Datadog trace ID:', context['dd.trace_id']);
81
+ * // Datadog trace ID: 12007117331170166582 (decimal for log correlation)
82
+ * }
83
+ * ```
84
+ */
85
+ function getTraceContext() {
86
+ const span = _opentelemetry_api.trace.getActiveSpan();
87
+ if (!span) return null;
88
+ const spanContext = span.spanContext();
89
+ const traceId = spanContext.traceId;
90
+ const spanId = spanContext.spanId;
91
+ const spanName = spanNameMap.get(span);
92
+ const ddTraceId = hexToDecimal(traceId.slice(-16));
93
+ const ddSpanId = hexToDecimal(spanId);
94
+ return {
95
+ traceId,
96
+ spanId,
97
+ correlationId: traceId.slice(0, 16),
98
+ ...spanName && { "code.function": spanName },
99
+ "dd.trace_id": ddTraceId,
100
+ "dd.span_id": ddSpanId
101
+ };
102
+ }
103
+ /**
104
+ * Enrich object with trace context (traceId, spanId, correlationId, and Datadog fields)
105
+ *
106
+ * If no span is active, returns the object unchanged.
107
+ * This prevents "undefined" or "null" values in logs.
108
+ *
109
+ * Automatically adds both OpenTelemetry standard fields (hex) and Datadog-specific
110
+ * fields (decimal) for maximum compatibility with observability backends.
111
+ *
112
+ * @param obj - Object to enrich (e.g., log metadata)
113
+ * @returns Object with trace context merged in, or unchanged if no active span
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * import { enrichWithTraceContext } from 'autotel/trace-helpers';
118
+ *
119
+ * // Inside a trace operation:
120
+ * const enriched = enrichWithTraceContext({ userId: '123' });
121
+ * // {
122
+ * // userId: '123',
123
+ * // traceId: '4bf92f3577b34da6a3ce929d0e0e4736',
124
+ * // spanId: '00f067aa0ba902b7',
125
+ * // correlationId: '4bf92f3577b34da6',
126
+ * // 'dd.trace_id': '12007117331170166582', // Datadog decimal format
127
+ * // 'dd.span_id': '67667974448284583' // Datadog decimal format
128
+ * // }
129
+ *
130
+ * // Outside trace operation:
131
+ * const unchanged = enrichWithTraceContext({ userId: '123' });
132
+ * // { userId: '123' } - no trace fields added
133
+ * ```
134
+ */
135
+ function enrichWithTraceContext(obj) {
136
+ const context = getTraceContext();
137
+ return context ? {
138
+ ...obj,
139
+ ...context
140
+ } : obj;
141
+ }
142
+ /**
143
+ * Check if currently in a trace context
144
+ *
145
+ * Useful for conditional logic based on trace presence
146
+ *
147
+ * @returns true if active span exists, false otherwise
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * import { isTracing } from 'autotel/trace-helpers';
152
+ *
153
+ * if (isTracing()) {
154
+ * // Add expensive debug metadata only when tracing
155
+ * logger.debug('Detailed context', expensiveDebugData());
156
+ * }
157
+ * ```
158
+ */
159
+ function isTracing() {
160
+ return _opentelemetry_api.trace.getActiveSpan() !== void 0;
161
+ }
162
+ /**
163
+ * Get a tracer instance for creating custom spans
164
+ *
165
+ * Use this when you need low-level control over span lifecycle.
166
+ * For most use cases, prefer trace(), span(), or instrument() instead.
167
+ *
168
+ * @param name - Tracer name (usually your service or module name)
169
+ * @param version - Optional version string
170
+ * @returns OpenTelemetry Tracer instance
171
+ *
172
+ * @example Basic usage
173
+ * ```typescript
174
+ * import { getTracer } from 'autotel';
175
+ *
176
+ * const tracer = getTracer('my-service');
177
+ * const span = tracer.startSpan('custom.operation');
178
+ * try {
179
+ * // Your logic
180
+ * span.setAttribute('key', 'value');
181
+ * } finally {
182
+ * span.end();
183
+ * }
184
+ * ```
185
+ *
186
+ * @example With AI SDK
187
+ * ```typescript
188
+ * import { getTracer } from 'autotel';
189
+ * import { generateText } from 'ai';
190
+ *
191
+ * const tracer = getTracer('ai-agent');
192
+ * const result = await generateText({
193
+ * model: myModel,
194
+ * prompt: 'Hello',
195
+ * experimental_telemetry: {
196
+ * isEnabled: true,
197
+ * tracer,
198
+ * },
199
+ * });
200
+ * ```
201
+ */
202
+ function getTracer(name, version) {
203
+ return _opentelemetry_api.trace.getTracer(name, version);
204
+ }
205
+ /**
206
+ * Get the currently active span
207
+ *
208
+ * Returns undefined if no span is currently active.
209
+ * Useful for adding attributes to the current span.
210
+ *
211
+ * @returns Active span or undefined
212
+ *
213
+ * @example Adding attributes to active span
214
+ * ```typescript
215
+ * import { getActiveSpan } from 'autotel';
216
+ *
217
+ * const span = getActiveSpan();
218
+ * if (span) {
219
+ * span.setAttribute('user.id', userId);
220
+ * span.setAttribute('user.action', 'click');
221
+ * }
222
+ * ```
223
+ *
224
+ * @example Checking span status
225
+ * ```typescript
226
+ * import { getActiveSpan, SpanStatusCode } from 'autotel';
227
+ *
228
+ * const span = getActiveSpan();
229
+ * if (span?.isRecording()) {
230
+ * span.setStatus({ code: SpanStatusCode.OK });
231
+ * }
232
+ * ```
233
+ */
234
+ function getActiveSpan() {
235
+ return _opentelemetry_api.trace.getActiveSpan();
236
+ }
237
+ /**
238
+ * Get the currently active OpenTelemetry context
239
+ *
240
+ * The context contains the active span and any baggage.
241
+ * Useful for context propagation and custom instrumentation.
242
+ *
243
+ * @returns Current active context
244
+ *
245
+ * @example Propagating context
246
+ * ```typescript
247
+ * import { getActiveContext } from 'autotel';
248
+ *
249
+ * const currentContext = getActiveContext();
250
+ * // Pass context to another function or service
251
+ * ```
252
+ *
253
+ * @example With context injection
254
+ * ```typescript
255
+ * import { getActiveContext, injectTraceContext } from 'autotel';
256
+ *
257
+ * const headers = {};
258
+ * injectTraceContext(headers);
259
+ * // Headers now contain trace propagation data
260
+ * ```
261
+ */
262
+ function getActiveContext() {
263
+ try {
264
+ const { getActiveContextWithBaggage } = require_node_require.requireModule("./trace-context");
265
+ return getActiveContextWithBaggage();
266
+ } catch {
267
+ return _opentelemetry_api.context.active();
268
+ }
269
+ }
270
+ /**
271
+ * Run a function with a specific span set as active
272
+ *
273
+ * This is a convenience wrapper around the two-step process of
274
+ * setting a span in context and running code within that context.
275
+ *
276
+ * @param span - The span to set as active
277
+ * @param fn - Function to execute with the span active
278
+ * @returns The return value of the function
279
+ *
280
+ * @example Running code with a custom span
281
+ * ```typescript
282
+ * import { getTracer, runWithSpan } from 'autotel';
283
+ *
284
+ * const tracer = getTracer('my-service');
285
+ * const span = tracer.startSpan('background.job');
286
+ *
287
+ * try {
288
+ * const result = await runWithSpan(span, async () => {
289
+ * // Any spans created here will be children of 'background.job'
290
+ * await processData();
291
+ * return { success: true };
292
+ * });
293
+ * console.log(result);
294
+ * } finally {
295
+ * span.end();
296
+ * }
297
+ * ```
298
+ *
299
+ * @example Testing with custom spans
300
+ * ```typescript
301
+ * import { runWithSpan, otelTrace } from 'autotel';
302
+ *
303
+ * const tracer = otelTrace.getTracer('test');
304
+ * const span = tracer.startSpan('test.operation');
305
+ *
306
+ * const result = runWithSpan(span, () => {
307
+ * // Code under test runs with this span as active
308
+ * return myFunction();
309
+ * });
310
+ *
311
+ * span.end();
312
+ * ```
313
+ */
314
+ function runWithSpan(span, fn) {
315
+ const ctx = _opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span);
316
+ return _opentelemetry_api.context.with(ctx, fn);
317
+ }
318
+ /**
319
+ * Finalize a span with appropriate status and optional error recording
320
+ *
321
+ * This is a convenience function that:
322
+ * - Records exceptions if an error is provided
323
+ * - Sets span status to ERROR if error exists, OK otherwise
324
+ * - Ends the span
325
+ *
326
+ * @param span - The span to finalize
327
+ * @param error - Optional error to record
328
+ *
329
+ * @example Without error (success case)
330
+ * ```typescript
331
+ * import { getTracer, finalizeSpan } from 'autotel';
332
+ *
333
+ * const tracer = getTracer('my-service');
334
+ * const span = tracer.startSpan('operation');
335
+ *
336
+ * try {
337
+ * await doWork();
338
+ * finalizeSpan(span);
339
+ * } catch (error) {
340
+ * finalizeSpan(span, error);
341
+ * throw error;
342
+ * }
343
+ * ```
344
+ *
345
+ * @example With error
346
+ * ```typescript
347
+ * import { getTracer, finalizeSpan } from 'autotel';
348
+ *
349
+ * const tracer = getTracer('my-service');
350
+ * const span = tracer.startSpan('operation');
351
+ *
352
+ * try {
353
+ * await riskyOperation();
354
+ * finalizeSpan(span);
355
+ * } catch (error) {
356
+ * finalizeSpan(span, error); // Records exception and sets ERROR status
357
+ * throw error;
358
+ * }
359
+ * ```
360
+ *
361
+ * @example In instrumentation
362
+ * ```typescript
363
+ * import { getTracer, runWithSpan, finalizeSpan } from 'autotel';
364
+ *
365
+ * function instrumentedQuery(query: string) {
366
+ * const tracer = getTracer('db');
367
+ * const span = tracer.startSpan('db.query');
368
+ *
369
+ * return runWithSpan(span, () => {
370
+ * try {
371
+ * const result = executeQuery(query);
372
+ * finalizeSpan(span);
373
+ * return result;
374
+ * } catch (error) {
375
+ * finalizeSpan(span, error);
376
+ * throw error;
377
+ * }
378
+ * });
379
+ * }
380
+ * ```
381
+ */
382
+ function finalizeSpan(span, error) {
383
+ if (error) {
384
+ if (error instanceof Error) span.recordException(error);
385
+ else span.recordException(new Error(String(error)));
386
+ span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
387
+ } else span.setStatus({ code: _opentelemetry_api.SpanStatusCode.OK });
388
+ span.end();
389
+ }
390
+ /**
391
+ * Creates a deterministic trace ID from a seed string.
392
+ *
393
+ * Generates a consistent 128-bit trace ID (32 hex characters) from an input seed
394
+ * using SHA-256 hashing. Useful for correlating external system IDs (request IDs,
395
+ * order IDs, session IDs) with OpenTelemetry trace IDs.
396
+ *
397
+ * **Use Cases:**
398
+ * - Correlate external request IDs with traces
399
+ * - Link customer support tickets to trace data
400
+ * - Associate business entities (orders, sessions) with observability data
401
+ * - Debug specific user flows by deterministic trace lookup
402
+ *
403
+ * **Important:** Only use this when you need deterministic trace IDs for correlation.
404
+ * For normal tracing, let OpenTelemetry generate random trace IDs automatically.
405
+ *
406
+ * **Runtime Support:**
407
+ * - Node.js 15+ (native crypto.subtle)
408
+ * - All modern browsers
409
+ * - Edge runtimes (Cloudflare Workers, Deno, etc.)
410
+ *
411
+ * @param seed - Input string to generate trace ID from (e.g., request ID, order ID)
412
+ * @returns Promise resolving to a 32-character hex trace ID (128 bits)
413
+ *
414
+ * @example Correlate external request ID with trace
415
+ * ```typescript
416
+ * import { createDeterministicTraceId } from 'autotel/trace-helpers'
417
+ * import { trace, context } from '@opentelemetry/api'
418
+ *
419
+ * // In middleware or request handler
420
+ * const requestId = req.headers['x-request-id']
421
+ * const traceId = await createDeterministicTraceId(requestId)
422
+ *
423
+ * // Use with manual span creation (advanced - not needed with trace/span functions)
424
+ * const tracer = trace.getTracer('my-service')
425
+ * const spanContext = {
426
+ * traceId,
427
+ * spanId: '0123456789abcdef', // Still random
428
+ * traceFlags: 1
429
+ * }
430
+ * ```
431
+ *
432
+ * @example Link customer support tickets to traces
433
+ * ```typescript
434
+ * import { createDeterministicTraceId } from 'autotel/trace-helpers'
435
+ *
436
+ * // Support dashboard integration
437
+ * const ticketId = 'TICKET-12345'
438
+ * const traceId = await createDeterministicTraceId(ticketId)
439
+ *
440
+ * // Generate direct link to traces in observability backend
441
+ * const traceUrl = `https://your-otel-backend.com/traces/${traceId}`
442
+ * console.log(`View related traces: ${traceUrl}`)
443
+ * ```
444
+ *
445
+ * @example Session-based correlation
446
+ * ```typescript
447
+ * import { createDeterministicTraceId } from 'autotel/trace-helpers'
448
+ *
449
+ * // Track all operations for a user session
450
+ * const sessionId = req.session.id
451
+ * const traceId = await createDeterministicTraceId(sessionId)
452
+ *
453
+ * // All operations in this session share the same trace ID
454
+ * // Makes it easy to find all activity for a specific session
455
+ * ```
456
+ *
457
+ * @public
458
+ */
459
+ async function createDeterministicTraceId(seed) {
460
+ const data = new TextEncoder().encode(seed);
461
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
462
+ return [...new Uint8Array(hashBuffer)].map((byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 32);
463
+ }
464
+ /**
465
+ * Flattens nested metadata objects into dot-notation span attributes.
466
+ *
467
+ * Converts complex nested objects into flat key-value pairs suitable for
468
+ * OpenTelemetry span attributes. Non-string values are JSON serialized.
469
+ * Handles serialization failures gracefully with a fallback value.
470
+ *
471
+ * **Use Cases:**
472
+ * - Structured metadata with nested objects
473
+ * - User context with multiple properties
474
+ * - Request/response metadata
475
+ * - Business entity attributes
476
+ *
477
+ * **Note:** Filters out null/undefined values automatically to keep spans clean.
478
+ *
479
+ * @param metadata - Nested metadata object to flatten
480
+ * @param prefix - Prefix for all attribute keys (default: 'metadata')
481
+ * @returns Flattened attributes as { [key: string]: string }
482
+ *
483
+ * @example Basic metadata flattening
484
+ * ```typescript
485
+ * import { flattenMetadata } from 'autotel/trace-helpers'
486
+ * import { trace } from 'autotel'
487
+ *
488
+ * export const processOrder = trace(ctx => async (orderId: string) => {
489
+ * const order = await getOrder(orderId)
490
+ *
491
+ * // Flatten complex order metadata
492
+ * const flattened = flattenMetadata({
493
+ * user: { id: order.userId, tier: 'premium' },
494
+ * payment: { method: 'card', processor: 'stripe' },
495
+ * items: order.items.length
496
+ * })
497
+ *
498
+ * ctx.setAttributes(flattened)
499
+ * // Results in:
500
+ * // {
501
+ * // 'metadata.user.id': 'user-123',
502
+ * // 'metadata.user.tier': 'premium',
503
+ * // 'metadata.payment.method': 'card',
504
+ * // 'metadata.payment.processor': 'stripe',
505
+ * // 'metadata.items': '5'
506
+ * // }
507
+ * })
508
+ * ```
509
+ *
510
+ * @example Custom prefix for semantic conventions
511
+ * ```typescript
512
+ * import { flattenMetadata } from 'autotel/trace-helpers'
513
+ * import { trace } from 'autotel'
514
+ *
515
+ * export const fetchUser = trace(ctx => async (userId: string) => {
516
+ * const user = await db.users.findOne({ id: userId })
517
+ *
518
+ * // Use semantic convention prefix
519
+ * const userAttrs = flattenMetadata(
520
+ * {
521
+ * id: user.id,
522
+ * email: user.email,
523
+ * plan: user.subscription.plan
524
+ * },
525
+ * 'user' // Custom prefix
526
+ * )
527
+ *
528
+ * ctx.setAttributes(userAttrs)
529
+ * // Results in:
530
+ * // {
531
+ * // 'user.id': 'user-123',
532
+ * // 'user.email': 'user@example.com',
533
+ * // 'user.plan': 'enterprise'
534
+ * // }
535
+ * })
536
+ * ```
537
+ *
538
+ * @example With complex objects (auto-serialized)
539
+ * ```typescript
540
+ * import { flattenMetadata } from 'autotel/trace-helpers'
541
+ * import { trace } from 'autotel'
542
+ *
543
+ * export const analyzeRequest = trace(ctx => async (req: Request) => {
544
+ * const metadata = flattenMetadata({
545
+ * headers: req.headers, // Object - will be JSON serialized
546
+ * query: req.query, // Object - will be JSON serialized
547
+ * timestamp: new Date() // Non-string - will be JSON serialized
548
+ * })
549
+ *
550
+ * ctx.setAttributes(metadata)
551
+ * // Results in:
552
+ * // {
553
+ * // 'metadata.headers': '{"accept":"application/json",...}',
554
+ * // 'metadata.query': '{"page":"1","limit":"10"}',
555
+ * // 'metadata.timestamp': '"2024-01-15T12:00:00.000Z"'
556
+ * // }
557
+ * })
558
+ * ```
559
+ *
560
+ * @example Error handling
561
+ * ```typescript
562
+ * import { flattenMetadata } from 'autotel/trace-helpers'
563
+ *
564
+ * // Objects with circular references are handled gracefully
565
+ * const circular: any = { a: 1 }
566
+ * circular.self = circular
567
+ *
568
+ * const flattened = flattenMetadata({ data: circular })
569
+ * // Results in:
570
+ * // { 'metadata.data': '<serialization-failed>' }
571
+ * ```
572
+ *
573
+ * @public
574
+ */
575
+ /**
576
+ * Resolve a trace URL from a template string and trace ID.
577
+ *
578
+ * Templates use `{traceId}` as placeholder. Falls back to `OTEL_TRACE_URL_TEMPLATE` env var.
579
+ *
580
+ * @example
581
+ * resolveTraceUrl('https://grafana.example.com/explore?traceId={traceId}', 'abc123')
582
+ * // => 'https://grafana.example.com/explore?traceId=abc123'
583
+ */
584
+ function resolveTraceUrl(template, traceId) {
585
+ const t = template ?? process.env.OTEL_TRACE_URL_TEMPLATE;
586
+ if (!t) return void 0;
587
+ return t.replace(/\{traceId\}/g, traceId);
588
+ }
589
+ function flattenMetadata(metadata, prefix = "metadata") {
590
+ const flattened = {};
591
+ const seen = /* @__PURE__ */ new WeakSet();
592
+ function flatten(obj, currentPrefix) {
593
+ for (const [key, value] of Object.entries(obj)) {
594
+ if (value == null) continue;
595
+ const attributeKey = `${currentPrefix}.${key}`;
596
+ if (typeof value === "string") {
597
+ flattened[attributeKey] = value;
598
+ continue;
599
+ }
600
+ if (typeof value === "number" || typeof value === "boolean") {
601
+ flattened[attributeKey] = String(value);
602
+ continue;
603
+ }
604
+ if (typeof value === "object" && value !== null && value.constructor === Object) {
605
+ if (seen.has(value)) {
606
+ flattened[attributeKey] = "<circular-reference>";
607
+ continue;
608
+ }
609
+ seen.add(value);
610
+ flatten(value, attributeKey);
611
+ continue;
612
+ }
613
+ try {
614
+ flattened[attributeKey] = JSON.stringify(value);
615
+ } catch {
616
+ flattened[attributeKey] = "<serialization-failed>";
617
+ }
618
+ }
619
+ }
620
+ flatten(metadata, prefix);
621
+ return flattened;
622
+ }
5
623
 
6
-
7
-
8
- Object.defineProperty(exports, "createDeterministicTraceId", {
9
- enumerable: true,
10
- get: function () { return chunkOPPXYVEZ_cjs.createDeterministicTraceId; }
11
- });
12
- Object.defineProperty(exports, "enrichWithTraceContext", {
13
- enumerable: true,
14
- get: function () { return chunkOPPXYVEZ_cjs.enrichWithTraceContext; }
15
- });
16
- Object.defineProperty(exports, "finalizeSpan", {
17
- enumerable: true,
18
- get: function () { return chunkOPPXYVEZ_cjs.finalizeSpan; }
19
- });
20
- Object.defineProperty(exports, "flattenMetadata", {
21
- enumerable: true,
22
- get: function () { return chunkOPPXYVEZ_cjs.flattenMetadata; }
23
- });
24
- Object.defineProperty(exports, "getActiveContext", {
25
- enumerable: true,
26
- get: function () { return chunkOPPXYVEZ_cjs.getActiveContext; }
27
- });
28
- Object.defineProperty(exports, "getActiveSpan", {
29
- enumerable: true,
30
- get: function () { return chunkOPPXYVEZ_cjs.getActiveSpan; }
31
- });
32
- Object.defineProperty(exports, "getTraceContext", {
33
- enumerable: true,
34
- get: function () { return chunkOPPXYVEZ_cjs.getTraceContext; }
35
- });
36
- Object.defineProperty(exports, "getTracer", {
37
- enumerable: true,
38
- get: function () { return chunkOPPXYVEZ_cjs.getTracer; }
39
- });
40
- Object.defineProperty(exports, "isTracing", {
41
- enumerable: true,
42
- get: function () { return chunkOPPXYVEZ_cjs.isTracing; }
43
- });
44
- Object.defineProperty(exports, "resolveTraceUrl", {
45
- enumerable: true,
46
- get: function () { return chunkOPPXYVEZ_cjs.resolveTraceUrl; }
47
- });
48
- Object.defineProperty(exports, "runWithSpan", {
49
- enumerable: true,
50
- get: function () { return chunkOPPXYVEZ_cjs.runWithSpan; }
51
- });
52
- Object.defineProperty(exports, "setSpanName", {
53
- enumerable: true,
54
- get: function () { return chunkOPPXYVEZ_cjs.setSpanName; }
55
- });
56
- //# sourceMappingURL=trace-helpers.cjs.map
624
+ //#endregion
625
+ exports.createDeterministicTraceId = createDeterministicTraceId;
626
+ exports.enrichWithTraceContext = enrichWithTraceContext;
627
+ exports.finalizeSpan = finalizeSpan;
628
+ exports.flattenMetadata = flattenMetadata;
629
+ exports.getActiveContext = getActiveContext;
630
+ exports.getActiveSpan = getActiveSpan;
631
+ exports.getTraceContext = getTraceContext;
632
+ exports.getTracer = getTracer;
633
+ exports.isTracing = isTracing;
634
+ exports.resolveTraceUrl = resolveTraceUrl;
635
+ exports.runWithSpan = runWithSpan;
636
+ exports.setSpanName = setSpanName;
57
637
  //# sourceMappingURL=trace-helpers.cjs.map