@btravstack/observability 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -154,8 +154,10 @@ import { UnitSpanModule, otel } from "@btravstack/observability/otel";
154
154
  // Configuration is the OTEL_* environment conventions, read by the SDK itself.
155
155
  const AppImports = [observability(), otel()];
156
156
 
157
- // A span per kernel unit, correlated with the same ids the logger stamps:
158
- // runMain(App, { unit: UnitSpanModule })
157
+ // A span per unit, correlated with the same ids the logger stamps — bound on
158
+ // the starter's own `unit` option and forked by the runtime around each
159
+ // request, delivery or activity attempt, e.g.
160
+ // http({ unit: { anonymous: UnitSpanModule } })
159
161
  ```
160
162
 
161
163
  Inbound W3C `traceparent` feeds the unit's trace id in `@btravstack/http-server` and
package/dist/index.d.cts CHANGED
@@ -13,7 +13,7 @@ import { Module } from "@btravstack/di";
13
13
  * `Config.string`, so it inherits the semantics every other variable has: an
14
14
  * unset variable takes the default, a set-but-blank one is an error.
15
15
  */
16
- declare const logLevel: (options?: {
16
+ export declare const logLevel: (options?: {
17
17
  readonly default?: Level;
18
18
  }) => ConfigField<Level>;
19
19
  /** What `observability()` binds from the environment. */
@@ -32,7 +32,7 @@ type LoggerSettings = {
32
32
  * The unit's ids are spread at the top level rather than nested under `unit`,
33
33
  * because `traceId` is the field an operator searches.
34
34
  */
35
- declare const jsonSink: (stream?: {
35
+ export declare const jsonSink: (stream?: {
36
36
  readonly write: (chunk: string) => unknown;
37
37
  }) => Sink;
38
38
  //#endregion
@@ -43,7 +43,7 @@ declare const LoggerConfig_base: import("@btravstack/di").PortClass<"LoggerConfi
43
43
  * filters at. A port of its own, like a starter's `HttpConfig`, so anything
44
44
  * that wants to know reads it rather than re-deriving it.
45
45
  */
46
- declare class LoggerConfig extends LoggerConfig_base<LoggerSettings> {}
46
+ export declare class LoggerConfig extends LoggerConfig_base<LoggerSettings> {}
47
47
  type ObservabilityOptions = {
48
48
  /**
49
49
  * Where lines go. Default: one JSON object per line on `stdout`. The
@@ -63,7 +63,7 @@ type ObservabilityOptions = {
63
63
  * `currentUnit()` per call — so a request's lines are attributable with no
64
64
  * argument threaded through the call stack.
65
65
  */
66
- declare const observability: (options?: ObservabilityOptions) => Module<Logger | LoggerConfig | Observers, ConfigInvalid, Env>;
66
+ export declare const observability: (options?: ObservabilityOptions) => Module<Logger | LoggerConfig | Observers, ConfigInvalid, Env>;
67
67
  /**
68
68
  * The kernel's nine lifecycle events, as log lines on `logger` — the adapter
69
69
  * between `StartOptions.onEvent` and an application's own stream.
@@ -76,6 +76,6 @@ declare const observability: (options?: ObservabilityOptions) => Module<Logger |
76
76
  * The logger is a PARAMETER, not resolved: `building` is emitted while the graph
77
77
  * is still being built, so the sink cannot come from the context it watches.
78
78
  */
79
- declare const kernelEvents: (logger: LoggerService) => EventSink;
79
+ export declare const kernelEvents: (logger: LoggerService) => EventSink;
80
80
  //#endregion
81
- export { type Line, LoggerConfig, type LoggerSettings, type ObservabilityOptions, type Sink, createLogger, jsonSink, kernelEvents, logLevel, observability };
81
+ export { type Line, type LoggerSettings, type ObservabilityOptions, type Sink, createLogger };
package/dist/index.d.mts CHANGED
@@ -13,7 +13,7 @@ import { Module } from "@btravstack/di";
13
13
  * `Config.string`, so it inherits the semantics every other variable has: an
14
14
  * unset variable takes the default, a set-but-blank one is an error.
15
15
  */
16
- declare const logLevel: (options?: {
16
+ export declare const logLevel: (options?: {
17
17
  readonly default?: Level;
18
18
  }) => ConfigField<Level>;
19
19
  /** What `observability()` binds from the environment. */
@@ -32,7 +32,7 @@ type LoggerSettings = {
32
32
  * The unit's ids are spread at the top level rather than nested under `unit`,
33
33
  * because `traceId` is the field an operator searches.
34
34
  */
35
- declare const jsonSink: (stream?: {
35
+ export declare const jsonSink: (stream?: {
36
36
  readonly write: (chunk: string) => unknown;
37
37
  }) => Sink;
38
38
  //#endregion
@@ -43,7 +43,7 @@ declare const LoggerConfig_base: import("@btravstack/di").PortClass<"LoggerConfi
43
43
  * filters at. A port of its own, like a starter's `HttpConfig`, so anything
44
44
  * that wants to know reads it rather than re-deriving it.
45
45
  */
46
- declare class LoggerConfig extends LoggerConfig_base<LoggerSettings> {}
46
+ export declare class LoggerConfig extends LoggerConfig_base<LoggerSettings> {}
47
47
  type ObservabilityOptions = {
48
48
  /**
49
49
  * Where lines go. Default: one JSON object per line on `stdout`. The
@@ -63,7 +63,7 @@ type ObservabilityOptions = {
63
63
  * `currentUnit()` per call — so a request's lines are attributable with no
64
64
  * argument threaded through the call stack.
65
65
  */
66
- declare const observability: (options?: ObservabilityOptions) => Module<Logger | LoggerConfig | Observers, ConfigInvalid, Env>;
66
+ export declare const observability: (options?: ObservabilityOptions) => Module<Logger | LoggerConfig | Observers, ConfigInvalid, Env>;
67
67
  /**
68
68
  * The kernel's nine lifecycle events, as log lines on `logger` — the adapter
69
69
  * between `StartOptions.onEvent` and an application's own stream.
@@ -76,6 +76,6 @@ declare const observability: (options?: ObservabilityOptions) => Module<Logger |
76
76
  * The logger is a PARAMETER, not resolved: `building` is emitted while the graph
77
77
  * is still being built, so the sink cannot come from the context it watches.
78
78
  */
79
- declare const kernelEvents: (logger: LoggerService) => EventSink;
79
+ export declare const kernelEvents: (logger: LoggerService) => EventSink;
80
80
  //#endregion
81
- export { type Line, LoggerConfig, type LoggerSettings, type ObservabilityOptions, type Sink, createLogger, jsonSink, kernelEvents, logLevel, observability };
81
+ export { type Line, type LoggerSettings, type ObservabilityOptions, type Sink, createLogger };
package/dist/otel.cjs CHANGED
@@ -112,9 +112,9 @@ const otel = (options) => (0, _btravstack_di.Module)("Otel")({
112
112
  /** The span a unit rides, ended when the unit's fork closes. */
113
113
  var UnitSpan = class extends (0, _btravstack_di.Port)("UnitSpan") {};
114
114
  /**
115
- * A span per kernel unit, as a `StartOptions.unit` module: the kernel forks it
116
- * per unit and tears it down inside the unit's ambient record, so the span opens
117
- * when the unit does and `onStop` ends it on every path out.
115
+ * A span per unit, as a module a starter's own `unit` option binds: the runtime
116
+ * forks it around every unit it opens, so the span opens when the fork is built
117
+ * and `onStop` ends it on every path out.
118
118
  *
119
119
  * The correlation is the ambient record's own, carried as attributes so a span
120
120
  * joins the same query the logger's lines answer. The remote PARENT is
@@ -122,7 +122,8 @@ var UnitSpan = class extends (0, _btravstack_di.Port)("UnitSpan") {};
122
122
  * id alone, so this correlates by attribute rather than pretending to a W3C
123
123
  * parent-child edge it cannot prove.
124
124
  *
125
- * Compose it as `start`'s `unit`; the root must export `Tracer`.
125
+ * Bind it as a starter's `unit` module — `unit: { anonymous: UnitSpanModule }`,
126
+ * `unit: { message: … }`, `unit: { activity: … }`; the root must export `Tracer`.
126
127
  */
127
128
  const UnitSpanModule = (0, _btravstack_di.Module)("UnitSpan")({
128
129
  needs: [_btravstack_core.Tracer],
package/dist/otel.d.cts CHANGED
@@ -29,14 +29,14 @@ import { NodeSDKConfiguration } from "@opentelemetry/sdk-node";
29
29
  * plan time and in `Needs`. Guice's `newSetBinder` declares the empty set for
30
30
  * the same reason.
31
31
  */
32
- declare const otel: (options?: Partial<NodeSDKConfiguration>) => Module<Tracer | Meter | Observers, never, Scope>;
32
+ export declare const otel: (options?: Partial<NodeSDKConfiguration>) => Module<Tracer | Meter | Observers, never, Scope>;
33
33
  declare const UnitSpan_base: import("@btravstack/di").PortClass<"UnitSpan">;
34
34
  /** The span a unit rides, ended when the unit's fork closes. */
35
- declare class UnitSpan extends UnitSpan_base<Span> {}
35
+ export declare class UnitSpan extends UnitSpan_base<Span> {}
36
36
  /**
37
- * A span per kernel unit, as a `StartOptions.unit` module: the kernel forks it
38
- * per unit and tears it down inside the unit's ambient record, so the span opens
39
- * when the unit does and `onStop` ends it on every path out.
37
+ * A span per unit, as a module a starter's own `unit` option binds: the runtime
38
+ * forks it around every unit it opens, so the span opens when the fork is built
39
+ * and `onStop` ends it on every path out.
40
40
  *
41
41
  * The correlation is the ambient record's own, carried as attributes so a span
42
42
  * joins the same query the logger's lines answer. The remote PARENT is
@@ -44,8 +44,8 @@ declare class UnitSpan extends UnitSpan_base<Span> {}
44
44
  * id alone, so this correlates by attribute rather than pretending to a W3C
45
45
  * parent-child edge it cannot prove.
46
46
  *
47
- * Compose it as `start`'s `unit`; the root must export `Tracer`.
47
+ * Bind it as a starter's `unit` module — `unit: { anonymous: UnitSpanModule }`,
48
+ * `unit: { message: … }`, `unit: { activity: … }`; the root must export `Tracer`.
48
49
  */
49
- declare const UnitSpanModule: Module<UnitSpan, never, Scope | Tracer>;
50
- //#endregion
51
- export { UnitSpan, UnitSpanModule, otel };
50
+ export declare const UnitSpanModule: Module<UnitSpan, never, Scope | Tracer>;
51
+ //#endregion
package/dist/otel.d.mts CHANGED
@@ -29,14 +29,14 @@ import { NodeSDKConfiguration } from "@opentelemetry/sdk-node";
29
29
  * plan time and in `Needs`. Guice's `newSetBinder` declares the empty set for
30
30
  * the same reason.
31
31
  */
32
- declare const otel: (options?: Partial<NodeSDKConfiguration>) => Module<Tracer | Meter | Observers, never, Scope>;
32
+ export declare const otel: (options?: Partial<NodeSDKConfiguration>) => Module<Tracer | Meter | Observers, never, Scope>;
33
33
  declare const UnitSpan_base: import("@btravstack/di").PortClass<"UnitSpan">;
34
34
  /** The span a unit rides, ended when the unit's fork closes. */
35
- declare class UnitSpan extends UnitSpan_base<Span> {}
35
+ export declare class UnitSpan extends UnitSpan_base<Span> {}
36
36
  /**
37
- * A span per kernel unit, as a `StartOptions.unit` module: the kernel forks it
38
- * per unit and tears it down inside the unit's ambient record, so the span opens
39
- * when the unit does and `onStop` ends it on every path out.
37
+ * A span per unit, as a module a starter's own `unit` option binds: the runtime
38
+ * forks it around every unit it opens, so the span opens when the fork is built
39
+ * and `onStop` ends it on every path out.
40
40
  *
41
41
  * The correlation is the ambient record's own, carried as attributes so a span
42
42
  * joins the same query the logger's lines answer. The remote PARENT is
@@ -44,8 +44,8 @@ declare class UnitSpan extends UnitSpan_base<Span> {}
44
44
  * id alone, so this correlates by attribute rather than pretending to a W3C
45
45
  * parent-child edge it cannot prove.
46
46
  *
47
- * Compose it as `start`'s `unit`; the root must export `Tracer`.
47
+ * Bind it as a starter's `unit` module — `unit: { anonymous: UnitSpanModule }`,
48
+ * `unit: { message: … }`, `unit: { activity: … }`; the root must export `Tracer`.
48
49
  */
49
- declare const UnitSpanModule: Module<UnitSpan, never, Scope | Tracer>;
50
- //#endregion
51
- export { UnitSpan, UnitSpanModule, otel };
50
+ export declare const UnitSpanModule: Module<UnitSpan, never, Scope | Tracer>;
51
+ //#endregion
package/dist/otel.mjs CHANGED
@@ -111,9 +111,9 @@ const otel = (options) => Module("Otel")({
111
111
  /** The span a unit rides, ended when the unit's fork closes. */
112
112
  var UnitSpan = class extends Port("UnitSpan") {};
113
113
  /**
114
- * A span per kernel unit, as a `StartOptions.unit` module: the kernel forks it
115
- * per unit and tears it down inside the unit's ambient record, so the span opens
116
- * when the unit does and `onStop` ends it on every path out.
114
+ * A span per unit, as a module a starter's own `unit` option binds: the runtime
115
+ * forks it around every unit it opens, so the span opens when the fork is built
116
+ * and `onStop` ends it on every path out.
117
117
  *
118
118
  * The correlation is the ambient record's own, carried as attributes so a span
119
119
  * joins the same query the logger's lines answer. The remote PARENT is
@@ -121,7 +121,8 @@ var UnitSpan = class extends Port("UnitSpan") {};
121
121
  * id alone, so this correlates by attribute rather than pretending to a W3C
122
122
  * parent-child edge it cannot prove.
123
123
  *
124
- * Compose it as `start`'s `unit`; the root must export `Tracer`.
124
+ * Bind it as a starter's `unit` module — `unit: { anonymous: UnitSpanModule }`,
125
+ * `unit: { message: … }`, `unit: { activity: … }`; the root must export `Tracer`.
125
126
  */
126
127
  const UnitSpanModule = Module("UnitSpan")({
127
128
  needs: [Tracer],
package/dist/pino.d.cts CHANGED
@@ -22,6 +22,5 @@ import { Logger } from "pino";
22
22
  * validated at startup. `fatal` and `trace` map to pino's own; the ambient
23
23
  * unit's ids ride as fields, not as a message prefix, so they stay indexable.
24
24
  */
25
- declare const pinoSink: (logger: Logger) => Sink;
26
- //#endregion
27
- export { pinoSink };
25
+ export declare const pinoSink: (logger: Logger) => Sink;
26
+ //#endregion
package/dist/pino.d.mts CHANGED
@@ -22,6 +22,5 @@ import { Logger } from "pino";
22
22
  * validated at startup. `fatal` and `trace` map to pino's own; the ambient
23
23
  * unit's ids ride as fields, not as a message prefix, so they stay indexable.
24
24
  */
25
- declare const pinoSink: (logger: Logger) => Sink;
26
- //#endregion
27
- export { pinoSink };
25
+ export declare const pinoSink: (logger: Logger) => Sink;
26
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btravstack/observability",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Observability for @btravstack/core: a strict Logger port correlated with the kernel's units, a dependency-free JSON sink, and the lifecycle events as log lines",
5
5
  "keywords": [
6
6
  "dependency-injection",
@@ -65,31 +65,31 @@
65
65
  "./package.json": "./package.json"
66
66
  },
67
67
  "devDependencies": {
68
- "@btravstack/tsconfig": "0.2.0",
68
+ "@btravstack/tsconfig": "0.4.0",
69
69
  "@opentelemetry/api": "1.9.1",
70
- "@opentelemetry/sdk-node": "0.221.0",
71
- "@opentelemetry/sdk-trace": "2.10.0",
72
- "@types/node": "26.4.0",
73
- "@unthrown/vitest": "5.7.0",
70
+ "@opentelemetry/sdk-node": "0.222.0",
71
+ "@opentelemetry/sdk-trace": "2.11.0",
72
+ "@types/node": "26.4.1",
73
+ "@unthrown/vitest": "5.8.0",
74
74
  "@vitest/coverage-v8": "4.1.11",
75
75
  "pino": "10.3.1",
76
- "tsdown": "0.22.14",
76
+ "tsdown": "0.23.0",
77
77
  "typescript": "7.0.2",
78
- "unthrown": "5.7.0",
78
+ "unthrown": "5.8.0",
79
79
  "vitest": "4.1.11",
80
- "@btravstack/config": "0.12.0",
81
- "@btravstack/core": "0.12.0",
82
- "@btravstack/di": "0.12.0",
83
- "@btravstack/testing": "0.12.0"
80
+ "@btravstack/config": "0.14.0",
81
+ "@btravstack/core": "0.14.0",
82
+ "@btravstack/di": "0.14.0",
83
+ "@btravstack/testing": "0.14.0"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@opentelemetry/api": "^1.9.0",
87
87
  "@opentelemetry/sdk-node": "^0.221.0",
88
88
  "pino": "^10",
89
89
  "unthrown": "^5.0.0",
90
- "@btravstack/config": "^0.12.0",
91
- "@btravstack/core": "^0.12.0",
92
- "@btravstack/di": "^0.12.0"
90
+ "@btravstack/config": "^0.14.0",
91
+ "@btravstack/core": "^0.14.0",
92
+ "@btravstack/di": "^0.14.0"
93
93
  },
94
94
  "peerDependenciesMeta": {
95
95
  "@opentelemetry/api": {