autotel 8.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/{attribute-redacting-processor-rkV_WL-k.d.ts → attribute-redacting-processor-BrrdojmP.d.ts} +5 -1
  2. package/dist/{attribute-redacting-processor-CvBE0z1p.d.cts → attribute-redacting-processor-Cq7K8Okp.d.cts} +5 -1
  3. package/dist/attribute-redacting-processor.cjs +18 -8
  4. package/dist/attribute-redacting-processor.d.cts +1 -1
  5. package/dist/attribute-redacting-processor.d.ts +1 -1
  6. package/dist/attribute-redacting-processor.js +18 -8
  7. package/dist/{attributes-Ii3jDPsW.cjs → attributes-BqgJl9qA.cjs} +1 -1
  8. package/dist/{attributes-CuGx6cOI.js → attributes-BtwTkuX7.js} +1 -1
  9. package/dist/attributes.cjs +1 -1
  10. package/dist/attributes.js +1 -1
  11. package/dist/auto.cjs +1 -1
  12. package/dist/auto.js +1 -1
  13. package/dist/business-baggage.cjs +1 -1
  14. package/dist/business-baggage.js +1 -1
  15. package/dist/{canonical-log-line-processor-CBRe-VsO.cjs → canonical-log-line-processor-DScNq1g8.cjs} +1 -1
  16. package/dist/{canonical-log-line-processor-CntKMtpJ.js → canonical-log-line-processor-naZRETyk.js} +1 -1
  17. package/dist/{channel-D0eaVqn3.cjs → channel-3MV-4Aqv.cjs} +1 -1
  18. package/dist/{channel-BobQKsZd.js → channel-BNFp4Sfq.js} +1 -1
  19. package/dist/{correlated-events-BfpH5uS-.js → correlated-events-CZFe6Z1P.js} +1 -1
  20. package/dist/{correlated-events-DE_4A3oD.cjs → correlated-events-wCrXVUby.cjs} +1 -1
  21. package/dist/correlation-id.cjs +1 -1
  22. package/dist/correlation-id.js +1 -1
  23. package/dist/db.cjs +1 -1
  24. package/dist/db.js +1 -1
  25. package/dist/decorators.cjs +2 -2
  26. package/dist/decorators.d.cts +1 -1
  27. package/dist/decorators.d.ts +1 -1
  28. package/dist/decorators.js +2 -2
  29. package/dist/diagnostics.cjs +3 -3
  30. package/dist/diagnostics.js +3 -3
  31. package/dist/event.cjs +1 -1
  32. package/dist/event.js +1 -1
  33. package/dist/exception-fingerprint.cjs +1 -1
  34. package/dist/exception-fingerprint.js +1 -1
  35. package/dist/{functional-C-D0KQg6.js → functional-7uwlAIJd.js} +4 -4
  36. package/dist/{functional-DDunG47Y.d.cts → functional-CN_cqIX8.d.cts} +8 -1
  37. package/dist/{functional-BliCZgwO.cjs → functional-DCfOaKoM.cjs} +4 -4
  38. package/dist/{functional-DU7NXyih.d.ts → functional-IGZ-Urlq.d.ts} +8 -1
  39. package/dist/functional.cjs +1 -1
  40. package/dist/functional.d.cts +1 -1
  41. package/dist/functional.d.ts +1 -1
  42. package/dist/functional.js +1 -1
  43. package/dist/http.cjs +2 -2
  44. package/dist/http.js +2 -2
  45. package/dist/index.cjs +9 -8
  46. package/dist/index.d.cts +29 -5
  47. package/dist/index.d.ts +29 -5
  48. package/dist/index.js +9 -9
  49. package/dist/{init-DMjyzzbM.d.ts → init-BYq2sUXg.d.ts} +4 -2
  50. package/dist/{init-CKHEf5g2.js → init-D4TpmUIg.js} +48 -7
  51. package/dist/{init-DF4YrpSB.cjs → init-DlJvp1WH.cjs} +53 -6
  52. package/dist/{init-D5k8hBRg.d.cts → init-axM4kgR4.d.cts} +4 -2
  53. package/dist/instrumentation.cjs +2 -2
  54. package/dist/instrumentation.js +2 -2
  55. package/dist/{logger-8Ah2EkH1.js → logger-4VXLbqWx.js} +1 -1
  56. package/dist/{logger-C_3xDBOz.cjs → logger-CWFxTLtR.cjs} +1 -1
  57. package/dist/logger.cjs +1 -1
  58. package/dist/logger.js +1 -1
  59. package/dist/messaging-adapters.cjs +1 -1
  60. package/dist/messaging-adapters.js +1 -1
  61. package/dist/messaging.cjs +4 -4
  62. package/dist/messaging.js +4 -4
  63. package/dist/{node-require-BPsB09eC.cjs → node-require-BotQNkYw.cjs} +1 -1
  64. package/dist/{node-require-CkK_xzL-.js → node-require-CY0YUdvZ.js} +1 -1
  65. package/dist/parse-error.cjs +1 -1
  66. package/dist/parse-error.js +1 -1
  67. package/dist/policy.cjs +0 -0
  68. package/dist/policy.js +0 -0
  69. package/dist/processors.cjs +1 -1
  70. package/dist/processors.js +1 -1
  71. package/dist/sampling.cjs +1 -1
  72. package/dist/sampling.js +1 -1
  73. package/dist/semantic-helpers.cjs +2 -2
  74. package/dist/semantic-helpers.js +2 -2
  75. package/dist/{stable-hash-sLi1o4jj.cjs → stable-hash-58iP5-N-.cjs} +1 -1
  76. package/dist/{stable-hash-AOUgw1DW.js → stable-hash-DVEU2MqW.js} +1 -1
  77. package/dist/{structured-error-DynjWTTu.cjs → structured-error-Ci8s_M6u.cjs} +6 -6
  78. package/dist/{structured-error-Y9y-1Pae.js → structured-error-UEtlg9Uu.js} +6 -6
  79. package/dist/tail-sampling-processor.cjs +1 -1
  80. package/dist/tail-sampling-processor.js +1 -1
  81. package/dist/test-span-collector.cjs +1 -1
  82. package/dist/test-span-collector.js +1 -1
  83. package/dist/testing.cjs +11 -1
  84. package/dist/testing.js +12 -2
  85. package/dist/trace-helpers.cjs +2 -2
  86. package/dist/trace-helpers.js +2 -2
  87. package/dist/tracer-provider.cjs +1 -1
  88. package/dist/tracer-provider.js +1 -1
  89. package/dist/validate.cjs +3 -3
  90. package/dist/validate.js +3 -3
  91. package/dist/{values-AxGpgYBA.cjs → values-9A6nOyZm.cjs} +69 -3
  92. package/dist/{values-xBtdXtjA.js → values-Dm0yEC5p.js} +58 -4
  93. package/dist/webhook.cjs +3 -3
  94. package/dist/webhook.js +3 -3
  95. package/dist/workflow-distributed.cjs +3 -3
  96. package/dist/workflow-distributed.js +3 -3
  97. package/dist/workflow.cjs +3 -3
  98. package/dist/workflow.js +3 -3
  99. package/dist/yaml-config.cjs +1 -1
  100. package/dist/yaml-config.d.cts +1 -1
  101. package/dist/yaml-config.d.ts +1 -1
  102. package/dist/yaml-config.js +1 -1
  103. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,16 +1,16 @@
1
- import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-CvBE0z1p.cjs";
1
+ import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-Cq7K8Okp.cjs";
2
2
  import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-DVPsz3DK.cjs";
3
3
  import { t as UnknownRecord } from "./values-CeMH-mYG.cjs";
4
4
  import { n as TraceContext$1, r as defineBaggageSchema, t as AttributeValue$2 } from "./trace-context-f7Xq0Q2q.cjs";
5
5
  import { BaggageError, BaggageFieldDefinition, BaggageFieldType, BusinessBaggage, BusinessBaggageValues, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema } from "./business-baggage.cjs";
6
6
  import { CORRELATION_ID_BAGGAGE_KEY, generateCorrelationId, getCorrelationId, getOrCreateCorrelationId, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage } from "./correlation-id.cjs";
7
7
  import { T as samplingPresets, _ as UserIdSampler, a as AdaptiveSampler, b as extractLinksFromBatch, d as NeverSampler, g as SamplingPreset, h as SamplingContext, i as AUTOTEL_SAMPLING_TAIL_KEEP, m as Sampler, o as AlwaysSampler, p as RandomSampler, r as AUTOTEL_SAMPLING_TAIL_EVALUATED, t as AUTOTEL_DEBUG_BAGGAGE_KEY, v as createLinkFromHeaders, w as resolveSamplingPreset } from "./sampling-CLJmXMw0.cjs";
8
- import { a as getActiveTraceContext, c as span, d as withNewContext, f as withTracing, i as ctx, l as trace$2, m as SingleInstrumentOptions, n as WithBaggageOptions, o as instrument, p as InstrumentOptions, r as WithNewContextOptions, s as requestCtx, t as SpanOptions, u as withBaggage } from "./functional-DDunG47Y.cjs";
8
+ import { a as getActiveTraceContext, c as span, d as withNewContext, f as withTracing, i as ctx, l as trace$2, m as SingleInstrumentOptions, n as WithBaggageOptions, o as instrument, p as InstrumentOptions, r as WithNewContextOptions, s as requestCtx, t as SpanOptions, u as withBaggage } from "./functional-CN_cqIX8.cjs";
9
9
  import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./drain-pipeline.cjs";
10
10
  import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.cjs";
11
11
  import { Event, EventsOptions, getEvents, resetEvents } from "./event.cjs";
12
12
  import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BYvLMiNz.cjs";
13
- import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-D5k8hBRg.cjs";
13
+ import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-axM4kgR4.cjs";
14
14
  import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-CN1-8C76.cjs";
15
15
  import "./canonical-log-line-processor-C-RdV5af.cjs";
16
16
  import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-BNeuKUPv.cjs";
@@ -23,7 +23,7 @@ import { DBConfig, HTTPConfig, MessagingConfig, traceDB, traceHTTP, traceMessagi
23
23
  import { a as URLAttributes, i as ServiceAttributes, n as httpResponseHeaderAttribute, r as HTTPAttributes, t as httpRequestHeaderAttribute } from "./semantic-conventions-yG0X2AsN.cjs";
24
24
  import { ConsumerConfig, ConsumerContext, LagMetricsConfig, MessagingOperation, MessagingSystem, ProducerConfig, ProducerContext, traceConsumer, traceProducer } from "./messaging.cjs";
25
25
  import { StepConfig, StepContext, StepStatus, WorkflowConfig, WorkflowContext, WorkflowStatus, getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.cjs";
26
- import { ReadableSpan, SpanProcessor } from "@opentelemetry/sdk-trace-base";
26
+ import { ReadableSpan, Span as Span$1, SpanProcessor } from "@opentelemetry/sdk-trace-base";
27
27
  import { AttributeValue, Attributes, Baggage, BaggageEntry, Context, Context as Context$1, Exception, HrTime, Link, Link as SpanLink, ROOT_CONTEXT, Span, Span as Span$2, SpanAttributes, SpanContext, SpanKind, SpanStatusCode, TextMapGetter, TextMapSetter, TimeInput, TraceFlags, TraceState, Tracer, TracerProvider, context, propagation, trace as otelTrace, trace as trace$1 } from "@opentelemetry/api";
28
28
  //#region src/baggage-span-processor.d.ts
29
29
  interface BaggageSpanProcessorOptions {
@@ -73,6 +73,29 @@ export declare class BaggageSpanProcessor implements SpanProcessor {
73
73
  forceFlush(): Promise<void>;
74
74
  }
75
75
  //#endregion
76
+ //#region src/enriched-span-processor.d.ts
77
+ /**
78
+ * `spanEnrichers` in front of the processors that export, as one processor.
79
+ *
80
+ * Spans reach the enrichers first, as they would in a flat list. The
81
+ * difference is flush and shutdown: the SDK runs those on every processor at
82
+ * once, so an enricher that ends a span of its own while it drains (an async
83
+ * judgment, say) would hand it to an exporter that had already closed. Here the
84
+ * enrichers drain first and the exporters flush after them.
85
+ */
86
+ export declare class EnrichedSpanProcessor implements SpanProcessor {
87
+ private readonly enrichers;
88
+ private readonly downstream;
89
+ /** Every processor in call order: the enrichers, then the rest. */
90
+ readonly processors: readonly SpanProcessor[];
91
+ constructor(enrichers: readonly SpanProcessor[], downstream: readonly SpanProcessor[]);
92
+ onStart(span: Span$1, parentContext: Context$1): void;
93
+ onEnd(span: ReadableSpan): void;
94
+ forceFlush(): Promise<void>;
95
+ shutdown(): Promise<void>;
96
+ private drainThenRun;
97
+ }
98
+ //#endregion
76
99
  //#region src/force-keep.d.ts
77
100
  /**
78
101
  * Keep this trace whatever the sampler decides.
@@ -595,7 +618,8 @@ export declare function defineAuditCatalog<const T extends Record<string, AuditC
595
618
  * Convert a value that arrived from outside to an OTel-compatible
596
619
  * AttributeValue. Returns undefined when the value cannot be represented -
597
620
  * which is how flattenToAttributes below learns it has an object to descend
598
- * into rather than a leaf to record.
621
+ * into rather than a leaf to record. An Error is one of those: it flattens to
622
+ * its name, message, stack, cause and fields, not its message alone.
599
623
  *
600
624
  * Total by construction: this runs on whatever an application hands an
601
625
  * attribute setter, so a value that cannot be read is a marker in the
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-rkV_WL-k.js";
1
+ import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-BrrdojmP.js";
2
2
  import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-DAH41w0W.js";
3
3
  import { t as UnknownRecord } from "./values-CeMH-mYG.js";
4
4
  import { n as TraceContext$1, r as defineBaggageSchema, t as AttributeValue$2 } from "./trace-context-CqCblIQE.js";
5
5
  import { BaggageError, BaggageFieldDefinition, BaggageFieldType, BusinessBaggage, BusinessBaggageValues, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema } from "./business-baggage.js";
6
6
  import { CORRELATION_ID_BAGGAGE_KEY, generateCorrelationId, getCorrelationId, getOrCreateCorrelationId, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage } from "./correlation-id.js";
7
7
  import { T as samplingPresets, _ as UserIdSampler, a as AdaptiveSampler, b as extractLinksFromBatch, d as NeverSampler, g as SamplingPreset, h as SamplingContext, i as AUTOTEL_SAMPLING_TAIL_KEEP, m as Sampler, o as AlwaysSampler, p as RandomSampler, r as AUTOTEL_SAMPLING_TAIL_EVALUATED, t as AUTOTEL_DEBUG_BAGGAGE_KEY, v as createLinkFromHeaders, w as resolveSamplingPreset } from "./sampling-DBlX8Nv5.js";
8
- import { a as getActiveTraceContext, c as span, d as withNewContext, f as withTracing, i as ctx, l as trace$2, m as SingleInstrumentOptions, n as WithBaggageOptions, o as instrument, p as InstrumentOptions, r as WithNewContextOptions, s as requestCtx, t as SpanOptions, u as withBaggage } from "./functional-DU7NXyih.js";
8
+ import { a as getActiveTraceContext, c as span, d as withNewContext, f as withTracing, i as ctx, l as trace$2, m as SingleInstrumentOptions, n as WithBaggageOptions, o as instrument, p as InstrumentOptions, r as WithNewContextOptions, s as requestCtx, t as SpanOptions, u as withBaggage } from "./functional-IGZ-Urlq.js";
9
9
  import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./drain-pipeline.js";
10
10
  import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.js";
11
11
  import { Event, EventsOptions, getEvents, resetEvents } from "./event.js";
12
12
  import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BDGe1myy.js";
13
- import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-DMjyzzbM.js";
13
+ import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-BYq2sUXg.js";
14
14
  import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-DHcg1bSP.js";
15
15
  import "./canonical-log-line-processor-BaFqHO5l.js";
16
16
  import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-Bd8f8mST.js";
@@ -24,7 +24,7 @@ import { a as URLAttributes, i as ServiceAttributes, n as httpResponseHeaderAttr
24
24
  import { ConsumerConfig, ConsumerContext, LagMetricsConfig, MessagingOperation, MessagingSystem, ProducerConfig, ProducerContext, traceConsumer, traceProducer } from "./messaging.js";
25
25
  import { StepConfig, StepContext, StepStatus, WorkflowConfig, WorkflowContext, WorkflowStatus, getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js";
26
26
  import { AttributeValue, Attributes, Baggage, BaggageEntry, Context, Context as Context$1, Exception, HrTime, Link, Link as SpanLink, ROOT_CONTEXT, Span, Span as Span$1, SpanAttributes, SpanContext, SpanKind, SpanStatusCode, TextMapGetter, TextMapSetter, TimeInput, TraceFlags, TraceState, Tracer, TracerProvider, context, propagation, trace as otelTrace, trace as trace$1 } from "@opentelemetry/api";
27
- import { ReadableSpan, SpanProcessor } from "@opentelemetry/sdk-trace-base";
27
+ import { ReadableSpan, Span as Span$2, SpanProcessor } from "@opentelemetry/sdk-trace-base";
28
28
  //#region src/baggage-span-processor.d.ts
29
29
  interface BaggageSpanProcessorOptions {
30
30
  /**
@@ -73,6 +73,29 @@ export declare class BaggageSpanProcessor implements SpanProcessor {
73
73
  forceFlush(): Promise<void>;
74
74
  }
75
75
  //#endregion
76
+ //#region src/enriched-span-processor.d.ts
77
+ /**
78
+ * `spanEnrichers` in front of the processors that export, as one processor.
79
+ *
80
+ * Spans reach the enrichers first, as they would in a flat list. The
81
+ * difference is flush and shutdown: the SDK runs those on every processor at
82
+ * once, so an enricher that ends a span of its own while it drains (an async
83
+ * judgment, say) would hand it to an exporter that had already closed. Here the
84
+ * enrichers drain first and the exporters flush after them.
85
+ */
86
+ export declare class EnrichedSpanProcessor implements SpanProcessor {
87
+ private readonly enrichers;
88
+ private readonly downstream;
89
+ /** Every processor in call order: the enrichers, then the rest. */
90
+ readonly processors: readonly SpanProcessor[];
91
+ constructor(enrichers: readonly SpanProcessor[], downstream: readonly SpanProcessor[]);
92
+ onStart(span: Span$2, parentContext: Context$1): void;
93
+ onEnd(span: ReadableSpan): void;
94
+ forceFlush(): Promise<void>;
95
+ shutdown(): Promise<void>;
96
+ private drainThenRun;
97
+ }
98
+ //#endregion
76
99
  //#region src/force-keep.d.ts
77
100
  /**
78
101
  * Keep this trace whatever the sampler decides.
@@ -595,7 +618,8 @@ export declare function defineAuditCatalog<const T extends Record<string, AuditC
595
618
  * Convert a value that arrived from outside to an OTel-compatible
596
619
  * AttributeValue. Returns undefined when the value cannot be represented -
597
620
  * which is how flattenToAttributes below learns it has an object to descend
598
- * into rather than a leaf to record.
621
+ * into rather than a leaf to record. An Error is one of those: it flattens to
622
+ * its name, message, stack, cause and fields, not its message alone.
599
623
  *
600
624
  * Total by construction: this runs on whatever an application hands an
601
625
  * attribute setter, so a value that cannot be read is a marker in the
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { $ as generateCorrelationId, D as AUTOTEL_SAMPLING_TAIL_KEEP, E as AUTOTEL_SAMPLING_TAIL_EVALUATED, F as RandomSampler, G as createTraceContext, H as markForceKept, I as UserIdSampler, K as defineBaggageSchema, L as createLinkFromHeaders, O as AdaptiveSampler, P as NeverSampler, Q as CORRELATION_ID_BAGGAGE_KEY, S as BaggageSpanProcessor, U as resolveSamplingPreset, W as samplingPresets, X as getEventQueue, Z as track, a as init, at as setCorrelationIdInBaggage, c as lockLogger, d as Event, et as getCorrelationId, f as getEvents, h as runInOperationContext, it as setCorrelationId, k as AlwaysSampler, l as flush, m as getOperationContext, nt as getOrCreateCorrelationId, o as isInitialized, p as resetEvents, rt as runWithCorrelationId, s as isLoggerLocked, u as shutdown, w as AUTOTEL_DEBUG_BAGGAGE_KEY, y as createStringRedactor, z as extractLinksFromBatch } from "./init-CKHEf5g2.js";
2
- import { g as nonEmptyString, i as asNumber, l as asString, r as asFunction, s as asRecord, x as toError } from "./values-xBtdXtjA.js";
1
+ import { $ as CORRELATION_ID_BAGGAGE_KEY, A as AlwaysSampler, B as extractLinksFromBatch, C as BaggageSpanProcessor, D as AUTOTEL_SAMPLING_TAIL_EVALUATED, F as NeverSampler, G as samplingPresets, I as RandomSampler, K as createTraceContext, L as UserIdSampler, O as AUTOTEL_SAMPLING_TAIL_KEEP, Q as track, R as createLinkFromHeaders, T as AUTOTEL_DEBUG_BAGGAGE_KEY, U as markForceKept, W as resolveSamplingPreset, Z as getEventQueue, a as init, at as setCorrelationId, b as EnrichedSpanProcessor, c as lockLogger, d as Event, et as generateCorrelationId, f as getEvents, h as runInOperationContext, it as runWithCorrelationId, k as AdaptiveSampler, l as flush, m as getOperationContext, o as isInitialized, ot as setCorrelationIdInBaggage, p as resetEvents, q as defineBaggageSchema, rt as getOrCreateCorrelationId, s as isLoggerLocked, tt as getCorrelationId, u as shutdown, y as createStringRedactor } from "./init-D4TpmUIg.js";
2
+ import { C as toError, _ as nonEmptyString, i as asNumber, l as asString, r as asFunction, s as asRecord } from "./values-Dm0yEC5p.js";
3
3
  import { getAutotelTracer, getAutotelTracerProvider, hasTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
4
- import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-Y9y-1Pae.js";
4
+ import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-UEtlg9Uu.js";
5
5
  import { FilteringSpanProcessor } from "./filtering-span-processor.js";
6
6
  import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
7
7
  import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
8
- import { n as formatDuration } from "./canonical-log-line-processor-CntKMtpJ.js";
8
+ import { n as formatDuration } from "./canonical-log-line-processor-naZRETyk.js";
9
9
  import { Metric, getMetrics, resetMetrics } from "./metric.js";
10
- import { a as span, c as withNewContext, i as requestCtx, l as withTracing, n as getActiveTraceContext, o as trace$2, r as instrument, s as withBaggage, t as ctx } from "./functional-C-D0KQg6.js";
10
+ import { a as span, c as withNewContext, i as requestCtx, l as withTracing, n as getActiveTraceContext, o as trace$2, r as instrument, s as withBaggage, t as ctx } from "./functional-7uwlAIJd.js";
11
11
  import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
12
- import { t as hashJson } from "./stable-hash-AOUgw1DW.js";
13
- import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
12
+ import { t as hashJson } from "./stable-hash-DVEU2MqW.js";
13
+ import { t as emitCorrelatedEvent } from "./correlated-events-CZFe6Z1P.js";
14
14
  import { parseError } from "./parse-error.js";
15
15
  import { createDrainPipeline } from "./drain-pipeline.js";
16
16
  import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js";
17
17
  import { traceDB, traceHTTP, traceMessaging } from "./semantic-helpers.js";
18
18
  import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-Cy4JjIB-.js";
19
19
  import { httpRequestHeaderAttribute, httpResponseHeaderAttribute } from "./semantic-conventions.js";
20
- import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-CuGx6cOI.js";
20
+ import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-BtwTkuX7.js";
21
21
  import { traceConsumer, traceProducer } from "./messaging.js";
22
22
  import { BusinessBaggage, createSafeBaggageSchema } from "./business-baggage.js";
23
23
  import { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js";
@@ -548,4 +548,4 @@ function defineEnricher(def, options = {}) {
548
548
  }
549
549
 
550
550
  //#endregion
551
- export { AUTOTEL_DEBUG_BAGGAGE_KEY, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, AttributeRedactingProcessor, BaggageSpanProcessor, BusinessBaggage, CORRELATION_ID_BAGGAGE_KEY, Event, FilteringSpanProcessor, HTTPAttributes, Metric, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, NeverSampler, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, RandomSampler, ServiceAttributes, SpanKind, SpanNameNormalizingProcessor, SpanStatusCode, URLAttributes, UserIdSampler, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, experiment, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, forceKeep, formatDuration, generateCorrelationId, getActiveContext, getActiveSpan, getActiveTraceContext, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, hasTracerProvider, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, lockLogger, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordStructuredError, request, requestCtx, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing };
551
+ export { AUTOTEL_DEBUG_BAGGAGE_KEY, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, AttributeRedactingProcessor, BaggageSpanProcessor, BusinessBaggage, CORRELATION_ID_BAGGAGE_KEY, EnrichedSpanProcessor, Event, FilteringSpanProcessor, HTTPAttributes, Metric, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, NeverSampler, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, RandomSampler, ServiceAttributes, SpanKind, SpanNameNormalizingProcessor, SpanStatusCode, URLAttributes, UserIdSampler, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, experiment, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, forceKeep, formatDuration, generateCorrelationId, getActiveContext, getActiveSpan, getActiveTraceContext, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, hasTracerProvider, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, lockLogger, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordStructuredError, request, requestCtx, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing };
@@ -1,4 +1,4 @@
1
- import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-rkV_WL-k.js";
1
+ import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-BrrdojmP.js";
2
2
  import { s as Logger } from "./logger-b0qgWFy7.js";
3
3
  import { g as SamplingPreset, m as Sampler$1 } from "./sampling-DBlX8Nv5.js";
4
4
  import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.js";
@@ -629,7 +629,9 @@ interface AutotelConfig {
629
629
  *
630
630
  * Unlike {@link spanProcessors}, which replaces the pipeline autotel would
631
631
  * have built, these are added to it. Use them for processors that enrich
632
- * rather than export, so `destinations` keeps working:
632
+ * rather than export, so `destinations` keeps working. On flush and
633
+ * shutdown they drain before the exporters do, so a span an enricher ends
634
+ * while draining is still exported:
633
635
  *
634
636
  * @example
635
637
  * ```typescript
@@ -1,15 +1,15 @@
1
- import { _ as readProperty, d as asStringRecord, f as describeValue, h as isFunction, i as asNumber, l as asString, r as asFunction, s as asRecord, t as asBoolean } from "./values-xBtdXtjA.js";
1
+ import { d as asStringRecord, f as describeValue, g as isFunction, i as asNumber, l as asString, r as asFunction, s as asRecord, t as asBoolean, v as readProperty } from "./values-Dm0yEC5p.js";
2
2
  import { getForceFlushableProvider } from "./tracer-provider.js";
3
3
  import { getConfig as getConfig$1 } from "./config.js";
4
- import { a as flattenToAttributes, o as toAttributeValue, r as recordStructuredError } from "./structured-error-Y9y-1Pae.js";
5
- import { n as safeRequire, t as requireModule } from "./node-require-CkK_xzL-.js";
4
+ import { a as flattenToAttributes, o as toAttributeValue, r as recordStructuredError } from "./structured-error-UEtlg9Uu.js";
5
+ import { n as safeRequire, t as requireModule } from "./node-require-CY0YUdvZ.js";
6
6
  import { FilteringSpanProcessor } from "./filtering-span-processor.js";
7
7
  import { PolicyLogRecordProcessor, policySpanFilter, setPolicies, watchPolicyFile } from "./policy.js";
8
8
  import { SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
9
9
  import { AttributeRedactingProcessor, REDACTOR_PRESETS, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
10
10
  import { t as PrettyConsoleExporter } from "./pretty-console-exporter-DqKl_q9z.js";
11
- import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CntKMtpJ.js";
12
- import { n as subscribeChannel } from "./channel-BobQKsZd.js";
11
+ import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-naZRETyk.js";
12
+ import { n as subscribeChannel } from "./channel-BNFp4Sfq.js";
13
13
  import { resetMetrics } from "./metric.js";
14
14
  import { DiagConsoleLogger, DiagLogLevel, TraceFlags, context, createContextKey, diag, metrics, propagation, trace } from "@opentelemetry/api";
15
15
  import { logs } from "@opentelemetry/api-logs";
@@ -2168,6 +2168,47 @@ var RequestAttributesSpanProcessor = class {
2168
2168
  }
2169
2169
  };
2170
2170
 
2171
+ //#endregion
2172
+ //#region src/enriched-span-processor.ts
2173
+ /**
2174
+ * `spanEnrichers` in front of the processors that export, as one processor.
2175
+ *
2176
+ * Spans reach the enrichers first, as they would in a flat list. The
2177
+ * difference is flush and shutdown: the SDK runs those on every processor at
2178
+ * once, so an enricher that ends a span of its own while it drains (an async
2179
+ * judgment, say) would hand it to an exporter that had already closed. Here the
2180
+ * enrichers drain first and the exporters flush after them.
2181
+ */
2182
+ var EnrichedSpanProcessor = class {
2183
+ enrichers;
2184
+ downstream;
2185
+ /** Every processor in call order: the enrichers, then the rest. */
2186
+ processors;
2187
+ constructor(enrichers, downstream) {
2188
+ this.enrichers = enrichers;
2189
+ this.downstream = downstream;
2190
+ this.processors = [...enrichers, ...downstream];
2191
+ }
2192
+ onStart(span, parentContext) {
2193
+ for (const processor of this.processors) processor.onStart(span, parentContext);
2194
+ }
2195
+ onEnd(span) {
2196
+ for (const processor of this.processors) processor.onEnd(span);
2197
+ }
2198
+ forceFlush() {
2199
+ return this.drainThenRun((p) => p.forceFlush());
2200
+ }
2201
+ shutdown() {
2202
+ return this.drainThenRun((p) => p.shutdown());
2203
+ }
2204
+ async drainThenRun(run) {
2205
+ const drained = await Promise.allSettled(this.enrichers.map(async (p) => run(p)));
2206
+ await Promise.all(this.downstream.map(run));
2207
+ const failed = drained.find((r) => r.status === "rejected");
2208
+ if (failed) throw failed.reason;
2209
+ }
2210
+ };
2211
+
2171
2212
  //#endregion
2172
2213
  //#region src/redact-values.ts
2173
2214
  /** Standalone string redaction for use outside the span processor pipeline. */
@@ -4524,7 +4565,7 @@ function init(cfg) {
4524
4565
  }
4525
4566
  if (mergedConfig.spanFilter && spanProcessors.length > 0) spanProcessors = spanProcessors.map((processor) => new FilteringSpanProcessor(processor, { filter: mergedConfig.spanFilter }));
4526
4567
  if (spanProcessors.length > 0) spanProcessors.unshift(new RequestAttributesSpanProcessor());
4527
- if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors.unshift(...mergedConfig.spanEnrichers);
4568
+ if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors = [new EnrichedSpanProcessor(mergedConfig.spanEnrichers, spanProcessors)];
4528
4569
  const metricReaders = [];
4529
4570
  if (configuredMetricReaders && configuredMetricReaders.length > 0) metricReaders.push(...configuredMetricReaders);
4530
4571
  else if (metricsEnabled) for (const destination of otlpDestinations) {
@@ -4697,4 +4738,4 @@ function getSdk() {
4697
4738
  }
4698
4739
 
4699
4740
  //#endregion
4700
- export { generateCorrelationId as $, CompositeSampler as A, hashUnitInterval as B, TailSamplingSpanProcessor as C, AUTOTEL_SAMPLING_TAIL_KEEP as D, AUTOTEL_SAMPLING_TAIL_EVALUATED as E, RandomSampler as F, createTraceContext as G, markForceKept as H, UserIdSampler as I, getActiveContextWithBaggage as J, defineBaggageSchema as K, createLinkFromHeaders as L, FeatureFlagSampler as M, KeyTargetRateSampler as N, AdaptiveSampler as O, NeverSampler as P, CORRELATION_ID_BAGGAGE_KEY as Q, debugCaptureRequested as R, BaggageSpanProcessor as S, AUTOTEL_SAMPLING_RATE as T, resolveSamplingPreset as U, isForceKept as V, samplingPresets as W, getEventQueue as X, getContextStorage as Y, track as Z, loadYamlConfig as _, init as a, setCorrelationIdInBaggage as at, getRequestSpanIn as b, lockLogger as c, Event as d, getCorrelationId as et, getEvents as f, hasYamlConfig as g, runInOperationContext as h, getSdk as i, setCorrelationId as it, DeterministicSampler as j, AlwaysSampler as k, flush as l, getOperationContext as m, getConfiguredSampler as n, getOrCreateCorrelationId as nt, isInitialized as o, resetEvents as p, explicitSpanStatus as q, getLogger as r, runWithCorrelationId as rt, isLoggerLocked as s, getConfig as t, getCorrelationStorage as tt, shutdown as u, loadYamlConfigFromFile as v, AUTOTEL_DEBUG_BAGGAGE_KEY as w, rememberRequestAttributes as x, createStringRedactor as y, extractLinksFromBatch as z };
4741
+ export { CORRELATION_ID_BAGGAGE_KEY as $, AlwaysSampler as A, extractLinksFromBatch as B, BaggageSpanProcessor as C, AUTOTEL_SAMPLING_TAIL_EVALUATED as D, AUTOTEL_SAMPLING_RATE as E, NeverSampler as F, samplingPresets as G, isForceKept as H, RandomSampler as I, explicitSpanStatus as J, createTraceContext as K, UserIdSampler as L, DeterministicSampler as M, FeatureFlagSampler as N, AUTOTEL_SAMPLING_TAIL_KEEP as O, KeyTargetRateSampler as P, track as Q, createLinkFromHeaders as R, rememberRequestAttributes as S, AUTOTEL_DEBUG_BAGGAGE_KEY as T, markForceKept as U, hashUnitInterval as V, resolveSamplingPreset as W, getContextStorage as X, getActiveContextWithBaggage as Y, getEventQueue as Z, loadYamlConfig as _, init as a, setCorrelationId as at, EnrichedSpanProcessor as b, lockLogger as c, Event as d, generateCorrelationId as et, getEvents as f, hasYamlConfig as g, runInOperationContext as h, getSdk as i, runWithCorrelationId as it, CompositeSampler as j, AdaptiveSampler as k, flush as l, getOperationContext as m, getConfiguredSampler as n, getCorrelationStorage as nt, isInitialized as o, setCorrelationIdInBaggage as ot, resetEvents as p, defineBaggageSchema as q, getLogger as r, getOrCreateCorrelationId as rt, isLoggerLocked as s, getConfig as t, getCorrelationId as tt, shutdown as u, loadYamlConfigFromFile as v, TailSamplingSpanProcessor as w, getRequestSpanIn as x, createStringRedactor as y, debugCaptureRequested as z };
@@ -1,16 +1,16 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.cjs');
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  const require_tracer_provider = require('./tracer-provider.cjs');
4
4
  const require_config = require('./config.cjs');
5
- const require_structured_error = require('./structured-error-DynjWTTu.cjs');
6
- const require_node_require = require('./node-require-BPsB09eC.cjs');
5
+ const require_structured_error = require('./structured-error-Ci8s_M6u.cjs');
6
+ const require_node_require = require('./node-require-BotQNkYw.cjs');
7
7
  const require_filtering_span_processor = require('./filtering-span-processor.cjs');
8
8
  const require_policy = require('./policy.cjs');
9
9
  const require_span_name_normalizer = require('./span-name-normalizer.cjs');
10
10
  const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
11
11
  const require_pretty_console_exporter = require('./pretty-console-exporter-CMzlrRNg.cjs');
12
- const require_canonical_log_line_processor = require('./canonical-log-line-processor-CBRe-VsO.cjs');
13
- const require_channel = require('./channel-D0eaVqn3.cjs');
12
+ const require_canonical_log_line_processor = require('./canonical-log-line-processor-DScNq1g8.cjs');
13
+ const require_channel = require('./channel-3MV-4Aqv.cjs');
14
14
  const require_metric = require('./metric.cjs');
15
15
  let _opentelemetry_api = require("@opentelemetry/api");
16
16
  let _opentelemetry_api_logs = require("@opentelemetry/api-logs");
@@ -2173,6 +2173,47 @@ var RequestAttributesSpanProcessor = class {
2173
2173
  }
2174
2174
  };
2175
2175
 
2176
+ //#endregion
2177
+ //#region src/enriched-span-processor.ts
2178
+ /**
2179
+ * `spanEnrichers` in front of the processors that export, as one processor.
2180
+ *
2181
+ * Spans reach the enrichers first, as they would in a flat list. The
2182
+ * difference is flush and shutdown: the SDK runs those on every processor at
2183
+ * once, so an enricher that ends a span of its own while it drains (an async
2184
+ * judgment, say) would hand it to an exporter that had already closed. Here the
2185
+ * enrichers drain first and the exporters flush after them.
2186
+ */
2187
+ var EnrichedSpanProcessor = class {
2188
+ enrichers;
2189
+ downstream;
2190
+ /** Every processor in call order: the enrichers, then the rest. */
2191
+ processors;
2192
+ constructor(enrichers, downstream) {
2193
+ this.enrichers = enrichers;
2194
+ this.downstream = downstream;
2195
+ this.processors = [...enrichers, ...downstream];
2196
+ }
2197
+ onStart(span, parentContext) {
2198
+ for (const processor of this.processors) processor.onStart(span, parentContext);
2199
+ }
2200
+ onEnd(span) {
2201
+ for (const processor of this.processors) processor.onEnd(span);
2202
+ }
2203
+ forceFlush() {
2204
+ return this.drainThenRun((p) => p.forceFlush());
2205
+ }
2206
+ shutdown() {
2207
+ return this.drainThenRun((p) => p.shutdown());
2208
+ }
2209
+ async drainThenRun(run) {
2210
+ const drained = await Promise.allSettled(this.enrichers.map(async (p) => run(p)));
2211
+ await Promise.all(this.downstream.map(run));
2212
+ const failed = drained.find((r) => r.status === "rejected");
2213
+ if (failed) throw failed.reason;
2214
+ }
2215
+ };
2216
+
2176
2217
  //#endregion
2177
2218
  //#region src/redact-values.ts
2178
2219
  /** Standalone string redaction for use outside the span processor pipeline. */
@@ -4529,7 +4570,7 @@ function init(cfg) {
4529
4570
  }
4530
4571
  if (mergedConfig.spanFilter && spanProcessors.length > 0) spanProcessors = spanProcessors.map((processor) => new require_filtering_span_processor.FilteringSpanProcessor(processor, { filter: mergedConfig.spanFilter }));
4531
4572
  if (spanProcessors.length > 0) spanProcessors.unshift(new RequestAttributesSpanProcessor());
4532
- if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors.unshift(...mergedConfig.spanEnrichers);
4573
+ if (mergedConfig.spanEnrichers && mergedConfig.spanEnrichers.length > 0) spanProcessors = [new EnrichedSpanProcessor(mergedConfig.spanEnrichers, spanProcessors)];
4533
4574
  const metricReaders = [];
4534
4575
  if (configuredMetricReaders && configuredMetricReaders.length > 0) metricReaders.push(...configuredMetricReaders);
4535
4576
  else if (metricsEnabled) for (const destination of otlpDestinations) {
@@ -4762,6 +4803,12 @@ Object.defineProperty(exports, 'DeterministicSampler', {
4762
4803
  return DeterministicSampler;
4763
4804
  }
4764
4805
  });
4806
+ Object.defineProperty(exports, 'EnrichedSpanProcessor', {
4807
+ enumerable: true,
4808
+ get: function () {
4809
+ return EnrichedSpanProcessor;
4810
+ }
4811
+ });
4765
4812
  Object.defineProperty(exports, 'Event', {
4766
4813
  enumerable: true,
4767
4814
  get: function () {
@@ -1,4 +1,4 @@
1
- import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-CvBE0z1p.cjs";
1
+ import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-Cq7K8Okp.cjs";
2
2
  import { s as Logger } from "./logger-b0qgWFy7.cjs";
3
3
  import { g as SamplingPreset, m as Sampler$1 } from "./sampling-CLJmXMw0.cjs";
4
4
  import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.cjs";
@@ -629,7 +629,9 @@ interface AutotelConfig {
629
629
  *
630
630
  * Unlike {@link spanProcessors}, which replaces the pipeline autotel would
631
631
  * have built, these are added to it. Use them for processors that enrich
632
- * rather than export, so `destinations` keeps working:
632
+ * rather than export, so `destinations` keeps working. On flush and
633
+ * shutdown they drain before the exporters do, so a span an enricher ends
634
+ * while draining is still exported:
633
635
  *
634
636
  * @example
635
637
  * ```typescript
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-DF4YrpSB.cjs');
3
- const require_node_require = require('./node-require-BPsB09eC.cjs');
2
+ const require_init = require('./init-DlJvp1WH.cjs');
3
+ const require_node_require = require('./node-require-BotQNkYw.cjs');
4
4
  let _opentelemetry_resources = require("@opentelemetry/resources");
5
5
  let _opentelemetry_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
6
6
  let _opentelemetry_sdk_logs = require("@opentelemetry/sdk-logs");
@@ -1,5 +1,5 @@
1
- import { C as TailSamplingSpanProcessor, r as getLogger } from "./init-CKHEf5g2.js";
2
- import { n as safeRequire, t as requireModule } from "./node-require-CkK_xzL-.js";
1
+ import { r as getLogger, w as TailSamplingSpanProcessor } from "./init-D4TpmUIg.js";
2
+ import { n as safeRequire, t as requireModule } from "./node-require-CY0YUdvZ.js";
3
3
  import { detectResources, hostDetector, processDetector, resourceFromAttributes } from "@opentelemetry/resources";
4
4
  import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
5
5
  import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
@@ -1,4 +1,4 @@
1
- import { l as asString, s as asRecord } from "./values-xBtdXtjA.js";
1
+ import { l as asString, s as asRecord } from "./values-Dm0yEC5p.js";
2
2
  import { getConfig } from "./config.js";
3
3
  import { SpanStatusCode, context, createContextKey, trace } from "@opentelemetry/api";
4
4
 
@@ -1,4 +1,4 @@
1
- const require_values = require('./values-AxGpgYBA.cjs');
1
+ const require_values = require('./values-9A6nOyZm.cjs');
2
2
  const require_config = require('./config.cjs');
3
3
  let _opentelemetry_api = require("@opentelemetry/api");
4
4
 
package/dist/logger.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_logger = require('./logger-C_3xDBOz.cjs');
2
+ const require_logger = require('./logger-CWFxTLtR.cjs');
3
3
 
4
4
  exports.LOG_LEVEL = require_logger.LOG_LEVEL;
5
5
  exports.LoggedOperation = require_logger.LoggedOperation;
package/dist/logger.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as getActiveLogLevel, i as createBuiltinLogger, n as LoggedOperation, o as getTraceContext, r as autotelLogger, s as runWithLogLevel, t as LOG_LEVEL } from "./logger-8Ah2EkH1.js";
1
+ import { a as getActiveLogLevel, i as createBuiltinLogger, n as LoggedOperation, o as getTraceContext, r as autotelLogger, s as runWithLogLevel, t as LOG_LEVEL } from "./logger-4VXLbqWx.js";
2
2
 
3
3
  export { LOG_LEVEL, LoggedOperation, autotelLogger, createBuiltinLogger, getActiveLogLevel, getTraceContext, runWithLogLevel };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  let _opentelemetry_api = require("@opentelemetry/api");
4
4
 
5
5
  //#region src/messaging-adapters.ts
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, l as asString, r as asFunction, s as asRecord } from "./values-xBtdXtjA.js";
1
+ import { l as asString, r as asFunction, s as asRecord, v as readProperty } from "./values-Dm0yEC5p.js";
2
2
  import { TraceFlags } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/messaging-adapters.ts
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-DF4YrpSB.cjs');
3
- const require_values = require('./values-AxGpgYBA.cjs');
4
- const require_functional = require('./functional-BliCZgwO.cjs');
5
- const require_correlated_events = require('./correlated-events-DE_4A3oD.cjs');
2
+ const require_init = require('./init-DlJvp1WH.cjs');
3
+ const require_values = require('./values-9A6nOyZm.cjs');
4
+ const require_functional = require('./functional-DCfOaKoM.cjs');
5
+ const require_correlated_events = require('./correlated-events-wCrXVUby.cjs');
6
6
  const require_trace_factory_validation = require('./trace-factory-validation-CHU1WcjK.cjs');
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
 
package/dist/messaging.js CHANGED
@@ -1,7 +1,7 @@
1
- import { L as createLinkFromHeaders, z as extractLinksFromBatch } from "./init-CKHEf5g2.js";
2
- import { _ as readProperty, b as toAttributeValue, c as asScalar, g as nonEmptyString, h as isFunction, s as asRecord, v as resolveValue, y as splitNameOrOptions } from "./values-xBtdXtjA.js";
3
- import { l as withTracing } from "./functional-C-D0KQg6.js";
4
- import { t as emitCorrelatedEvent } from "./correlated-events-BfpH5uS-.js";
1
+ import { B as extractLinksFromBatch, R as createLinkFromHeaders } from "./init-D4TpmUIg.js";
2
+ import { S as toAttributeValue, _ as nonEmptyString, b as splitNameOrOptions, c as asScalar, g as isFunction, s as asRecord, v as readProperty, y as resolveValue } from "./values-Dm0yEC5p.js";
3
+ import { l as withTracing } from "./functional-7uwlAIJd.js";
4
+ import { t as emitCorrelatedEvent } from "./correlated-events-CZFe6Z1P.js";
5
5
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
6
6
  import { SpanKind, context, propagation } from "@opentelemetry/api";
7
7
 
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.cjs');
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  let node_module = require("node:module");
4
4
  node_module = require_rolldown_runtime.__toESM(node_module, 1);
5
5
 
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, l as asString } from "./values-xBtdXtjA.js";
1
+ import { l as asString, v as readProperty } from "./values-Dm0yEC5p.js";
2
2
  import * as nodeModule from "node:module";
3
3
 
4
4
  //#region src/node-require.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
 
4
4
  //#region src/parse-error.ts
5
5
  /** An HTTP-ish status, however the library that threw chose to spell it. */
@@ -1,4 +1,4 @@
1
- import { _ as readProperty, i as asNumber, l as asString, s as asRecord } from "./values-xBtdXtjA.js";
1
+ import { i as asNumber, l as asString, s as asRecord, v as readProperty } from "./values-Dm0yEC5p.js";
2
2
 
3
3
  //#region src/parse-error.ts
4
4
  /** An HTTP-ish status, however the library that threw chose to spell it. */
package/dist/policy.cjs CHANGED
Binary file
package/dist/policy.js CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_canonical_log_line_processor = require('./canonical-log-line-processor-CBRe-VsO.cjs');
2
+ const require_canonical_log_line_processor = require('./canonical-log-line-processor-DScNq1g8.cjs');
3
3
  let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
4
4
 
5
5
  Object.defineProperty(exports, 'BatchSpanProcessor', {
@@ -1,4 +1,4 @@
1
- import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CntKMtpJ.js";
1
+ import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-naZRETyk.js";
2
2
  import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
3
3
 
4
4
  export { BatchSpanProcessor, CanonicalLogLineProcessor, SimpleSpanProcessor };
package/dist/sampling.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-DF4YrpSB.cjs');
2
+ const require_init = require('./init-DlJvp1WH.cjs');
3
3
 
4
4
  exports.AUTOTEL_DEBUG_BAGGAGE_KEY = require_init.AUTOTEL_DEBUG_BAGGAGE_KEY;
5
5
  exports.AUTOTEL_SAMPLING_RATE = require_init.AUTOTEL_SAMPLING_RATE;
package/dist/sampling.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as CompositeSampler, B as hashUnitInterval, D as AUTOTEL_SAMPLING_TAIL_KEEP, E as AUTOTEL_SAMPLING_TAIL_EVALUATED, F as RandomSampler, H as markForceKept, I as UserIdSampler, L as createLinkFromHeaders, M as FeatureFlagSampler, N as KeyTargetRateSampler, O as AdaptiveSampler, P as NeverSampler, R as debugCaptureRequested, T as AUTOTEL_SAMPLING_RATE, U as resolveSamplingPreset, V as isForceKept, W as samplingPresets, j as DeterministicSampler, k as AlwaysSampler, w as AUTOTEL_DEBUG_BAGGAGE_KEY, z as extractLinksFromBatch } from "./init-CKHEf5g2.js";
1
+ import { A as AlwaysSampler, B as extractLinksFromBatch, D as AUTOTEL_SAMPLING_TAIL_EVALUATED, E as AUTOTEL_SAMPLING_RATE, F as NeverSampler, G as samplingPresets, H as isForceKept, I as RandomSampler, L as UserIdSampler, M as DeterministicSampler, N as FeatureFlagSampler, O as AUTOTEL_SAMPLING_TAIL_KEEP, P as KeyTargetRateSampler, R as createLinkFromHeaders, T as AUTOTEL_DEBUG_BAGGAGE_KEY, U as markForceKept, V as hashUnitInterval, W as resolveSamplingPreset, j as CompositeSampler, k as AdaptiveSampler, z as debugCaptureRequested } from "./init-D4TpmUIg.js";
2
2
 
3
3
  export { AUTOTEL_DEBUG_BAGGAGE_KEY, AUTOTEL_SAMPLING_RATE, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, CompositeSampler, DeterministicSampler, FeatureFlagSampler, KeyTargetRateSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, debugCaptureRequested, extractLinksFromBatch, hashUnitInterval, isForceKept, markForceKept, resolveSamplingPreset, samplingPresets };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_values = require('./values-AxGpgYBA.cjs');
3
- const require_functional = require('./functional-BliCZgwO.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
+ const require_functional = require('./functional-DCfOaKoM.cjs');
4
4
  const require_trace_factory_validation = require('./trace-factory-validation-CHU1WcjK.cjs');
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
6
6
 
@@ -1,5 +1,5 @@
1
- import { b as toAttributeValue, g as nonEmptyString, s as asRecord } from "./values-xBtdXtjA.js";
2
- import { l as withTracing } from "./functional-C-D0KQg6.js";
1
+ import { S as toAttributeValue, _ as nonEmptyString, s as asRecord } from "./values-Dm0yEC5p.js";
2
+ import { l as withTracing } from "./functional-7uwlAIJd.js";
3
3
  import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
4
4
  import { SpanKind } from "@opentelemetry/api";
5
5
 
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.cjs');
2
- const require_values = require('./values-AxGpgYBA.cjs');
2
+ const require_values = require('./values-9A6nOyZm.cjs');
3
3
  let node_crypto = require("node:crypto");
4
4
  node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
5
5