@nodii/telemetry 0.15.0 → 0.17.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.
@@ -0,0 +1,58 @@
1
+ import type { AuditArgs } from "./audit.js";
2
+ /** Options for {@link AuditBuffer}. */
3
+ export interface AuditBufferOptions {
4
+ /**
5
+ * Sink for flushed coalesced rows — typically `(args) => audit.emit(args)`
6
+ * (Pattern C, out-of-band: the writer owns its own tx). Errors are routed to
7
+ * {@link AuditBufferOptions.onFlushError}; a rejecting sink never throws out
8
+ * of `record()`.
9
+ */
10
+ flush: (args: AuditArgs) => void | Promise<void>;
11
+ /** Coalesce window in ms. Default 60_000 (§ 9 default 60s). */
12
+ windowMs?: number;
13
+ /**
14
+ * Upper bound on the per-row `metadata.queries` array, to cap memory under a
15
+ * read flood. `read_count` stays accurate; queries beyond the cap are dropped
16
+ * (the count records that they happened). Default 200.
17
+ */
18
+ maxQueries?: number;
19
+ /**
20
+ * Called when the `flush` sink throws/rejects, instead of the rejection being
21
+ * swallowed silently. The buffer entry is already removed when this fires, so
22
+ * a coalesced row CAN be lost on a sink failure — wire this to your logger.
23
+ */
24
+ onFlushError?: (err: unknown, key: string) => void;
25
+ }
26
+ /** Per-read input to {@link AuditBuffer.record}. */
27
+ export interface AuditReadRecord {
28
+ /**
29
+ * The request path PATTERN (templated, not the concrete path) — e.g.
30
+ * `/invoices/:id`, NOT `/invoices/inv_123`. Part of the coalesce key so the
31
+ * same logical endpoint collapses regardless of path params.
32
+ */
33
+ requestPathPattern: string;
34
+ /** Optional per-read query detail appended to `metadata.queries`. */
35
+ query?: Record<string, unknown>;
36
+ }
37
+ export declare class AuditBuffer {
38
+ #private;
39
+ constructor(opts: AuditBufferOptions);
40
+ /** Number of distinct coalesce keys currently buffered (in-window). */
41
+ get size(): number;
42
+ /**
43
+ * Record one READ. The first read for a key opens the window + schedules its
44
+ * flush; later reads in the same window bump `read_count` + `last_read_at` and
45
+ * append `query` (up to `maxQueries`). Do NOT feed mutations here.
46
+ */
47
+ record(args: AuditArgs, rec: AuditReadRecord): void;
48
+ /** Flush + clear the timer for one key (no-op if absent). */
49
+ flush(key: string): Promise<void>;
50
+ /** Flush every buffered key (e.g. a periodic safety sweep). */
51
+ flushAll(): Promise<void>;
52
+ /**
53
+ * Graceful shutdown: flush all pending coalesced rows + clear timers. After
54
+ * `close()`, `record()` throws. Idempotent.
55
+ */
56
+ close(): Promise<void>;
57
+ }
58
+ //# sourceMappingURL=audit-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-buffer.d.ts","sourceRoot":"","sources":["../src/audit-buffer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAYD,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAoBD,qBAAa,WAAW;;gBAYV,IAAI,EAAE,kBAAkB;IAOpC,uEAAuE;IACvE,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI;IAuCnD,6DAA6D;IACvD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,+DAA+D;IACzD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA2B7B"}
@@ -0,0 +1,126 @@
1
+ const DEFAULT_WINDOW_MS = 60_000;
2
+ const DEFAULT_MAX_QUERIES = 200;
3
+ /**
4
+ * Builds the coalesce key `(actor, resource_type, request_path_pattern)` (§ 9).
5
+ * Actor is the internal `actorId` when present, else the `actorExternalId`, else
6
+ * the literal `"anon"` so anonymous reads still coalesce together (they don't
7
+ * cross-contaminate identified actors — different actor segment).
8
+ */
9
+ function coalesceKey(args, requestPathPattern) {
10
+ const actor = args.actorId ?? args.actorExternalId ?? "anon";
11
+ // tenant_id is part of the key (beyond doctrine §9's literal tuple) so anon /
12
+ // multi-tenant-actor reads of the same resource never coalesce ACROSS tenants
13
+ // into one mis-attributed row. Strictly finer — never merges buckets.
14
+ const tenant = args.tenantId ?? "no-tenant";
15
+ return `${tenant} ${actor} ${args.resourceType} ${requestPathPattern}`;
16
+ }
17
+ export class AuditBuffer {
18
+ #flush;
19
+ #windowMs;
20
+ #maxQueries;
21
+ #onFlushError;
22
+ #entries = new Map();
23
+ // In-flight TIMER-triggered flushes (fire-and-forget Promises). `close()`
24
+ // awaits these so a flush that the window timer kicked off just before
25
+ // shutdown finishes before close() resolves — no lost / mid-flight rows.
26
+ #inflight = new Set();
27
+ #closed = false;
28
+ constructor(opts) {
29
+ this.#flush = opts.flush;
30
+ this.#windowMs = opts.windowMs ?? DEFAULT_WINDOW_MS;
31
+ this.#maxQueries = opts.maxQueries ?? DEFAULT_MAX_QUERIES;
32
+ this.#onFlushError = opts.onFlushError;
33
+ }
34
+ /** Number of distinct coalesce keys currently buffered (in-window). */
35
+ get size() {
36
+ return this.#entries.size;
37
+ }
38
+ /**
39
+ * Record one READ. The first read for a key opens the window + schedules its
40
+ * flush; later reads in the same window bump `read_count` + `last_read_at` and
41
+ * append `query` (up to `maxQueries`). Do NOT feed mutations here.
42
+ */
43
+ record(args, rec) {
44
+ if (this.#closed) {
45
+ throw new Error("AuditBuffer.record called after close()");
46
+ }
47
+ const key = coalesceKey(args, rec.requestPathPattern);
48
+ const now = new Date();
49
+ const existing = this.#entries.get(key);
50
+ if (existing) {
51
+ existing.readCount += 1;
52
+ existing.lastReadAt = now;
53
+ if (rec.query && existing.queries.length < this.#maxQueries) {
54
+ existing.queries.push({ ...rec.query }); // snapshot — no caller aliasing
55
+ }
56
+ return;
57
+ }
58
+ // Snapshot args (incl. its metadata) + the seed query so a caller
59
+ // reusing/mutating them after record() can't alter the buffered (and later
60
+ // coalesced) row. The seed respects maxQueries (maxQueries=0 keeps none).
61
+ const entry = {
62
+ base: args.metadata
63
+ ? { ...args, metadata: { ...args.metadata } }
64
+ : { ...args },
65
+ readCount: 1,
66
+ firstReadAt: now,
67
+ lastReadAt: now,
68
+ queries: rec.query && this.#maxQueries > 0 ? [{ ...rec.query }] : [],
69
+ // The window runs from the FIRST read; later reads do not extend it.
70
+ // Track the timer's flush Promise so close() can await it.
71
+ timer: setTimeout(() => {
72
+ const p = this.#flushKey(key);
73
+ this.#inflight.add(p);
74
+ void p.finally(() => this.#inflight.delete(p));
75
+ }, this.#windowMs),
76
+ };
77
+ // Don't keep the process alive solely for a pending flush (Node/Bun).
78
+ entry.timer.unref?.();
79
+ this.#entries.set(key, entry);
80
+ }
81
+ /** Flush + clear the timer for one key (no-op if absent). */
82
+ async flush(key) {
83
+ await this.#flushKey(key);
84
+ }
85
+ /** Flush every buffered key (e.g. a periodic safety sweep). */
86
+ async flushAll() {
87
+ const keys = [...this.#entries.keys()];
88
+ for (const key of keys) {
89
+ await this.#flushKey(key);
90
+ }
91
+ }
92
+ /**
93
+ * Graceful shutdown: flush all pending coalesced rows + clear timers. After
94
+ * `close()`, `record()` throws. Idempotent.
95
+ */
96
+ async close() {
97
+ this.#closed = true;
98
+ await this.flushAll();
99
+ // Drain any TIMER-triggered flush that fired before/during close().
100
+ if (this.#inflight.size > 0) {
101
+ await Promise.allSettled([...this.#inflight]);
102
+ }
103
+ }
104
+ async #flushKey(key) {
105
+ const entry = this.#entries.get(key);
106
+ if (!entry)
107
+ return;
108
+ clearTimeout(entry.timer);
109
+ this.#entries.delete(key);
110
+ const coalesced = {
111
+ ...entry.base,
112
+ readCount: entry.readCount,
113
+ firstReadAt: entry.firstReadAt,
114
+ lastReadAt: entry.lastReadAt,
115
+ metadata: { ...entry.base.metadata, queries: entry.queries },
116
+ };
117
+ try {
118
+ await this.#flush(coalesced);
119
+ }
120
+ catch (err) {
121
+ if (this.#onFlushError)
122
+ this.#onFlushError(err, key);
123
+ }
124
+ }
125
+ }
126
+ //# sourceMappingURL=audit-buffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-buffer.js","sourceRoot":"","sources":["../src/audit-buffer.ts"],"names":[],"mappings":"AAiEA,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAe,EAAE,kBAA0B;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,IAAI,MAAM,CAAC;IAC7D,8EAA8E;IAC9E,8EAA8E;IAC9E,sEAAsE;IACtE,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC;IAC5C,OAAO,GAAG,MAAM,IAAI,KAAK,IAAI,IAAI,CAAC,YAAY,IAAI,kBAAkB,EAAE,CAAC;AACzE,CAAC;AAED,MAAM,OAAO,WAAW;IACb,MAAM,CAA8B;IACpC,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,aAAa,CAAqC;IAClD,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IACnD,0EAA0E;IAC1E,uEAAuE;IACvE,yEAAyE;IAChE,SAAS,GAAG,IAAI,GA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audit-registry.json`, produced by
4
+ * a service's `audit:codegen` (doctrine § 5.3). Served verbatim — the service's
5
+ * codegen owns the exact shape; the index signature keeps the plugin
6
+ * forward-compatible with registry-schema additions.
7
+ */
8
+ export interface AuditRegistry {
9
+ service: string;
10
+ actions?: string[];
11
+ sensitive_read_methods?: string[];
12
+ generated_at?: string;
13
+ [key: string]: unknown;
14
+ }
15
+ /** Canonical well-known path (§ 15.1). */
16
+ export declare const AUDIT_REGISTRY_WELL_KNOWN_PATH = "/.well-known/audit-registry.json";
17
+ /** Options for {@link auditWellKnownPlugin}. */
18
+ export interface AuditWellKnownOptions {
19
+ /**
20
+ * The bundled registry object (e.g. `import registry from "./build/audit-registry.json"`),
21
+ * or a loader returning it (sync or async — e.g. read-from-disk at first
22
+ * request). Served verbatim as JSON.
23
+ */
24
+ registry: AuditRegistry | (() => AuditRegistry | Promise<AuditRegistry>);
25
+ /** Route path. Default {@link AUDIT_REGISTRY_WELL_KNOWN_PATH}. */
26
+ path?: string;
27
+ /**
28
+ * `Cache-Control` for the response. The registry only changes on deploy, so a
29
+ * short cache is safe. Default `public, max-age=300`. Pass `""` to omit.
30
+ */
31
+ cacheControl?: string;
32
+ }
33
+ /**
34
+ * Hono middleware that serves the audit registry at the well-known path and
35
+ * passes every other request through untouched.
36
+ *
37
+ * @example
38
+ * import { Hono } from "hono";
39
+ * import registry from "./build/audit-registry.json";
40
+ * import { auditWellKnownPlugin } from "@nodii/telemetry/hono";
41
+ *
42
+ * const app = new Hono();
43
+ * app.use(auditWellKnownPlugin({ registry }));
44
+ * // GET /.well-known/audit-registry.json -> the bundled registry JSON
45
+ */
46
+ export declare function auditWellKnownPlugin(opts: AuditWellKnownOptions): MiddlewareHandler;
47
+ //# sourceMappingURL=audit-well-known.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-well-known.d.ts","sourceRoot":"","sources":["../../src/hono/audit-well-known.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAW,iBAAiB,EAAQ,MAAM,MAAM,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0CAA0C;AAC1C,eAAO,MAAM,8BAA8B,qCACP,CAAC;AAErC,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,QAAQ,EAAE,aAAa,GAAG,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IACzE,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,qBAAqB,GAC1B,iBAAiB,CAYnB"}
@@ -0,0 +1,31 @@
1
+ /** Canonical well-known path (§ 15.1). */
2
+ export const AUDIT_REGISTRY_WELL_KNOWN_PATH = "/.well-known/audit-registry.json";
3
+ const DEFAULT_CACHE_CONTROL = "public, max-age=300";
4
+ /**
5
+ * Hono middleware that serves the audit registry at the well-known path and
6
+ * passes every other request through untouched.
7
+ *
8
+ * @example
9
+ * import { Hono } from "hono";
10
+ * import registry from "./build/audit-registry.json";
11
+ * import { auditWellKnownPlugin } from "@nodii/telemetry/hono";
12
+ *
13
+ * const app = new Hono();
14
+ * app.use(auditWellKnownPlugin({ registry }));
15
+ * // GET /.well-known/audit-registry.json -> the bundled registry JSON
16
+ */
17
+ export function auditWellKnownPlugin(opts) {
18
+ const path = opts.path ?? AUDIT_REGISTRY_WELL_KNOWN_PATH;
19
+ const cacheControl = opts.cacheControl ?? DEFAULT_CACHE_CONTROL;
20
+ return async (c, next) => {
21
+ if (c.req.method !== "GET" || c.req.path !== path)
22
+ return next();
23
+ const registry = typeof opts.registry === "function"
24
+ ? await opts.registry()
25
+ : opts.registry;
26
+ if (cacheControl)
27
+ c.header("Cache-Control", cacheControl);
28
+ return c.json(registry);
29
+ };
30
+ }
31
+ //# sourceMappingURL=audit-well-known.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-well-known.js","sourceRoot":"","sources":["../../src/hono/audit-well-known.ts"],"names":[],"mappings":"AAmCA,0CAA0C;AAC1C,MAAM,CAAC,MAAM,8BAA8B,GACzC,kCAAkC,CAAC;AAmBrC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAA2B;IAE3B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,8BAA8B,CAAC;IACzD,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,qBAAqB,CAAC;IAChE,OAAO,KAAK,EAAE,CAAU,EAAE,IAAU,EAAE,EAAE;QACtC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,EAAE,CAAC;QACjE,MAAM,QAAQ,GACZ,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU;YACjC,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;YACvB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QACpB,IAAI,YAAY;YAAE,CAAC,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QAC1D,OAAO,CAAC,CAAC,IAAI,CAAC,QAAmC,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { Context, MiddlewareHandler } from "hono";
2
+ /** Canonical inbound W3C trace-context header (lower-case; Hono headers are case-insensitive). */
3
+ export declare const TRACEPARENT_HEADER = "traceparent";
4
+ /** Options for {@link honoTelemetry}. */
5
+ export interface HonoTelemetryOptions {
6
+ /**
7
+ * Honor an inbound W3C `traceparent` header so the SERVER span inherits
8
+ * the upstream `trace_id` (distributed trace continuity) instead of
9
+ * starting a fresh root trace. Default `true`.
10
+ *
11
+ * A malformed inbound traceparent does NOT throw — `tracer.span` starts a
12
+ * root span and records the raw value under
13
+ * `telemetry.inbound_traceparent_malformed` (see `tracer.ts`).
14
+ *
15
+ * Set `false` to always start the request as a fresh root SERVER span
16
+ * (e.g. when the edge is the trusted trace root and upstream values are
17
+ * not trustworthy).
18
+ */
19
+ honorInboundTraceparent?: boolean;
20
+ /**
21
+ * Header to read the inbound traceparent from. Defaults to `traceparent`.
22
+ */
23
+ traceparentHeader?: string;
24
+ /**
25
+ * Customize the SERVER span name. Defaults to the OTel HTTP-semconv
26
+ * low-cardinality form: `"<METHOD> <route-template>"` when Hono resolved
27
+ * a route template (e.g. `"GET /users/:id"`), else `"<METHOD>"`. Override
28
+ * for services that want a different naming scheme.
29
+ *
30
+ * Avoid putting the raw `url.path` in the span name — that is HIGH
31
+ * cardinality (one name per id) and the per-OTel-semconv reason the
32
+ * default uses the route template, not the concrete path.
33
+ */
34
+ spanName?: (c: Context) => string;
35
+ /**
36
+ * Extra static attributes stamped on every SERVER span (e.g. a deploy
37
+ * marker). Per-request attributes should be added by downstream handlers
38
+ * via `getActiveSpan()` / `withSpanAttributes`.
39
+ */
40
+ attributes?: Record<string, unknown>;
41
+ }
42
+ /**
43
+ * Hono middleware factory that opens ONE OTel SERVER span per HTTP request
44
+ * and runs the rest of the pipeline INSIDE that span's context, so:
45
+ * - every inbound request emits an HTTP SERVER span even on `Bun.serve`
46
+ * (which bypasses `@opentelemetry/instrumentation-http`) — D154;
47
+ * - child business spans + pg-query/outbox spans nest under it (the span
48
+ * is the active stack parent for the downstream scope);
49
+ * - the OTel HTTP semantic-convention attributes are stamped
50
+ * (`http.request.method`, `url.path`, `url.scheme`,
51
+ * `http.response.status_code`, `http.route`, …);
52
+ * - span status maps from the response: `5xx` → ERROR (D27), and a
53
+ * thrown handler error is recorded + re-thrown so the framework's own
54
+ * error handler still runs.
55
+ *
56
+ * Mount it FIRST in the pipeline (before auth / context) so it wraps the
57
+ * full request duration, mirroring edge's `requestContext()`:
58
+ *
59
+ * import { honoTelemetry } from "@nodii/telemetry/hono";
60
+ * const app = new Hono();
61
+ * app.use("*", honoTelemetry());
62
+ */
63
+ export declare function honoTelemetry(options?: HonoTelemetryOptions): MiddlewareHandler;
64
+ export { AUDIT_REGISTRY_WELL_KNOWN_PATH, type AuditRegistry, type AuditWellKnownOptions, auditWellKnownPlugin, } from "./audit-well-known.js";
65
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAgBvD,kGAAkG;AAClG,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;OAYG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAyED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,GAAE,oBAAyB,GACjC,iBAAiB,CAmGnB;AAGD,OAAO,EACL,8BAA8B,EAC9B,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,219 @@
1
+ // `@nodii/telemetry/hono` — the HTTP SERVER-span middleware for Bun-served
2
+ // Hono apps (D154: HTTP auto-instrumentation ON-by-default).
3
+ //
4
+ // Spec: `global/15-telemetry-doctrine.md` § 7.1 (D154 — HTTP+gRPC server
5
+ // spans ON by default) + `nodii-libs/features/telemetry.md` § 5.9
6
+ // (Hono middleware adapter) + § 5.11 (auto-instrumentation defaults).
7
+ //
8
+ // WHY THIS EXISTS (the gap it closes):
9
+ // `@opentelemetry/instrumentation-http` works by monkey-patching Node's
10
+ // built-in `http`/`https` modules. `Bun.serve` does NOT route through
11
+ // those modules — it has its own native HTTP server — so the standard
12
+ // OTel HTTP instrumentation NEVER fires on a Bun process. Every
13
+ // Bun-based Nodii service (auth, hr, edge, …) therefore emits ZERO HTTP
14
+ // SERVER spans despite D154 mandating HTTP instrumentation on-by-default
15
+ // (verified empirically: auth 0 server spans, hr 0 server spans).
16
+ //
17
+ // This middleware restores the D154 guarantee at the framework layer:
18
+ // one OTel SERVER span per inbound HTTP request, with the OTel HTTP
19
+ // semantic-convention attributes, run with the rest of the Hono pipeline
20
+ // nested INSIDE the span's context so child business spans (and the
21
+ // pg-query / outbox spans) parent correctly onto the request span.
22
+ //
23
+ // It GENERALIZES the bespoke `edge.request` request-span bridge that
24
+ // `nodii-edge`'s `requestContext()` middleware hand-rolls today (see
25
+ // `nodii-edge/src/lib/middleware/request-context.ts`). Once a service
26
+ // adopts this adapter, edge can retire its private copy.
27
+ //
28
+ // REAL SPANS (R1): the span is produced by the lib's own `tracer.span`,
29
+ // which routes through the mandatory-attribute SpanProcessor (D26) and the
30
+ // installed OTLP exporter (`installOtlpAdapter` → `_setSpanEmitter`). There
31
+ // is NO Noop path here — when no OTLP adapter is installed the span still
32
+ // flows to whatever emitter is set (the default no-op emitter is a
33
+ // TEST-ONLY seam, never a production default; production calls
34
+ // `installOtlpAdapter`).
35
+ //
36
+ // SCOPE: TS only. Hono is a TypeScript framework, so this lives behind a
37
+ // TS subpath exactly like `/lambda` + `/worker`. The Python (FastAPI /
38
+ // starlette) and Go HTTP middleware are SEPARATE adapters in their
39
+ // respective language trees (§ 5.9) and are OUT OF SCOPE for this file.
40
+ import { ATTR_ERROR_TYPE, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, ATTR_NETWORK_PROTOCOL_VERSION, ATTR_SERVER_ADDRESS, ATTR_URL_PATH, ATTR_URL_QUERY, ATTR_URL_SCHEME, ATTR_USER_AGENT_ORIGINAL, } from "@opentelemetry/semantic-conventions";
41
+ import { tracer } from "../tracer.js";
42
+ /** Canonical inbound W3C trace-context header (lower-case; Hono headers are case-insensitive). */
43
+ export const TRACEPARENT_HEADER = "traceparent";
44
+ /** Prefer the proxy-forwarded scheme; fall back to the request URL; default `https`. */
45
+ function urlScheme(c) {
46
+ const fwd = c.req.header("x-forwarded-proto");
47
+ if (fwd) {
48
+ const first = fwd.split(",")[0];
49
+ if (first)
50
+ return first.trim();
51
+ }
52
+ try {
53
+ return new URL(c.req.url).protocol.replace(":", "");
54
+ }
55
+ catch {
56
+ return "https";
57
+ }
58
+ }
59
+ /** The `url.query` component (without the leading `?`), or undefined when absent. */
60
+ function urlQuery(c) {
61
+ try {
62
+ const q = new URL(c.req.url).search;
63
+ return q ? q.slice(1) : undefined;
64
+ }
65
+ catch {
66
+ return undefined;
67
+ }
68
+ }
69
+ /**
70
+ * Resolve the low-cardinality route TEMPLATE for the request (e.g.
71
+ * `/users/:id`), or `undefined` when no concrete handler route matched
72
+ * (e.g. a 404, where only the `/*` middleware route is present).
73
+ *
74
+ * `c.req.routePath` is only meaningful AFTER `next()` (once the matching
75
+ * handler has run). Because this middleware needs the template at
76
+ * span-OPEN (before `next()`), it reads `c.req.matchedRoutes` — which Hono
77
+ * populates at match time, before dispatch — and takes the most specific
78
+ * matched route: the last one whose path is NOT a `/*` / `/` middleware
79
+ * wildcard and whose method is NOT the `ALL` middleware pseudo-method.
80
+ */
81
+ function resolveRouteTemplate(c) {
82
+ const matched = c.req
83
+ .matchedRoutes;
84
+ if (Array.isArray(matched)) {
85
+ for (let i = matched.length - 1; i >= 0; i--) {
86
+ const r = matched[i];
87
+ const p = r?.path;
88
+ if (p && p !== "/*" && p !== "/" && r?.method !== "ALL")
89
+ return p;
90
+ }
91
+ return undefined;
92
+ }
93
+ // Fallback for Hono builds without `matchedRoutes`: `routePath` (only set
94
+ // post-match, so this path is for the post-`next()` re-read).
95
+ const route = c.req.routePath;
96
+ if (route && route !== "/*" && route !== "/")
97
+ return route;
98
+ return undefined;
99
+ }
100
+ /**
101
+ * Default SERVER span name per OTel HTTP semconv: `"<METHOD> <route>"`
102
+ * (low cardinality — uses the route TEMPLATE, never the concrete path)
103
+ * when Hono matched a concrete handler route, else just `"<METHOD>"`.
104
+ */
105
+ function defaultSpanName(c) {
106
+ const method = c.req.method;
107
+ const route = resolveRouteTemplate(c);
108
+ return route ? `${method} ${route}` : method;
109
+ }
110
+ /**
111
+ * Hono middleware factory that opens ONE OTel SERVER span per HTTP request
112
+ * and runs the rest of the pipeline INSIDE that span's context, so:
113
+ * - every inbound request emits an HTTP SERVER span even on `Bun.serve`
114
+ * (which bypasses `@opentelemetry/instrumentation-http`) — D154;
115
+ * - child business spans + pg-query/outbox spans nest under it (the span
116
+ * is the active stack parent for the downstream scope);
117
+ * - the OTel HTTP semantic-convention attributes are stamped
118
+ * (`http.request.method`, `url.path`, `url.scheme`,
119
+ * `http.response.status_code`, `http.route`, …);
120
+ * - span status maps from the response: `5xx` → ERROR (D27), and a
121
+ * thrown handler error is recorded + re-thrown so the framework's own
122
+ * error handler still runs.
123
+ *
124
+ * Mount it FIRST in the pipeline (before auth / context) so it wraps the
125
+ * full request duration, mirroring edge's `requestContext()`:
126
+ *
127
+ * import { honoTelemetry } from "@nodii/telemetry/hono";
128
+ * const app = new Hono();
129
+ * app.use("*", honoTelemetry());
130
+ */
131
+ export function honoTelemetry(options = {}) {
132
+ const honorInbound = options.honorInboundTraceparent ?? true;
133
+ const traceparentHeader = options.traceparentHeader ?? TRACEPARENT_HEADER;
134
+ const nameOf = options.spanName ?? defaultSpanName;
135
+ const staticAttrs = options.attributes;
136
+ return async (c, next) => {
137
+ const inboundTraceparent = honorInbound
138
+ ? c.req.header(traceparentHeader)
139
+ : undefined;
140
+ // Build the entry attributes per the OTel HTTP semconv. Status code +
141
+ // route are set AFTER `next()` (route may only resolve once matched;
142
+ // status is the response status).
143
+ const scheme = urlScheme(c);
144
+ const query = urlQuery(c);
145
+ const host = c.req.header("host");
146
+ const userAgent = c.req.header("user-agent");
147
+ const entryAttrs = {
148
+ [ATTR_HTTP_REQUEST_METHOD]: c.req.method,
149
+ [ATTR_URL_PATH]: c.req.path,
150
+ [ATTR_URL_SCHEME]: scheme,
151
+ ...(query !== undefined ? { [ATTR_URL_QUERY]: query } : {}),
152
+ ...(host ? { [ATTR_SERVER_ADDRESS]: host } : {}),
153
+ ...(userAgent ? { [ATTR_USER_AGENT_ORIGINAL]: userAgent } : {}),
154
+ [ATTR_NETWORK_PROTOCOL_VERSION]: "1.1",
155
+ ...(staticAttrs ?? {}),
156
+ };
157
+ await tracer.span(
158
+ // Span name is resolved at span-OPEN against the request line; the
159
+ // route template is also stamped post-`next()` once matched.
160
+ nameOf(c), async (span) => {
161
+ // Run the rest of the Hono pipeline INSIDE the SERVER span so
162
+ // downstream `tracer.span` calls nest under it (the lib's active
163
+ // span stack makes this span the parent for the downstream scope).
164
+ //
165
+ // NOTE on error capture: when a handler throws, Hono CATCHES it
166
+ // inside its own dispatch (compose) — whether or not an `onError`
167
+ // handler is registered — sets `c.error` + a 500 response, and
168
+ // `next()` RESOLVES normally (it does NOT re-throw past us). So the
169
+ // canonical way to observe the handler exception from middleware is
170
+ // `c.error` after `next()`, NOT a try/catch here. The try/catch is
171
+ // kept as a belt-and-suspenders for the rare case where an error
172
+ // genuinely propagates out of `next()` (e.g. a middleware that
173
+ // throws AFTER the response is built).
174
+ try {
175
+ await next();
176
+ }
177
+ catch (err) {
178
+ span.recordException(err);
179
+ span.setAttribute(ATTR_ERROR_TYPE, err instanceof Error ? err.name : "Error");
180
+ throw err;
181
+ }
182
+ // Post-pipeline: stamp the resolved route template + response
183
+ // status.
184
+ const route = resolveRouteTemplate(c);
185
+ if (route)
186
+ span.setAttribute(ATTR_HTTP_ROUTE, route);
187
+ // Capture the handler exception Hono stashed on `c.error` (present
188
+ // in both the `onError` and default-500 paths). This records the
189
+ // real `exception` span event + sets ERROR status per D27 — the
190
+ // information `instrumentation-http` would have captured.
191
+ const handlerError = c.error;
192
+ if (handlerError) {
193
+ span.recordException(handlerError);
194
+ span.setAttribute(ATTR_ERROR_TYPE, handlerError instanceof Error ? handlerError.name : "Error");
195
+ span.setStatus("ERROR");
196
+ }
197
+ const status = c.res.status;
198
+ span.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE, status);
199
+ // D27 HTTP status mapping: 5xx → ERROR; 4xx is a client error and
200
+ // stays UNSET (the server behaved correctly). `error.type` carries
201
+ // the status string on 5xx for filterable error analytics. (When a
202
+ // handler exception was already recorded above, the span is ERROR
203
+ // regardless; the status-derived `error.type` still applies on 5xx.)
204
+ if (status >= 500) {
205
+ span.setAttribute(ATTR_ERROR_TYPE, String(status));
206
+ span.setStatus("ERROR", `http_status_${status}`);
207
+ }
208
+ }, {
209
+ kind: "SERVER",
210
+ attributes: entryAttrs,
211
+ // Inherit the inbound trace when present (distributed continuity);
212
+ // malformed values fall back to root + a forensic attr (no throw).
213
+ ...(inboundTraceparent ? { parent: inboundTraceparent } : {}),
214
+ });
215
+ };
216
+ }
217
+ // ---- audit-registry well-known route (audit doctrine § 15.1 / § 5.3) ----
218
+ export { AUDIT_REGISTRY_WELL_KNOWN_PATH, auditWellKnownPlugin, } from "./audit-well-known.js";
219
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3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eHandle, HistogramHandle, MetricKind, MetricReg
13
13
  export { _getAuditChain, _hasAnyAuditWriter, _resetAuditChainForTests, _resetDefaultAuditWriterForTests, _resetAuditWriterForTests, _setAuditChain, _setAuditWriter, _setDefaultAuditWriterProvider, audit, AUDIT_ACTOR_KINDS, AUDIT_OUTCOMES, } from "./audit.js";
14
14
  export type { ActorKind, ActorStamp, AuditArgs, AuditChainAdapter, AuditEvent, AuditEventRow, AuditOutcome, AuditWriter, DefaultAuditWriterProvider, } from "./audit.js";
15
15
  export { TelemetryAuditWriterMissing } from "./audit.js";
16
+ export { AuditBuffer } from "./audit-buffer.js";
17
+ export type { AuditBufferOptions, AuditReadRecord, } from "./audit-buffer.js";
16
18
  export { configureTelemetry } from "./configure.js";
17
19
  export type { ConfigureTelemetryOptions } from "./configure.js";
18
20
  export { intent, IntentTypeNotRegistered } from "./intent.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EACV,WAAW,EACX,aAAa,EACb,OAAO,EACP,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,EACV,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AAM,YAAY,CAAC;AACrD,YAAY,EACV,SAAS,EACT,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EACV,WAAW,EACX,aAAa,EACb,OAAO,EACP,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kB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E,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EACV,SAAS,EACT,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -13,6 +13,12 @@
13
13
  // force-flush-on-return so spans/metrics/
14
14
  // logs survive the post-handler freeze.
15
15
  // First consumer: s2s-auth-service.
16
+ // - @nodii/telemetry/hono — HTTP SERVER-span middleware (D154). One
17
+ // OTel SERVER span per request for Bun-served
18
+ // Hono apps, which `instrumentation-http`
19
+ // BYPASSES (Bun.serve doesn't use Node http).
20
+ // Generalizes edge's bespoke `edge.request`
21
+ // request-span bridge. TS-only subpath.
16
22
  //
17
23
  // Not yet shipped (D44 § 6.5 lists them; no implementation exists yet —
18
24
  // they are tracked as follow-on requests, NOT advertised as vapor):
@@ -35,6 +41,7 @@ export { forensicParentValue, parseTraceparent, resolveSpanParent, } from "./tra
35
41
  export { metrics, MetricVocabularyError, recordMetric } from "./metrics.js";
36
42
  export { _getAuditChain, _hasAnyAuditWriter, _resetAuditChainForTests, _resetDefaultAuditWriterForTests, _resetAuditWriterForTests, _setAuditChain, _setAuditWriter, _setDefaultAuditWriterProvider, audit, AUDIT_ACTOR_KINDS, AUDIT_OUTCOMES, } from "./audit.js";
37
43
  export { TelemetryAuditWriterMissing } from "./audit.js";
44
+ export { AuditBuffer } from "./audit-buffer.js";
38
45
  export { configureTelemetry } from "./configure.js";
39
46
  export { intent, IntentTypeNotRegistered } from "./intent.js";
40
47
  export { agentInvocable, readAgentRegistry, AGENT_INVOCABLE_METADATA, } from "./agent-invocable.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,EAAE;AACF,0EAA0E;AAC1E,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,0EAA0E;AAC1E,mEAAmE;AACnE,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,uEAAuE;AACvE,8DAA8D;AAC9D,mDAAmD;AACnD,EAAE;AACF,oEAAoE;AACpE,gBAAgB;AAChB,EAAE;AACF,oEAAoE;AACpE,gEAAgE;AAChE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOnD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAWjD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,8BAA8B,EAC9B,KAAK,EACL,iBA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AY,CAAC;AA0BrD,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/telemetry",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "Substrate observability library for the Nodii microservice stack — OTel wrapper, log envelope, intent lifecycle, audit signal, agent registry, context propagation. Spec: planning hub docKey=telemetry.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,6 +27,10 @@
27
27
  "types": "./dist/lambda/index.d.ts",
28
28
  "default": "./dist/lambda/index.js"
29
29
  },
30
+ "./hono": {
31
+ "types": "./dist/hono/index.d.ts",
32
+ "default": "./dist/hono/index.js"
33
+ },
30
34
  "./worker": {
31
35
  "types": "./dist/worker/index.d.ts",
32
36
  "default": "./dist/worker/index.js"
@@ -87,7 +91,7 @@
87
91
  }
88
92
  },
89
93
  "devDependencies": {
90
- "@nodii/audit-chain": "0.10.0",
94
+ "@nodii/audit-chain": "0.11.1",
91
95
  "drizzle-orm": "^0.45.2",
92
96
  "hono": "^4.4.0",
93
97
  "ioredis": "^5.4.0",