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/chunk-D4TM63S3.js
DELETED
|
@@ -1,795 +0,0 @@
|
|
|
1
|
-
import { emitCorrelatedEvent } from './chunk-KIL5CUN6.js';
|
|
2
|
-
import { trace } from './chunk-T7JO2TCP.js';
|
|
3
|
-
import { extractLinksFromBatch, createLinkFromHeaders } from './chunk-DPSA4QLA.js';
|
|
4
|
-
import { SpanKind, propagation, context } from '@opentelemetry/api';
|
|
5
|
-
|
|
6
|
-
function traceProducer(config) {
|
|
7
|
-
const spanName = `${config.system}.publish ${config.destination}`;
|
|
8
|
-
return (fnFactory) => {
|
|
9
|
-
return trace(
|
|
10
|
-
{ name: spanName, spanKind: SpanKind.PRODUCER },
|
|
11
|
-
(baseCtx) => {
|
|
12
|
-
const ctx = extendContextForProducer(baseCtx, config);
|
|
13
|
-
setProducerAttributes(ctx, config);
|
|
14
|
-
return (...args) => {
|
|
15
|
-
setDynamicProducerAttributes(ctx, config, args);
|
|
16
|
-
if (config.customAttributes) {
|
|
17
|
-
const customAttrs = config.customAttributes(ctx, args);
|
|
18
|
-
for (const [key, value] of Object.entries(customAttrs)) {
|
|
19
|
-
if (value !== void 0 && value !== null) {
|
|
20
|
-
ctx.setAttribute(key, value);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (config.beforeSend) {
|
|
25
|
-
config.beforeSend(ctx, args);
|
|
26
|
-
}
|
|
27
|
-
const userFn = fnFactory(ctx);
|
|
28
|
-
return userFn(...args).catch((error) => {
|
|
29
|
-
if (config.onError) {
|
|
30
|
-
config.onError(error, ctx);
|
|
31
|
-
}
|
|
32
|
-
throw error;
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function traceConsumer(config) {
|
|
40
|
-
const operation = config.batchMode ? "receive" : "process";
|
|
41
|
-
const spanName = `${config.system}.${operation} ${config.destination}`;
|
|
42
|
-
return (fnFactory) => {
|
|
43
|
-
return trace(
|
|
44
|
-
{ name: spanName, spanKind: SpanKind.CONSUMER },
|
|
45
|
-
(baseCtx) => {
|
|
46
|
-
const linkStorage = { links: [] };
|
|
47
|
-
const orderingState = {
|
|
48
|
-
sequenceNumber: null,
|
|
49
|
-
partitionKey: null,
|
|
50
|
-
messageId: null,
|
|
51
|
-
isDuplicate: false,
|
|
52
|
-
outOfOrderInfo: null
|
|
53
|
-
};
|
|
54
|
-
const groupTracking = config.consumerGroupTracking;
|
|
55
|
-
const groupState = {
|
|
56
|
-
memberId: typeof groupTracking?.memberId === "function" ? groupTracking.memberId() ?? null : groupTracking?.memberId ?? null,
|
|
57
|
-
groupInstanceId: typeof groupTracking?.groupInstanceId === "function" ? groupTracking.groupInstanceId() ?? null : groupTracking?.groupInstanceId ?? null,
|
|
58
|
-
assignedPartitions: [],
|
|
59
|
-
generation: null,
|
|
60
|
-
isActive: true,
|
|
61
|
-
lastHeartbeat: null,
|
|
62
|
-
state: null
|
|
63
|
-
};
|
|
64
|
-
const ctx = extendContextForConsumer(
|
|
65
|
-
baseCtx,
|
|
66
|
-
config,
|
|
67
|
-
linkStorage,
|
|
68
|
-
orderingState,
|
|
69
|
-
groupState
|
|
70
|
-
);
|
|
71
|
-
setConsumerAttributes(ctx, config);
|
|
72
|
-
return async (...args) => {
|
|
73
|
-
await extractAndAddLinks(ctx, config, args, linkStorage);
|
|
74
|
-
if (config.ordering) {
|
|
75
|
-
extractAndProcessOrdering(ctx, config, args, orderingState);
|
|
76
|
-
}
|
|
77
|
-
if (config.lagMetrics) {
|
|
78
|
-
await extractLagMetrics(ctx, config.lagMetrics, args);
|
|
79
|
-
}
|
|
80
|
-
if (config.customAttributes) {
|
|
81
|
-
const batch = args[0];
|
|
82
|
-
const msg = config.batchMode && Array.isArray(batch) && batch.length > 0 ? batch[0] : batch;
|
|
83
|
-
if (msg !== void 0) {
|
|
84
|
-
const customAttrs = config.customAttributes(ctx, msg);
|
|
85
|
-
for (const [key, value] of Object.entries(customAttrs)) {
|
|
86
|
-
if (value !== void 0 && value !== null) {
|
|
87
|
-
ctx.setAttribute(key, value);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const userFn = fnFactory(ctx);
|
|
93
|
-
return userFn(...args).catch((error) => {
|
|
94
|
-
if (config.onError) {
|
|
95
|
-
config.onError(error, ctx);
|
|
96
|
-
}
|
|
97
|
-
throw error;
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function extendContextForProducer(baseCtx, config) {
|
|
105
|
-
const producerCtx = {
|
|
106
|
-
...baseCtx,
|
|
107
|
-
getTraceHeaders() {
|
|
108
|
-
const headers = {};
|
|
109
|
-
propagation.inject(context.active(), headers);
|
|
110
|
-
const result = {
|
|
111
|
-
traceparent: headers["traceparent"] || ""
|
|
112
|
-
};
|
|
113
|
-
if (headers["tracestate"]) {
|
|
114
|
-
result.tracestate = headers["tracestate"];
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
},
|
|
118
|
-
getAllPropagationHeaders() {
|
|
119
|
-
const headers = {};
|
|
120
|
-
propagation.inject(context.active(), headers);
|
|
121
|
-
if (config.propagateBaggage) {
|
|
122
|
-
const baggage = propagation.getBaggage(context.active());
|
|
123
|
-
if (baggage) {
|
|
124
|
-
const entries = [];
|
|
125
|
-
for (const [key, value] of baggage.getAllEntries()) {
|
|
126
|
-
entries.push(
|
|
127
|
-
`${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
if (entries.length > 0) {
|
|
131
|
-
headers["baggage"] = entries.join(",");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return headers;
|
|
136
|
-
},
|
|
137
|
-
getFullHeaders() {
|
|
138
|
-
const headers = producerCtx.getAllPropagationHeaders();
|
|
139
|
-
if (config.customHeaders) {
|
|
140
|
-
const customHeaders = config.customHeaders(producerCtx);
|
|
141
|
-
Object.assign(headers, customHeaders);
|
|
142
|
-
}
|
|
143
|
-
return headers;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
return producerCtx;
|
|
147
|
-
}
|
|
148
|
-
var sequenceTrackers = /* @__PURE__ */ new Map();
|
|
149
|
-
var deduplicationWindow = /* @__PURE__ */ new Map();
|
|
150
|
-
var DEFAULT_DEDUP_WINDOW_SIZE = 1e3;
|
|
151
|
-
function trimDeduplicationWindow(maxSize) {
|
|
152
|
-
if (deduplicationWindow.size > maxSize) {
|
|
153
|
-
const excess = deduplicationWindow.size - maxSize;
|
|
154
|
-
const iterator = deduplicationWindow.keys();
|
|
155
|
-
for (let i = 0; i < excess; i++) {
|
|
156
|
-
const key = iterator.next().value;
|
|
157
|
-
if (key) deduplicationWindow.delete(key);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function extendContextForConsumer(baseCtx, config, linkStorage, orderingState, groupState) {
|
|
162
|
-
const consumerCtx = {
|
|
163
|
-
...baseCtx,
|
|
164
|
-
recordDLQ(reason, dlqNameOrOptions, optionsParam) {
|
|
165
|
-
let dlqName;
|
|
166
|
-
let options;
|
|
167
|
-
if (typeof dlqNameOrOptions === "string") {
|
|
168
|
-
dlqName = dlqNameOrOptions;
|
|
169
|
-
options = optionsParam;
|
|
170
|
-
} else if (typeof dlqNameOrOptions === "object") {
|
|
171
|
-
options = dlqNameOrOptions;
|
|
172
|
-
}
|
|
173
|
-
const linkToProducer = options?.linkToProducer ?? true;
|
|
174
|
-
baseCtx.setAttribute("messaging.dlq.reason", reason);
|
|
175
|
-
if (dlqName) {
|
|
176
|
-
baseCtx.setAttribute("messaging.dlq.name", dlqName);
|
|
177
|
-
}
|
|
178
|
-
if (options?.reasonCategory) {
|
|
179
|
-
baseCtx.setAttribute(
|
|
180
|
-
"messaging.dlq.reason_category",
|
|
181
|
-
options.reasonCategory
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
if (options?.attemptCount !== void 0) {
|
|
185
|
-
baseCtx.setAttribute(
|
|
186
|
-
"messaging.dlq.attempt_count",
|
|
187
|
-
options.attemptCount
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
if (options?.originalError) {
|
|
191
|
-
baseCtx.setAttribute(
|
|
192
|
-
"messaging.dlq.error.type",
|
|
193
|
-
options.originalError.name
|
|
194
|
-
);
|
|
195
|
-
baseCtx.setAttribute(
|
|
196
|
-
"messaging.dlq.error.message",
|
|
197
|
-
options.originalError.message
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
if (options?.metadata) {
|
|
201
|
-
for (const [key, value] of Object.entries(options.metadata)) {
|
|
202
|
-
baseCtx.setAttribute(`messaging.dlq.metadata.${key}`, value);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const producerLink = linkStorage.links[0];
|
|
206
|
-
if (linkToProducer && producerLink) {
|
|
207
|
-
baseCtx.setAttribute(
|
|
208
|
-
"messaging.dlq.producer_trace_id",
|
|
209
|
-
producerLink.context.traceId
|
|
210
|
-
);
|
|
211
|
-
baseCtx.setAttribute(
|
|
212
|
-
"messaging.dlq.producer_span_id",
|
|
213
|
-
producerLink.context.spanId
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
const eventAttrs = {
|
|
217
|
-
"messaging.dlq.reason": reason,
|
|
218
|
-
...dlqName && { "messaging.dlq.name": dlqName },
|
|
219
|
-
...options?.reasonCategory && {
|
|
220
|
-
"messaging.dlq.reason_category": options.reasonCategory
|
|
221
|
-
},
|
|
222
|
-
...options?.attemptCount !== void 0 && {
|
|
223
|
-
"messaging.dlq.attempt_count": options.attemptCount
|
|
224
|
-
},
|
|
225
|
-
...options?.originalError && {
|
|
226
|
-
"messaging.dlq.error.type": options.originalError.name,
|
|
227
|
-
"messaging.dlq.error.message": options.originalError.message
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
if (linkToProducer && producerLink) {
|
|
231
|
-
eventAttrs["messaging.dlq.producer_trace_id"] = producerLink.context.traceId;
|
|
232
|
-
eventAttrs["messaging.dlq.producer_span_id"] = producerLink.context.spanId;
|
|
233
|
-
}
|
|
234
|
-
emitCorrelatedEvent(baseCtx, "dlq_routed", eventAttrs);
|
|
235
|
-
if (config.onDLQ) {
|
|
236
|
-
config.onDLQ(consumerCtx, reason);
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
recordReplay(options) {
|
|
240
|
-
baseCtx.setAttribute("messaging.replay", true);
|
|
241
|
-
if (options?.replayAttempt !== void 0) {
|
|
242
|
-
baseCtx.setAttribute("messaging.replay.attempt", options.replayAttempt);
|
|
243
|
-
}
|
|
244
|
-
if (options?.dlqDwellTimeMs !== void 0) {
|
|
245
|
-
baseCtx.setAttribute(
|
|
246
|
-
"messaging.replay.dwell_time_ms",
|
|
247
|
-
options.dlqDwellTimeMs
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
if (options?.originalDLQSpanContext) {
|
|
251
|
-
baseCtx.addLinks([
|
|
252
|
-
{
|
|
253
|
-
context: options.originalDLQSpanContext,
|
|
254
|
-
attributes: { "messaging.link.source": "dlq_replay" }
|
|
255
|
-
}
|
|
256
|
-
]);
|
|
257
|
-
}
|
|
258
|
-
const eventAttrs = {
|
|
259
|
-
"messaging.replay": true,
|
|
260
|
-
...options?.replayAttempt !== void 0 && {
|
|
261
|
-
"messaging.replay.attempt": options.replayAttempt
|
|
262
|
-
},
|
|
263
|
-
...options?.dlqDwellTimeMs !== void 0 && {
|
|
264
|
-
"messaging.replay.dwell_time_ms": options.dlqDwellTimeMs
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
emitCorrelatedEvent(baseCtx, "dlq_replay", eventAttrs);
|
|
268
|
-
},
|
|
269
|
-
recordRetry(attemptNumber, maxAttempts) {
|
|
270
|
-
baseCtx.setAttribute("messaging.retry.count", attemptNumber);
|
|
271
|
-
if (maxAttempts !== void 0) {
|
|
272
|
-
baseCtx.setAttribute("messaging.retry.max_attempts", maxAttempts);
|
|
273
|
-
}
|
|
274
|
-
emitCorrelatedEvent(baseCtx, "retry_attempt", {
|
|
275
|
-
"messaging.retry.count": attemptNumber,
|
|
276
|
-
...maxAttempts !== void 0 && {
|
|
277
|
-
"messaging.retry.max_attempts": maxAttempts
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
},
|
|
281
|
-
getProducerLinks() {
|
|
282
|
-
return [...linkStorage.links];
|
|
283
|
-
},
|
|
284
|
-
// ---- Ordering Methods ----
|
|
285
|
-
isDuplicate() {
|
|
286
|
-
return orderingState.isDuplicate;
|
|
287
|
-
},
|
|
288
|
-
getOutOfOrderInfo() {
|
|
289
|
-
return orderingState.outOfOrderInfo;
|
|
290
|
-
},
|
|
291
|
-
getSequenceNumber() {
|
|
292
|
-
return orderingState.sequenceNumber;
|
|
293
|
-
},
|
|
294
|
-
getPartitionKey() {
|
|
295
|
-
return orderingState.partitionKey;
|
|
296
|
-
},
|
|
297
|
-
// ---- Consumer Group Methods ----
|
|
298
|
-
recordRebalance(event) {
|
|
299
|
-
if (event.type === "assigned") {
|
|
300
|
-
groupState.assignedPartitions = event.partitions;
|
|
301
|
-
groupState.isActive = true;
|
|
302
|
-
groupState.state = "stable";
|
|
303
|
-
} else if (event.type === "revoked" || event.type === "lost") {
|
|
304
|
-
const revokedSet = new Set(
|
|
305
|
-
event.partitions.map((p) => `${p.topic}:${p.partition}`)
|
|
306
|
-
);
|
|
307
|
-
groupState.assignedPartitions = groupState.assignedPartitions.filter(
|
|
308
|
-
(p) => !revokedSet.has(`${p.topic}:${p.partition}`)
|
|
309
|
-
);
|
|
310
|
-
if (event.type === "lost") {
|
|
311
|
-
groupState.isActive = false;
|
|
312
|
-
groupState.state = "dead";
|
|
313
|
-
} else {
|
|
314
|
-
groupState.state = groupState.assignedPartitions.length === 0 ? "empty" : "preparing_rebalance";
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (event.generation !== void 0) {
|
|
318
|
-
groupState.generation = event.generation;
|
|
319
|
-
}
|
|
320
|
-
if (event.memberId) {
|
|
321
|
-
groupState.memberId = event.memberId;
|
|
322
|
-
}
|
|
323
|
-
baseCtx.setAttribute(
|
|
324
|
-
"messaging.consumer_group.rebalance.type",
|
|
325
|
-
event.type
|
|
326
|
-
);
|
|
327
|
-
baseCtx.setAttribute(
|
|
328
|
-
"messaging.consumer_group.rebalance.partition_count",
|
|
329
|
-
event.partitions.length
|
|
330
|
-
);
|
|
331
|
-
if (event.generation !== void 0) {
|
|
332
|
-
baseCtx.setAttribute(
|
|
333
|
-
"messaging.consumer_group.generation",
|
|
334
|
-
event.generation
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
if (event.memberId) {
|
|
338
|
-
baseCtx.setAttribute(
|
|
339
|
-
"messaging.consumer_group.member_id",
|
|
340
|
-
event.memberId
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
if (event.reason) {
|
|
344
|
-
baseCtx.setAttribute(
|
|
345
|
-
"messaging.consumer_group.rebalance.reason",
|
|
346
|
-
event.reason
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
if (groupState.state) {
|
|
350
|
-
baseCtx.setAttribute(
|
|
351
|
-
"messaging.consumer_group.state",
|
|
352
|
-
groupState.state
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
const eventAttrs = {
|
|
356
|
-
"messaging.consumer_group.rebalance.type": event.type,
|
|
357
|
-
"messaging.consumer_group.rebalance.partition_count": event.partitions.length,
|
|
358
|
-
"messaging.consumer_group.rebalance.timestamp": event.timestamp,
|
|
359
|
-
...event.generation !== void 0 && {
|
|
360
|
-
"messaging.consumer_group.generation": event.generation
|
|
361
|
-
},
|
|
362
|
-
...event.memberId && {
|
|
363
|
-
"messaging.consumer_group.member_id": event.memberId
|
|
364
|
-
},
|
|
365
|
-
...event.reason && {
|
|
366
|
-
"messaging.consumer_group.rebalance.reason": event.reason
|
|
367
|
-
},
|
|
368
|
-
...groupState.state && {
|
|
369
|
-
"messaging.consumer_group.state": groupState.state
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
if (event.partitions.length <= 10) {
|
|
373
|
-
eventAttrs["messaging.consumer_group.rebalance.partitions"] = event.partitions.map((p) => `${p.topic}:${p.partition}`).join(",");
|
|
374
|
-
}
|
|
375
|
-
emitCorrelatedEvent(baseCtx, `consumer_group_${event.type}`, eventAttrs);
|
|
376
|
-
if (config.consumerGroupTracking?.onRebalance) {
|
|
377
|
-
config.consumerGroupTracking.onRebalance(consumerCtx, event);
|
|
378
|
-
}
|
|
379
|
-
if (event.type === "assigned" && config.consumerGroupTracking?.onPartitionsAssigned) {
|
|
380
|
-
config.consumerGroupTracking.onPartitionsAssigned(
|
|
381
|
-
consumerCtx,
|
|
382
|
-
event.partitions
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
if (event.type === "revoked" && config.consumerGroupTracking?.onPartitionsRevoked) {
|
|
386
|
-
config.consumerGroupTracking.onPartitionsRevoked(
|
|
387
|
-
consumerCtx,
|
|
388
|
-
event.partitions
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
recordHeartbeat(healthy, latencyMs) {
|
|
393
|
-
groupState.lastHeartbeat = Date.now();
|
|
394
|
-
baseCtx.setAttribute(
|
|
395
|
-
"messaging.consumer_group.heartbeat.healthy",
|
|
396
|
-
healthy
|
|
397
|
-
);
|
|
398
|
-
if (latencyMs !== void 0) {
|
|
399
|
-
baseCtx.setAttribute(
|
|
400
|
-
"messaging.consumer_group.heartbeat.latency_ms",
|
|
401
|
-
latencyMs
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
emitCorrelatedEvent(baseCtx, "consumer_group_heartbeat", {
|
|
405
|
-
"messaging.consumer_group.heartbeat.healthy": healthy,
|
|
406
|
-
"messaging.consumer_group.heartbeat.timestamp": groupState.lastHeartbeat,
|
|
407
|
-
...latencyMs !== void 0 && {
|
|
408
|
-
"messaging.consumer_group.heartbeat.latency_ms": latencyMs
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
},
|
|
412
|
-
recordPartitionLag(lag) {
|
|
413
|
-
const prefix = `messaging.consumer_group.lag.${lag.topic}.${lag.partition}`;
|
|
414
|
-
baseCtx.setAttribute(`${prefix}.current_offset`, lag.currentOffset);
|
|
415
|
-
baseCtx.setAttribute(`${prefix}.end_offset`, lag.endOffset);
|
|
416
|
-
baseCtx.setAttribute(`${prefix}.lag`, lag.lag);
|
|
417
|
-
emitCorrelatedEvent(baseCtx, "partition_lag_recorded", {
|
|
418
|
-
"messaging.consumer_group.lag.topic": lag.topic,
|
|
419
|
-
"messaging.consumer_group.lag.partition": lag.partition,
|
|
420
|
-
"messaging.consumer_group.lag.current_offset": lag.currentOffset,
|
|
421
|
-
"messaging.consumer_group.lag.end_offset": lag.endOffset,
|
|
422
|
-
"messaging.consumer_group.lag.lag": lag.lag,
|
|
423
|
-
"messaging.consumer_group.lag.timestamp": lag.timestamp
|
|
424
|
-
});
|
|
425
|
-
},
|
|
426
|
-
getConsumerGroupState() {
|
|
427
|
-
if (!config.consumerGroup) {
|
|
428
|
-
return null;
|
|
429
|
-
}
|
|
430
|
-
return {
|
|
431
|
-
groupId: config.consumerGroup,
|
|
432
|
-
memberId: groupState.memberId ?? void 0,
|
|
433
|
-
groupInstanceId: groupState.groupInstanceId ?? void 0,
|
|
434
|
-
assignedPartitions: [...groupState.assignedPartitions],
|
|
435
|
-
generation: groupState.generation ?? void 0,
|
|
436
|
-
isActive: groupState.isActive,
|
|
437
|
-
lastHeartbeat: groupState.lastHeartbeat ?? void 0,
|
|
438
|
-
state: groupState.state ?? void 0
|
|
439
|
-
};
|
|
440
|
-
},
|
|
441
|
-
getMemberId() {
|
|
442
|
-
return groupState.memberId;
|
|
443
|
-
},
|
|
444
|
-
getAssignedPartitions() {
|
|
445
|
-
return [...groupState.assignedPartitions];
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
return consumerCtx;
|
|
449
|
-
}
|
|
450
|
-
function setProducerAttributes(ctx, config) {
|
|
451
|
-
ctx.setAttribute("messaging.system", config.system);
|
|
452
|
-
ctx.setAttribute("messaging.operation", "publish");
|
|
453
|
-
ctx.setAttribute("messaging.destination.name", config.destination);
|
|
454
|
-
if (config.system === "kafka") {
|
|
455
|
-
ctx.setAttribute("messaging.kafka.destination.topic", config.destination);
|
|
456
|
-
}
|
|
457
|
-
if (config.attributes) {
|
|
458
|
-
setCustomAttributes(ctx, config.attributes);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
function setDynamicProducerAttributes(ctx, config, args) {
|
|
462
|
-
if (config.messageIdFrom) {
|
|
463
|
-
const messageId = extractValue(config.messageIdFrom, args);
|
|
464
|
-
if (messageId !== void 0) {
|
|
465
|
-
ctx.setAttribute("messaging.message.id", String(messageId));
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
if (config.partitionFrom) {
|
|
469
|
-
const partition = extractValue(config.partitionFrom, args);
|
|
470
|
-
if (partition !== void 0) {
|
|
471
|
-
ctx.setAttribute(
|
|
472
|
-
"messaging.kafka.destination.partition",
|
|
473
|
-
Number(partition)
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (config.keyFrom) {
|
|
478
|
-
const key = extractValue(config.keyFrom, args);
|
|
479
|
-
if (key !== void 0) {
|
|
480
|
-
ctx.setAttribute("messaging.kafka.message.key", String(key));
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
function setConsumerAttributes(ctx, config) {
|
|
485
|
-
ctx.setAttribute("messaging.system", config.system);
|
|
486
|
-
ctx.setAttribute(
|
|
487
|
-
"messaging.operation",
|
|
488
|
-
config.batchMode ? "receive" : "process"
|
|
489
|
-
);
|
|
490
|
-
ctx.setAttribute("messaging.destination.name", config.destination);
|
|
491
|
-
if (config.consumerGroup) {
|
|
492
|
-
ctx.setAttribute("messaging.consumer.group", config.consumerGroup);
|
|
493
|
-
if (config.system === "kafka") {
|
|
494
|
-
ctx.setAttribute("messaging.kafka.consumer.group", config.consumerGroup);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
if (config.system === "kafka") {
|
|
498
|
-
ctx.setAttribute("messaging.kafka.destination.topic", config.destination);
|
|
499
|
-
}
|
|
500
|
-
if (config.attributes) {
|
|
501
|
-
setCustomAttributes(ctx, config.attributes);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
async function extractAndAddLinks(ctx, config, args, linkStorage) {
|
|
505
|
-
if (!config.headersFrom && !config.customContextExtractor) {
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
const links = [];
|
|
509
|
-
if (config.batchMode && Array.isArray(args[0])) {
|
|
510
|
-
const messages = args[0];
|
|
511
|
-
if (config.headersFrom) {
|
|
512
|
-
const batchLinks = extractLinksFromBatch(
|
|
513
|
-
messages.map((msg) => {
|
|
514
|
-
const headers = extractHeaders(config.headersFrom, msg);
|
|
515
|
-
return { headers };
|
|
516
|
-
}),
|
|
517
|
-
"headers"
|
|
518
|
-
);
|
|
519
|
-
links.push(...batchLinks);
|
|
520
|
-
}
|
|
521
|
-
if (config.customContextExtractor && config.headersFrom) {
|
|
522
|
-
for (const msg of messages) {
|
|
523
|
-
const headers = extractHeaders(config.headersFrom, msg);
|
|
524
|
-
if (headers) {
|
|
525
|
-
const w3cLink = createLinkFromHeaders(headers);
|
|
526
|
-
if (!w3cLink) {
|
|
527
|
-
const customContext = config.customContextExtractor(headers);
|
|
528
|
-
if (customContext) {
|
|
529
|
-
links.push({
|
|
530
|
-
context: customContext,
|
|
531
|
-
attributes: { "messaging.link.source": "custom_extractor" }
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
ctx.setAttribute("messaging.batch.message_count", messages.length);
|
|
539
|
-
} else {
|
|
540
|
-
const msg = args[0];
|
|
541
|
-
const headers = config.headersFrom ? extractHeaders(config.headersFrom, msg) : void 0;
|
|
542
|
-
if (headers) {
|
|
543
|
-
const w3cLink = createLinkFromHeaders(headers);
|
|
544
|
-
if (w3cLink) {
|
|
545
|
-
links.push(w3cLink);
|
|
546
|
-
} else if (config.customContextExtractor) {
|
|
547
|
-
const customContext = config.customContextExtractor(headers);
|
|
548
|
-
if (customContext) {
|
|
549
|
-
links.push({
|
|
550
|
-
context: customContext,
|
|
551
|
-
attributes: { "messaging.link.source": "custom_extractor" }
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
if (links.length > 0) {
|
|
558
|
-
ctx.addLinks(links);
|
|
559
|
-
linkStorage.links.push(...links);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
async function extractLagMetrics(ctx, lagConfig, args) {
|
|
563
|
-
const msg = Array.isArray(args[0]) ? args[0][0] : args[0];
|
|
564
|
-
let currentOffset;
|
|
565
|
-
if (lagConfig.getCurrentOffset && msg) {
|
|
566
|
-
currentOffset = lagConfig.getCurrentOffset(msg);
|
|
567
|
-
if (currentOffset !== void 0) {
|
|
568
|
-
ctx.setAttribute("messaging.kafka.message.offset", currentOffset);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
if (lagConfig.getPartition && msg) {
|
|
572
|
-
const partition = lagConfig.getPartition(msg);
|
|
573
|
-
if (partition !== void 0) {
|
|
574
|
-
ctx.setAttribute("messaging.kafka.partition", partition);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
if (lagConfig.getEndOffset) {
|
|
578
|
-
try {
|
|
579
|
-
const endOffset = await Promise.resolve(lagConfig.getEndOffset());
|
|
580
|
-
if (endOffset !== void 0 && currentOffset !== void 0) {
|
|
581
|
-
const lag = endOffset - currentOffset;
|
|
582
|
-
ctx.setAttribute("messaging.kafka.consumer_lag", lag);
|
|
583
|
-
emitCorrelatedEvent(ctx, "consumer_lag_measured", {
|
|
584
|
-
"messaging.kafka.consumer_lag": lag,
|
|
585
|
-
"messaging.kafka.message.offset": currentOffset,
|
|
586
|
-
"messaging.kafka.high_watermark": endOffset
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
} catch {
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
if (lagConfig.getCommittedOffset) {
|
|
593
|
-
try {
|
|
594
|
-
const committedOffset = await Promise.resolve(
|
|
595
|
-
lagConfig.getCommittedOffset()
|
|
596
|
-
);
|
|
597
|
-
if (committedOffset !== void 0) {
|
|
598
|
-
ctx.setAttribute("messaging.kafka.committed_offset", committedOffset);
|
|
599
|
-
}
|
|
600
|
-
} catch {
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
if (Array.isArray(args[0]) && args[0].length > 0) {
|
|
604
|
-
const messages = args[0];
|
|
605
|
-
if (lagConfig.getCurrentOffset) {
|
|
606
|
-
const firstOffset = lagConfig.getCurrentOffset(messages[0]);
|
|
607
|
-
const lastMessage = messages.at(-1);
|
|
608
|
-
const lastOffset = lastMessage === void 0 ? void 0 : lagConfig.getCurrentOffset(lastMessage);
|
|
609
|
-
if (firstOffset !== void 0) {
|
|
610
|
-
ctx.setAttribute("messaging.batch.first_offset", firstOffset);
|
|
611
|
-
}
|
|
612
|
-
if (lastOffset !== void 0) {
|
|
613
|
-
ctx.setAttribute("messaging.batch.last_offset", lastOffset);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
function extractHeaders(headersFrom, msg) {
|
|
619
|
-
if (typeof headersFrom === "function") {
|
|
620
|
-
return headersFrom(msg);
|
|
621
|
-
}
|
|
622
|
-
if (typeof msg === "object" && msg !== null) {
|
|
623
|
-
const value = msg[headersFrom];
|
|
624
|
-
if (typeof value === "object" && value !== null) {
|
|
625
|
-
return value;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
return void 0;
|
|
629
|
-
}
|
|
630
|
-
function extractValue(extractor, args) {
|
|
631
|
-
if (typeof extractor === "function") {
|
|
632
|
-
return extractor(args);
|
|
633
|
-
}
|
|
634
|
-
const firstArg = args[0];
|
|
635
|
-
if (typeof firstArg === "object" && firstArg !== null) {
|
|
636
|
-
return firstArg[extractor];
|
|
637
|
-
}
|
|
638
|
-
return void 0;
|
|
639
|
-
}
|
|
640
|
-
function setCustomAttributes(ctx, attributes) {
|
|
641
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
642
|
-
if (value !== void 0 && value !== null) {
|
|
643
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
644
|
-
ctx.setAttribute(key, value);
|
|
645
|
-
} else if (Array.isArray(value)) {
|
|
646
|
-
const cleanArray = value.filter(
|
|
647
|
-
(v) => v !== null && v !== void 0 && (typeof v === "string" || typeof v === "number" || typeof v === "boolean")
|
|
648
|
-
);
|
|
649
|
-
if (cleanArray.length > 0) {
|
|
650
|
-
ctx.setAttribute(key, cleanArray);
|
|
651
|
-
}
|
|
652
|
-
} else {
|
|
653
|
-
ctx.setAttribute(key, JSON.stringify(value));
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
function extractAndProcessOrdering(ctx, config, args, orderingState) {
|
|
659
|
-
const ordering = config.ordering;
|
|
660
|
-
if (!ordering) return;
|
|
661
|
-
const messages = config.batchMode && Array.isArray(args[0]) ? args[0] : [args[0]];
|
|
662
|
-
if (messages.length === 0) return;
|
|
663
|
-
let outOfOrderCount = 0;
|
|
664
|
-
let duplicateCount = 0;
|
|
665
|
-
let lastSequence = null;
|
|
666
|
-
let lastPartitionKey = null;
|
|
667
|
-
let lastMessageId = null;
|
|
668
|
-
for (const [i, msg] of messages.entries()) {
|
|
669
|
-
if (!msg) continue;
|
|
670
|
-
let msgSequence = null;
|
|
671
|
-
let msgPartitionKey = null;
|
|
672
|
-
let msgId = null;
|
|
673
|
-
if (ordering.sequenceFrom) {
|
|
674
|
-
const seq = ordering.sequenceFrom(msg);
|
|
675
|
-
if (seq !== void 0) {
|
|
676
|
-
msgSequence = seq;
|
|
677
|
-
lastSequence = seq;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
if (ordering.partitionKeyFrom) {
|
|
681
|
-
const key = ordering.partitionKeyFrom(msg);
|
|
682
|
-
if (key !== void 0) {
|
|
683
|
-
msgPartitionKey = key;
|
|
684
|
-
lastPartitionKey = key;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
if (ordering.messageIdFrom) {
|
|
688
|
-
const id = ordering.messageIdFrom(msg);
|
|
689
|
-
if (id !== void 0) {
|
|
690
|
-
msgId = id;
|
|
691
|
-
lastMessageId = id;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
if (ordering.detectOutOfOrder && msgSequence !== null) {
|
|
695
|
-
const msgOrderingState = {
|
|
696
|
-
partitionKey: msgPartitionKey};
|
|
697
|
-
const trackerKey = buildTrackerKey(config, msgOrderingState);
|
|
698
|
-
const prevSequence = sequenceTrackers.get(trackerKey);
|
|
699
|
-
if (prevSequence !== void 0) {
|
|
700
|
-
const expectedSequence = prevSequence + 1;
|
|
701
|
-
if (msgSequence !== expectedSequence) {
|
|
702
|
-
outOfOrderCount++;
|
|
703
|
-
const gap = msgSequence - expectedSequence;
|
|
704
|
-
const outOfOrderInfo = {
|
|
705
|
-
currentSequence: msgSequence,
|
|
706
|
-
expectedSequence,
|
|
707
|
-
partitionKey: msgPartitionKey ?? void 0,
|
|
708
|
-
gap
|
|
709
|
-
};
|
|
710
|
-
if (!orderingState.outOfOrderInfo) {
|
|
711
|
-
orderingState.outOfOrderInfo = outOfOrderInfo;
|
|
712
|
-
}
|
|
713
|
-
emitCorrelatedEvent(ctx, "message_out_of_order", {
|
|
714
|
-
"messaging.ordering.batch_index": i,
|
|
715
|
-
"messaging.ordering.current_sequence": msgSequence,
|
|
716
|
-
"messaging.ordering.expected_sequence": expectedSequence,
|
|
717
|
-
"messaging.ordering.gap": gap,
|
|
718
|
-
...msgPartitionKey && {
|
|
719
|
-
"messaging.ordering.partition_key": msgPartitionKey
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
if (ordering.onOutOfOrder) {
|
|
723
|
-
ordering.onOutOfOrder(ctx, outOfOrderInfo);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
sequenceTrackers.set(trackerKey, msgSequence);
|
|
728
|
-
}
|
|
729
|
-
if (ordering.detectDuplicates && msgId !== null) {
|
|
730
|
-
const msgOrderingState = {
|
|
731
|
-
messageId: msgId};
|
|
732
|
-
const dedupKey = buildDedupKey(config, msgOrderingState);
|
|
733
|
-
if (deduplicationWindow.has(dedupKey)) {
|
|
734
|
-
duplicateCount++;
|
|
735
|
-
emitCorrelatedEvent(ctx, "message_duplicate", {
|
|
736
|
-
"messaging.ordering.batch_index": i,
|
|
737
|
-
"messaging.message.id": msgId
|
|
738
|
-
});
|
|
739
|
-
if (ordering.onDuplicate) {
|
|
740
|
-
ordering.onDuplicate(ctx, msgId);
|
|
741
|
-
}
|
|
742
|
-
} else {
|
|
743
|
-
deduplicationWindow.set(dedupKey, Date.now());
|
|
744
|
-
const windowSize = ordering.deduplicationWindowSize ?? DEFAULT_DEDUP_WINDOW_SIZE;
|
|
745
|
-
trimDeduplicationWindow(windowSize);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
orderingState.sequenceNumber = lastSequence;
|
|
750
|
-
orderingState.partitionKey = lastPartitionKey;
|
|
751
|
-
orderingState.messageId = lastMessageId;
|
|
752
|
-
orderingState.isDuplicate = duplicateCount > 0;
|
|
753
|
-
if (lastSequence !== null) {
|
|
754
|
-
ctx.setAttribute("messaging.message.sequence_number", lastSequence);
|
|
755
|
-
}
|
|
756
|
-
if (lastPartitionKey !== null) {
|
|
757
|
-
ctx.setAttribute("messaging.message.partition_key", lastPartitionKey);
|
|
758
|
-
}
|
|
759
|
-
if (lastMessageId !== null) {
|
|
760
|
-
ctx.setAttribute("messaging.message.id", lastMessageId);
|
|
761
|
-
}
|
|
762
|
-
if (outOfOrderCount > 0) {
|
|
763
|
-
ctx.setAttribute("messaging.ordering.out_of_order", true);
|
|
764
|
-
ctx.setAttribute("messaging.ordering.out_of_order_count", outOfOrderCount);
|
|
765
|
-
}
|
|
766
|
-
if (duplicateCount > 0) {
|
|
767
|
-
ctx.setAttribute("messaging.ordering.duplicate", true);
|
|
768
|
-
ctx.setAttribute("messaging.ordering.duplicate_count", duplicateCount);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
function buildTrackerKey(config, orderingState) {
|
|
772
|
-
const parts = [config.system, config.destination];
|
|
773
|
-
if (orderingState.partitionKey) {
|
|
774
|
-
parts.push(orderingState.partitionKey);
|
|
775
|
-
}
|
|
776
|
-
if (config.consumerGroup) {
|
|
777
|
-
parts.push(config.consumerGroup);
|
|
778
|
-
}
|
|
779
|
-
return parts.join(":");
|
|
780
|
-
}
|
|
781
|
-
function buildDedupKey(config, orderingState) {
|
|
782
|
-
const parts = [config.system, config.destination];
|
|
783
|
-
if (orderingState.messageId) {
|
|
784
|
-
parts.push(orderingState.messageId);
|
|
785
|
-
}
|
|
786
|
-
return parts.join(":");
|
|
787
|
-
}
|
|
788
|
-
function clearOrderingState() {
|
|
789
|
-
sequenceTrackers.clear();
|
|
790
|
-
deduplicationWindow.clear();
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
export { clearOrderingState, traceConsumer, traceProducer };
|
|
794
|
-
//# sourceMappingURL=chunk-D4TM63S3.js.map
|
|
795
|
-
//# sourceMappingURL=chunk-D4TM63S3.js.map
|