autotel 6.4.1 → 7.0.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 (166) hide show
  1. package/README.md +30 -23
  2. package/dist/{attribute-redacting-processor-Pk7lAzWd.d.cts → attribute-redacting-processor-CvBE0z1p.d.cts} +33 -1
  3. package/dist/{attribute-redacting-processor-Pk7lAzWd.d.ts → attribute-redacting-processor-CvBE0z1p.d.ts} +33 -1
  4. package/dist/attribute-redacting-processor.cjs +34 -32
  5. package/dist/attribute-redacting-processor.d.cts +1 -1
  6. package/dist/attribute-redacting-processor.d.ts +1 -1
  7. package/dist/attribute-redacting-processor.js +35 -32
  8. package/dist/{attributes-aDmJYral.cjs → attributes-Cxys8tgr.cjs} +34 -35
  9. package/dist/{attributes-B7wix2VG.js → attributes-Dt4YUYbP.js} +34 -35
  10. package/dist/attributes.cjs +1 -1
  11. package/dist/attributes.d.cts +1 -1
  12. package/dist/attributes.d.ts +1 -1
  13. package/dist/attributes.js +1 -1
  14. package/dist/auto.cjs +1 -1
  15. package/dist/auto.js +1 -1
  16. package/dist/business-baggage.cjs +19 -12
  17. package/dist/business-baggage.d.cts +8 -3
  18. package/dist/business-baggage.d.ts +8 -3
  19. package/dist/business-baggage.js +19 -12
  20. package/dist/{canonical-log-line-processor-DxtBGZIi.cjs → canonical-log-line-processor-DolzdawH.cjs} +43 -32
  21. package/dist/{canonical-log-line-processor-B4WgG-VS.d.cts → canonical-log-line-processor-cPB4Axk-.d.ts} +4 -3
  22. package/dist/{canonical-log-line-processor-B0vq_QR6.js → canonical-log-line-processor-hFUmS__K.js} +43 -32
  23. package/dist/{canonical-log-line-processor-CL_J7gb5.d.ts → canonical-log-line-processor-l0Aqe6yp.d.cts} +4 -3
  24. package/dist/config.d.cts +1 -1
  25. package/dist/config.d.ts +1 -1
  26. package/dist/{correlated-events-kSwLo3mi.cjs → correlated-events-CcuknWnU.cjs} +2 -1
  27. package/dist/{correlated-events-Bzh5y-UB.js → correlated-events-DwMMbItg.js} +3 -1
  28. package/dist/correlation-id.cjs +1 -1
  29. package/dist/correlation-id.js +1 -1
  30. package/dist/db.cjs +34 -19
  31. package/dist/db.js +34 -19
  32. package/dist/decorators.cjs +4 -2
  33. package/dist/decorators.d.cts +16 -11
  34. package/dist/decorators.d.ts +16 -11
  35. package/dist/decorators.js +4 -2
  36. package/dist/{define-event-CGG048HE.d.cts → define-event-BNeuKUPv.d.cts} +1 -1
  37. package/dist/{define-event-B2z1SBe7.d.ts → define-event-Bd8f8mST.d.ts} +1 -1
  38. package/dist/diagnostics.cjs +18 -16
  39. package/dist/diagnostics.d.cts +14 -10
  40. package/dist/diagnostics.d.ts +14 -10
  41. package/dist/diagnostics.js +18 -16
  42. package/dist/{event-subscriber-CWh8sTGh.d.cts → event-subscriber-DMACQA-1.d.cts} +19 -9
  43. package/dist/{event-subscriber-CWh8sTGh.d.ts → event-subscriber-DMACQA-1.d.ts} +19 -9
  44. package/dist/event-subscriber.d.cts +2 -2
  45. package/dist/event-subscriber.d.ts +2 -2
  46. package/dist/{event-testing-D0qWfqAy.d.cts → event-testing-CBtnJXE5.d.cts} +1 -1
  47. package/dist/{event-testing-CA2mIx1E.d.ts → event-testing-CkPgV3Ii.d.ts} +1 -1
  48. package/dist/event-testing.d.cts +1 -1
  49. package/dist/event-testing.d.ts +1 -1
  50. package/dist/event.cjs +1 -1
  51. package/dist/event.d.cts +5 -5
  52. package/dist/event.d.ts +5 -5
  53. package/dist/event.js +1 -1
  54. package/dist/exception-fingerprint.cjs +133 -0
  55. package/dist/exception-fingerprint.d.cts +51 -0
  56. package/dist/exception-fingerprint.d.ts +51 -0
  57. package/dist/exception-fingerprint.js +126 -0
  58. package/dist/{functional-AT22vCw6.d.ts → functional-CJn2zY4o.d.cts} +96 -39
  59. package/dist/{functional-e6jw5zQj.d.cts → functional-DXy1cHFF.d.ts} +96 -39
  60. package/dist/{functional-qZxRcIBp.cjs → functional-Da6Yv64r.cjs} +27 -15
  61. package/dist/{functional-0o9xSedq.js → functional-uSbNnnxK.js} +27 -15
  62. package/dist/functional.cjs +1 -1
  63. package/dist/functional.d.cts +2 -2
  64. package/dist/functional.d.ts +2 -2
  65. package/dist/functional.js +1 -1
  66. package/dist/http.cjs +11 -8
  67. package/dist/http.js +11 -8
  68. package/dist/{index-DolOVX6F.d.ts → index-CwrNAsgk.d.ts} +22 -26
  69. package/dist/{index-BPcxVucm.d.cts → index-DQHf4cNl.d.cts} +22 -26
  70. package/dist/index.cjs +41 -35
  71. package/dist/index.d.cts +45 -30
  72. package/dist/index.d.ts +45 -30
  73. package/dist/index.js +41 -35
  74. package/dist/{init-CsODvlau.d.ts → init-BgnYi2sm.d.ts} +94 -90
  75. package/dist/{init-BnxHAi2M.cjs → init-D4m5rCmD.cjs} +142 -123
  76. package/dist/{init-Cc7-vvzj.d.cts → init-DrlL1eis.d.cts} +94 -90
  77. package/dist/{init-BxfZ3Vbw.js → init-JtX-KKz_.js} +137 -124
  78. package/dist/instrumentation.cjs +2 -2
  79. package/dist/instrumentation.js +2 -2
  80. package/dist/{logger-D3Ej3DII.js → logger-DdPp__xW.js} +63 -54
  81. package/dist/{logger-CN4xpzMd.d.cts → logger-S1Fgl0g3.d.cts} +0 -20
  82. package/dist/{logger-CN4xpzMd.d.ts → logger-S1Fgl0g3.d.ts} +0 -20
  83. package/dist/{logger-thMPLpOG.cjs → logger-Sm66cjKl.cjs} +63 -54
  84. package/dist/logger.cjs +1 -1
  85. package/dist/logger.d.cts +1 -1
  86. package/dist/logger.d.ts +1 -1
  87. package/dist/logger.js +1 -1
  88. package/dist/messaging-adapters.cjs +26 -12
  89. package/dist/messaging-adapters.d.cts +0 -30
  90. package/dist/messaging-adapters.d.ts +0 -30
  91. package/dist/messaging-adapters.js +26 -12
  92. package/dist/messaging.cjs +37 -34
  93. package/dist/messaging.d.cts +21 -62
  94. package/dist/messaging.d.ts +21 -62
  95. package/dist/messaging.js +37 -34
  96. package/dist/{metric-testing-CpvP3ZIa.d.cts → metric-testing-86WO1wan.d.cts} +1 -1
  97. package/dist/{metric-testing-CWm6UhaR.d.ts → metric-testing-CbCxdPBp.d.ts} +1 -1
  98. package/dist/metric-testing.d.cts +1 -1
  99. package/dist/metric-testing.d.ts +1 -1
  100. package/dist/metric.d.cts +3 -3
  101. package/dist/metric.d.ts +3 -3
  102. package/dist/{node-require-vROmTeJ8.js → node-require-DSPjaw_l.js} +3 -2
  103. package/dist/{node-require-PFqDihze.cjs → node-require-EifOMikz.cjs} +3 -2
  104. package/dist/parse-error.cjs +18 -12
  105. package/dist/parse-error.d.cts +2 -1
  106. package/dist/parse-error.d.ts +2 -1
  107. package/dist/parse-error.js +19 -12
  108. package/dist/policy.cjs +0 -0
  109. package/dist/policy.js +0 -0
  110. package/dist/processors.cjs +1 -1
  111. package/dist/processors.d.cts +1 -1
  112. package/dist/processors.d.ts +1 -1
  113. package/dist/processors.js +1 -1
  114. package/dist/{sampling-BR9fkSwx.d.cts → sampling-CM5S2Lp3.d.ts} +5 -6
  115. package/dist/{sampling-CP3e7-Yr.d.ts → sampling-CmRdnXUi.d.cts} +5 -6
  116. package/dist/sampling.cjs +3 -2
  117. package/dist/sampling.d.cts +1 -1
  118. package/dist/sampling.d.ts +1 -1
  119. package/dist/sampling.js +3 -2
  120. package/dist/semantic-helpers.cjs +9 -9
  121. package/dist/semantic-helpers.d.cts +1 -1
  122. package/dist/semantic-helpers.d.ts +1 -1
  123. package/dist/semantic-helpers.js +9 -9
  124. package/dist/{stable-hash-ChFBIhNt.js → stable-hash-BkoAYVks.js} +4 -3
  125. package/dist/{stable-hash-CS9BxvVQ.cjs → stable-hash-C0pOegH_.cjs} +4 -3
  126. package/dist/{structured-error-CHg7DoIQ.cjs → structured-error--_wXpd_C.cjs} +34 -25
  127. package/dist/{structured-error-9--cxBay.js → structured-error-YIuka-FE.js} +34 -25
  128. package/dist/test-span-collector.cjs +15 -8
  129. package/dist/test-span-collector.js +15 -8
  130. package/dist/testing.cjs +16 -18
  131. package/dist/testing.d.cts +7 -6
  132. package/dist/testing.d.ts +7 -6
  133. package/dist/testing.js +16 -18
  134. package/dist/{trace-context-IuyoPyNq.d.cts → trace-context-C1Cn1q0y.d.cts} +8 -7
  135. package/dist/{trace-context-IuyoPyNq.d.ts → trace-context-f89xPJbK.d.ts} +8 -7
  136. package/dist/trace-helpers.cjs +16 -13
  137. package/dist/trace-helpers.d.cts +9 -4
  138. package/dist/trace-helpers.d.ts +9 -4
  139. package/dist/trace-helpers.js +16 -13
  140. package/dist/tracer-provider.cjs +8 -12
  141. package/dist/tracer-provider.js +8 -12
  142. package/dist/validate.cjs +22 -20
  143. package/dist/validate.d.cts +3 -2
  144. package/dist/validate.d.ts +3 -2
  145. package/dist/validate.js +22 -20
  146. package/dist/values-BenyvWKz.js +141 -0
  147. package/dist/values-CeMH-mYG.d.cts +8 -0
  148. package/dist/values-CeMH-mYG.d.ts +8 -0
  149. package/dist/values-DApyq53y.cjs +267 -0
  150. package/dist/webhook.cjs +3 -3
  151. package/dist/webhook.d.cts +1 -1
  152. package/dist/webhook.d.ts +1 -1
  153. package/dist/webhook.js +3 -3
  154. package/dist/workflow-distributed.cjs +9 -7
  155. package/dist/workflow-distributed.d.cts +9 -8
  156. package/dist/workflow-distributed.d.ts +9 -8
  157. package/dist/workflow-distributed.js +9 -7
  158. package/dist/workflow.cjs +26 -17
  159. package/dist/workflow.d.cts +1 -28
  160. package/dist/workflow.d.ts +1 -28
  161. package/dist/workflow.js +26 -17
  162. package/dist/yaml-config.cjs +26 -11
  163. package/dist/yaml-config.d.cts +9 -3
  164. package/dist/yaml-config.d.ts +9 -3
  165. package/dist/yaml-config.js +26 -11
  166. package/package.json +6 -1
@@ -1,12 +1,12 @@
1
- import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-Pk7lAzWd.cjs";
2
- import { s as Logger } from "./logger-CN4xpzMd.cjs";
3
- import { h as SamplingPreset, p as Sampler } from "./sampling-BR9fkSwx.cjs";
4
- import { a as EventSubscriber } from "./event-subscriber-CWh8sTGh.cjs";
1
+ import { a as AttributeRedactorPreset, r as AttributeRedactorConfig } from "./attribute-redacting-processor-CvBE0z1p.cjs";
2
+ import { s as Logger } from "./logger-S1Fgl0g3.cjs";
3
+ import { h as SamplingPreset, p as Sampler } from "./sampling-CmRdnXUi.cjs";
4
+ import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.cjs";
5
5
  import { r as SpanFilterPredicate } from "./filtering-span-processor-BpDagWNa.cjs";
6
6
  import { r as Policy } from "./policy-CbpP4tFH.cjs";
7
7
  import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.cjs";
8
- import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-B4WgG-VS.cjs";
9
- import { SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
8
+ import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-l0Aqe6yp.cjs";
9
+ import { ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
10
10
  import { Attributes } from "@opentelemetry/api";
11
11
  import { Resource } from "@opentelemetry/resources";
12
12
  import { NodeSDK, NodeSDKConfiguration } from "@opentelemetry/sdk-node";
@@ -223,6 +223,73 @@ interface ProcessHandlersConfig {
223
223
  shutdownTimeoutMs?: number;
224
224
  }
225
225
  //#endregion
226
+ //#region src/canonical-log-lines-config.d.ts
227
+ /**
228
+ * Emit completed spans as canonical wide-event logs.
229
+ *
230
+ * Each span (or only each root span) becomes one comprehensive log record with
231
+ * all span attributes. This provides high-cardinality, structured events
232
+ * without scattering logging calls throughout a request.
233
+ *
234
+ * @example One canonical log line per request
235
+ * ```typescript
236
+ * init({
237
+ * service: 'checkout-api',
238
+ * canonicalLogLines: {
239
+ * enabled: true,
240
+ * rootSpansOnly: true,
241
+ * },
242
+ * });
243
+ * ```
244
+ *
245
+ * @example Custom logger and message
246
+ * ```typescript
247
+ * const logger = pino();
248
+ * init({
249
+ * service: 'checkout-api',
250
+ * logger,
251
+ * canonicalLogLines: {
252
+ * enabled: true,
253
+ * logger,
254
+ * messageFormat: (span) => {
255
+ * const status = span.status.code === 2 ? 'ERROR' : 'SUCCESS';
256
+ * return `${span.name} [${status}]`;
257
+ * },
258
+ * },
259
+ * });
260
+ * ```
261
+ */
262
+ interface CanonicalLogLinesConfig {
263
+ enabled: boolean;
264
+ /** Logger to use for emitting canonical log lines (defaults to OTel Logs API). */
265
+ logger?: Logger;
266
+ /** Only emit canonical log lines for root spans (default: false). */
267
+ rootSpansOnly?: boolean;
268
+ /** Minimum log level for canonical log lines (default: 'info'). */
269
+ minLevel?: 'debug' | 'info' | 'warn' | 'error';
270
+ /** Custom message format (default: uses the span name). */
271
+ messageFormat?: (span: ReadableSpan) => string;
272
+ /** Whether to include resource attributes (default: true). */
273
+ includeResourceAttributes?: boolean;
274
+ /** Predicate to decide whether to emit (runs after the event is built). */
275
+ shouldEmit?: CanonicalLogLineOptions['shouldEmit'];
276
+ /**
277
+ * Declarative tail sampling conditions (OR logic).
278
+ * Ignored when `shouldEmit` is provided.
279
+ * @example keep: [{ status: 500 }, { durationMs: 1000 }]
280
+ */
281
+ keep?: CanonicalLogLineOptions['keep'];
282
+ /** Callback invoked after emit for custom fan-out. */
283
+ drain?: CanonicalLogLineOptions['drain'];
284
+ /** Handler for drain failures. */
285
+ onDrainError?: CanonicalLogLineOptions['onDrainError'];
286
+ /**
287
+ * Pretty-print canonical log lines to console.
288
+ * Defaults to true when NODE_ENV is 'development'.
289
+ */
290
+ pretty?: boolean;
291
+ }
292
+ //#endregion
226
293
  //#region src/otlp-exporters.d.ts
227
294
  type OtlpSignal = 'traces' | 'metrics' | 'logs';
228
295
  interface OtlpDestinationConfig {
@@ -465,6 +532,24 @@ interface AutotelConfig {
465
532
  * ```
466
533
  */
467
534
  spanProcessors?: SpanProcessor[];
535
+ /**
536
+ * Span processors that decorate spans on the way out, running before every
537
+ * exporting processor.
538
+ *
539
+ * Unlike {@link spanProcessors}, which replaces the pipeline autotel would
540
+ * have built, these are added to it. Use them for processors that enrich
541
+ * rather than export, so `destinations` keeps working:
542
+ *
543
+ * @example
544
+ * ```typescript
545
+ * init({
546
+ * service: 'support-agent',
547
+ * destinations: [{ endpoint: `${langfuseUrl}/api/public/otel`, headers }],
548
+ * spanEnrichers: [langfuseCompatibility({ tags: ['production'] })],
549
+ * })
550
+ * ```
551
+ */
552
+ spanEnrichers?: SpanProcessor[];
468
553
  /**
469
554
  * Custom span processor for traces (single-item alias of spanProcessors)
470
555
  * @deprecated Use spanProcessors for consistency with other multi-value config fields
@@ -1105,89 +1190,8 @@ interface AutotelConfig {
1105
1190
  enabled: boolean;
1106
1191
  options?: Record<string, unknown>;
1107
1192
  };
1108
- /**
1109
- * Canonical log lines - automatically emit spans as wide events (canonical log lines)
1110
- *
1111
- * When enabled, each span (or root span only) is automatically emitted as a
1112
- * comprehensive log record with ALL span attributes. This implements the
1113
- * "canonical log line" pattern: one comprehensive event per request with all context.
1114
- *
1115
- * **Benefits:**
1116
- * - One log line per request with all context (wide event)
1117
- * - High-cardinality, high-dimensionality data for powerful queries
1118
- * - Automatic - no manual logging needed
1119
- * - Queryable as structured data instead of string search
1120
- *
1121
- * @example Basic usage (one canonical log line per request)
1122
- * ```typescript
1123
- * init({
1124
- * service: 'checkout-api',
1125
- * canonicalLogLines: {
1126
- * enabled: true,
1127
- * rootSpansOnly: true, // One canonical log line per request
1128
- * },
1129
- * });
1130
- * ```
1131
- *
1132
- * @example With custom logger
1133
- * ```typescript
1134
- * import pino from 'pino';
1135
- * const logger = pino();
1136
- * init({
1137
- * service: 'my-app',
1138
- * logger,
1139
- * canonicalLogLines: {
1140
- * enabled: true,
1141
- * logger, // Use Pino for canonical log lines
1142
- * rootSpansOnly: true,
1143
- * },
1144
- * });
1145
- * ```
1146
- *
1147
- * @example Custom message format
1148
- * ```typescript
1149
- * init({
1150
- * service: 'my-app',
1151
- * canonicalLogLines: {
1152
- * enabled: true,
1153
- * messageFormat: (span) => {
1154
- * const status = span.status.code === 2 ? 'ERROR' : 'SUCCESS';
1155
- * return `${span.name} [${status}]`;
1156
- * },
1157
- * },
1158
- * });
1159
- * ```
1160
- */
1161
- canonicalLogLines?: {
1162
- enabled: boolean;
1163
- /** Logger to use for emitting canonical log lines (defaults to OTel Logs API) */
1164
- logger?: Logger;
1165
- /** Only emit canonical log lines for root spans (default: false) */
1166
- rootSpansOnly?: boolean;
1167
- /** Minimum log level for canonical log lines (default: 'info') */
1168
- minLevel?: 'debug' | 'info' | 'warn' | 'error';
1169
- /** Custom message format (default: uses span name) */
1170
- messageFormat?: (span: import('@opentelemetry/sdk-trace-base').ReadableSpan) => string;
1171
- /** Whether to include resource attributes (default: true) */
1172
- includeResourceAttributes?: boolean;
1173
- /** Predicate to decide whether to emit (runs after event is built). */
1174
- shouldEmit?: CanonicalLogLineOptions['shouldEmit'];
1175
- /**
1176
- * Declarative tail sampling conditions (OR logic).
1177
- * Ignored when `shouldEmit` is provided.
1178
- * @example keep: [{ status: 500 }, { durationMs: 1000 }]
1179
- */
1180
- keep?: CanonicalLogLineOptions['keep'];
1181
- /** Callback invoked after emit for custom fan-out. */
1182
- drain?: CanonicalLogLineOptions['drain'];
1183
- /** Handler for drain failures. */
1184
- onDrainError?: CanonicalLogLineOptions['onDrainError'];
1185
- /**
1186
- * Pretty-print canonical log lines to console.
1187
- * Defaults to true when NODE_ENV is 'development'.
1188
- */
1189
- pretty?: boolean;
1190
- };
1193
+ /** Emit completed spans as canonical wide-event logs. */
1194
+ canonicalLogLines?: CanonicalLogLinesConfig;
1191
1195
  /**
1192
1196
  * Suppress console output while keeping OTel exporters running.
1193
1197
  * Useful for platforms like GCP Cloud Run / AWS Lambda where stdout
@@ -1229,7 +1233,7 @@ declare function isLoggerLocked(): boolean;
1229
1233
  *
1230
1234
  * @example With events (observe in PostHog, Mixpanel, etc.)
1231
1235
  * ```typescript
1232
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
1236
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
1233
1237
  *
1234
1238
  * init({
1235
1239
  * service: 'my-app',