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,1075 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkQWW3E3JM_cjs = require('./chunk-QWW3E3JM.cjs');
4
- var chunkCEAQK2QY_cjs = require('./chunk-CEAQK2QY.cjs');
5
- var chunkZNMBW67B_cjs = require('./chunk-ZNMBW67B.cjs');
6
- var chunkIOYFAFHJ_cjs = require('./chunk-IOYFAFHJ.cjs');
7
- var chunkNEIB3TLD_cjs = require('./chunk-NEIB3TLD.cjs');
8
- var chunkCU6IDACR_cjs = require('./chunk-CU6IDACR.cjs');
9
- var chunk6S5RUKU3_cjs = require('./chunk-6S5RUKU3.cjs');
10
- var chunkNVAI5CCN_cjs = require('./chunk-NVAI5CCN.cjs');
11
- var chunkVH77IPJN_cjs = require('./chunk-VH77IPJN.cjs');
12
- var api = require('@opentelemetry/api');
13
- var sdkNode = require('@opentelemetry/sdk-node');
14
- var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
15
- var resources = require('@opentelemetry/resources');
16
- var semanticConventions = require('@opentelemetry/semantic-conventions');
17
- var sdkMetrics = require('@opentelemetry/sdk-metrics');
18
- var exporterMetricsOtlpHttp = require('@opentelemetry/exporter-metrics-otlp-http');
19
- var exporterTraceOtlpHttp = require('@opentelemetry/exporter-trace-otlp-http');
20
- var exporterLogsOtlpHttp = require('@opentelemetry/exporter-logs-otlp-http');
21
- var sdkLogs = require('@opentelemetry/sdk-logs');
22
-
23
- var BaggageSpanProcessor = class {
24
- prefix;
25
- constructor(options = {}) {
26
- this.prefix = options.prefix ?? "baggage.";
27
- }
28
- onStart(span, parentContext) {
29
- let baggage = api.propagation.getBaggage(parentContext);
30
- if (!baggage) {
31
- baggage = api.propagation.getBaggage(api.context.active());
32
- }
33
- if (!baggage) {
34
- try {
35
- const { getActiveContextWithBaggage } = chunkNVAI5CCN_cjs.requireModule("./trace-context");
36
- const storedContext = getActiveContextWithBaggage();
37
- baggage = api.propagation.getBaggage(storedContext);
38
- } catch {
39
- }
40
- }
41
- if (!baggage) return;
42
- for (const [key, entry] of baggage.getAllEntries()) {
43
- span.setAttribute(`${this.prefix}${key}`, entry.value);
44
- }
45
- }
46
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
- onEnd(_span) {
48
- }
49
- async shutdown() {
50
- }
51
- async forceFlush() {
52
- }
53
- };
54
-
55
- // src/redact-values.ts
56
- function createStringRedactor(config2) {
57
- const resolved = typeof config2 === "string" ? chunkNEIB3TLD_cjs.REDACTOR_PRESETS[config2] : config2;
58
- const valuePatterns = resolved.valuePatterns ?? [];
59
- const defaultReplacement = resolved.replacement ?? "[REDACTED]";
60
- return (value) => {
61
- let result = value;
62
- for (const { pattern, replacement, mask } of valuePatterns) {
63
- pattern.lastIndex = 0;
64
- if (mask) {
65
- result = result.replaceAll(pattern, (match) => mask(match));
66
- } else {
67
- result = result.replaceAll(pattern, replacement ?? defaultReplacement);
68
- }
69
- }
70
- return result;
71
- };
72
- }
73
-
74
- // src/posthog-logs.ts
75
- var RedactingLogRecordProcessor = class {
76
- constructor(wrapped, redact) {
77
- this.wrapped = wrapped;
78
- this.redact = redact;
79
- }
80
- wrapped;
81
- redact;
82
- onEmit(logRecord, context) {
83
- if (logRecord.body && typeof logRecord.body === "string") {
84
- logRecord.body = this.redact(logRecord.body);
85
- }
86
- if (logRecord.attributes) {
87
- for (const [key, value] of Object.entries(logRecord.attributes)) {
88
- if (typeof value === "string") {
89
- logRecord.attributes[key] = this.redact(value);
90
- } else if (Array.isArray(value)) {
91
- logRecord.attributes[key] = value.map(
92
- (item) => typeof item === "string" ? this.redact(item) : item
93
- );
94
- }
95
- }
96
- }
97
- this.wrapped.onEmit(logRecord, context);
98
- }
99
- shutdown() {
100
- return this.wrapped.shutdown();
101
- }
102
- forceFlush() {
103
- return this.wrapped.forceFlush();
104
- }
105
- };
106
- function buildPostHogLogProcessors(config2, stringRedactor) {
107
- const url = config2?.url || process.env.POSTHOG_LOGS_URL;
108
- if (!url) return [];
109
- const sdkLogs = chunkNVAI5CCN_cjs.safeRequire("@opentelemetry/sdk-logs");
110
- const exporterModule = chunkNVAI5CCN_cjs.safeRequire("@opentelemetry/exporter-logs-otlp-http");
111
- if (!sdkLogs || !exporterModule) return [];
112
- const exporter = new exporterModule.OTLPLogExporter({ url });
113
- let processor = new sdkLogs.BatchLogRecordProcessor(
114
- exporter
115
- );
116
- if (stringRedactor) {
117
- processor = new RedactingLogRecordProcessor(processor, stringRedactor);
118
- }
119
- return [processor];
120
- }
121
- function isValidUrl(urlString) {
122
- try {
123
- const url = new URL(urlString);
124
- return url.protocol === "http:" || url.protocol === "https:";
125
- } catch {
126
- return false;
127
- }
128
- }
129
- function resolveOtelEnv() {
130
- const env = {};
131
- if (process.env.OTEL_SERVICE_NAME) {
132
- const value = process.env.OTEL_SERVICE_NAME.trim();
133
- if (value) {
134
- env.OTEL_SERVICE_NAME = value;
135
- }
136
- }
137
- if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {
138
- const value = process.env.OTEL_EXPORTER_OTLP_ENDPOINT.trim();
139
- if (value && isValidUrl(value)) {
140
- env.OTEL_EXPORTER_OTLP_ENDPOINT = value;
141
- }
142
- }
143
- if (process.env.OTEL_EXPORTER_OTLP_HEADERS) {
144
- const value = process.env.OTEL_EXPORTER_OTLP_HEADERS.trim();
145
- if (value) {
146
- env.OTEL_EXPORTER_OTLP_HEADERS = value;
147
- }
148
- }
149
- if (process.env.OTEL_RESOURCE_ATTRIBUTES) {
150
- const value = process.env.OTEL_RESOURCE_ATTRIBUTES.trim();
151
- if (value) {
152
- env.OTEL_RESOURCE_ATTRIBUTES = value;
153
- }
154
- }
155
- if (process.env.OTEL_EXPORTER_OTLP_PROTOCOL) {
156
- const value = process.env.OTEL_EXPORTER_OTLP_PROTOCOL.trim().toLowerCase();
157
- if (value === "http" || value === "grpc") {
158
- env.OTEL_EXPORTER_OTLP_PROTOCOL = value;
159
- }
160
- }
161
- if (process.env.OTEL_TRACES_SAMPLER) {
162
- const value = process.env.OTEL_TRACES_SAMPLER.trim();
163
- if (value) {
164
- env.OTEL_TRACES_SAMPLER = value;
165
- }
166
- }
167
- if (process.env.OTEL_TRACES_SAMPLER_ARG) {
168
- const value = process.env.OTEL_TRACES_SAMPLER_ARG.trim();
169
- if (value) {
170
- env.OTEL_TRACES_SAMPLER_ARG = value;
171
- }
172
- }
173
- return env;
174
- }
175
- function parseRatioSamplerArg(samplerName, samplerArg) {
176
- if (samplerArg === void 0) {
177
- return 1;
178
- }
179
- const ratio = Number(samplerArg);
180
- if (!Number.isFinite(ratio) || ratio < 0 || ratio > 1) {
181
- console.error(
182
- `[autotel] Invalid OTEL_TRACES_SAMPLER_ARG="${samplerArg}" for ${samplerName}. Expected a number in [0..1]. Falling back to 1.0.`
183
- );
184
- return 1;
185
- }
186
- return ratio;
187
- }
188
- function warnOnUnusedSamplerArg(samplerName, samplerArg) {
189
- if (samplerArg !== void 0) {
190
- console.error(
191
- `[autotel] OTEL_TRACES_SAMPLER_ARG is not used by OTEL_TRACES_SAMPLER="${samplerName}". Ignoring value "${samplerArg}".`
192
- );
193
- }
194
- }
195
- function createSamplerFromEnv(env) {
196
- const samplerName = env.OTEL_TRACES_SAMPLER;
197
- if (!samplerName) {
198
- return void 0;
199
- }
200
- switch (samplerName) {
201
- case "always_on":
202
- warnOnUnusedSamplerArg(samplerName, env.OTEL_TRACES_SAMPLER_ARG);
203
- return new sdkTraceBase.AlwaysOnSampler();
204
- case "always_off":
205
- warnOnUnusedSamplerArg(samplerName, env.OTEL_TRACES_SAMPLER_ARG);
206
- return new sdkTraceBase.AlwaysOffSampler();
207
- case "traceidratio":
208
- return new sdkTraceBase.TraceIdRatioBasedSampler(
209
- parseRatioSamplerArg(samplerName, env.OTEL_TRACES_SAMPLER_ARG)
210
- );
211
- case "parentbased_always_on":
212
- warnOnUnusedSamplerArg(samplerName, env.OTEL_TRACES_SAMPLER_ARG);
213
- return new sdkTraceBase.ParentBasedSampler({ root: new sdkTraceBase.AlwaysOnSampler() });
214
- case "parentbased_always_off":
215
- warnOnUnusedSamplerArg(samplerName, env.OTEL_TRACES_SAMPLER_ARG);
216
- return new sdkTraceBase.ParentBasedSampler({ root: new sdkTraceBase.AlwaysOffSampler() });
217
- case "parentbased_traceidratio":
218
- return new sdkTraceBase.ParentBasedSampler({
219
- root: new sdkTraceBase.TraceIdRatioBasedSampler(
220
- parseRatioSamplerArg(samplerName, env.OTEL_TRACES_SAMPLER_ARG)
221
- )
222
- });
223
- case "jaeger_remote":
224
- case "parentbased_jaeger_remote":
225
- case "xray":
226
- console.error(
227
- `[autotel] OTEL_TRACES_SAMPLER="${samplerName}" is not supported yet by autotel. Falling back to the next sampler source.`
228
- );
229
- return void 0;
230
- default:
231
- console.error(
232
- `[autotel] Unknown OTEL_TRACES_SAMPLER="${samplerName}". Falling back to the next sampler source.`
233
- );
234
- return void 0;
235
- }
236
- }
237
- function parseResourceAttributes(input) {
238
- if (!input || input.trim() === "") {
239
- return {};
240
- }
241
- const attributes = {};
242
- const pairs = input.split(",");
243
- for (const pair of pairs) {
244
- const trimmedPair = pair.trim();
245
- if (!trimmedPair) continue;
246
- const equalIndex = trimmedPair.indexOf("=");
247
- if (equalIndex === -1) {
248
- continue;
249
- }
250
- const key = trimmedPair.slice(0, equalIndex).trim();
251
- const value = trimmedPair.slice(equalIndex + 1).trim();
252
- if (key && value) {
253
- attributes[key] = value;
254
- }
255
- }
256
- return attributes;
257
- }
258
- function parseOtlpHeaders(input) {
259
- if (!input || input.trim() === "") {
260
- return {};
261
- }
262
- const headers = {};
263
- const pairs = input.split(",");
264
- for (const pair of pairs) {
265
- const trimmedPair = pair.trim();
266
- if (!trimmedPair) continue;
267
- const equalIndex = trimmedPair.indexOf("=");
268
- if (equalIndex === -1) {
269
- continue;
270
- }
271
- const key = trimmedPair.slice(0, equalIndex).trim();
272
- const value = trimmedPair.slice(equalIndex + 1).trim();
273
- if (key && value) {
274
- headers[key] = value;
275
- }
276
- }
277
- return headers;
278
- }
279
- function envToConfig(env) {
280
- const config2 = {};
281
- if (env.OTEL_SERVICE_NAME) {
282
- config2.service = env.OTEL_SERVICE_NAME;
283
- }
284
- if (env.OTEL_EXPORTER_OTLP_ENDPOINT) {
285
- config2.endpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT;
286
- }
287
- if (env.OTEL_EXPORTER_OTLP_PROTOCOL) {
288
- config2.protocol = env.OTEL_EXPORTER_OTLP_PROTOCOL;
289
- }
290
- if (env.OTEL_EXPORTER_OTLP_HEADERS) {
291
- config2.headers = parseOtlpHeaders(env.OTEL_EXPORTER_OTLP_HEADERS);
292
- }
293
- const resourceAttrs = parseResourceAttributes(env.OTEL_RESOURCE_ATTRIBUTES);
294
- if (Object.keys(resourceAttrs).length > 0) {
295
- config2.resourceAttributes = resourceAttrs;
296
- }
297
- const sampler = createSamplerFromEnv(env);
298
- if (sampler) {
299
- config2.otelSampler = sampler;
300
- }
301
- return config2;
302
- }
303
- function resolveConfigFromEnv() {
304
- const env = resolveOtelEnv();
305
- return envToConfig(env);
306
- }
307
-
308
- // src/devtools.ts
309
- var defaultHost = "127.0.0.1";
310
- var defaultPort = 4318;
311
- function resolveDevtoolsConfig(config2) {
312
- if (!config2) {
313
- return {
314
- enabled: false,
315
- endpoint: void 0,
316
- embedded: false,
317
- host: defaultHost,
318
- port: defaultPort,
319
- verbose: false
320
- };
321
- }
322
- if (config2 === true) {
323
- return {
324
- enabled: true,
325
- endpoint: `http://${defaultHost}:${defaultPort}`,
326
- embedded: false,
327
- host: defaultHost,
328
- port: defaultPort,
329
- verbose: false
330
- };
331
- }
332
- const enabled = config2.enabled ?? true;
333
- const host = config2.host ?? defaultHost;
334
- const port = config2.port ?? defaultPort;
335
- const endpoint = config2.endpoint ?? `http://${host}:${port}`;
336
- return {
337
- enabled,
338
- endpoint: enabled ? endpoint : void 0,
339
- embedded: enabled && (config2.embedded ?? false),
340
- host,
341
- port,
342
- verbose: config2.verbose ?? false
343
- };
344
- }
345
-
346
- // src/init.ts
347
- var silentLogger = {
348
- info: () => {
349
- },
350
- warn: () => {
351
- },
352
- error: () => {
353
- },
354
- debug: () => {
355
- }
356
- };
357
- function toOtelSampler(sampler) {
358
- return {
359
- shouldSample(_context, _traceId, spanName, _spanKind, _attributes, links) {
360
- const shouldTrace = sampler.shouldSample({
361
- operationName: spanName,
362
- args: [],
363
- links
364
- });
365
- return {
366
- decision: shouldTrace ? sdkTraceBase.SamplingDecision.RECORD_AND_SAMPLED : sdkTraceBase.SamplingDecision.NOT_RECORD
367
- };
368
- },
369
- toString() {
370
- return `AutotelSamplerAdapter`;
371
- }
372
- };
373
- }
374
- var OTLPTraceExporterGRPC;
375
- var OTLPMetricExporterGRPC;
376
- var OTLPLogExporterGRPC;
377
- function loadGRPCTraceExporter() {
378
- if (OTLPTraceExporterGRPC) return OTLPTraceExporterGRPC;
379
- try {
380
- const grpcModule = chunkNVAI5CCN_cjs.requireModule("@opentelemetry/exporter-trace-otlp-grpc");
381
- OTLPTraceExporterGRPC = grpcModule.OTLPTraceExporter;
382
- return OTLPTraceExporterGRPC;
383
- } catch {
384
- throw new Error(
385
- "gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc"
386
- );
387
- }
388
- }
389
- function loadGRPCMetricExporter() {
390
- if (OTLPMetricExporterGRPC) return OTLPMetricExporterGRPC;
391
- try {
392
- const grpcModule = chunkNVAI5CCN_cjs.requireModule("@opentelemetry/exporter-metrics-otlp-grpc");
393
- OTLPMetricExporterGRPC = grpcModule.OTLPMetricExporter;
394
- return OTLPMetricExporterGRPC;
395
- } catch {
396
- throw new Error(
397
- "gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc"
398
- );
399
- }
400
- }
401
- function createTraceExporter(protocol, config2) {
402
- if (protocol === "grpc") {
403
- const Exporter = loadGRPCTraceExporter();
404
- return new Exporter(config2);
405
- }
406
- return new exporterTraceOtlpHttp.OTLPTraceExporter(config2);
407
- }
408
- function createMetricExporter(protocol, config2) {
409
- if (protocol === "grpc") {
410
- const Exporter = loadGRPCMetricExporter();
411
- return new Exporter(config2);
412
- }
413
- return new exporterMetricsOtlpHttp.OTLPMetricExporter(config2);
414
- }
415
- function loadGRPCLogExporter() {
416
- if (OTLPLogExporterGRPC) return OTLPLogExporterGRPC;
417
- try {
418
- const grpcModule = chunkNVAI5CCN_cjs.requireModule("@opentelemetry/exporter-logs-otlp-grpc");
419
- OTLPLogExporterGRPC = grpcModule.OTLPLogExporter;
420
- return OTLPLogExporterGRPC;
421
- } catch {
422
- throw new Error(
423
- "gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc"
424
- );
425
- }
426
- }
427
- function createLogExporter(protocol, config2) {
428
- if (protocol === "grpc") {
429
- const Exporter = loadGRPCLogExporter();
430
- return new Exporter(config2);
431
- }
432
- return new exporterLogsOtlpHttp.OTLPLogExporter(config2);
433
- }
434
- function resolveProtocol(configProtocol) {
435
- if (configProtocol === "grpc" || configProtocol === "http") {
436
- return configProtocol;
437
- }
438
- const envProtocol = process.env.OTEL_EXPORTER_OTLP_PROTOCOL;
439
- if (envProtocol === "grpc") return "grpc";
440
- if (envProtocol === "http/protobuf" || envProtocol === "http") return "http";
441
- return "http";
442
- }
443
- function formatEndpointUrl(endpoint, signal, protocol) {
444
- if (protocol === "grpc") {
445
- return endpoint.replace(/\/(v1\/)?(traces|metrics|logs)$/, "");
446
- }
447
- if (!endpoint.endsWith(`/v1/${signal}`)) {
448
- return `${endpoint}/v1/${signal}`;
449
- }
450
- return endpoint;
451
- }
452
- var initialized = false;
453
- var locked = false;
454
- var config = null;
455
- var sdk = null;
456
- var warnedOnce = false;
457
- var logger = silentLogger;
458
- var validationConfig = null;
459
- var eventsConfig = null;
460
- var _stringRedactor = null;
461
- var _optionalRequire = chunkNVAI5CCN_cjs.safeRequire;
462
- var _devtoolsClose = null;
463
- var LOG_LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
464
- function lockLogger() {
465
- locked = true;
466
- }
467
- function isLoggerLocked() {
468
- return locked;
469
- }
470
- function createSilentLogger() {
471
- return {
472
- info: () => {
473
- },
474
- warn: () => {
475
- },
476
- error: () => {
477
- },
478
- debug: () => {
479
- }
480
- };
481
- }
482
- function wrapLogger(base, silent, minLevel) {
483
- if (silent) return createSilentLogger();
484
- const threshold = LOG_LEVELS[minLevel];
485
- const wrap = (fn, level) => {
486
- if (LOG_LEVELS[level] < threshold) {
487
- return (() => {
488
- });
489
- }
490
- return ((...args) => fn(...args));
491
- };
492
- return {
493
- debug: wrap(base.debug, "debug"),
494
- info: wrap(base.info, "info"),
495
- warn: wrap(base.warn, "warn"),
496
- error: wrap(base.error, "error")
497
- };
498
- }
499
- function resolveAttributeRedactor(explicit, environment) {
500
- if (explicit === false) return void 0;
501
- if (explicit !== void 0) return explicit;
502
- const flag = process.env.AUTOTEL_REDACT_PII?.trim().toLowerCase();
503
- if (flag) {
504
- if (["off", "false", "0", "none", "disabled"].includes(flag)) {
505
- return void 0;
506
- }
507
- if (flag === "default" || flag === "strict" || flag === "pci-dss") {
508
- return flag;
509
- }
510
- if (["on", "true", "1", "enabled"].includes(flag)) {
511
- return "default";
512
- }
513
- }
514
- return environment === "production" ? "default" : void 0;
515
- }
516
- function detectEnvironmentAttributes() {
517
- const attrs = {};
518
- const commitSha = process.env.COMMIT_SHA || process.env.GITHUB_SHA || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CF_PAGES_COMMIT_SHA || process.env.AWS_CODEPIPELINE_EXECUTION_ID;
519
- if (commitSha) attrs["service.commit.sha"] = commitSha;
520
- const region = process.env.VERCEL_REGION || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || process.env.FLY_REGION || process.env.CF_REGION || process.env.GOOGLE_CLOUD_REGION;
521
- if (region) attrs["service.region"] = region;
522
- const version = process.env.APP_VERSION || process.env.HEROKU_RELEASE_VERSION || process.env.VERCEL_GIT_COMMIT_REF;
523
- if (version) attrs["service.deploy.version"] = version;
524
- return attrs;
525
- }
526
- function resolveMetricsFlag(configFlag = "auto") {
527
- const envFlag = process.env.AUTOTEL_METRICS;
528
- if (envFlag === "on" || envFlag === "true") return true;
529
- if (envFlag === "off" || envFlag === "false") return false;
530
- if (configFlag === true) return true;
531
- if (configFlag === false) return false;
532
- return true;
533
- }
534
- function resolveLogsFlag(configFlag = "auto") {
535
- const envFlag = process.env.AUTOTEL_LOGS;
536
- if (envFlag === "on" || envFlag === "true") return true;
537
- if (envFlag === "off" || envFlag === "false") return false;
538
- if (configFlag === true) return true;
539
- if (configFlag === false) return false;
540
- return false;
541
- }
542
- function resolveDebugFlag(configFlag) {
543
- const envFlag = process.env.AUTOTEL_DEBUG;
544
- if (envFlag === "pretty") return "pretty";
545
- if (envFlag === "true" || envFlag === "1") return true;
546
- if (envFlag === "false" || envFlag === "0") return false;
547
- return configFlag ?? false;
548
- }
549
- function normalizeOtlpHeaders(headers) {
550
- if (!headers) return void 0;
551
- if (typeof headers !== "string") return headers;
552
- const parsed = {};
553
- for (const pair of headers.split(",")) {
554
- const [key, ...valueParts] = pair.split("=");
555
- if (!key || valueParts.length === 0) continue;
556
- parsed[key.trim()] = valueParts.join("=").trim();
557
- }
558
- return parsed;
559
- }
560
- function init(cfg) {
561
- if (locked) {
562
- return;
563
- }
564
- const envConfig = resolveConfigFromEnv();
565
- const yamlConfig = chunkQWW3E3JM_cjs.loadYamlConfig() ?? {};
566
- const mergedConfig = {
567
- ...envConfig,
568
- // Environment variables (lowest priority)
569
- ...yamlConfig,
570
- // YAML file (middle priority)
571
- ...cfg,
572
- // Explicit config (highest priority)
573
- // Deep merge for resourceAttributes
574
- resourceAttributes: {
575
- ...envConfig.resourceAttributes,
576
- ...yamlConfig.resourceAttributes,
577
- ...detectEnvironmentAttributes(),
578
- ...cfg.resourceAttributes
579
- },
580
- // Handle headers merge (can be string or object)
581
- headers: cfg.headers ?? yamlConfig.headers ?? envConfig.headers
582
- };
583
- const resolvedRedactor = resolveAttributeRedactor(
584
- mergedConfig.attributeRedactor,
585
- mergedConfig.environment || process.env.NODE_ENV || "development"
586
- );
587
- if (resolvedRedactor === void 0) {
588
- mergedConfig.attributeRedactor = void 0;
589
- } else {
590
- const normalizedRedactor = chunkNEIB3TLD_cjs.normalizeAttributeRedactorConfig(resolvedRedactor);
591
- if (!normalizedRedactor) {
592
- throw new Error("Invalid attributeRedactor config");
593
- }
594
- mergedConfig.attributeRedactor = normalizedRedactor;
595
- }
596
- const devtoolsConfig = resolveDevtoolsConfig(mergedConfig.devtools);
597
- if (devtoolsConfig.enabled && mergedConfig.logs === void 0) {
598
- mergedConfig.logs = true;
599
- }
600
- const silent = mergedConfig.silent ?? false;
601
- const minLevel = mergedConfig.minLevel ?? "info";
602
- const baseLogger = mergedConfig.logger || silentLogger;
603
- logger = wrapLogger(baseLogger, silent, minLevel);
604
- if (initialized) {
605
- logger.warn(
606
- {},
607
- "[autotel] init() called again - last config wins. This may cause unexpected behavior."
608
- );
609
- }
610
- config = mergedConfig;
611
- validationConfig = mergedConfig.validation || null;
612
- eventsConfig = mergedConfig.events || null;
613
- let endpoint = mergedConfig.endpoint ?? devtoolsConfig.endpoint;
614
- const otlpHeaders = normalizeOtlpHeaders(mergedConfig.headers);
615
- const version = mergedConfig.version || detectVersion();
616
- const environment = mergedConfig.environment || process.env.NODE_ENV || "development";
617
- const metricsEnabled = resolveMetricsFlag(mergedConfig.metrics);
618
- const logsEnabled = resolveLogsFlag(mergedConfig.logs);
619
- if (devtoolsConfig.enabled && devtoolsConfig.embedded) {
620
- const devtoolsModule = _optionalRequire("autotel-devtools");
621
- if (devtoolsModule?.createDevtools) {
622
- const devtoolsInstance = devtoolsModule.createDevtools({
623
- port: devtoolsConfig.port,
624
- host: devtoolsConfig.host,
625
- verbose: devtoolsConfig.verbose
626
- });
627
- _devtoolsClose = devtoolsInstance.close;
628
- endpoint = `http://${devtoolsConfig.host}:${devtoolsInstance.port}`;
629
- logger.info(
630
- {},
631
- `[autotel] autotel-devtools embedded server started at ${endpoint}`
632
- );
633
- } else {
634
- logger.warn(
635
- {},
636
- "[autotel] devtools.embedded requested but autotel-devtools is not installed. Falling back to endpoint-only mode."
637
- );
638
- }
639
- }
640
- const hostname = detectHostname();
641
- let resource = resources.resourceFromAttributes({
642
- [semanticConventions.ATTR_SERVICE_NAME]: mergedConfig.service,
643
- [semanticConventions.ATTR_SERVICE_VERSION]: version,
644
- // Support both old and new OpenTelemetry semantic conventions for environment
645
- "deployment.environment": environment,
646
- // Deprecated but widely supported
647
- "deployment.environment.name": environment
648
- // OTel v1.27.0+ standard
649
- });
650
- if (hostname) {
651
- resource = resource.merge(
652
- resources.resourceFromAttributes({
653
- "host.name": hostname,
654
- // OpenTelemetry standard
655
- "datadog.host.name": hostname
656
- // Datadog-specific, highest priority for Datadog
657
- })
658
- );
659
- }
660
- if (mergedConfig.resource) {
661
- resource = resource.merge(mergedConfig.resource);
662
- }
663
- if (mergedConfig.resourceAttributes) {
664
- resource = resource.merge(
665
- resources.resourceFromAttributes(mergedConfig.resourceAttributes)
666
- );
667
- }
668
- const protocol = resolveProtocol(mergedConfig.protocol);
669
- const configuredSpanProcessors = mergedConfig.spanProcessors && mergedConfig.spanProcessors.length > 0 ? mergedConfig.spanProcessors : mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0;
670
- const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
671
- const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
672
- const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
673
- let spanProcessors = [];
674
- if (configuredSpanProcessors && configuredSpanProcessors.length > 0) {
675
- spanProcessors.push(...configuredSpanProcessors);
676
- } else if (configuredSpanExporters && configuredSpanExporters.length > 0) {
677
- for (const exporter of configuredSpanExporters) {
678
- spanProcessors.push(
679
- new chunkCEAQK2QY_cjs.TailSamplingSpanProcessor(new sdkTraceBase.BatchSpanProcessor(exporter))
680
- );
681
- }
682
- } else if (endpoint) {
683
- const traceExporter = createTraceExporter(protocol, {
684
- url: formatEndpointUrl(endpoint, "traces", protocol),
685
- headers: otlpHeaders
686
- });
687
- spanProcessors.push(
688
- new chunkCEAQK2QY_cjs.TailSamplingSpanProcessor(new sdkTraceBase.BatchSpanProcessor(traceExporter))
689
- );
690
- }
691
- if (mergedConfig.baggage) {
692
- const prefix = typeof mergedConfig.baggage === "string" ? mergedConfig.baggage ? `${mergedConfig.baggage}.` : "" : "baggage.";
693
- spanProcessors.push(new BaggageSpanProcessor({ prefix }));
694
- }
695
- const debugMode = resolveDebugFlag(mergedConfig.debug);
696
- if (debugMode === "pretty") {
697
- spanProcessors.push(new sdkTraceBase.SimpleSpanProcessor(new chunkCU6IDACR_cjs.PrettyConsoleExporter()));
698
- } else if (debugMode === true) {
699
- spanProcessors.push(new sdkTraceBase.SimpleSpanProcessor(new sdkTraceBase.ConsoleSpanExporter()));
700
- }
701
- if (mergedConfig.canonicalLogLines?.enabled) {
702
- const canonicalOptions = {
703
- logger: mergedConfig.canonicalLogLines.logger || mergedConfig.logger,
704
- rootSpansOnly: mergedConfig.canonicalLogLines.rootSpansOnly,
705
- minLevel: mergedConfig.canonicalLogLines.minLevel,
706
- messageFormat: mergedConfig.canonicalLogLines.messageFormat,
707
- includeResourceAttributes: mergedConfig.canonicalLogLines.includeResourceAttributes,
708
- shouldEmit: mergedConfig.canonicalLogLines.shouldEmit,
709
- keep: mergedConfig.canonicalLogLines.keep,
710
- drain: mergedConfig.canonicalLogLines.drain,
711
- onDrainError: mergedConfig.canonicalLogLines.onDrainError,
712
- pretty: mergedConfig.canonicalLogLines.pretty
713
- };
714
- spanProcessors.push(new chunk6S5RUKU3_cjs.CanonicalLogLineProcessor(canonicalOptions));
715
- }
716
- if (mergedConfig.attributeRedactor && spanProcessors.length > 0) {
717
- const redactor = mergedConfig.attributeRedactor;
718
- spanProcessors = spanProcessors.map(
719
- (processor) => new chunkNEIB3TLD_cjs.AttributeRedactingProcessor(processor, {
720
- redactor
721
- })
722
- );
723
- }
724
- if (mergedConfig.attributeRedactor) {
725
- _stringRedactor = createStringRedactor(mergedConfig.attributeRedactor);
726
- }
727
- if (_stringRedactor && mergedConfig.subscribers) {
728
- for (const subscriber of mergedConfig.subscribers) {
729
- if ("setStringRedactor" in subscriber && typeof subscriber.setStringRedactor === "function") {
730
- subscriber.setStringRedactor(_stringRedactor);
731
- }
732
- }
733
- }
734
- if (mergedConfig.spanNameNormalizer && spanProcessors.length > 0) {
735
- spanProcessors = spanProcessors.map(
736
- (processor) => new chunkIOYFAFHJ_cjs.SpanNameNormalizingProcessor(processor, {
737
- normalizer: mergedConfig.spanNameNormalizer
738
- })
739
- );
740
- }
741
- if (mergedConfig.spanFilter && spanProcessors.length > 0) {
742
- spanProcessors = spanProcessors.map(
743
- (processor) => new chunkZNMBW67B_cjs.FilteringSpanProcessor(processor, {
744
- filter: mergedConfig.spanFilter
745
- })
746
- );
747
- }
748
- const metricReaders = [];
749
- if (configuredMetricReaders && configuredMetricReaders.length > 0) {
750
- metricReaders.push(...configuredMetricReaders);
751
- } else if (metricsEnabled && endpoint) {
752
- const metricExporter = createMetricExporter(protocol, {
753
- url: formatEndpointUrl(endpoint, "metrics", protocol),
754
- headers: otlpHeaders
755
- });
756
- metricReaders.push(
757
- new sdkMetrics.PeriodicExportingMetricReader({
758
- exporter: metricExporter
759
- })
760
- );
761
- }
762
- let logRecordProcessors;
763
- if (configuredLogRecordProcessors && configuredLogRecordProcessors.length > 0) {
764
- logRecordProcessors = [...configuredLogRecordProcessors];
765
- }
766
- if (logsEnabled && endpoint) {
767
- const logExporter = createLogExporter(protocol, {
768
- url: formatEndpointUrl(endpoint, "logs", protocol),
769
- headers: otlpHeaders
770
- });
771
- let processor = new sdkLogs.BatchLogRecordProcessor(
772
- logExporter
773
- );
774
- if (_stringRedactor) {
775
- processor = new RedactingLogRecordProcessor(processor, _stringRedactor);
776
- }
777
- if (!logRecordProcessors) {
778
- logRecordProcessors = [];
779
- }
780
- logRecordProcessors.push(processor);
781
- logger.info({}, "[autotel] OTLP log exporter configured");
782
- }
783
- const posthogProcessors = buildPostHogLogProcessors(
784
- mergedConfig.posthog,
785
- _stringRedactor
786
- );
787
- if (posthogProcessors.length > 0) {
788
- if (!logRecordProcessors) {
789
- logRecordProcessors = [];
790
- }
791
- logRecordProcessors.push(...posthogProcessors);
792
- logger.info({}, "[autotel] PostHog OTLP logs configured");
793
- }
794
- let finalInstrumentations = mergedConfig.instrumentations ? [...mergedConfig.instrumentations] : [];
795
- if (mergedConfig.autoInstrumentations !== void 0 && mergedConfig.autoInstrumentations !== false) {
796
- const isESM = isESMMode();
797
- if (isESM) {
798
- logger.info(
799
- {},
800
- "[autotel] ESM mode detected. For auto-instrumentation to work:\n 1. Install @opentelemetry/auto-instrumentations-node as a direct dependency\n 2. Import autotel/register FIRST in your instrumentation file\n 3. Use getNodeAutoInstrumentations() directly instead of autoInstrumentations\n See: https://github.com/jagreehal/autotel#esm-setup"
801
- );
802
- }
803
- try {
804
- const manualInstrumentationNames = getInstrumentationNames(
805
- mergedConfig.instrumentations ?? []
806
- );
807
- if (manualInstrumentationNames.size > 0) {
808
- const manualNames = [...manualInstrumentationNames].join(", ");
809
- logger.info(
810
- {},
811
- `[autotel] Detected manual instrumentations (${manualNames}). These will take precedence over auto-instrumentations. Tip: Set autoInstrumentations:false if you want full manual control, or remove manual configs to use auto-instrumentations.`
812
- );
813
- }
814
- const autoInstrumentations = getAutoInstrumentations(
815
- mergedConfig.autoInstrumentations,
816
- manualInstrumentationNames
817
- );
818
- if (autoInstrumentations && autoInstrumentations.length > 0) {
819
- finalInstrumentations = [
820
- ...finalInstrumentations,
821
- ...autoInstrumentations
822
- ];
823
- }
824
- } catch (error) {
825
- logger.warn(
826
- {},
827
- `[autotel] Failed to configure auto-instrumentations: ${error instanceof Error ? error.message : String(error)}`
828
- );
829
- }
830
- }
831
- const autotelSampler = mergedConfig.sampler ?? (mergedConfig.sampling ? chunkVH77IPJN_cjs.resolveSamplingPreset(mergedConfig.sampling) : void 0);
832
- if (autotelSampler) {
833
- mergedConfig.sampler = autotelSampler;
834
- }
835
- const sampler = autotelSampler ? toOtelSampler(autotelSampler) : envConfig.otelSampler ?? toOtelSampler(chunkVH77IPJN_cjs.samplingPresets.production());
836
- const sdkOptions = {
837
- resource,
838
- sampler,
839
- instrumentations: finalInstrumentations
840
- };
841
- if (spanProcessors.length > 0) {
842
- sdkOptions.spanProcessors = spanProcessors;
843
- }
844
- if (metricReaders.length > 0) {
845
- sdkOptions.metricReaders = metricReaders;
846
- }
847
- if (logRecordProcessors && logRecordProcessors.length > 0) {
848
- sdkOptions.logRecordProcessors = logRecordProcessors;
849
- }
850
- sdk = mergedConfig.sdkFactory ? mergedConfig.sdkFactory(sdkOptions) : new sdkNode.NodeSDK(sdkOptions);
851
- if (!sdk) {
852
- throw new Error("[autotel] sdkFactory must return a NodeSDK instance");
853
- }
854
- sdk.start();
855
- if (mergedConfig.openllmetry?.enabled) {
856
- const traceloop = _optionalRequire("@traceloop/node-server-sdk");
857
- if (traceloop) {
858
- const initOptions = {
859
- ...mergedConfig.openllmetry.options
860
- };
861
- try {
862
- const tracerProvider = sdk.getTracerProvider();
863
- initOptions.tracerProvider = tracerProvider;
864
- } catch {
865
- }
866
- if (configuredSpanExporters?.[0]) {
867
- initOptions.exporter = configuredSpanExporters[0];
868
- }
869
- if (typeof traceloop.initialize === "function") {
870
- traceloop.initialize(initOptions);
871
- logger.info({}, "[autotel] OpenLLMetry initialized successfully");
872
- } else {
873
- logger.warn(
874
- {},
875
- "[autotel] OpenLLMetry initialize function not found. Check @traceloop/node-server-sdk version."
876
- );
877
- }
878
- } else {
879
- logger.warn(
880
- {},
881
- "[autotel] OpenLLMetry enabled but @traceloop/node-server-sdk is not installed. Install it as a peer dependency to use OpenLLMetry integration."
882
- );
883
- }
884
- }
885
- initialized = true;
886
- }
887
- function getInstrumentationNames(instrumentations) {
888
- const names = /* @__PURE__ */ new Set();
889
- if (!instrumentations) return names;
890
- for (const instrumentation of instrumentations) {
891
- if (instrumentation && typeof instrumentation === "object") {
892
- names.add(instrumentation.constructor.name);
893
- }
894
- }
895
- return names;
896
- }
897
- var INSTRUMENTATION_CLASS_TO_PACKAGE = {
898
- HttpInstrumentation: "@opentelemetry/instrumentation-http",
899
- HttpsInstrumentation: "@opentelemetry/instrumentation-http",
900
- ExpressInstrumentation: "@opentelemetry/instrumentation-express",
901
- FastifyInstrumentation: "@opentelemetry/instrumentation-fastify",
902
- MongoDBInstrumentation: "@opentelemetry/instrumentation-mongodb",
903
- MongooseInstrumentation: "@opentelemetry/instrumentation-mongoose",
904
- PrismaInstrumentation: "@opentelemetry/instrumentation-prisma",
905
- PinoInstrumentation: "@opentelemetry/instrumentation-pino",
906
- WinstonInstrumentation: "@opentelemetry/instrumentation-winston",
907
- RedisInstrumentation: "@opentelemetry/instrumentation-redis",
908
- GraphQLInstrumentation: "@opentelemetry/instrumentation-graphql",
909
- GrpcInstrumentation: "@opentelemetry/instrumentation-grpc",
910
- IORedisInstrumentation: "@opentelemetry/instrumentation-ioredis",
911
- KnexInstrumentation: "@opentelemetry/instrumentation-knex",
912
- NestJsInstrumentation: "@opentelemetry/instrumentation-nestjs-core",
913
- PgInstrumentation: "@opentelemetry/instrumentation-pg",
914
- MySQLInstrumentation: "@opentelemetry/instrumentation-mysql",
915
- MySQL2Instrumentation: "@opentelemetry/instrumentation-mysql2"
916
- };
917
- function isESMMode() {
918
- try {
919
- const fs = chunkNVAI5CCN_cjs.requireModule("node:fs");
920
- try {
921
- const pkg = JSON.parse(
922
- fs.readFileSync(`${process.cwd()}/package.json`, "utf8")
923
- );
924
- return pkg.type === "module";
925
- } catch {
926
- return false;
927
- }
928
- } catch {
929
- return false;
930
- }
931
- }
932
- function loadNodeAutoInstrumentations() {
933
- try {
934
- const mod = chunkNVAI5CCN_cjs.requireModule("@opentelemetry/auto-instrumentations-node");
935
- return mod.getNodeAutoInstrumentations;
936
- } catch {
937
- const isESM = isESMMode();
938
- const baseMessage = "@opentelemetry/auto-instrumentations-node not found.";
939
- if (isESM) {
940
- throw new Error(
941
- `${baseMessage}
942
-
943
- ESM Setup Required:
944
- 1. Install as a direct dependency: pnpm add @opentelemetry/auto-instrumentations-node
945
- 2. Create instrumentation.mjs with:
946
- import 'autotel/register'; // MUST be first!
947
- import { init } from 'autotel';
948
- import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
949
- init({ service: "my-app", instrumentations: getNodeAutoInstrumentations() });
950
- 3. Run with: tsx --import ./instrumentation.mjs src/index.ts
951
-
952
- See: https://github.com/jagreehal/autotel#esm-setup`
953
- );
954
- }
955
- throw new Error(
956
- `${baseMessage} Install it: pnpm add @opentelemetry/auto-instrumentations-node`
957
- );
958
- }
959
- }
960
- function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @__PURE__ */ new Set()) {
961
- if (integrations === false) {
962
- return [];
963
- }
964
- const getNodeAutoInstrumentations = loadNodeAutoInstrumentations();
965
- const exclusionConfig = {};
966
- for (const className of manualInstrumentationNames) {
967
- const packageName = INSTRUMENTATION_CLASS_TO_PACKAGE[className];
968
- if (packageName) {
969
- exclusionConfig[packageName] = { enabled: false };
970
- }
971
- }
972
- if (integrations === true) {
973
- if (Object.keys(exclusionConfig).length > 0) {
974
- return getNodeAutoInstrumentations(exclusionConfig);
975
- }
976
- return getNodeAutoInstrumentations();
977
- }
978
- if (Array.isArray(integrations)) {
979
- const config3 = { ...exclusionConfig };
980
- for (const name of integrations) {
981
- const packageName = `@opentelemetry/instrumentation-${name}`;
982
- if (!exclusionConfig[packageName]) {
983
- config3[packageName] = { enabled: true };
984
- }
985
- }
986
- return getNodeAutoInstrumentations(config3);
987
- }
988
- const config2 = {
989
- ...exclusionConfig,
990
- ...integrations
991
- };
992
- for (const packageName of Object.keys(exclusionConfig)) {
993
- const integrationsKey = Object.keys(integrations).find(
994
- (key) => packageName.includes(key)
995
- );
996
- if (integrationsKey) {
997
- config2[packageName] = { enabled: false };
998
- }
999
- }
1000
- return getNodeAutoInstrumentations(config2);
1001
- }
1002
- function isInitialized() {
1003
- return initialized;
1004
- }
1005
- function getConfig() {
1006
- return config;
1007
- }
1008
- function getLogger() {
1009
- return logger;
1010
- }
1011
- function getValidationConfig() {
1012
- return validationConfig;
1013
- }
1014
- function getEventsConfig() {
1015
- return eventsConfig;
1016
- }
1017
- function warnIfNotInitialized(context) {
1018
- if (!initialized && !warnedOnce) {
1019
- logger.warn(
1020
- {},
1021
- `[autotel] ${context} used before init() called. Call init({ service: "..." }) first. See: https://docs.autotel.dev/quickstart`
1022
- );
1023
- warnedOnce = true;
1024
- }
1025
- }
1026
- function detectVersion() {
1027
- try {
1028
- const fs = chunkNVAI5CCN_cjs.requireModule("node:fs");
1029
- const pkg = JSON.parse(
1030
- fs.readFileSync(`${process.cwd()}/package.json`, "utf8")
1031
- );
1032
- return pkg.version || "1.0.0";
1033
- } catch {
1034
- return "1.0.0";
1035
- }
1036
- }
1037
- function detectHostname() {
1038
- if (process.env.DD_HOSTNAME) {
1039
- return process.env.DD_HOSTNAME;
1040
- }
1041
- if (process.env.HOSTNAME) {
1042
- return process.env.HOSTNAME;
1043
- }
1044
- try {
1045
- const os = chunkNVAI5CCN_cjs.requireModule("node:os");
1046
- return os.hostname();
1047
- } catch {
1048
- return void 0;
1049
- }
1050
- }
1051
- async function _closeEmbeddedDevtools() {
1052
- if (_devtoolsClose) {
1053
- await _devtoolsClose();
1054
- _devtoolsClose = null;
1055
- }
1056
- }
1057
- function getSdk() {
1058
- return sdk;
1059
- }
1060
-
1061
- exports.BaggageSpanProcessor = BaggageSpanProcessor;
1062
- exports._closeEmbeddedDevtools = _closeEmbeddedDevtools;
1063
- exports.createStringRedactor = createStringRedactor;
1064
- exports.getConfig = getConfig;
1065
- exports.getEventsConfig = getEventsConfig;
1066
- exports.getLogger = getLogger;
1067
- exports.getSdk = getSdk;
1068
- exports.getValidationConfig = getValidationConfig;
1069
- exports.init = init;
1070
- exports.isInitialized = isInitialized;
1071
- exports.isLoggerLocked = isLoggerLocked;
1072
- exports.lockLogger = lockLogger;
1073
- exports.warnIfNotInitialized = warnIfNotInitialized;
1074
- //# sourceMappingURL=chunk-R7QYGZUP.cjs.map
1075
- //# sourceMappingURL=chunk-R7QYGZUP.cjs.map