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