@zudojs/observability 1.2.2 → 1.3.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 (104) hide show
  1. package/README.md +5 -2
  2. package/dist/errors/index.d.ts +0 -1
  3. package/dist/errors/index.js +0 -1
  4. package/dist/errors/observabilityError.core.d.ts +0 -1
  5. package/dist/errors/observabilityError.core.js +0 -1
  6. package/dist/exporter/exporter.console.d.ts +0 -1
  7. package/dist/exporter/exporter.console.js +4 -1
  8. package/dist/exporter/index.d.ts +0 -1
  9. package/dist/exporter/index.js +0 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +0 -1
  12. package/dist/internal/ids.core.d.ts +0 -1
  13. package/dist/internal/ids.core.js +0 -1
  14. package/dist/internal/index.d.ts +0 -1
  15. package/dist/internal/index.js +0 -1
  16. package/dist/logLevel/index.d.ts +0 -1
  17. package/dist/logLevel/index.js +0 -1
  18. package/dist/logLevel/logLevel.bridge.d.ts +0 -1
  19. package/dist/logLevel/logLevel.bridge.js +0 -1
  20. package/dist/logLevel/logLevel.type.d.ts +0 -1
  21. package/dist/logLevel/logLevel.type.js +0 -1
  22. package/dist/logRecord/index.d.ts +0 -1
  23. package/dist/logRecord/index.js +0 -1
  24. package/dist/logRecord/logRecord.core.d.ts +2 -1
  25. package/dist/logRecord/logRecord.core.js +2 -1
  26. package/dist/logger/index.d.ts +0 -1
  27. package/dist/logger/index.js +0 -1
  28. package/dist/logger/logger.core.d.ts +2 -2
  29. package/dist/logger/logger.core.js +4 -2
  30. package/dist/metrics/counter/counter.core.d.ts +0 -1
  31. package/dist/metrics/counter/counter.core.js +0 -1
  32. package/dist/metrics/counter/index.d.ts +0 -1
  33. package/dist/metrics/counter/index.js +0 -1
  34. package/dist/metrics/gauge/gauge.core.d.ts +0 -1
  35. package/dist/metrics/gauge/gauge.core.js +0 -1
  36. package/dist/metrics/gauge/index.d.ts +0 -1
  37. package/dist/metrics/gauge/index.js +0 -1
  38. package/dist/metrics/histogram/histogram.core.d.ts +0 -1
  39. package/dist/metrics/histogram/histogram.core.js +0 -1
  40. package/dist/metrics/histogram/index.d.ts +0 -1
  41. package/dist/metrics/histogram/index.js +0 -1
  42. package/dist/metrics/index.d.ts +0 -1
  43. package/dist/metrics/index.js +0 -1
  44. package/dist/metrics/metrics.reader.d.ts +0 -1
  45. package/dist/metrics/metrics.reader.js +0 -1
  46. package/dist/metrics/metrics.registry.d.ts +0 -1
  47. package/dist/metrics/metrics.registry.js +0 -1
  48. package/dist/noop/index.d.ts +0 -1
  49. package/dist/noop/index.js +0 -1
  50. package/dist/noop/noopObservability.core.d.ts +0 -1
  51. package/dist/noop/noopObservability.core.js +0 -1
  52. package/dist/observability/index.d.ts +0 -1
  53. package/dist/observability/index.js +0 -1
  54. package/dist/observability/observability.core.d.ts +0 -1
  55. package/dist/observability/observability.core.js +0 -1
  56. package/dist/processor/index.d.ts +0 -1
  57. package/dist/processor/index.js +0 -1
  58. package/dist/processor/processor.batch.d.ts +0 -1
  59. package/dist/processor/processor.batch.js +0 -1
  60. package/dist/processor/processor.log.d.ts +0 -1
  61. package/dist/processor/processor.log.js +0 -1
  62. package/dist/propagation/index.d.ts +0 -1
  63. package/dist/propagation/index.js +0 -1
  64. package/dist/propagation/propagation.core.d.ts +0 -1
  65. package/dist/propagation/propagation.core.js +0 -1
  66. package/dist/propagation/propagation.traceparent.d.ts +0 -1
  67. package/dist/propagation/propagation.traceparent.js +0 -1
  68. package/dist/redaction/index.d.ts +0 -1
  69. package/dist/redaction/index.js +0 -1
  70. package/dist/redaction/redaction.core.d.ts +0 -1
  71. package/dist/redaction/redaction.core.js +0 -1
  72. package/dist/redaction/redaction.defaults.d.ts +0 -1
  73. package/dist/redaction/redaction.defaults.js +0 -1
  74. package/dist/sampling/index.d.ts +0 -1
  75. package/dist/sampling/index.js +0 -1
  76. package/dist/sampling/sampler.type.d.ts +0 -1
  77. package/dist/sampling/sampler.type.js +0 -1
  78. package/dist/tracing/index.d.ts +0 -1
  79. package/dist/tracing/index.js +0 -1
  80. package/dist/tracing/span/index.d.ts +0 -1
  81. package/dist/tracing/span/index.js +0 -1
  82. package/dist/tracing/span/span.core.d.ts +0 -1
  83. package/dist/tracing/span/span.core.js +0 -1
  84. package/dist/tracing/span/spanContext.type.d.ts +0 -1
  85. package/dist/tracing/span/spanContext.type.js +0 -1
  86. package/dist/tracing/tracer/index.d.ts +0 -1
  87. package/dist/tracing/tracer/index.js +0 -1
  88. package/dist/tracing/tracer/tracer.active.d.ts +0 -1
  89. package/dist/tracing/tracer/tracer.active.js +0 -1
  90. package/dist/tracing/tracer/tracer.core.d.ts +0 -1
  91. package/dist/tracing/tracer/tracer.core.js +0 -1
  92. package/dist/tracing/tracer/tracer.parent.d.ts +0 -1
  93. package/dist/tracing/tracer/tracer.parent.js +0 -1
  94. package/dist/types/config.types.d.ts +0 -1
  95. package/dist/types/config.types.js +0 -1
  96. package/dist/types/logging.types.d.ts +6 -2
  97. package/dist/types/logging.types.js +0 -1
  98. package/dist/types/metrics.types.d.ts +0 -1
  99. package/dist/types/metrics.types.js +0 -1
  100. package/dist/types/tracing.types.d.ts +0 -1
  101. package/dist/types/tracing.types.js +0 -1
  102. package/dist/types.d.ts +0 -1
  103. package/dist/types.js +0 -1
  104. package/package.json +3 -3
package/README.md CHANGED
@@ -71,7 +71,10 @@ await obs.logger.flush();
71
71
  ```
72
72
 
73
73
  Every record carries `traceId` and `spanId` when a propagation context is
74
- active, so logs and traces line up without threading IDs by hand.
74
+ active — and the context's `requestId` and `correlationId` when it has them
75
+ (`createPropagationContext({ requestId, correlationId })`) — so logs, traces
76
+ and requests line up without threading IDs by hand. `correlate: false`
77
+ turns all four off.
75
78
 
76
79
  `LogLevel` here counts upward in severity (`TRACE = 0 … FATAL = 5`), the
77
80
  opposite of `@zudojs/logger`'s `LoggerLevel` (`FATAL = 0 … TRACE = 5`).
@@ -255,7 +258,7 @@ child, which is what keeps a sampled trace whole across services.
255
258
  import { createPropagationContext } from "@zudojs/observability";
256
259
 
257
260
  await obs.propagation.run(createPropagationContext({ requestId }), async () => {
258
- obs.logger.info("handling"); // carries traceId, spanId
261
+ obs.logger.info("handling"); // carries traceId, spanId, requestId
259
262
  await handle();
260
263
  });
261
264
 
@@ -2,4 +2,3 @@
2
2
  * @zudojs/observability — Errors
3
3
  */
4
4
  export { ObservabilityError, ExporterError, ObservabilityConfigError, MetricValueError, isObservabilityError, } from "./observabilityError.core.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * @zudojs/observability — Errors
3
3
  */
4
4
  export { ObservabilityError, ExporterError, ObservabilityConfigError, MetricValueError, isObservabilityError, } from "./observabilityError.core.js";
5
- //# sourceMappingURL=index.js.map
@@ -28,4 +28,3 @@ export declare class MetricValueError extends ObservabilityError {
28
28
  }
29
29
  /** Determines whether an unknown value is an observability error. */
30
30
  export declare function isObservabilityError(value: unknown): value is ObservabilityError;
31
- //# sourceMappingURL=observabilityError.core.d.ts.map
@@ -44,4 +44,3 @@ export class MetricValueError extends ObservabilityError {
44
44
  export function isObservabilityError(value) {
45
45
  return value instanceof ObservabilityError;
46
46
  }
47
- //# sourceMappingURL=observabilityError.core.js.map
@@ -79,4 +79,3 @@ export declare function createConsoleSpanExporter(options?: ConsoleExporterOptio
79
79
  export declare function createConsoleLogExporter(options?: ConsoleExporterOptions): ConsoleLogExporter;
80
80
  /** Creates a console metric exporter. */
81
81
  export declare function createConsoleMetricExporter(options?: ConsoleExporterOptions): ConsoleMetricExporter;
82
- //# sourceMappingURL=exporter.console.d.ts.map
@@ -115,6 +115,10 @@ export class ConsoleLogExporter {
115
115
  message: record.message,
116
116
  ...(record.traceId ? { traceId: record.traceId } : {}),
117
117
  ...(record.spanId ? { spanId: record.spanId } : {}),
118
+ ...(record.requestId ? { requestId: record.requestId } : {}),
119
+ ...(record.correlationId
120
+ ? { correlationId: record.correlationId }
121
+ : {}),
118
122
  ...(record.context ? { context: record.context } : {}),
119
123
  ...(record.error ? { error: record.error } : {}),
120
124
  }, this.pretty);
@@ -178,4 +182,3 @@ export function createConsoleLogExporter(options) {
178
182
  export function createConsoleMetricExporter(options) {
179
183
  return new ConsoleMetricExporter(options);
180
184
  }
181
- //# sourceMappingURL=exporter.console.js.map
@@ -4,4 +4,3 @@
4
4
  * Console exporters for spans, logs, and metrics, plus no-op exporters.
5
5
  */
6
6
  export { ConsoleSpanExporter, ConsoleLogExporter, ConsoleMetricExporter, createConsoleSpanExporter, createConsoleLogExporter, createConsoleMetricExporter, noopLogExporter, noopMetricExporter, safeStringify, type ConsoleExporterOptions, type ConsoleLike, } from "./exporter.console.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Console exporters for spans, logs, and metrics, plus no-op exporters.
5
5
  */
6
6
  export { ConsoleSpanExporter, ConsoleLogExporter, ConsoleMetricExporter, createConsoleSpanExporter, createConsoleLogExporter, createConsoleMetricExporter, noopLogExporter, noopMetricExporter, safeStringify, } from "./exporter.console.js";
7
- //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -45,4 +45,3 @@ export { BatchSpanProcessor, createBatchSpanProcessor, SimpleSpanProcessor, crea
45
45
  export { createRedactor, createStructureRedactor, redactObject, redactValue, isSensitiveField, DEFAULT_SENSITIVE_FIELDS, CIRCULAR_MARKER, MAX_DEPTH_MARKER, } from "./redaction/index.js";
46
46
  export { NoopObservability, createNoopObservability, noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, INVALID_PROPAGATION_CONTEXT, } from "./noop/index.js";
47
47
  export { DefaultObservability, createObservability, } from "./observability/index.js";
48
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -60,4 +60,3 @@ export { createRedactor, createStructureRedactor, redactObject, redactValue, isS
60
60
  export { NoopObservability, createNoopObservability, noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, INVALID_PROPAGATION_CONTEXT, } from "./noop/index.js";
61
61
  /* ─── Observability Facade ──────────────────────────────────────────────── */
62
62
  export { DefaultObservability, createObservability, } from "./observability/index.js";
63
- //# sourceMappingURL=index.js.map
@@ -23,4 +23,3 @@ export declare function isValidId(id: string, byteLength: number): boolean;
23
23
  export declare function isValidTraceId(traceId: string): boolean;
24
24
  /** True when `spanId` is a valid W3C span ID. */
25
25
  export declare function isValidSpanId(spanId: string): boolean;
26
- //# sourceMappingURL=ids.core.d.ts.map
@@ -48,4 +48,3 @@ export function isValidTraceId(traceId) {
48
48
  export function isValidSpanId(spanId) {
49
49
  return isValidId(spanId, SPAN_ID_BYTES);
50
50
  }
51
- //# sourceMappingURL=ids.core.js.map
@@ -2,4 +2,3 @@
2
2
  * @zudojs/observability — Internal helpers shared across modules.
3
3
  */
4
4
  export { generateHexId, generateTraceId, generateSpanId, isValidId, isValidTraceId, isValidSpanId, TRACE_ID_BYTES, SPAN_ID_BYTES, } from "./ids.core.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * @zudojs/observability — Internal helpers shared across modules.
3
3
  */
4
4
  export { generateHexId, generateTraceId, generateSpanId, isValidId, isValidTraceId, isValidSpanId, TRACE_ID_BYTES, SPAN_ID_BYTES, } from "./ids.core.js";
5
- //# sourceMappingURL=index.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { logLevelToName, logLevelFromName, parseLogLevel, shouldLog, getLogLevelNames, } from "./logLevel.type.js";
7
7
  export { toLoggerLevel, fromLoggerLevel } from "./logLevel.bridge.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { logLevelToName, logLevelFromName, parseLogLevel, shouldLog, getLogLevelNames, } from "./logLevel.type.js";
7
7
  export { toLoggerLevel, fromLoggerLevel } from "./logLevel.bridge.js";
8
- //# sourceMappingURL=index.js.map
@@ -22,4 +22,3 @@ export declare function toLoggerLevel(level: LogLevel): number | undefined;
22
22
  * Returns `undefined` for a value outside `LoggerLevel` (`0`–`5`).
23
23
  */
24
24
  export declare function fromLoggerLevel(level: number): LogLevel | undefined;
25
- //# sourceMappingURL=logLevel.bridge.d.ts.map
@@ -35,4 +35,3 @@ export function fromLoggerLevel(level) {
35
35
  }
36
36
  return (LOGGER_TRACE - level);
37
37
  }
38
- //# sourceMappingURL=logLevel.bridge.js.map
@@ -19,4 +19,3 @@ export declare function parseLogLevel(value: string): LogLevel | undefined;
19
19
  export declare function shouldLog(threshold: LogLevel, messageLevel: LogLevel): boolean;
20
20
  /** Returns all log level names. */
21
21
  export declare function getLogLevelNames(): readonly LogLevelName[];
22
- //# sourceMappingURL=logLevel.type.d.ts.map
@@ -46,4 +46,3 @@ export function shouldLog(threshold, messageLevel) {
46
46
  export function getLogLevelNames() {
47
47
  return LEVEL_NAMES;
48
48
  }
49
- //# sourceMappingURL=logLevel.type.js.map
@@ -4,4 +4,3 @@
4
4
  * Structured log record creation and error log records.
5
5
  */
6
6
  export { createLogRecord, createErrorLogRecord, serializeError, } from "./logRecord.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Structured log record creation and error log records.
5
5
  */
6
6
  export { createLogRecord, createErrorLogRecord, serializeError, } from "./logRecord.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -23,8 +23,9 @@ export declare function createLogRecord(options: {
23
23
  readonly error?: unknown;
24
24
  readonly traceId?: string;
25
25
  readonly spanId?: string;
26
+ readonly requestId?: string;
27
+ readonly correlationId?: string;
26
28
  readonly timestamp?: Date;
27
29
  }): LogRecord;
28
30
  /** Creates a log record for an error. */
29
31
  export declare function createErrorLogRecord(error: unknown, level: LogLevel, loggerName: string, context?: Record<string, unknown>): LogRecord;
30
- //# sourceMappingURL=logRecord.core.d.ts.map
@@ -55,6 +55,8 @@ export function createLogRecord(options) {
55
55
  error: options.error === undefined ? undefined : serializeError(options.error),
56
56
  traceId: options.traceId,
57
57
  spanId: options.spanId,
58
+ requestId: options.requestId,
59
+ correlationId: options.correlationId,
58
60
  };
59
61
  }
60
62
  /** Creates a log record for an error. */
@@ -68,4 +70,3 @@ export function createErrorLogRecord(error, level, loggerName, context) {
68
70
  error,
69
71
  });
70
72
  }
71
- //# sourceMappingURL=logRecord.core.js.map
@@ -4,4 +4,3 @@
4
4
  * Structured logger with level filtering, child loggers, and transport support.
5
5
  */
6
6
  export { StructuredLogger, createStructuredLogger } from "./logger.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Structured logger with level filtering, child loggers, and transport support.
5
5
  */
6
6
  export { StructuredLogger, createStructuredLogger } from "./logger.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -10,7 +10,8 @@ import { LogLevel } from "../types.js";
10
10
  * Core structured logger with level filtering, child loggers,
11
11
  * persistent context, and transport support.
12
12
  *
13
- * Every record is stamped with the ambient `traceId`/`spanId` when a
13
+ * Every record is stamped with the ambient `traceId`/`spanId` — and the
14
+ * context's `requestId`/`correlationId` when it carries them — when a
14
15
  * propagation context is active, so logs and traces line up without the
15
16
  * caller threading IDs through by hand.
16
17
  */
@@ -37,4 +38,3 @@ export declare class StructuredLogger implements Logger {
37
38
  }
38
39
  /** Creates a structured logger. */
39
40
  export declare function createStructuredLogger(options: LoggerOptions): StructuredLogger;
40
- //# sourceMappingURL=logger.core.d.ts.map
@@ -17,7 +17,8 @@ const noopTransport = {
17
17
  * Core structured logger with level filtering, child loggers,
18
18
  * persistent context, and transport support.
19
19
  *
20
- * Every record is stamped with the ambient `traceId`/`spanId` when a
20
+ * Every record is stamped with the ambient `traceId`/`spanId` — and the
21
+ * context's `requestId`/`correlationId` when it carries them — when a
21
22
  * propagation context is active, so logs and traces line up without the
22
23
  * caller threading IDs through by hand.
23
24
  */
@@ -92,6 +93,8 @@ export class StructuredLogger {
92
93
  error,
93
94
  traceId: propagation?.traceId,
94
95
  spanId: propagation?.spanId,
96
+ requestId: propagation?.requestId,
97
+ correlationId: propagation?.correlationId,
95
98
  });
96
99
  // A transport must never take the caller down with it. A failing sink is
97
100
  // reported through the transport's own channel, not raised here.
@@ -109,4 +112,3 @@ export class StructuredLogger {
109
112
  export function createStructuredLogger(options) {
110
113
  return new StructuredLogger(options);
111
114
  }
112
- //# sourceMappingURL=logger.core.js.map
@@ -22,4 +22,3 @@ export declare class DefaultCounter implements Counter {
22
22
  }
23
23
  /** Creates a counter. */
24
24
  export declare function createCounter(name: string, labels?: Record<string, string>): DefaultCounter;
25
- //# sourceMappingURL=counter.core.d.ts.map
@@ -39,4 +39,3 @@ export class DefaultCounter {
39
39
  export function createCounter(name, labels) {
40
40
  return new DefaultCounter(name, labels);
41
41
  }
42
- //# sourceMappingURL=counter.core.js.map
@@ -4,4 +4,3 @@
4
4
  * Monotonically increasing counter for event counts.
5
5
  */
6
6
  export { DefaultCounter, createCounter } from "./counter.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Monotonically increasing counter for event counts.
5
5
  */
6
6
  export { DefaultCounter, createCounter } from "./counter.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -21,4 +21,3 @@ export declare class DefaultGauge implements Gauge {
21
21
  }
22
22
  /** Creates a gauge. */
23
23
  export declare function createGauge(name: string, labels?: Record<string, string>): DefaultGauge;
24
- //# sourceMappingURL=gauge.core.d.ts.map
@@ -43,4 +43,3 @@ export class DefaultGauge {
43
43
  export function createGauge(name, labels) {
44
44
  return new DefaultGauge(name, labels);
45
45
  }
46
- //# sourceMappingURL=gauge.core.js.map
@@ -4,4 +4,3 @@
4
4
  * Value that can go up and down for tracking current state.
5
5
  */
6
6
  export { DefaultGauge, createGauge } from "./gauge.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Value that can go up and down for tracking current state.
5
5
  */
6
6
  export { DefaultGauge, createGauge } from "./gauge.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -38,4 +38,3 @@ export declare class DefaultHistogram implements Histogram {
38
38
  }
39
39
  /** Creates a histogram. */
40
40
  export declare function createHistogram(name: string, labels?: Record<string, string>, boundaries?: readonly number[]): DefaultHistogram;
41
- //# sourceMappingURL=histogram.core.d.ts.map
@@ -140,4 +140,3 @@ export class DefaultHistogram {
140
140
  export function createHistogram(name, labels, boundaries) {
141
141
  return new DefaultHistogram(name, labels, boundaries);
142
142
  }
143
- //# sourceMappingURL=histogram.core.js.map
@@ -4,4 +4,3 @@
4
4
  * Distribution of observed values for latencies and sizes.
5
5
  */
6
6
  export { DefaultHistogram, createHistogram, DEFAULT_BUCKET_BOUNDARIES, } from "./histogram.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Distribution of observed values for latencies and sizes.
5
5
  */
6
6
  export { DefaultHistogram, createHistogram, DEFAULT_BUCKET_BOUNDARIES, } from "./histogram.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -8,4 +8,3 @@ export { DefaultGauge, createGauge } from "./gauge/index.js";
8
8
  export { DefaultHistogram, createHistogram, DEFAULT_BUCKET_BOUNDARIES, } from "./histogram/index.js";
9
9
  export { DefaultMetricsRegistry, createMetricsRegistry, metricKey, type MetricsRegistryOptions, } from "./metrics.registry.js";
10
10
  export { PeriodicMetricReader, createPeriodicMetricReader, type PeriodicMetricReaderOptions, } from "./metrics.reader.js";
11
- //# sourceMappingURL=index.d.ts.map
@@ -8,4 +8,3 @@ export { DefaultGauge, createGauge } from "./gauge/index.js";
8
8
  export { DefaultHistogram, createHistogram, DEFAULT_BUCKET_BOUNDARIES, } from "./histogram/index.js";
9
9
  export { DefaultMetricsRegistry, createMetricsRegistry, metricKey, } from "./metrics.registry.js";
10
10
  export { PeriodicMetricReader, createPeriodicMetricReader, } from "./metrics.reader.js";
11
- //# sourceMappingURL=index.js.map
@@ -36,4 +36,3 @@ export declare class PeriodicMetricReader {
36
36
  }
37
37
  /** Creates a periodic metric reader. */
38
38
  export declare function createPeriodicMetricReader(options: PeriodicMetricReaderOptions): PeriodicMetricReader;
39
- //# sourceMappingURL=metrics.reader.d.ts.map
@@ -78,4 +78,3 @@ export class PeriodicMetricReader {
78
78
  export function createPeriodicMetricReader(options) {
79
79
  return new PeriodicMetricReader(options);
80
80
  }
81
- //# sourceMappingURL=metrics.reader.js.map
@@ -77,4 +77,3 @@ export declare class DefaultMetricsRegistry implements MetricsRegistry {
77
77
  }
78
78
  /** Creates a metrics registry. */
79
79
  export declare function createMetricsRegistry(options?: MetricsRegistryOptions): DefaultMetricsRegistry;
80
- //# sourceMappingURL=metrics.registry.d.ts.map
@@ -190,4 +190,3 @@ export class DefaultMetricsRegistry {
190
190
  export function createMetricsRegistry(options) {
191
191
  return new DefaultMetricsRegistry(options);
192
192
  }
193
- //# sourceMappingURL=metrics.registry.js.map
@@ -4,4 +4,3 @@
4
4
  * No-op implementations that discard all telemetry.
5
5
  */
6
6
  export { NoopObservability, createNoopObservability, noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, INVALID_PROPAGATION_CONTEXT, } from "./noopObservability.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * No-op implementations that discard all telemetry.
5
5
  */
6
6
  export { NoopObservability, createNoopObservability, noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, INVALID_PROPAGATION_CONTEXT, } from "./noopObservability.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -40,4 +40,3 @@ export declare function createNoopObservability(): NoopObservability;
40
40
  /** A propagation context with the reserved invalid IDs. */
41
41
  export declare const INVALID_PROPAGATION_CONTEXT: PropagationContext;
42
42
  export { noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, };
43
- //# sourceMappingURL=noopObservability.core.d.ts.map
@@ -137,4 +137,3 @@ export const INVALID_PROPAGATION_CONTEXT = Object.freeze({
137
137
  traceFlags: TraceFlags.NONE,
138
138
  });
139
139
  export { noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, };
140
- //# sourceMappingURL=noopObservability.core.js.map
@@ -4,4 +4,3 @@
4
4
  * Central facade for logging, metrics, tracing, and context propagation.
5
5
  */
6
6
  export { DefaultObservability, createObservability, } from "./observability.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Central facade for logging, metrics, tracing, and context propagation.
5
5
  */
6
6
  export { DefaultObservability, createObservability, } from "./observability.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -84,4 +84,3 @@ export declare class DefaultObservability implements Observability {
84
84
  /** Creates an observability instance. */
85
85
  export declare function createObservability(config: ObservabilityConfig): DefaultObservability;
86
86
  export {};
87
- //# sourceMappingURL=observability.core.d.ts.map
@@ -294,4 +294,3 @@ function buildAttributeRedactor(redaction) {
294
294
  export function createObservability(config) {
295
295
  return new DefaultObservability(config);
296
296
  }
297
- //# sourceMappingURL=observability.core.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { BatchSpanProcessor, createBatchSpanProcessor, SimpleSpanProcessor, createSimpleSpanProcessor, noopSpanExporter, type BatchSpanProcessorOptions, } from "./processor.batch.js";
7
7
  export { BatchLogProcessor, createBatchLogProcessor, type BatchLogProcessorOptions, } from "./processor.log.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { BatchSpanProcessor, createBatchSpanProcessor, SimpleSpanProcessor, createSimpleSpanProcessor, noopSpanExporter, } from "./processor.batch.js";
7
7
  export { BatchLogProcessor, createBatchLogProcessor, } from "./processor.log.js";
8
- //# sourceMappingURL=index.js.map
@@ -87,4 +87,3 @@ export declare function createSimpleSpanProcessor(options: {
87
87
  readonly exporter: SpanExporter;
88
88
  readonly onError?: (error: unknown, source: string) => void;
89
89
  }): SimpleSpanProcessor;
90
- //# sourceMappingURL=processor.batch.d.ts.map
@@ -175,4 +175,3 @@ export class SimpleSpanProcessor {
175
175
  export function createSimpleSpanProcessor(options) {
176
176
  return new SimpleSpanProcessor(options);
177
177
  }
178
- //# sourceMappingURL=processor.batch.js.map
@@ -53,4 +53,3 @@ export declare class BatchLogProcessor implements LogTransport {
53
53
  }
54
54
  /** Creates a batching log transport. */
55
55
  export declare function createBatchLogProcessor(options: BatchLogProcessorOptions): BatchLogProcessor;
56
- //# sourceMappingURL=processor.log.d.ts.map
@@ -116,4 +116,3 @@ export class BatchLogProcessor {
116
116
  export function createBatchLogProcessor(options) {
117
117
  return new BatchLogProcessor(options);
118
118
  }
119
- //# sourceMappingURL=processor.log.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { createPropagationContext, derivePropagationContext, getCurrentContext, requireCurrentContext, AsyncPropagationManager, createPropagationManager, } from "./propagation.core.js";
7
7
  export { parseTraceparent, formatTraceparent, TRACEPARENT_HEADER, } from "./propagation.traceparent.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { createPropagationContext, derivePropagationContext, getCurrentContext, requireCurrentContext, AsyncPropagationManager, createPropagationManager, } from "./propagation.core.js";
7
7
  export { parseTraceparent, formatTraceparent, TRACEPARENT_HEADER, } from "./propagation.traceparent.js";
8
- //# sourceMappingURL=index.js.map
@@ -47,4 +47,3 @@ export declare class AsyncPropagationManager implements PropagationManager {
47
47
  }
48
48
  /** Creates a propagation manager. */
49
49
  export declare function createPropagationManager(): AsyncPropagationManager;
50
- //# sourceMappingURL=propagation.core.d.ts.map
@@ -96,4 +96,3 @@ export class AsyncPropagationManager {
96
96
  export function createPropagationManager() {
97
97
  return new AsyncPropagationManager();
98
98
  }
99
- //# sourceMappingURL=propagation.core.js.map
@@ -25,4 +25,3 @@ export declare function parseTraceparent(header: string | readonly string[] | un
25
25
  * malformed context is never propagated downstream.
26
26
  */
27
27
  export declare function formatTraceparent(context: Pick<SpanContext, "traceId" | "spanId" | "traceFlags">): string | undefined;
28
- //# sourceMappingURL=propagation.traceparent.d.ts.map
@@ -55,4 +55,3 @@ export function formatTraceparent(context) {
55
55
  .toString(16)
56
56
  .padStart(2, "0")}`;
57
57
  }
58
- //# sourceMappingURL=propagation.traceparent.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { createRedactor, createStructureRedactor, redactObject, redactValue, isSensitiveField, CIRCULAR_MARKER, MAX_DEPTH_MARKER, } from "./redaction.core.js";
7
7
  export { DEFAULT_SENSITIVE_FIELDS } from "./redaction.defaults.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { createRedactor, createStructureRedactor, redactObject, redactValue, isSensitiveField, CIRCULAR_MARKER, MAX_DEPTH_MARKER, } from "./redaction.core.js";
7
7
  export { DEFAULT_SENSITIVE_FIELDS } from "./redaction.defaults.js";
8
- //# sourceMappingURL=index.js.map
@@ -49,4 +49,3 @@ export declare function isSensitiveField(fieldName: string, config?: RedactionCo
49
49
  * matcher on every call.
50
50
  */
51
51
  export declare function createStructureRedactor(config?: RedactionConfig): (value: unknown) => unknown;
52
- //# sourceMappingURL=redaction.core.d.ts.map
@@ -243,4 +243,3 @@ export function createStructureRedactor(config) {
243
243
  const compiled = compile(config);
244
244
  return (value) => walk(value, compiled, 0, new WeakSet());
245
245
  }
246
- //# sourceMappingURL=redaction.core.js.map
@@ -15,4 +15,3 @@
15
15
  * spellings in {@link OBSERVABILITY_EXTRA_FIELDS}.
16
16
  */
17
17
  export declare const DEFAULT_SENSITIVE_FIELDS: readonly string[];
18
- //# sourceMappingURL=redaction.defaults.d.ts.map
@@ -30,4 +30,3 @@ const OBSERVABILITY_EXTRA_FIELDS = [
30
30
  export const DEFAULT_SENSITIVE_FIELDS = Object.freeze([
31
31
  ...new Set([...DEFAULT_LOGGER_SECRET_FIELDS, ...OBSERVABILITY_EXTRA_FIELDS]),
32
32
  ]);
33
- //# sourceMappingURL=redaction.defaults.js.map
@@ -4,4 +4,3 @@
4
4
  * Sampling strategies: AlwaysOn, AlwaysOff, Probability, ParentBased.
5
5
  */
6
6
  export { AlwaysOnSampler, AlwaysOffSampler, ProbabilitySampler, ParentBasedSampler, createAlwaysOnSampler, createAlwaysOffSampler, createProbabilitySampler, createParentBasedSampler, isSampled, isRecording, type ParentBasedSamplerOptions, } from "./sampler.type.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Sampling strategies: AlwaysOn, AlwaysOff, Probability, ParentBased.
5
5
  */
6
6
  export { AlwaysOnSampler, AlwaysOffSampler, ProbabilitySampler, ParentBasedSampler, createAlwaysOnSampler, createAlwaysOffSampler, createProbabilitySampler, createParentBasedSampler, isSampled, isRecording, } from "./sampler.type.js";
7
- //# sourceMappingURL=index.js.map
@@ -64,4 +64,3 @@ export declare function createAlwaysOffSampler(): AlwaysOffSampler;
64
64
  export declare function createProbabilitySampler(probability: number): ProbabilitySampler;
65
65
  /** Creates a parent-based sampler. */
66
66
  export declare function createParentBasedSampler(rootOrOptions?: Sampler | ParentBasedSamplerOptions): ParentBasedSampler;
67
- //# sourceMappingURL=sampler.type.d.ts.map
@@ -106,4 +106,3 @@ export function createProbabilitySampler(probability) {
106
106
  export function createParentBasedSampler(rootOrOptions) {
107
107
  return new ParentBasedSampler(rootOrOptions);
108
108
  }
109
- //# sourceMappingURL=sampler.type.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { DefaultSpan, createSpan, createSpanContext, createChildSpanContext, isSampledContext, isValidSpanContext, } from "./span/index.js";
7
7
  export { DefaultTracer, createTracer, withSpan, type TracerOptions, } from "./tracer/index.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { DefaultSpan, createSpan, createSpanContext, createChildSpanContext, isSampledContext, isValidSpanContext, } from "./span/index.js";
7
7
  export { DefaultTracer, createTracer, withSpan, } from "./tracer/index.js";
8
- //# sourceMappingURL=index.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { DefaultSpan, createSpan } from "./span.core.js";
7
7
  export { createSpanContext, createChildSpanContext, isSampledContext, isValidSpanContext, } from "./spanContext.type.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { DefaultSpan, createSpan } from "./span.core.js";
7
7
  export { createSpanContext, createChildSpanContext, isSampledContext, isValidSpanContext, } from "./spanContext.type.js";
8
- //# sourceMappingURL=index.js.map
@@ -82,4 +82,3 @@ export declare class DefaultSpan implements Span {
82
82
  }
83
83
  /** Creates a new span. */
84
84
  export declare function createSpan(name: string, options?: SpanOptions & SpanInternalOptions): DefaultSpan;
85
- //# sourceMappingURL=span.core.d.ts.map
@@ -199,4 +199,3 @@ export function createSpan(name, options) {
199
199
  : createSpanContext();
200
200
  return new DefaultSpan(name, context, options);
201
201
  }
202
- //# sourceMappingURL=span.core.js.map
@@ -38,4 +38,3 @@ export declare function createChildSpanContext(parent: SpanContext, overrides?:
38
38
  }): SpanContext;
39
39
  /** True when the context carries the W3C sampled flag. */
40
40
  export declare function isSampledContext(context: SpanContext): boolean;
41
- //# sourceMappingURL=spanContext.type.d.ts.map
@@ -62,4 +62,3 @@ export function isSampledContext(context) {
62
62
  return (((context.traceFlags ?? TraceFlags.NONE) & TraceFlags.SAMPLED) ===
63
63
  TraceFlags.SAMPLED);
64
64
  }
65
- //# sourceMappingURL=spanContext.type.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { DefaultTracer, createTracer, type TracerOptions, } from "./tracer.core.js";
7
7
  export { withSpan } from "./tracer.active.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { DefaultTracer, createTracer, } from "./tracer.core.js";
7
7
  export { withSpan } from "./tracer.active.js";
8
- //# sourceMappingURL=index.js.map
@@ -16,4 +16,3 @@ import type { Span, SpanOptions, Tracer } from "../../types.js";
16
16
  * rejection is recorded on the span and re-thrown.
17
17
  */
18
18
  export declare function withSpan<T>(tracer: Tracer, name: string, fn: (span: Span) => T, options?: SpanOptions): T;
19
- //# sourceMappingURL=tracer.active.d.ts.map
@@ -64,4 +64,3 @@ export function withSpan(tracer, name, fn, options) {
64
64
  });
65
65
  });
66
66
  }
67
- //# sourceMappingURL=tracer.active.js.map
@@ -63,4 +63,3 @@ export declare class DefaultTracer implements Tracer {
63
63
  }
64
64
  /** Creates a tracer. */
65
65
  export declare function createTracer(options?: TracerOptions): DefaultTracer;
66
- //# sourceMappingURL=tracer.core.d.ts.map
@@ -124,4 +124,3 @@ export class DefaultTracer {
124
124
  export function createTracer(options) {
125
125
  return new DefaultTracer(options);
126
126
  }
127
- //# sourceMappingURL=tracer.core.js.map
@@ -25,4 +25,3 @@ export interface ResolvedSpanParent {
25
25
  * trace ID.
26
26
  */
27
27
  export declare function resolveSpanParent(explicit?: SpanContext): ResolvedSpanParent;
28
- //# sourceMappingURL=tracer.parent.d.ts.map
@@ -33,4 +33,3 @@ export function resolveSpanParent(explicit) {
33
33
  samplerParent: ambient.traceFlags === undefined ? undefined : parent,
34
34
  };
35
35
  }
36
- //# sourceMappingURL=tracer.parent.js.map
@@ -147,4 +147,3 @@ export interface ObservabilityConfig {
147
147
  /** Reports a telemetry failure that would otherwise be swallowed. */
148
148
  readonly onError?: (error: unknown, source: string) => void;
149
149
  }
150
- //# sourceMappingURL=config.types.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * Configuration types for the observability package.
3
3
  */
4
4
  export {};
5
- //# sourceMappingURL=config.types.js.map
@@ -38,6 +38,10 @@ export interface LogRecord {
38
38
  readonly traceId?: string;
39
39
  /** Span this record was emitted under, when a propagation context is active. */
40
40
  readonly spanId?: string;
41
+ /** `requestId` of the active propagation context, when it carries one. */
42
+ readonly requestId?: string;
43
+ /** `correlationId` of the active propagation context, when it carries one. */
44
+ readonly correlationId?: string;
41
45
  }
42
46
  /** Structured logger interface. */
43
47
  export interface Logger {
@@ -69,7 +73,8 @@ export interface LoggerOptions {
69
73
  readonly context?: Record<string, unknown>;
70
74
  readonly transport?: LogTransport;
71
75
  /**
72
- * Stamps `traceId` and `spanId` onto every record from the ambient
76
+ * Stamps `traceId`, `spanId` and, when the context carries them,
77
+ * `requestId` and `correlationId` onto every record from the ambient
73
78
  * propagation context. Defaults to `true`.
74
79
  */
75
80
  readonly correlate?: boolean;
@@ -91,4 +96,3 @@ export interface LogExporter {
91
96
  export(records: readonly LogRecord[]): Promise<void>;
92
97
  shutdown(): Promise<void>;
93
98
  }
94
- //# sourceMappingURL=logging.types.d.ts.map
@@ -17,4 +17,3 @@ export var LogLevel;
17
17
  LogLevel[LogLevel["FATAL"] = 5] = "FATAL";
18
18
  LogLevel[LogLevel["OFF"] = 6] = "OFF";
19
19
  })(LogLevel || (LogLevel = {}));
20
- //# sourceMappingURL=logging.types.js.map
@@ -90,4 +90,3 @@ export interface MetricExporter {
90
90
  export(snapshots: readonly MetricSnapshot[]): Promise<void>;
91
91
  shutdown(): Promise<void>;
92
92
  }
93
- //# sourceMappingURL=metrics.types.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * Metrics types for the observability package.
3
3
  */
4
4
  export {};
5
- //# sourceMappingURL=metrics.types.js.map
@@ -112,4 +112,3 @@ export interface SpanProcessor {
112
112
  forceFlush?(): Promise<void>;
113
113
  shutdown(): Promise<void>;
114
114
  }
115
- //# sourceMappingURL=tracing.types.d.ts.map
@@ -25,4 +25,3 @@ export var SpanKind;
25
25
  SpanKind["PRODUCER"] = "PRODUCER";
26
26
  SpanKind["CONSUMER"] = "CONSUMER";
27
27
  })(SpanKind || (SpanKind = {}));
28
- //# sourceMappingURL=tracing.types.js.map
package/dist/types.d.ts CHANGED
@@ -7,4 +7,3 @@ export * from "./types/logging.types.js";
7
7
  export * from "./types/metrics.types.js";
8
8
  export * from "./types/tracing.types.js";
9
9
  export * from "./types/config.types.js";
10
- //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -7,4 +7,3 @@ export * from "./types/logging.types.js";
7
7
  export * from "./types/metrics.types.js";
8
8
  export * from "./types/tracing.types.js";
9
9
  export * from "./types/config.types.js";
10
- //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zudojs/observability",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Structured logging, metrics, tracing, context propagation, and exporters for Zudojs applications.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -26,8 +26,8 @@
26
26
  "!dist/.tsbuildinfo"
27
27
  ],
28
28
  "dependencies": {
29
- "@zudojs/errors": "1.3.1",
30
- "@zudojs/logger": "1.4.2"
29
+ "@zudojs/errors": "1.4.0",
30
+ "@zudojs/logger": "1.5.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "typescript": "7.0.2",