autotel 3.5.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 (591) 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 -53
  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 -16
  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 -65
  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 -63
  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 -36
  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 -20
  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 -56
  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 -19
  149. package/dist/http.cjs +276 -175
  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 -173
  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 +1050 -1184
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +401 -570
  164. package/dist/index.d.cts.map +1 -0
  165. package/dist/index.d.ts +401 -570
  166. package/dist/index.d.ts.map +1 -0
  167. package/dist/index.js +913 -725
  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 -35
  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 -20
  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 -38
  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 -19
  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 +201 -0
  382. package/dist/validate.cjs.map +1 -0
  383. package/dist/validate.d.cts +105 -0
  384. package/dist/validate.d.cts.map +1 -0
  385. package/dist/validate.d.ts +105 -0
  386. package/dist/validate.d.ts.map +1 -0
  387. package/dist/validate.js +197 -0
  388. package/dist/validate.js.map +1 -0
  389. package/dist/validation-attributes.cjs +45 -0
  390. package/dist/validation-attributes.cjs.map +1 -0
  391. package/dist/validation-attributes.d.cts +33 -0
  392. package/dist/validation-attributes.d.cts.map +1 -0
  393. package/dist/validation-attributes.d.ts +33 -0
  394. package/dist/validation-attributes.d.ts.map +1 -0
  395. package/dist/validation-attributes.js +41 -0
  396. package/dist/validation-attributes.js.map +1 -0
  397. package/dist/webhook.cjs +286 -255
  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 -253
  404. package/dist/webhook.js.map +1 -1
  405. package/dist/workflow-distributed.cjs +498 -411
  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 -409
  412. package/dist/workflow-distributed.js.map +1 -1
  413. package/dist/workflow.cjs +405 -39
  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 -20
  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 +14 -4
  431. package/src/define-event.ts +2 -21
  432. package/src/index.ts +3 -0
  433. package/src/request-logger.test.ts +53 -1
  434. package/src/request-logger.ts +58 -0
  435. package/src/stable-hash.ts +27 -0
  436. package/src/validate.test.ts +287 -0
  437. package/src/validate.ts +307 -0
  438. package/src/validation-attributes.ts +43 -0
  439. package/dist/attributes.cjs.map +0 -1
  440. package/dist/attributes.js.map +0 -1
  441. package/dist/chunk-2ZKEORFN.cjs +0 -14
  442. package/dist/chunk-2ZKEORFN.cjs.map +0 -1
  443. package/dist/chunk-3QXBFGKP.js +0 -344
  444. package/dist/chunk-3QXBFGKP.js.map +0 -1
  445. package/dist/chunk-454CH4OV.js +0 -744
  446. package/dist/chunk-454CH4OV.js.map +0 -1
  447. package/dist/chunk-4A53YIAX.js +0 -180
  448. package/dist/chunk-4A53YIAX.js.map +0 -1
  449. package/dist/chunk-4IFSYQVX.js +0 -337
  450. package/dist/chunk-4IFSYQVX.js.map +0 -1
  451. package/dist/chunk-4P6ZOARG.cjs +0 -33
  452. package/dist/chunk-4P6ZOARG.cjs.map +0 -1
  453. package/dist/chunk-55ER2KD5.js +0 -228
  454. package/dist/chunk-55ER2KD5.js.map +0 -1
  455. package/dist/chunk-5ZN622AO.js +0 -73
  456. package/dist/chunk-5ZN622AO.js.map +0 -1
  457. package/dist/chunk-6S5RUKU3.cjs +0 -347
  458. package/dist/chunk-6S5RUKU3.cjs.map +0 -1
  459. package/dist/chunk-6UQRVUN3.js +0 -222
  460. package/dist/chunk-6UQRVUN3.js.map +0 -1
  461. package/dist/chunk-7552UTQW.js +0 -11
  462. package/dist/chunk-7552UTQW.js.map +0 -1
  463. package/dist/chunk-7EQ4G4SI.cjs +0 -146
  464. package/dist/chunk-7EQ4G4SI.cjs.map +0 -1
  465. package/dist/chunk-7SAWIN74.js +0 -285
  466. package/dist/chunk-7SAWIN74.js.map +0 -1
  467. package/dist/chunk-A4E5AQFK.js +0 -30
  468. package/dist/chunk-A4E5AQFK.js.map +0 -1
  469. package/dist/chunk-AC5GNZKB.cjs +0 -344
  470. package/dist/chunk-AC5GNZKB.cjs.map +0 -1
  471. package/dist/chunk-ALPYR2GC.js +0 -1061
  472. package/dist/chunk-ALPYR2GC.js.map +0 -1
  473. package/dist/chunk-BZHG5IZ4.js +0 -73
  474. package/dist/chunk-BZHG5IZ4.js.map +0 -1
  475. package/dist/chunk-CEAQK2QY.cjs +0 -32
  476. package/dist/chunk-CEAQK2QY.cjs.map +0 -1
  477. package/dist/chunk-CMHVQR6P.js +0 -170
  478. package/dist/chunk-CMHVQR6P.js.map +0 -1
  479. package/dist/chunk-CU6IDACR.cjs +0 -224
  480. package/dist/chunk-CU6IDACR.cjs.map +0 -1
  481. package/dist/chunk-DPSA4QLA.js +0 -344
  482. package/dist/chunk-DPSA4QLA.js.map +0 -1
  483. package/dist/chunk-DQEHQNQE.js +0 -795
  484. package/dist/chunk-DQEHQNQE.js.map +0 -1
  485. package/dist/chunk-ESLWRGAG.cjs +0 -92
  486. package/dist/chunk-ESLWRGAG.cjs.map +0 -1
  487. package/dist/chunk-ESMHTKLJ.cjs +0 -206
  488. package/dist/chunk-ESMHTKLJ.cjs.map +0 -1
  489. package/dist/chunk-FGNDN2FD.cjs +0 -1242
  490. package/dist/chunk-FGNDN2FD.cjs.map +0 -1
  491. package/dist/chunk-FU6R566Y.cjs +0 -236
  492. package/dist/chunk-FU6R566Y.cjs.map +0 -1
  493. package/dist/chunk-GBFTC7Q7.cjs +0 -837
  494. package/dist/chunk-GBFTC7Q7.cjs.map +0 -1
  495. package/dist/chunk-GYR5K654.js +0 -91
  496. package/dist/chunk-GYR5K654.js.map +0 -1
  497. package/dist/chunk-HA2WBOGQ.js +0 -57
  498. package/dist/chunk-HA2WBOGQ.js.map +0 -1
  499. package/dist/chunk-HT5JQKN2.js +0 -118
  500. package/dist/chunk-HT5JQKN2.js.map +0 -1
  501. package/dist/chunk-INJD3G4K.cjs +0 -340
  502. package/dist/chunk-INJD3G4K.cjs.map +0 -1
  503. package/dist/chunk-IOYFAFHJ.cjs +0 -95
  504. package/dist/chunk-IOYFAFHJ.cjs.map +0 -1
  505. package/dist/chunk-J5QENANM.js +0 -87
  506. package/dist/chunk-J5QENANM.js.map +0 -1
  507. package/dist/chunk-J7VGRIAJ.js +0 -64
  508. package/dist/chunk-J7VGRIAJ.js.map +0 -1
  509. package/dist/chunk-KFOHQK7X.js +0 -144
  510. package/dist/chunk-KFOHQK7X.js.map +0 -1
  511. package/dist/chunk-KIL5CUN6.js +0 -31
  512. package/dist/chunk-KIL5CUN6.js.map +0 -1
  513. package/dist/chunk-LITNXTTT.js +0 -3
  514. package/dist/chunk-LITNXTTT.js.map +0 -1
  515. package/dist/chunk-M3LFHHTN.cjs +0 -764
  516. package/dist/chunk-M3LFHHTN.cjs.map +0 -1
  517. package/dist/chunk-NEIB3TLD.cjs +0 -360
  518. package/dist/chunk-NEIB3TLD.cjs.map +0 -1
  519. package/dist/chunk-NVAI5CCN.cjs +0 -39
  520. package/dist/chunk-NVAI5CCN.cjs.map +0 -1
  521. package/dist/chunk-NVGPMGI4.js +0 -95
  522. package/dist/chunk-NVGPMGI4.js.map +0 -1
  523. package/dist/chunk-NZ72VDNY.cjs +0 -4
  524. package/dist/chunk-NZ72VDNY.cjs.map +0 -1
  525. package/dist/chunk-O4JZUCUE.js +0 -1174
  526. package/dist/chunk-O4JZUCUE.js.map +0 -1
  527. package/dist/chunk-O7JOKRN2.js +0 -833
  528. package/dist/chunk-O7JOKRN2.js.map +0 -1
  529. package/dist/chunk-OPPXYVEZ.cjs +0 -131
  530. package/dist/chunk-OPPXYVEZ.cjs.map +0 -1
  531. package/dist/chunk-Q4EULJQY.js +0 -35
  532. package/dist/chunk-Q4EULJQY.js.map +0 -1
  533. package/dist/chunk-QWW3E3JM.cjs +0 -178
  534. package/dist/chunk-QWW3E3JM.cjs.map +0 -1
  535. package/dist/chunk-R7QYGZUP.cjs +0 -1075
  536. package/dist/chunk-R7QYGZUP.cjs.map +0 -1
  537. package/dist/chunk-RUPKBKUF.js +0 -352
  538. package/dist/chunk-RUPKBKUF.js.map +0 -1
  539. package/dist/chunk-SEO6NAQT.js +0 -14
  540. package/dist/chunk-SEO6NAQT.js.map +0 -1
  541. package/dist/chunk-T4B5LB6E.cjs +0 -66
  542. package/dist/chunk-T4B5LB6E.cjs.map +0 -1
  543. package/dist/chunk-TC5ZPWM4.cjs +0 -289
  544. package/dist/chunk-TC5ZPWM4.cjs.map +0 -1
  545. package/dist/chunk-TQ5UWA7S.js +0 -26
  546. package/dist/chunk-TQ5UWA7S.js.map +0 -1
  547. package/dist/chunk-URHPSJW2.js +0 -339
  548. package/dist/chunk-URHPSJW2.js.map +0 -1
  549. package/dist/chunk-UY3UYPBZ.cjs +0 -77
  550. package/dist/chunk-UY3UYPBZ.cjs.map +0 -1
  551. package/dist/chunk-VG2ABKJX.cjs +0 -100
  552. package/dist/chunk-VG2ABKJX.cjs.map +0 -1
  553. package/dist/chunk-VH77IPJN.cjs +0 -358
  554. package/dist/chunk-VH77IPJN.cjs.map +0 -1
  555. package/dist/chunk-VQTCQKHQ.cjs +0 -17
  556. package/dist/chunk-VQTCQKHQ.cjs.map +0 -1
  557. package/dist/chunk-WGWSHJ2N.js +0 -38
  558. package/dist/chunk-WGWSHJ2N.js.map +0 -1
  559. package/dist/chunk-WJH6IYU2.cjs +0 -32
  560. package/dist/chunk-WJH6IYU2.cjs.map +0 -1
  561. package/dist/chunk-YREV3LGG.cjs +0 -61
  562. package/dist/chunk-YREV3LGG.cjs.map +0 -1
  563. package/dist/chunk-YTXEZ4SD.cjs +0 -77
  564. package/dist/chunk-YTXEZ4SD.cjs.map +0 -1
  565. package/dist/chunk-YWCESU4Y.js +0 -1233
  566. package/dist/chunk-YWCESU4Y.js.map +0 -1
  567. package/dist/chunk-Z6HRSM2Y.cjs +0 -799
  568. package/dist/chunk-Z6HRSM2Y.cjs.map +0 -1
  569. package/dist/chunk-Z7PW3KHL.cjs +0 -1198
  570. package/dist/chunk-Z7PW3KHL.cjs.map +0 -1
  571. package/dist/chunk-ZNMBW67B.cjs +0 -40
  572. package/dist/chunk-ZNMBW67B.cjs.map +0 -1
  573. package/dist/correlation-id.cjs.map +0 -1
  574. package/dist/correlation-id.js.map +0 -1
  575. package/dist/event-subscriber.cjs.map +0 -1
  576. package/dist/event-subscriber.js.map +0 -1
  577. package/dist/event.cjs.map +0 -1
  578. package/dist/event.js.map +0 -1
  579. package/dist/exporters.cjs.map +0 -1
  580. package/dist/exporters.js.map +0 -1
  581. package/dist/functional.cjs.map +0 -1
  582. package/dist/functional.js.map +0 -1
  583. package/dist/init-DIowiiCh.d.ts +0 -1167
  584. package/dist/init-j-A1zI16.d.cts +0 -1167
  585. package/dist/processors.cjs.map +0 -1
  586. package/dist/processors.js.map +0 -1
  587. package/dist/trace-context-DbGKd1Rn.d.cts +0 -213
  588. package/dist/trace-context-DbGKd1Rn.d.ts +0 -213
  589. package/dist/utils-BahBCFtJ.d.cts +0 -712
  590. package/dist/utils-CLKwaUlG.d.ts +0 -712
  591. package/dist/yaml-config.cjs.map +0 -1
@@ -1,38 +1,760 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_sampling = require('./sampling.cjs');
3
+ const require_functional = require('./functional-C4CzoVrX.cjs');
4
+ const require_correlated_events = require('./correlated-events-kSwLo3mi.cjs');
5
+ let _opentelemetry_api = require("@opentelemetry/api");
2
6
 
3
- var chunkZ6HRSM2Y_cjs = require('./chunk-Z6HRSM2Y.cjs');
4
- require('./chunk-4P6ZOARG.cjs');
5
- require('./chunk-FGNDN2FD.cjs');
6
- require('./chunk-OPPXYVEZ.cjs');
7
- require('./chunk-VQTCQKHQ.cjs');
8
- require('./chunk-Z7PW3KHL.cjs');
9
- require('./chunk-R7QYGZUP.cjs');
10
- require('./chunk-QWW3E3JM.cjs');
11
- require('./chunk-CEAQK2QY.cjs');
12
- require('./chunk-ZNMBW67B.cjs');
13
- require('./chunk-IOYFAFHJ.cjs');
14
- require('./chunk-NEIB3TLD.cjs');
15
- require('./chunk-CU6IDACR.cjs');
16
- require('./chunk-6S5RUKU3.cjs');
17
- require('./chunk-NVAI5CCN.cjs');
18
- require('./chunk-VH77IPJN.cjs');
19
- require('./chunk-FU6R566Y.cjs');
20
- require('./chunk-ESLWRGAG.cjs');
21
- require('./chunk-YREV3LGG.cjs');
7
+ //#region src/messaging.ts
8
+ /**
9
+ * Messaging helpers for event-driven architectures
10
+ *
11
+ * Provides specialized tracing for message producers and consumers
12
+ * with automatic context propagation, link extraction, and OTel
13
+ * semantic convention compliance.
14
+ *
15
+ * @example Producer
16
+ * ```typescript
17
+ * import { traceProducer } from 'autotel/messaging';
18
+ *
19
+ * export const publishEvent = traceProducer({
20
+ * system: 'kafka',
21
+ * destination: 'user-events',
22
+ * })(ctx => async (event: UserEvent) => {
23
+ * const headers = ctx.getTraceHeaders();
24
+ * await producer.send({
25
+ * topic: 'user-events',
26
+ * messages: [{ value: JSON.stringify(event), headers }]
27
+ * });
28
+ * });
29
+ * ```
30
+ *
31
+ * @example Consumer
32
+ * ```typescript
33
+ * import { traceConsumer } from 'autotel/messaging';
34
+ *
35
+ * export const processEvents = traceConsumer({
36
+ * system: 'kafka',
37
+ * destination: 'user-events',
38
+ * consumerGroup: 'event-processor',
39
+ * batchMode: true,
40
+ * })(ctx => async (messages: KafkaMessage[]) => {
41
+ * // Links to producer spans are automatically extracted
42
+ * for (const msg of messages) {
43
+ * await processMessage(msg);
44
+ * }
45
+ * });
46
+ * ```
47
+ *
48
+ * @module
49
+ */
50
+ /**
51
+ * Create a traced message producer function
52
+ *
53
+ * Sets SpanKind.PRODUCER, OTel messaging semantic attributes,
54
+ * and provides context injection helpers.
55
+ *
56
+ * @param config - Producer configuration
57
+ * @returns Factory function that wraps your producer logic
58
+ *
59
+ * @example Kafka producer
60
+ * ```typescript
61
+ * export const publishUserEvent = traceProducer({
62
+ * system: 'kafka',
63
+ * destination: 'user-events',
64
+ * messageIdFrom: (args) => args[0]?.eventId,
65
+ * })(ctx => async (event: UserEvent) => {
66
+ * const headers = ctx.getTraceHeaders();
67
+ * await producer.send({
68
+ * topic: 'user-events',
69
+ * messages: [{
70
+ * key: event.userId,
71
+ * value: JSON.stringify(event),
72
+ * headers,
73
+ * }]
74
+ * });
75
+ * });
76
+ * ```
77
+ *
78
+ * @example SQS producer
79
+ * ```typescript
80
+ * export const sendToSQS = traceProducer({
81
+ * system: 'sqs',
82
+ * destination: 'orders-queue',
83
+ * })(ctx => async (order: Order) => {
84
+ * const headers = ctx.getAllPropagationHeaders();
85
+ * await sqs.sendMessage({
86
+ * QueueUrl: QUEUE_URL,
87
+ * MessageBody: JSON.stringify(order),
88
+ * MessageAttributes: headersToSQSAttributes(headers),
89
+ * });
90
+ * });
91
+ * ```
92
+ */
93
+ function traceProducer(config) {
94
+ const spanName = `${config.system}.publish ${config.destination}`;
95
+ return (fnFactory) => {
96
+ return require_functional.trace({
97
+ name: spanName,
98
+ spanKind: _opentelemetry_api.SpanKind.PRODUCER
99
+ }, (baseCtx) => {
100
+ const ctx = extendContextForProducer(baseCtx, config);
101
+ setProducerAttributes(ctx, config);
102
+ return (...args) => {
103
+ setDynamicProducerAttributes(ctx, config, args);
104
+ if (config.customAttributes) {
105
+ const customAttrs = config.customAttributes(ctx, args);
106
+ for (const [key, value] of Object.entries(customAttrs)) if (value !== void 0 && value !== null) ctx.setAttribute(key, value);
107
+ }
108
+ if (config.beforeSend) config.beforeSend(ctx, args);
109
+ return fnFactory(ctx)(...args).catch((error) => {
110
+ if (config.onError) config.onError(error, ctx);
111
+ throw error;
112
+ });
113
+ };
114
+ });
115
+ };
116
+ }
117
+ /**
118
+ * Create a traced message consumer function
119
+ *
120
+ * Sets SpanKind.CONSUMER, OTel messaging semantic attributes,
121
+ * automatically extracts links from producer trace headers,
122
+ * and provides DLQ/retry recording helpers.
123
+ *
124
+ * @param config - Consumer configuration
125
+ * @returns Factory function that wraps your consumer logic
126
+ *
127
+ * @example Kafka consumer (single message)
128
+ * ```typescript
129
+ * export const processUserEvent = traceConsumer({
130
+ * system: 'kafka',
131
+ * destination: 'user-events',
132
+ * consumerGroup: 'event-processor',
133
+ * headersFrom: (msg) => msg.headers,
134
+ * })(ctx => async (message: KafkaMessage) => {
135
+ * // Link to producer span is automatically created
136
+ * const event = JSON.parse(message.value.toString());
137
+ * await processEvent(event);
138
+ * });
139
+ * ```
140
+ *
141
+ * @example Kafka consumer (batch mode)
142
+ * ```typescript
143
+ * export const processUserEventBatch = traceConsumer({
144
+ * system: 'kafka',
145
+ * destination: 'user-events',
146
+ * consumerGroup: 'event-processor',
147
+ * batchMode: true,
148
+ * headersFrom: (msg) => msg.headers,
149
+ * lagMetrics: {
150
+ * getCurrentOffset: (msg) => msg.offset,
151
+ * getEndOffset: () => consumer.getHighWatermark(),
152
+ * getPartition: (msg) => msg.partition,
153
+ * },
154
+ * })(ctx => async (messages: KafkaMessage[]) => {
155
+ * // Links to all producer spans are automatically created
156
+ * for (const msg of messages) {
157
+ * await processEvent(JSON.parse(msg.value.toString()));
158
+ * }
159
+ * });
160
+ * ```
161
+ *
162
+ * @example SQS consumer with DLQ handling
163
+ * ```typescript
164
+ * export const processSQSMessage = traceConsumer({
165
+ * system: 'sqs',
166
+ * destination: 'orders-queue',
167
+ * headersFrom: (msg) => sqsAttributesToHeaders(msg.MessageAttributes),
168
+ * onDLQ: (ctx, reason) => {
169
+ * ctx.recordDLQ(reason, 'orders-dlq');
170
+ * },
171
+ * })(ctx => async (message: SQSMessage) => {
172
+ * try {
173
+ * await processOrder(JSON.parse(message.Body));
174
+ * } catch (error) {
175
+ * if (message.ApproximateReceiveCount > 3) {
176
+ * ctx.recordDLQ(error.message);
177
+ * throw error;
178
+ * }
179
+ * ctx.recordRetry(message.ApproximateReceiveCount, 3);
180
+ * throw error;
181
+ * }
182
+ * });
183
+ * ```
184
+ */
185
+ function traceConsumer(config) {
186
+ const operation = config.batchMode ? "receive" : "process";
187
+ const spanName = `${config.system}.${operation} ${config.destination}`;
188
+ return (fnFactory) => {
189
+ return require_functional.trace({
190
+ name: spanName,
191
+ spanKind: _opentelemetry_api.SpanKind.CONSUMER
192
+ }, (baseCtx) => {
193
+ const linkStorage = { links: [] };
194
+ const orderingState = {
195
+ sequenceNumber: null,
196
+ partitionKey: null,
197
+ messageId: null,
198
+ isDuplicate: false,
199
+ outOfOrderInfo: null
200
+ };
201
+ const groupTracking = config.consumerGroupTracking;
202
+ const ctx = extendContextForConsumer(baseCtx, config, linkStorage, orderingState, {
203
+ memberId: typeof groupTracking?.memberId === "function" ? groupTracking.memberId() ?? null : groupTracking?.memberId ?? null,
204
+ groupInstanceId: typeof groupTracking?.groupInstanceId === "function" ? groupTracking.groupInstanceId() ?? null : groupTracking?.groupInstanceId ?? null,
205
+ assignedPartitions: [],
206
+ generation: null,
207
+ isActive: true,
208
+ lastHeartbeat: null,
209
+ state: null
210
+ });
211
+ setConsumerAttributes(ctx, config);
212
+ return async (...args) => {
213
+ await extractAndAddLinks(ctx, config, args, linkStorage);
214
+ if (config.ordering) extractAndProcessOrdering(ctx, config, args, orderingState);
215
+ if (config.lagMetrics) await extractLagMetrics(ctx, config.lagMetrics, args);
216
+ if (config.customAttributes) {
217
+ const batch = args[0];
218
+ const msg = config.batchMode && Array.isArray(batch) && batch.length > 0 ? batch[0] : batch;
219
+ if (msg !== void 0) {
220
+ const customAttrs = config.customAttributes(ctx, msg);
221
+ for (const [key, value] of Object.entries(customAttrs)) if (value !== void 0 && value !== null) ctx.setAttribute(key, value);
222
+ }
223
+ }
224
+ return fnFactory(ctx)(...args).catch((error) => {
225
+ if (config.onError) config.onError(error, ctx);
226
+ throw error;
227
+ });
228
+ };
229
+ });
230
+ };
231
+ }
232
+ /**
233
+ * Extend base context with producer-specific methods
234
+ */
235
+ function extendContextForProducer(baseCtx, config) {
236
+ const producerCtx = {
237
+ ...baseCtx,
238
+ getTraceHeaders() {
239
+ const headers = {};
240
+ _opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), headers);
241
+ const result = { traceparent: headers["traceparent"] || "" };
242
+ if (headers["tracestate"]) result.tracestate = headers["tracestate"];
243
+ return result;
244
+ },
245
+ getAllPropagationHeaders() {
246
+ const headers = {};
247
+ _opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), headers);
248
+ if (config.propagateBaggage) {
249
+ const baggage = _opentelemetry_api.propagation.getBaggage(_opentelemetry_api.context.active());
250
+ if (baggage) {
251
+ const entries = [];
252
+ for (const [key, value] of baggage.getAllEntries()) entries.push(`${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`);
253
+ if (entries.length > 0) headers["baggage"] = entries.join(",");
254
+ }
255
+ }
256
+ return headers;
257
+ },
258
+ getFullHeaders() {
259
+ const headers = producerCtx.getAllPropagationHeaders();
260
+ if (config.customHeaders) {
261
+ const customHeaders = config.customHeaders(producerCtx);
262
+ Object.assign(headers, customHeaders);
263
+ }
264
+ return headers;
265
+ }
266
+ };
267
+ return producerCtx;
268
+ }
269
+ /**
270
+ * Global sequence tracker for out-of-order detection (per partition)
271
+ */
272
+ const sequenceTrackers = /* @__PURE__ */ new Map();
273
+ /**
274
+ * Global deduplication window (LRU-style using Map insertion order)
275
+ */
276
+ const deduplicationWindow = /* @__PURE__ */ new Map();
277
+ const DEFAULT_DEDUP_WINDOW_SIZE = 1e3;
278
+ /**
279
+ * Clean up old entries from deduplication window
280
+ */
281
+ function trimDeduplicationWindow(maxSize) {
282
+ if (deduplicationWindow.size > maxSize) {
283
+ const excess = deduplicationWindow.size - maxSize;
284
+ const iterator = deduplicationWindow.keys();
285
+ for (let i = 0; i < excess; i++) {
286
+ const key = iterator.next().value;
287
+ if (key) deduplicationWindow.delete(key);
288
+ }
289
+ }
290
+ }
291
+ /**
292
+ * Extend base context with consumer-specific methods
293
+ */
294
+ function extendContextForConsumer(baseCtx, config, linkStorage, orderingState, groupState) {
295
+ const consumerCtx = {
296
+ ...baseCtx,
297
+ recordDLQ(reason, dlqNameOrOptions, optionsParam) {
298
+ let dlqName;
299
+ let options;
300
+ if (typeof dlqNameOrOptions === "string") {
301
+ dlqName = dlqNameOrOptions;
302
+ options = optionsParam;
303
+ } else if (typeof dlqNameOrOptions === "object") options = dlqNameOrOptions;
304
+ const linkToProducer = options?.linkToProducer ?? true;
305
+ baseCtx.setAttribute("messaging.dlq.reason", reason);
306
+ if (dlqName) baseCtx.setAttribute("messaging.dlq.name", dlqName);
307
+ if (options?.reasonCategory) baseCtx.setAttribute("messaging.dlq.reason_category", options.reasonCategory);
308
+ if (options?.attemptCount !== void 0) baseCtx.setAttribute("messaging.dlq.attempt_count", options.attemptCount);
309
+ if (options?.originalError) {
310
+ baseCtx.setAttribute("messaging.dlq.error.type", options.originalError.name);
311
+ baseCtx.setAttribute("messaging.dlq.error.message", options.originalError.message);
312
+ }
313
+ if (options?.metadata) for (const [key, value] of Object.entries(options.metadata)) baseCtx.setAttribute(`messaging.dlq.metadata.${key}`, value);
314
+ const producerLink = linkStorage.links[0];
315
+ if (linkToProducer && producerLink) {
316
+ baseCtx.setAttribute("messaging.dlq.producer_trace_id", producerLink.context.traceId);
317
+ baseCtx.setAttribute("messaging.dlq.producer_span_id", producerLink.context.spanId);
318
+ }
319
+ const eventAttrs = {
320
+ "messaging.dlq.reason": reason,
321
+ ...dlqName && { "messaging.dlq.name": dlqName },
322
+ ...options?.reasonCategory && { "messaging.dlq.reason_category": options.reasonCategory },
323
+ ...options?.attemptCount !== void 0 && { "messaging.dlq.attempt_count": options.attemptCount },
324
+ ...options?.originalError && {
325
+ "messaging.dlq.error.type": options.originalError.name,
326
+ "messaging.dlq.error.message": options.originalError.message
327
+ }
328
+ };
329
+ if (linkToProducer && producerLink) {
330
+ eventAttrs["messaging.dlq.producer_trace_id"] = producerLink.context.traceId;
331
+ eventAttrs["messaging.dlq.producer_span_id"] = producerLink.context.spanId;
332
+ }
333
+ require_correlated_events.emitCorrelatedEvent(baseCtx, "dlq_routed", eventAttrs);
334
+ if (config.onDLQ) config.onDLQ(consumerCtx, reason);
335
+ },
336
+ recordReplay(options) {
337
+ baseCtx.setAttribute("messaging.replay", true);
338
+ if (options?.replayAttempt !== void 0) baseCtx.setAttribute("messaging.replay.attempt", options.replayAttempt);
339
+ if (options?.dlqDwellTimeMs !== void 0) baseCtx.setAttribute("messaging.replay.dwell_time_ms", options.dlqDwellTimeMs);
340
+ if (options?.originalDLQSpanContext) baseCtx.addLinks([{
341
+ context: options.originalDLQSpanContext,
342
+ attributes: { "messaging.link.source": "dlq_replay" }
343
+ }]);
344
+ require_correlated_events.emitCorrelatedEvent(baseCtx, "dlq_replay", {
345
+ "messaging.replay": true,
346
+ ...options?.replayAttempt !== void 0 && { "messaging.replay.attempt": options.replayAttempt },
347
+ ...options?.dlqDwellTimeMs !== void 0 && { "messaging.replay.dwell_time_ms": options.dlqDwellTimeMs }
348
+ });
349
+ },
350
+ recordRetry(attemptNumber, maxAttempts) {
351
+ baseCtx.setAttribute("messaging.retry.count", attemptNumber);
352
+ if (maxAttempts !== void 0) baseCtx.setAttribute("messaging.retry.max_attempts", maxAttempts);
353
+ require_correlated_events.emitCorrelatedEvent(baseCtx, "retry_attempt", {
354
+ "messaging.retry.count": attemptNumber,
355
+ ...maxAttempts !== void 0 && { "messaging.retry.max_attempts": maxAttempts }
356
+ });
357
+ },
358
+ getProducerLinks() {
359
+ return [...linkStorage.links];
360
+ },
361
+ isDuplicate() {
362
+ return orderingState.isDuplicate;
363
+ },
364
+ getOutOfOrderInfo() {
365
+ return orderingState.outOfOrderInfo;
366
+ },
367
+ getSequenceNumber() {
368
+ return orderingState.sequenceNumber;
369
+ },
370
+ getPartitionKey() {
371
+ return orderingState.partitionKey;
372
+ },
373
+ recordRebalance(event) {
374
+ if (event.type === "assigned") {
375
+ groupState.assignedPartitions = event.partitions;
376
+ groupState.isActive = true;
377
+ groupState.state = "stable";
378
+ } else if (event.type === "revoked" || event.type === "lost") {
379
+ const revokedSet = new Set(event.partitions.map((p) => `${p.topic}:${p.partition}`));
380
+ groupState.assignedPartitions = groupState.assignedPartitions.filter((p) => !revokedSet.has(`${p.topic}:${p.partition}`));
381
+ if (event.type === "lost") {
382
+ groupState.isActive = false;
383
+ groupState.state = "dead";
384
+ } else groupState.state = groupState.assignedPartitions.length === 0 ? "empty" : "preparing_rebalance";
385
+ }
386
+ if (event.generation !== void 0) groupState.generation = event.generation;
387
+ if (event.memberId) groupState.memberId = event.memberId;
388
+ baseCtx.setAttribute("messaging.consumer_group.rebalance.type", event.type);
389
+ baseCtx.setAttribute("messaging.consumer_group.rebalance.partition_count", event.partitions.length);
390
+ if (event.generation !== void 0) baseCtx.setAttribute("messaging.consumer_group.generation", event.generation);
391
+ if (event.memberId) baseCtx.setAttribute("messaging.consumer_group.member_id", event.memberId);
392
+ if (event.reason) baseCtx.setAttribute("messaging.consumer_group.rebalance.reason", event.reason);
393
+ if (groupState.state) baseCtx.setAttribute("messaging.consumer_group.state", groupState.state);
394
+ const eventAttrs = {
395
+ "messaging.consumer_group.rebalance.type": event.type,
396
+ "messaging.consumer_group.rebalance.partition_count": event.partitions.length,
397
+ "messaging.consumer_group.rebalance.timestamp": event.timestamp,
398
+ ...event.generation !== void 0 && { "messaging.consumer_group.generation": event.generation },
399
+ ...event.memberId && { "messaging.consumer_group.member_id": event.memberId },
400
+ ...event.reason && { "messaging.consumer_group.rebalance.reason": event.reason },
401
+ ...groupState.state && { "messaging.consumer_group.state": groupState.state }
402
+ };
403
+ if (event.partitions.length <= 10) eventAttrs["messaging.consumer_group.rebalance.partitions"] = event.partitions.map((p) => `${p.topic}:${p.partition}`).join(",");
404
+ require_correlated_events.emitCorrelatedEvent(baseCtx, `consumer_group_${event.type}`, eventAttrs);
405
+ if (config.consumerGroupTracking?.onRebalance) config.consumerGroupTracking.onRebalance(consumerCtx, event);
406
+ if (event.type === "assigned" && config.consumerGroupTracking?.onPartitionsAssigned) config.consumerGroupTracking.onPartitionsAssigned(consumerCtx, event.partitions);
407
+ if (event.type === "revoked" && config.consumerGroupTracking?.onPartitionsRevoked) config.consumerGroupTracking.onPartitionsRevoked(consumerCtx, event.partitions);
408
+ },
409
+ recordHeartbeat(healthy, latencyMs) {
410
+ groupState.lastHeartbeat = Date.now();
411
+ baseCtx.setAttribute("messaging.consumer_group.heartbeat.healthy", healthy);
412
+ if (latencyMs !== void 0) baseCtx.setAttribute("messaging.consumer_group.heartbeat.latency_ms", latencyMs);
413
+ require_correlated_events.emitCorrelatedEvent(baseCtx, "consumer_group_heartbeat", {
414
+ "messaging.consumer_group.heartbeat.healthy": healthy,
415
+ "messaging.consumer_group.heartbeat.timestamp": groupState.lastHeartbeat,
416
+ ...latencyMs !== void 0 && { "messaging.consumer_group.heartbeat.latency_ms": latencyMs }
417
+ });
418
+ },
419
+ recordPartitionLag(lag) {
420
+ const prefix = `messaging.consumer_group.lag.${lag.topic}.${lag.partition}`;
421
+ baseCtx.setAttribute(`${prefix}.current_offset`, lag.currentOffset);
422
+ baseCtx.setAttribute(`${prefix}.end_offset`, lag.endOffset);
423
+ baseCtx.setAttribute(`${prefix}.lag`, lag.lag);
424
+ require_correlated_events.emitCorrelatedEvent(baseCtx, "partition_lag_recorded", {
425
+ "messaging.consumer_group.lag.topic": lag.topic,
426
+ "messaging.consumer_group.lag.partition": lag.partition,
427
+ "messaging.consumer_group.lag.current_offset": lag.currentOffset,
428
+ "messaging.consumer_group.lag.end_offset": lag.endOffset,
429
+ "messaging.consumer_group.lag.lag": lag.lag,
430
+ "messaging.consumer_group.lag.timestamp": lag.timestamp
431
+ });
432
+ },
433
+ getConsumerGroupState() {
434
+ if (!config.consumerGroup) return null;
435
+ return {
436
+ groupId: config.consumerGroup,
437
+ memberId: groupState.memberId ?? void 0,
438
+ groupInstanceId: groupState.groupInstanceId ?? void 0,
439
+ assignedPartitions: [...groupState.assignedPartitions],
440
+ generation: groupState.generation ?? void 0,
441
+ isActive: groupState.isActive,
442
+ lastHeartbeat: groupState.lastHeartbeat ?? void 0,
443
+ state: groupState.state ?? void 0
444
+ };
445
+ },
446
+ getMemberId() {
447
+ return groupState.memberId;
448
+ },
449
+ getAssignedPartitions() {
450
+ return [...groupState.assignedPartitions];
451
+ }
452
+ };
453
+ return consumerCtx;
454
+ }
455
+ /**
456
+ * Set OTel semantic convention attributes for producer
457
+ */
458
+ function setProducerAttributes(ctx, config) {
459
+ ctx.setAttribute("messaging.system", config.system);
460
+ ctx.setAttribute("messaging.operation", "publish");
461
+ ctx.setAttribute("messaging.destination.name", config.destination);
462
+ if (config.system === "kafka") ctx.setAttribute("messaging.kafka.destination.topic", config.destination);
463
+ if (config.attributes) setCustomAttributes(ctx, config.attributes);
464
+ }
465
+ /**
466
+ * Set dynamic producer attributes from arguments
467
+ */
468
+ function setDynamicProducerAttributes(ctx, config, args) {
469
+ if (config.messageIdFrom) {
470
+ const messageId = extractValue(config.messageIdFrom, args);
471
+ if (messageId !== void 0) ctx.setAttribute("messaging.message.id", String(messageId));
472
+ }
473
+ if (config.partitionFrom) {
474
+ const partition = extractValue(config.partitionFrom, args);
475
+ if (partition !== void 0) ctx.setAttribute("messaging.kafka.destination.partition", Number(partition));
476
+ }
477
+ if (config.keyFrom) {
478
+ const key = extractValue(config.keyFrom, args);
479
+ if (key !== void 0) ctx.setAttribute("messaging.kafka.message.key", String(key));
480
+ }
481
+ }
482
+ /**
483
+ * Set OTel semantic convention attributes for consumer
484
+ */
485
+ function setConsumerAttributes(ctx, config) {
486
+ ctx.setAttribute("messaging.system", config.system);
487
+ ctx.setAttribute("messaging.operation", config.batchMode ? "receive" : "process");
488
+ ctx.setAttribute("messaging.destination.name", config.destination);
489
+ if (config.consumerGroup) {
490
+ ctx.setAttribute("messaging.consumer.group", config.consumerGroup);
491
+ if (config.system === "kafka") ctx.setAttribute("messaging.kafka.consumer.group", config.consumerGroup);
492
+ }
493
+ if (config.system === "kafka") ctx.setAttribute("messaging.kafka.destination.topic", config.destination);
494
+ if (config.attributes) setCustomAttributes(ctx, config.attributes);
495
+ }
496
+ /**
497
+ * Extract links from message headers and add to span
498
+ *
499
+ * Uses W3C trace context by default, falls back to customContextExtractor if provided.
500
+ * Also populates linkStorage for getProducerLinks() and DLQ auto-linking.
501
+ */
502
+ async function extractAndAddLinks(ctx, config, args, linkStorage) {
503
+ if (!config.headersFrom && !config.customContextExtractor) return;
504
+ const links = [];
505
+ if (config.batchMode && Array.isArray(args[0])) {
506
+ const messages = args[0];
507
+ if (config.headersFrom) {
508
+ const batchLinks = require_sampling.extractLinksFromBatch(messages.map((msg) => {
509
+ return { headers: extractHeaders(config.headersFrom, msg) };
510
+ }), "headers");
511
+ links.push(...batchLinks);
512
+ }
513
+ if (config.customContextExtractor && config.headersFrom) for (const msg of messages) {
514
+ const headers = extractHeaders(config.headersFrom, msg);
515
+ if (headers) {
516
+ if (!require_sampling.createLinkFromHeaders(headers)) {
517
+ const customContext = config.customContextExtractor(headers);
518
+ if (customContext) links.push({
519
+ context: customContext,
520
+ attributes: { "messaging.link.source": "custom_extractor" }
521
+ });
522
+ }
523
+ }
524
+ }
525
+ ctx.setAttribute("messaging.batch.message_count", messages.length);
526
+ } else {
527
+ const msg = args[0];
528
+ const headers = config.headersFrom ? extractHeaders(config.headersFrom, msg) : void 0;
529
+ if (headers) {
530
+ const w3cLink = require_sampling.createLinkFromHeaders(headers);
531
+ if (w3cLink) links.push(w3cLink);
532
+ else if (config.customContextExtractor) {
533
+ const customContext = config.customContextExtractor(headers);
534
+ if (customContext) links.push({
535
+ context: customContext,
536
+ attributes: { "messaging.link.source": "custom_extractor" }
537
+ });
538
+ }
539
+ }
540
+ }
541
+ if (links.length > 0) {
542
+ ctx.addLinks(links);
543
+ linkStorage.links.push(...links);
544
+ }
545
+ }
546
+ /**
547
+ * Extract lag metrics and set as span attributes
548
+ */
549
+ async function extractLagMetrics(ctx, lagConfig, args) {
550
+ const msg = Array.isArray(args[0]) ? args[0][0] : args[0];
551
+ let currentOffset;
552
+ if (lagConfig.getCurrentOffset && msg) {
553
+ currentOffset = lagConfig.getCurrentOffset(msg);
554
+ if (currentOffset !== void 0) ctx.setAttribute("messaging.kafka.message.offset", currentOffset);
555
+ }
556
+ if (lagConfig.getPartition && msg) {
557
+ const partition = lagConfig.getPartition(msg);
558
+ if (partition !== void 0) ctx.setAttribute("messaging.kafka.partition", partition);
559
+ }
560
+ if (lagConfig.getEndOffset) try {
561
+ const endOffset = await Promise.resolve(lagConfig.getEndOffset());
562
+ if (endOffset !== void 0 && currentOffset !== void 0) {
563
+ const lag = endOffset - currentOffset;
564
+ ctx.setAttribute("messaging.kafka.consumer_lag", lag);
565
+ require_correlated_events.emitCorrelatedEvent(ctx, "consumer_lag_measured", {
566
+ "messaging.kafka.consumer_lag": lag,
567
+ "messaging.kafka.message.offset": currentOffset,
568
+ "messaging.kafka.high_watermark": endOffset
569
+ });
570
+ }
571
+ } catch {}
572
+ if (lagConfig.getCommittedOffset) try {
573
+ const committedOffset = await Promise.resolve(lagConfig.getCommittedOffset());
574
+ if (committedOffset !== void 0) ctx.setAttribute("messaging.kafka.committed_offset", committedOffset);
575
+ } catch {}
576
+ if (Array.isArray(args[0]) && args[0].length > 0) {
577
+ const messages = args[0];
578
+ if (lagConfig.getCurrentOffset) {
579
+ const firstOffset = lagConfig.getCurrentOffset(messages[0]);
580
+ const lastMessage = messages.at(-1);
581
+ const lastOffset = lastMessage === void 0 ? void 0 : lagConfig.getCurrentOffset(lastMessage);
582
+ if (firstOffset !== void 0) ctx.setAttribute("messaging.batch.first_offset", firstOffset);
583
+ if (lastOffset !== void 0) ctx.setAttribute("messaging.batch.last_offset", lastOffset);
584
+ }
585
+ }
586
+ }
587
+ /**
588
+ * Extract headers from message using config
589
+ */
590
+ function extractHeaders(headersFrom, msg) {
591
+ if (typeof headersFrom === "function") return headersFrom(msg);
592
+ if (typeof msg === "object" && msg !== null) {
593
+ const value = msg[headersFrom];
594
+ if (typeof value === "object" && value !== null) return value;
595
+ }
596
+ }
597
+ /**
598
+ * Extract value from arguments using config
599
+ */
600
+ function extractValue(extractor, args) {
601
+ if (typeof extractor === "function") return extractor(args);
602
+ const firstArg = args[0];
603
+ if (typeof firstArg === "object" && firstArg !== null) return firstArg[extractor];
604
+ }
605
+ /**
606
+ * Set custom attributes on context, handling non-primitive values
607
+ */
608
+ function setCustomAttributes(ctx, attributes) {
609
+ for (const [key, value] of Object.entries(attributes)) if (value !== void 0 && value !== null) if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") ctx.setAttribute(key, value);
610
+ else if (Array.isArray(value)) {
611
+ const cleanArray = value.filter((v) => v !== null && v !== void 0 && (typeof v === "string" || typeof v === "number" || typeof v === "boolean"));
612
+ if (cleanArray.length > 0) ctx.setAttribute(key, cleanArray);
613
+ } else ctx.setAttribute(key, JSON.stringify(value));
614
+ }
615
+ /**
616
+ * Extract and process ordering information from message
617
+ *
618
+ * Handles:
619
+ * - Sequence number extraction and tracking
620
+ * - Out-of-order detection
621
+ * - Duplicate detection
622
+ * - Span attribute setting
623
+ * - Callback invocation
624
+ */
625
+ function extractAndProcessOrdering(ctx, config, args, orderingState) {
626
+ const ordering = config.ordering;
627
+ if (!ordering) return;
628
+ const messages = config.batchMode && Array.isArray(args[0]) ? args[0] : [args[0]];
629
+ if (messages.length === 0) return;
630
+ let outOfOrderCount = 0;
631
+ let duplicateCount = 0;
632
+ let lastSequence = null;
633
+ let lastPartitionKey = null;
634
+ let lastMessageId = null;
635
+ for (const [i, msg] of messages.entries()) {
636
+ if (!msg) continue;
637
+ let msgSequence = null;
638
+ let msgPartitionKey = null;
639
+ let msgId = null;
640
+ if (ordering.sequenceFrom) {
641
+ const seq = ordering.sequenceFrom(msg);
642
+ if (seq !== void 0) {
643
+ msgSequence = seq;
644
+ lastSequence = seq;
645
+ }
646
+ }
647
+ if (ordering.partitionKeyFrom) {
648
+ const key = ordering.partitionKeyFrom(msg);
649
+ if (key !== void 0) {
650
+ msgPartitionKey = key;
651
+ lastPartitionKey = key;
652
+ }
653
+ }
654
+ if (ordering.messageIdFrom) {
655
+ const id = ordering.messageIdFrom(msg);
656
+ if (id !== void 0) {
657
+ msgId = id;
658
+ lastMessageId = id;
659
+ }
660
+ }
661
+ if (ordering.detectOutOfOrder && msgSequence !== null) {
662
+ const trackerKey = buildTrackerKey(config, {
663
+ sequenceNumber: msgSequence,
664
+ partitionKey: msgPartitionKey,
665
+ messageId: msgId,
666
+ isDuplicate: false,
667
+ outOfOrderInfo: null
668
+ });
669
+ const prevSequence = sequenceTrackers.get(trackerKey);
670
+ if (prevSequence !== void 0) {
671
+ const expectedSequence = prevSequence + 1;
672
+ if (msgSequence !== expectedSequence) {
673
+ outOfOrderCount++;
674
+ const gap = msgSequence - expectedSequence;
675
+ const outOfOrderInfo = {
676
+ currentSequence: msgSequence,
677
+ expectedSequence,
678
+ partitionKey: msgPartitionKey ?? void 0,
679
+ gap
680
+ };
681
+ if (!orderingState.outOfOrderInfo) orderingState.outOfOrderInfo = outOfOrderInfo;
682
+ require_correlated_events.emitCorrelatedEvent(ctx, "message_out_of_order", {
683
+ "messaging.ordering.batch_index": i,
684
+ "messaging.ordering.current_sequence": msgSequence,
685
+ "messaging.ordering.expected_sequence": expectedSequence,
686
+ "messaging.ordering.gap": gap,
687
+ ...msgPartitionKey && { "messaging.ordering.partition_key": msgPartitionKey }
688
+ });
689
+ if (ordering.onOutOfOrder) ordering.onOutOfOrder(ctx, outOfOrderInfo);
690
+ }
691
+ }
692
+ sequenceTrackers.set(trackerKey, msgSequence);
693
+ }
694
+ if (ordering.detectDuplicates && msgId !== null) {
695
+ const dedupKey = buildDedupKey(config, {
696
+ sequenceNumber: msgSequence,
697
+ partitionKey: msgPartitionKey,
698
+ messageId: msgId,
699
+ isDuplicate: false,
700
+ outOfOrderInfo: null
701
+ });
702
+ if (deduplicationWindow.has(dedupKey)) {
703
+ duplicateCount++;
704
+ require_correlated_events.emitCorrelatedEvent(ctx, "message_duplicate", {
705
+ "messaging.ordering.batch_index": i,
706
+ "messaging.message.id": msgId
707
+ });
708
+ if (ordering.onDuplicate) ordering.onDuplicate(ctx, msgId);
709
+ } else {
710
+ deduplicationWindow.set(dedupKey, Date.now());
711
+ trimDeduplicationWindow(ordering.deduplicationWindowSize ?? DEFAULT_DEDUP_WINDOW_SIZE);
712
+ }
713
+ }
714
+ }
715
+ orderingState.sequenceNumber = lastSequence;
716
+ orderingState.partitionKey = lastPartitionKey;
717
+ orderingState.messageId = lastMessageId;
718
+ orderingState.isDuplicate = duplicateCount > 0;
719
+ if (lastSequence !== null) ctx.setAttribute("messaging.message.sequence_number", lastSequence);
720
+ if (lastPartitionKey !== null) ctx.setAttribute("messaging.message.partition_key", lastPartitionKey);
721
+ if (lastMessageId !== null) ctx.setAttribute("messaging.message.id", lastMessageId);
722
+ if (outOfOrderCount > 0) {
723
+ ctx.setAttribute("messaging.ordering.out_of_order", true);
724
+ ctx.setAttribute("messaging.ordering.out_of_order_count", outOfOrderCount);
725
+ }
726
+ if (duplicateCount > 0) {
727
+ ctx.setAttribute("messaging.ordering.duplicate", true);
728
+ ctx.setAttribute("messaging.ordering.duplicate_count", duplicateCount);
729
+ }
730
+ }
731
+ /**
732
+ * Build a unique key for sequence tracking based on system, destination, and partition
733
+ */
734
+ function buildTrackerKey(config, orderingState) {
735
+ const parts = [config.system, config.destination];
736
+ if (orderingState.partitionKey) parts.push(orderingState.partitionKey);
737
+ if (config.consumerGroup) parts.push(config.consumerGroup);
738
+ return parts.join(":");
739
+ }
740
+ /**
741
+ * Build a unique key for deduplication based on system, destination, and message ID
742
+ */
743
+ function buildDedupKey(config, orderingState) {
744
+ const parts = [config.system, config.destination];
745
+ if (orderingState.messageId) parts.push(orderingState.messageId);
746
+ return parts.join(":");
747
+ }
748
+ /**
749
+ * Clear sequence tracking state (useful for testing)
750
+ */
751
+ function clearOrderingState() {
752
+ sequenceTrackers.clear();
753
+ deduplicationWindow.clear();
754
+ }
22
755
 
23
-
24
-
25
- Object.defineProperty(exports, "clearOrderingState", {
26
- enumerable: true,
27
- get: function () { return chunkZ6HRSM2Y_cjs.clearOrderingState; }
28
- });
29
- Object.defineProperty(exports, "traceConsumer", {
30
- enumerable: true,
31
- get: function () { return chunkZ6HRSM2Y_cjs.traceConsumer; }
32
- });
33
- Object.defineProperty(exports, "traceProducer", {
34
- enumerable: true,
35
- get: function () { return chunkZ6HRSM2Y_cjs.traceProducer; }
36
- });
37
- //# sourceMappingURL=messaging.cjs.map
756
+ //#endregion
757
+ exports.clearOrderingState = clearOrderingState;
758
+ exports.traceConsumer = traceConsumer;
759
+ exports.traceProducer = traceProducer;
38
760
  //# sourceMappingURL=messaging.cjs.map