@fougere/observability 0.6.0-alpha.0 → 0.7.0-alpha.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 (47) hide show
  1. package/dist/Beat.d.ts +1 -10
  2. package/dist/Beat.d.ts.map +1 -1
  3. package/dist/Beat.js +1 -10
  4. package/dist/Beat.js.map +1 -1
  5. package/dist/Endpoint.d.ts +1 -6
  6. package/dist/Endpoint.d.ts.map +1 -1
  7. package/dist/Endpoint.js +1 -6
  8. package/dist/Endpoint.js.map +1 -1
  9. package/dist/context/none.d.ts.map +1 -1
  10. package/dist/context/none.js.map +1 -1
  11. package/dist/context/port.d.ts +1 -13
  12. package/dist/context/port.d.ts.map +1 -1
  13. package/dist/extension.d.ts +3 -25
  14. package/dist/extension.d.ts.map +1 -1
  15. package/dist/extension.js +3 -25
  16. package/dist/extension.js.map +1 -1
  17. package/dist/index.d.ts +6 -37
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +6 -57
  20. package/dist/index.js.map +1 -1
  21. package/dist/logs.d.ts +1 -5
  22. package/dist/logs.d.ts.map +1 -1
  23. package/dist/logs.js +1 -11
  24. package/dist/logs.js.map +1 -1
  25. package/dist/metrics.d.ts +5 -32
  26. package/dist/metrics.d.ts.map +1 -1
  27. package/dist/metrics.js +0 -0
  28. package/dist/metrics.js.map +1 -1
  29. package/dist/otlp.d.ts +1 -8
  30. package/dist/otlp.d.ts.map +1 -1
  31. package/dist/otlp.js +1 -9
  32. package/dist/otlp.js.map +1 -1
  33. package/dist/traceparent.d.ts +1 -10
  34. package/dist/traceparent.d.ts.map +1 -1
  35. package/dist/traceparent.js +1 -10
  36. package/dist/traceparent.js.map +1 -1
  37. package/package.json +6 -6
  38. package/src/Beat.ts +1 -10
  39. package/src/Endpoint.ts +1 -6
  40. package/src/context/none.ts +1 -13
  41. package/src/context/port.ts +1 -13
  42. package/src/extension.ts +4 -31
  43. package/src/index.ts +10 -74
  44. package/src/logs.ts +2 -16
  45. package/src/metrics.ts +0 -0
  46. package/src/otlp.ts +2 -17
  47. package/src/traceparent.ts +1 -10
package/dist/Beat.d.ts CHANGED
@@ -1,13 +1,4 @@
1
- /**
2
- * How often a batch leaves, and how the beat stops.
3
- *
4
- * `flushMs: 0` means "nobody is on a timer here, I will say when" — and on a Worker it is
5
- * not a preference, it is the only legal form: Cloudflare REFUSES a deployment whose
6
- * module scope sets a timeout ("Disallowed operation called within global scope"), and an
7
- * app built at module scope builds its exporter there. Measured 2026-08-23, the deploy
8
- * failed with error 10021. The isolate is frozen at the response anyway, so the timer
9
- * could never have fired; `ctx.waitUntil(flushTelemetry())` is what sends.
10
- */
1
+ /** How often a batch leaves, and how the beat stops. */
11
2
  export declare class Beat {
12
3
  private readonly timer;
13
4
  private readonly run;
@@ -1 +1 @@
1
- {"version":3,"file":"Beat.d.ts","sourceRoot":"","sources":["../src/Beat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,IAAI;IAEb,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAFtB,OAAO,eAGH;IAEJ;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAMnE;IAED,wFAAwF;IAClF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAG1B;CACF"}
1
+ {"version":3,"file":"Beat.d.ts","sourceRoot":"","sources":["../src/Beat.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,qBAAa,IAAI;IAEb,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAFtB,OAAO,eAGH;IAEJ;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAMnE;IAED,wFAAwF;IAClF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAG1B;CACF"}
package/dist/Beat.js CHANGED
@@ -1,13 +1,4 @@
1
- /**
2
- * How often a batch leaves, and how the beat stops.
3
- *
4
- * `flushMs: 0` means "nobody is on a timer here, I will say when" — and on a Worker it is
5
- * not a preference, it is the only legal form: Cloudflare REFUSES a deployment whose
6
- * module scope sets a timeout ("Disallowed operation called within global scope"), and an
7
- * app built at module scope builds its exporter there. Measured 2026-08-23, the deploy
8
- * failed with error 10021. The isolate is frozen at the response anyway, so the timer
9
- * could never have fired; `ctx.waitUntil(flushTelemetry())` is what sends.
10
- */
1
+ /** How often a batch leaves, and how the beat stops. */
11
2
  export class Beat {
12
3
  timer;
13
4
  run;
package/dist/Beat.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Beat.js","sourceRoot":"","sources":["../src/Beat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,OAAO,IAAI;IAEI,KAAK;IACL,GAAG;IAFtB,YACmB,KAAiD,EACjD,GAAwB;qBADxB,KAAK;mBACL,GAAG;IACnB,CAAC;IAEJ;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,EAAsB,EAAE,GAAwB;QAC3D,MAAM,KAAK,GAAG,EAAE,IAAI,KAAK,CAAC;QAC1B,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3E,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QAEjB,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,wFAAwF;IACxF,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,KAAK;YAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;CACF"}
1
+ {"version":3,"file":"Beat.js","sourceRoot":"","sources":["../src/Beat.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,OAAO,IAAI;IAEI,KAAK;IACL,GAAG;IAFtB,YACmB,KAAiD,EACjD,GAAwB;qBADxB,KAAK;mBACL,GAAG;IACnB,CAAC;IAEJ;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,EAAsB,EAAE,GAAwB;QAC3D,MAAM,KAAK,GAAG,EAAE,IAAI,KAAK,CAAC;QAC1B,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3E,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QAEjB,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,wFAAwF;IACxF,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,KAAK;YAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;CACF"}
@@ -1,9 +1,4 @@
1
- /**
2
- * Where a batch goes, and what a failure to send is allowed to do — nothing.
3
- *
4
- * A trace must never break the call it describes, so a refusal is reported through
5
- * `onError` or not at all, and `post` resolves either way.
6
- */
1
+ /** Where a batch goes, and what a failure to send is allowed to do — nothing. */
7
2
  export declare class Endpoint {
8
3
  private readonly url;
9
4
  private readonly onError;
@@ -1 +1 @@
1
- {"version":3,"file":"Endpoint.d.ts","sourceRoot":"","sources":["../src/Endpoint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,QAAQ;IAEjB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAF1B,OAAO,eAGH;IAEJ,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAAG,QAAQ,CAEjE;IAED,wFAAwF;IAClF,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvC;CACF"}
1
+ {"version":3,"file":"Endpoint.d.ts","sourceRoot":"","sources":["../src/Endpoint.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,qBAAa,QAAQ;IAEjB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAF1B,OAAO,eAGH;IAEJ,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAAG,QAAQ,CAEjE;IAED,wFAAwF;IAClF,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvC;CACF"}
package/dist/Endpoint.js CHANGED
@@ -1,9 +1,4 @@
1
- /**
2
- * Where a batch goes, and what a failure to send is allowed to do — nothing.
3
- *
4
- * A trace must never break the call it describes, so a refusal is reported through
5
- * `onError` or not at all, and `post` resolves either way.
6
- */
1
+ /** Where a batch goes, and what a failure to send is allowed to do — nothing. */
7
2
  export class Endpoint {
8
3
  url;
9
4
  onError;
@@ -1 +1 @@
1
- {"version":3,"file":"Endpoint.js","sourceRoot":"","sources":["../src/Endpoint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IAEA,GAAG;IACH,OAAO;IAF1B,YACmB,GAAW,EACX,OAA6C;mBAD7C,GAAG;uBACH,OAAO;IACvB,CAAC;IAEJ,MAAM,CAAC,EAAE,CAAC,GAAW,EAAE,OAAgC;QACrD,OAAO,IAAI,QAA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AAC,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,kBAAkB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC9F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/context/none.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAC"}
1
+ {"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/context/none.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"none.js","sourceRoot":"","sources":["../../src/context/none.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,GAAyC,EAAE,CAAC,SAAS;IAC9D,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;CAC5B,CAAC"}
1
+ {"version":3,"file":"none.js","sourceRoot":"","sources":["../../src/context/none.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,GAAyC,EAAE,CAAC,SAAS;IAC9D,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;CAC5B,CAAC"}
@@ -1,16 +1,4 @@
1
- /**
2
- * Where the step running right now is kept — the one thing a Worker cannot do.
3
- *
4
- * A trace has TWO ways to name its parent, and only one of them is ambient: an arriving
5
- * call carries `traceparent` on the invocation, which every transport moves and which
6
- * needs nothing from the runtime. This is the other way — the parent of a call that
7
- * crossed no wire, which is in the stack and nowhere else.
8
- *
9
- * `node:async_hooks` does not exist on workerd unless the deployment asks for it, so
10
- * `#trace-context` resolves to two realizations: the real store by default, and one that
11
- * answers "no parent here" under the `workerd` condition. What that costs is stated at
12
- * boot rather than discovered in a trace viewer — see `traceContext.ambient`.
13
- */
1
+ /** Where the step running right now is kept — the one thing a Worker cannot do. */
14
2
  import type { SpanContext } from '../traceparent.js';
15
3
  export interface TraceContext {
16
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/context/port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,OAAO,CAAC,CAAC,SAAS,WAAW,KAAK,CAAC,GAAG,SAAS,CAAC;IAChD,iDAAiD;IACjD,MAAM,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7E"}
1
+ {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/context/port.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,OAAO,CAAC,CAAC,SAAS,WAAW,KAAK,CAAC,GAAG,SAAS,CAAC;IAChD,iDAAiD;IACjD,MAAM,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7E"}
@@ -1,36 +1,14 @@
1
- /**
2
- * This package's own ascent and descent, in one value.
3
- *
4
- * Four gestures in a fixed order — the middleware, the accumulator, the sinks, the wire op
5
- * — is a boot sequence, and a host had to know it: `demos/observability` wrote it out and
6
- * hand-rolled its own `stop()` beside it, which is a `down` under another name. Declared as
7
- * an extension, the order is stated once here and the release is not the host's to remember.
8
- *
9
- * It is not a frond and cannot become one: a frond may move behind `remotes:`, and this
10
- * reads the process it runs in — moved, it would report the observer instead of the observed.
11
- */
1
+ /** This package's own ascent and descent, in one value. */
12
2
  import { type Extension } from '@fougere/core';
13
3
  export interface ObservabilityOptions {
14
4
  /** What a dashboard groups this process by, and the name a log line carries. */
15
5
  service?: string;
16
- /**
17
- * An OTLP collector's base URL — SigNoz, Jaeger, Tempo all read the same one.
18
- *
19
- * Absent, nothing leaves the process and `rpc.topology` still answers: a panel asking
20
- * the app what shape it is in needs no collector.
21
- */
6
+ /** An OTLP collector's base URL — SigNoz, Jaeger, Tempo all read the same one. */
22
7
  otlp?: string;
23
8
  flushMs?: number;
24
9
  /** A collector that cannot be reached is the app's business, not its failure. */
25
10
  onError?: (error: unknown) => void;
26
11
  }
27
- /**
28
- * Observe this process — one member of the ascent.
29
- *
30
- * `up` wires in the order that matters and `down` withdraws in reverse, which is the whole
31
- * reason the two halves are one value: `onSpan` and `onLog` already RETURN their withdrawal
32
- * and nothing was calling it, so a discarded app kept feeding the sinks of the app that
33
- * replaced it. That is invisible until the ring turns, and then it doubles every metric.
34
- */
12
+ /** Observe this process — one member of the ascent. */
35
13
  export declare function observability(options?: ObservabilityOptions): Extension;
36
14
  //# sourceMappingURL=extension.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1F,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,SAAS,CAsE3E"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1F,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAED,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,SAAS,CAiE3E"}
package/dist/extension.js CHANGED
@@ -1,14 +1,4 @@
1
- /**
2
- * This package's own ascent and descent, in one value.
3
- *
4
- * Four gestures in a fixed order — the middleware, the accumulator, the sinks, the wire op
5
- * — is a boot sequence, and a host had to know it: `demos/observability` wrote it out and
6
- * hand-rolled its own `stop()` beside it, which is a `down` under another name. Declared as
7
- * an extension, the order is stated once here and the release is not the host's to remember.
8
- *
9
- * It is not a frond and cannot become one: a frond may move behind `remotes:`, and this
10
- * reads the process it runs in — moved, it would report the observer instead of the observed.
11
- */
1
+ /** This package's own ascent and descent, in one value. */
12
2
  import { loggerMiddleware, Logger, onLog } from '@fougere/core';
13
3
  import { traceContext } from '#trace-context';
14
4
  import { registerFlush } from './index.js';
@@ -16,22 +6,10 @@ import { trace, onSpan } from './index.js';
16
6
  import { metrics, serveTopology } from './metrics.js';
17
7
  import { otlp } from './otlp.js';
18
8
  import { logs } from './logs.js';
19
- /**
20
- * Observe this process — one member of the ascent.
21
- *
22
- * `up` wires in the order that matters and `down` withdraws in reverse, which is the whole
23
- * reason the two halves are one value: `onSpan` and `onLog` already RETURN their withdrawal
24
- * and nothing was calling it, so a discarded app kept feeding the sinks of the app that
25
- * replaced it. That is invisible until the ring turns, and then it doubles every metric.
26
- */
9
+ /** Observe this process — one member of the ascent. */
27
10
  export function observability(options = {}) {
28
11
  const service = options.service ?? 'fougere';
29
- /**
30
- * Per APP, not per extension. A host declares its extensions once (`configureFougere`),
31
- * so the same instance goes up on the new app before the old one is released: one shared
32
- * list meant the old app's `down` withdrew — and erased — the new app's sinks too, after
33
- * which every counter stayed frozen and nothing said so.
34
- */
12
+ /** Per APP, not per extension. */
35
13
  const undoing = new WeakMap();
36
14
  return {
37
15
  name: 'observability',
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAA4B,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EA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,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzD,CAAC,CAAC;YACH,gFAAgF;YAChF,sFAAsF;YACtF,IAAI,CAAC,IAAI,CACP,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAC3C,aAAa,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,EAC5E,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAC7C,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAQ;YACjB,qFAAqF;YACrF,+EAA+E;YAC/E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI;gBAAE,OAAO;YAClB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;gBAAE,MAAM,IAAI,EAAE,CAAC;QAClD,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,62 +6,31 @@ export type { SpanContext } from './traceparent.js';
6
6
  export interface FinishedSpan extends SpanContext {
7
7
  parentId: string | undefined;
8
8
  /**
9
- * The frond of the step this one is nested in, when it is a DIFFERENT one — an edge of
10
- * the call graph, `shop → catalog`.
11
- *
12
- * Only the caller can say it: a traceparent carries no frond, so a receiver knows it
13
- * has a parent and not whose. That is not a gap — the caller already published the edge.
9
+ * The frond of the step this one is nested in, when it is a DIFFERENT one — an edge of the call
10
+ * graph, `shop → catalog`.
14
11
  */
15
12
  callerFrond: string | undefined;
16
13
  /** Which frond owned the op — the deployment unit, so the first thing a reader groups by. */
17
14
  frond: string | undefined;
18
15
  entity: string;
19
16
  operation: string;
20
- /**
21
- * When it started, in epoch milliseconds — an INSTANT, not an offset.
22
- *
23
- * `performance.now()` measures the duration below and nothing else: it counts from
24
- * this process's own start, so two processes' numbers cannot be put on one timeline,
25
- * which is the only thing a trace is for.
26
- */
17
+ /** When it started, in epoch milliseconds — an INSTANT, not an offset. */
27
18
  startedAt: number;
28
19
  ms: number;
29
20
  /** The FougereError code when it refused, absent when it answered. */
30
21
  error: string | undefined;
31
22
  }
32
23
  export type SpanSink = (span: FinishedSpan) => void;
33
- /**
34
- * The step running here and now.
35
- *
36
- * It exists for the call the wire cannot describe: a handler reaching a second frond
37
- * builds a fresh invocation, so the parent is not on that call — it is in the context
38
- * the first one is still running inside.
39
- *
40
- * Behind `#trace-context` because that context is a runtime capability, not ours: a
41
- * Worker has none unless the deployment asks. `traceContext.ambient` says which one is
42
- * running, and `trace()` reports it once at install rather than letting a reader
43
- * discover it in a trace viewer.
44
- */
24
+ /** The step running here and now. */
45
25
  /** The step running right now, if any. */
46
26
  export declare function currentSpan(): SpanContext | undefined;
47
27
  export declare function activeCalls(): number;
48
- /**
49
- * Send what is buffered, now. Safe to call where there is nothing to send.
50
- *
51
- * Module-level like `sinks`, and for the same reason: an exporter belongs to the PROCESS,
52
- * and the handler that wants to flush it holds no reference to the extension that built it.
53
- */
28
+ /** Send what is buffered, now. */
54
29
  export declare function flushTelemetry(): Promise<void>;
55
30
  /** Declare an exporter's flush, and answer the way to withdraw it — like `onSpan`. */
56
31
  export declare function registerFlush(send: () => Promise<void>): () => void;
57
32
  export declare function onSpan(next: SpanSink): () => void;
58
- /**
59
- * The middleware. `app.use(trace())` traces every operation; `app.use('post', trace())`
60
- * traces one entity's.
61
- *
62
- * Nothing is opened while no sink is set: observing is a decision, and the cost of one
63
- * nobody asked for is zero rather than small.
64
- */
33
+ /** The middleware. */
65
34
  export declare function trace(): AppMiddleware;
66
35
  export { otlp } from './otlp.js';
67
36
  export type { OtlpOptions, OtlpExporter } from './otlp.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAA8C,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAWpD,iDAAiD;AACjD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,6FAA6F;IAC7F,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,sEAAsE;IACtE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;AAEpD;;;;;;;;;;;GAWG;AAEH,0CAA0C;AAC1C,wBAAgB,WAAW,IAAI,WAAW,GAAG,SAAS,CAErD;AAiBD,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAYD;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAMpD;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,CAMnE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,IAAI,CAMjD;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E,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;AAEpD,qCAAqC;AAErC,0CAA0C;AAC1C,wBAAgB,WAAW,IAAI,WAAW,GAAG,SAAS,CAErD;AAWD,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAKD,kCAAkC;AAClC,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAMpD;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,CAMnE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,IAAI,CAMjD;AAED,sBAAsB;AACtB,wBAAgB,KAAK,IAAI,aAAa,CA4DrC;AAOD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,46 +1,13 @@
1
- /**
2
- * @fougere/observability — one span per operation, and the trace that survives a wire.
3
- *
4
- * Named for the subject and not for today's reading of it: a span carries an op's
5
- * duration and its verdict, which is the matter of a metric as much as of a trace, and
6
- * an exporter for either hangs off the same `onSpan`.
7
- *
8
- * Optional in the strong sense: core holds no tracing code at all, only a `trace` field
9
- * on the invocation that it carries and never reads. Everything else is here, behind
10
- * `app.use(trace())`, and an app that does not install it pays nothing.
11
- *
12
- * It is an ordinary app middleware because an operation ALREADY has a lifecycle and it
13
- * is that one — a second hook system would be a second answer to a settled question.
14
- * The same middleware runs on both halves of a split: at the door a call arrives at, and
15
- * at the stand-in it leaves from. That is why the numbers line up across processes, and
16
- * why the difference between the two spans is what the wire cost.
17
- */
1
+ /** @fougere/observability — one span per operation, and the trace that survives a wire. */
18
2
  import { traceContext } from '#trace-context';
19
3
  import { parseTraceparent, traceparentOf, randomHex } from './traceparent.js';
20
4
  export { traceparentOf, parseTraceparent } from './traceparent.js';
21
- /**
22
- * The step running here and now.
23
- *
24
- * It exists for the call the wire cannot describe: a handler reaching a second frond
25
- * builds a fresh invocation, so the parent is not on that call — it is in the context
26
- * the first one is still running inside.
27
- *
28
- * Behind `#trace-context` because that context is a runtime capability, not ours: a
29
- * Worker has none unless the deployment asks. `traceContext.ambient` says which one is
30
- * running, and `trace()` reports it once at install rather than letting a reader
31
- * discover it in a trace viewer.
32
- */
5
+ /** The step running here and now. */
33
6
  /** The step running right now, if any. */
34
7
  export function currentSpan() {
35
8
  return traceContext.current();
36
9
  }
37
- /**
38
- * Who takes the spans this process finishes, consulted at every end like the log level.
39
- *
40
- * A list rather than one: a span is the source of a trace AND of a metric, so the two
41
- * exporters read the same value rather than the middleware producing it twice.
42
- * Returns the way to withdraw.
43
- */
10
+ /** Who takes the spans this process finishes, consulted at every end like the log level. */
44
11
  const sinks = [];
45
12
  /**
46
13
  * Calls running right now — the saturation signal, and the only one a FINISHED span
@@ -50,21 +17,9 @@ let active = 0;
50
17
  export function activeCalls() {
51
18
  return active;
52
19
  }
53
- /**
54
- * Every exporter this process installed, so something can make them send NOW.
55
- *
56
- * An exporter buffers and flushes on a timer, which assumes a process that lives between
57
- * two requests. An isolate does not: it is frozen the moment it answers, so the timer
58
- * never fires and what it held is lost. `ctx.waitUntil(flushTelemetry())` is the whole
59
- * remedy — the platform's way of saying "this work outlives the response".
60
- */
20
+ /** Every exporter this process installed, so something can make them send NOW. */
61
21
  const flushes = [];
62
- /**
63
- * Send what is buffered, now. Safe to call where there is nothing to send.
64
- *
65
- * Module-level like `sinks`, and for the same reason: an exporter belongs to the PROCESS,
66
- * and the handler that wants to flush it holds no reference to the extension that built it.
67
- */
22
+ /** Send what is buffered, now. */
68
23
  export async function flushTelemetry() {
69
24
  // Every one, and the refusals together — a flush that abandons the rest loses the
70
25
  // windows after it, which is the answer `app.deliver` gives for the same shape.
@@ -90,13 +45,7 @@ export function onSpan(next) {
90
45
  sinks.splice(at, 1);
91
46
  };
92
47
  }
93
- /**
94
- * The middleware. `app.use(trace())` traces every operation; `app.use('post', trace())`
95
- * traces one entity's.
96
- *
97
- * Nothing is opened while no sink is set: observing is a decision, and the cost of one
98
- * nobody asked for is zero rather than small.
99
- */
48
+ /** The middleware. */
100
49
  export function trace() {
101
50
  return (ctx, next) => {
102
51
  if (sinks.length === 0)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AA0CnE;;;;;;;;;;;GAWG;AAEH,0CAA0C;AAC1C,MAAM,UAAU,WAAW;IACzB,OAAO,YAAY,CAAC,OAAO,EAAW,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,KAAK,GAAe,EAAE,CAAC;AAE7B;;;GAGG;AACH,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf,MAAM,UAAU,WAAW;IACzB,OAAO,MAAM,CAAC;A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,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;gBAC5B,MAAM,CAAC,SAAS,CAAC,CAAC;gBAClB,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBACpB,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,GAAY;IAC1B,MAAM,IAAI,GAAI,GAA0B,EAAE,IAAI,CAAC;IAC/C,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,GAAa,EAAE,IAAI,IAAI,OAAO,CAAC,CAAC;AAC7E,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/logs.d.ts CHANGED
@@ -21,11 +21,7 @@ export interface LogsOptions {
21
21
  flushMs?: number;
22
22
  /** Told when a batch could not be sent. Default: silence. */
23
23
  onError?: (err: unknown) => void;
24
- /**
25
- * Drop anything below this level before it leaves the process. Absent means "whatever
26
- * the logger let through" — `setLogLevel` has already filtered, and a second threshold
27
- * here would be a second place where the level lives.
28
- */
24
+ /** Drop anything below this level before it leaves the process. */
29
25
  minimum?: 'debug' | 'info' | 'warn' | 'error';
30
26
  }
31
27
  export declare function logs(options: LogsOptions): LogExporter;
@@ -1 +1 @@
1
- {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAA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CAA4C;IAC5C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC/C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CA2BtD"}
package/dist/logs.js CHANGED
@@ -1,14 +1,4 @@
1
- /**
2
- * Log export — the third signal, and the only one whose value is entirely in its links.
3
- *
4
- * A log shipped without a trace id is a log stored somewhere else. What makes it the third
5
- * pillar is landing on a trace and reading the lines that call produced, so every record
6
- * leaves with the span it was written inside — which this package knows and the logger
7
- * deliberately does not.
8
- *
9
- * The logger emits a structured record and nothing more (`onLog` in core). Attaching the
10
- * trace, naming the severity and speaking OTLP all happen here.
11
- */
1
+ /** Log export — the third signal, and the only one whose value is entirely in its links. */
12
2
  import { Beat } from './Beat.js';
13
3
  import { Endpoint } from './Endpoint.js';
14
4
  import { currentSpan } from './index.js';
package/dist/logs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"logs.js","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,gFAAgF;AAChF,MAAM,QAAQ,GAAqD;IACjE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE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AAC,CAAC,EAAE,CAAC;gCACtD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;6BACpD,CAAC;wBACJ,CAAC,CAAC;qBACH;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,MAAM,CAAC,MAAmB;IACjC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,OAAO,CAAC;IACpD,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;IACrE,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
package/dist/metrics.d.ts CHANGED
@@ -1,19 +1,4 @@
1
- /**
2
- * The four signals every service is judged on, derived from the span that already exists.
3
- *
4
- * Rate, errors and duration are ONE metric — a histogram of durations, dimensioned by
5
- * the op and by whether it refused. Its `count` is the rate, its dimension is the error
6
- * rate, its buckets are the latency: that is how OpenTelemetry spells
7
- * `http.server.request.duration`, and splitting it into three counters would publish the
8
- * same numbers three times and let them disagree.
9
- *
10
- * The fourth — saturation — cannot come from a finished span, because it is about the
11
- * ones that have NOT finished. The middleware counts it, `activeCalls()` reads it.
12
- *
13
- * Cardinality is bounded by construction: entity × operation × {ok, error}, all of them
14
- * declared in the code. Nothing carrying an id, a user or a trace ever becomes a
15
- * dimension — that is the one mistake a metrics layer cannot recover from.
16
- */
1
+ /** The four signals every service is judged on, derived from the span that already exists. */
17
2
  import type { App, Edge, FrondPlacement } from '@fougere/core';
18
3
  export type { Edge, FrondPlacement, TopologyReport } from '@fougere/core';
19
4
  import { type SpanSink } from './index.js';
@@ -45,18 +30,11 @@ export interface MetricsSnapshot {
45
30
  edges: Edge[];
46
31
  }
47
32
  /**
48
- * `app` is optional and only feeds the topology: what fronds this process found, and
49
- * which of them run elsewhere. Read from the scan, so it is DISCOVERED — a frond that
50
- * appears is on the dashboard without anyone declaring it there.
33
+ * `app` is optional and only feeds the topology: what fronds this process found, and which of them
34
+ * run elsewhere.
51
35
  */
52
36
  export declare function metrics(app?: App): Metrics;
53
- /**
54
- * Serve the topology on `rpc.topology` — read from inside the process it describes.
55
- *
56
- * This is why observability is not a frond: a frond may move behind `remotes:`, and moved,
57
- * this one would report the observer's process instead of the observed one. The op exists
58
- * exactly when this package is wired, so an app that installed none refuses it by name.
59
- */
37
+ /** Serve the topology on `rpc.topology` — read from inside the process it describes. */
60
38
  export declare function serveTopology(app: App, measured: Metrics): void;
61
39
  /** One snapshot, as OTLP/JSON spells metrics. Cumulative, which is what Prometheus reads. */
62
40
  export declare function metricsPayload(service: string, snapshot: MetricsSnapshot): {
@@ -73,12 +51,7 @@ export declare function metricsPayload(service: string, snapshot: MetricsSnapsho
73
51
  scope: {
74
52
  name: string;
75
53
  };
76
- /**
77
- * Only what has points. A metric with an empty `dataPoints` makes a
78
- * collector reject the WHOLE batch — measured: Prometheus answers 500 and
79
- * every other metric in the payload is lost with it. A process that calls
80
- * nobody has no edges, which is ordinary, not a reason to publish nothing.
81
- */
54
+ /** Only what has points. */
82
55
  metrics: Record<string, any>[];
83
56
  }[];
84
57
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"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EAAE,CAAC,CAAC;wCACxC,UAAU,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;wCAC5C,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE;wCACnB,YAAY,EAAE,GAAG;qCAClB,CAAC,CAAC;iCACJ;6BACF;yBACwB,CAAC,MAAM,CAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAC/D;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
package/dist/otlp.d.ts CHANGED
@@ -9,14 +9,7 @@ export interface OtlpOptions {
9
9
  flushMs?: number;
10
10
  /** Told when a batch could not be sent. Default: silence — a trace must never break a call. */
11
11
  onError?: (err: unknown) => void;
12
- /**
13
- * Publish these metrics on the same beat.
14
- *
15
- * Their endpoint defaults to the traces one with its last segment swapped — the OTLP
16
- * convention when a single collector takes both. Name `metricsUrl` when they are two:
17
- * traces and metrics are stored by different engines, and a deployment is free to run
18
- * one of each rather than a collector in front.
19
- */
12
+ /** Publish these metrics on the same beat. */
20
13
  metrics?: Metrics;
21
14
  /** Where metrics go when it is not the same collector as traces. */
22
15
  metricsUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"otlp.d.ts","sourceRoot":"","sources":["../src/otlp.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAgB,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,OAA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G,YAAY,CA2BvD"}
package/dist/otlp.js CHANGED
@@ -1,12 +1,4 @@
1
- /**
2
- * OTLP export — the spans this process finished, in the one shape every collector reads.
3
- *
4
- * OTLP has a JSON encoding over plain HTTP, so this needs no protobuf and no dependency:
5
- * a POST to `/v1/traces`, and Jaeger, Tempo, Datadog or Honeycomb ingest it as-is.
6
- *
7
- * It is a sink and nothing more — `onSpan(otlp({...}).sink)` is the whole wiring. What
8
- * a span IS was decided by the middleware; this file only renames its fields.
9
- */
1
+ /** OTLP export — the spans this process finished, in the one shape every collector reads. */
10
2
  import { Beat } from './Beat.js';
11
3
  import { Endpoint } from './Endpoint.js';
12
4
  import { metricsPayload } from './metrics.js';
package/dist/otlp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"otlp.js","sourceRoot":"","sources":["../src/otlp.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAgB,MAAM,cAAc,CAAC;AAiC5D,iDAAiD;AACjD,MAAM,EAAE,GAAG,CAAC,CAAC;AACb,MAAM,KAAK,GAAG,CAAC,CAAC;AAEhB,MAAM,UAAU,IAAI,CAAC,OAAoB;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,iCAAiC,CAAC;IAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,CACzB,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,EACjE,OAAO,CAAC,OAAO,CAChB,CAAC;IACF,IAAI,MAAM,GAAmB,EAAE,CAAC;IAEhC,KAAK,UAAU,KAAK;QAClB,MAAM,KAAK,GAAG,MAAM,CAA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AAc,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE;gBACpF,UAAU,EAAE;oBACV;wBACE,KAAK,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE;wBACzC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;4BAC1B,OAAO,EAAE,IAAI,CAAC,OAAO;4BACrB,MAAM,EAAE,IAAI,CAAC,MAAM;4BACnB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;4BACzD,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE;4BACxC,IAAI,EAAE,CAAC;4BACP,iBAAiB,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;4BACxC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC;4BAChD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;yBACzE,CAAC,CAAC;qBACJ;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;AACnC,CAAC"}
@@ -1,13 +1,4 @@
1
- /**
2
- * `traceparent` — the one form a trace takes between two processes (W3C Trace Context).
3
- *
4
- * A standard rather than ours, so any collector reads it. It rides `InvocationContext.trace`
5
- * and never a header: a header is HTTP's alone, and the same call over a socket would have
6
- * arrived untraced.
7
- *
8
- * Pure — no runtime, no node builtin. What holds the CURRENT trace is `index.ts`, and the
9
- * line between the two is the line between a format and the thing that carries it.
10
- */
1
+ /** `traceparent` — the one form a trace takes between two processes (W3C Trace Context). */
11
2
  /** A step in a trace, as both halves of a split agree on it. */
12
3
  export interface SpanContext {
13
4
  /** The whole call, across every process. 32 hex. */
@@ -1 +1 @@
1
- {"version":3,"file":"traceparent.d.ts","sourceRoot":"","sources":["../src/traceparent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAEvD;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAOpF;AAID,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/C"}
1
+ {"version":3,"file":"traceparent.d.ts","sourceRoot":"","sources":["../src/traceparent.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAE5F,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAEvD;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAOpF;AAID,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/C"}
@@ -1,13 +1,4 @@
1
- /**
2
- * `traceparent` — the one form a trace takes between two processes (W3C Trace Context).
3
- *
4
- * A standard rather than ours, so any collector reads it. It rides `InvocationContext.trace`
5
- * and never a header: a header is HTTP's alone, and the same call over a socket would have
6
- * arrived untraced.
7
- *
8
- * Pure — no runtime, no node builtin. What holds the CURRENT trace is `index.ts`, and the
9
- * line between the two is the line between a format and the thing that carries it.
10
- */
1
+ /** `traceparent` — the one form a trace takes between two processes (W3C Trace Context). */
11
2
  const TRACEPARENT = /^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;
12
3
  const NO_TRACE = '0'.repeat(32);
13
4
  const NO_SPAN = '0'.repeat(16);
@@ -1 +1 @@
1
- {"version":3,"file":"traceparent.js","sourceRoot":"","sources":["../src/traceparent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,MAAM,WAAW,GAAG,kDAAkD,CAAC;AACvE,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE/B,qEAAqE;AACrE,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,OAAO,MAAM,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3E,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,gBAAgB,CAAC,MAA0B;IACzD,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClF,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAE7B,MAAM,CAAC,EAAE,OAAO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G,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClF,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAE7B,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;IACzC,IAAI,OAAO,KAAK,QAAQ,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,gEAAgE;AAChE,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,MAAM;QAAE,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAClE,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fougere/observability",
3
- "version": "0.6.0-alpha.0",
3
+ "version": "0.7.0-alpha.0",
4
4
  "description": "Optional observability for Fougere: one span per operation, W3C Trace Context across any transport.",
5
5
  "keywords": [
6
6
  "fougere",
@@ -31,14 +31,14 @@
31
31
  "src"
32
32
  ],
33
33
  "peerDependencies": {
34
- "@fougere/core": "^0.6.0-alpha.0"
34
+ "@fougere/core": "^0.7.0-alpha.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "vitest": "^4.1.0",
38
- "@fougere/container": "0.6.0-alpha.0",
39
- "@fougere/schema": "0.6.0-alpha.0",
40
- "@fougere/core": "0.6.0-alpha.0",
41
- "@fougere/transport-http": "0.6.0-alpha.0"
38
+ "@fougere/container": "0.7.0-alpha.0",
39
+ "@fougere/core": "0.7.0-alpha.0",
40
+ "@fougere/transport-http": "0.7.0-alpha.0",
41
+ "@fougere/schema": "0.7.0-alpha.0"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
package/src/Beat.ts CHANGED
@@ -1,13 +1,4 @@
1
- /**
2
- * How often a batch leaves, and how the beat stops.
3
- *
4
- * `flushMs: 0` means "nobody is on a timer here, I will say when" — and on a Worker it is
5
- * not a preference, it is the only legal form: Cloudflare REFUSES a deployment whose
6
- * module scope sets a timeout ("Disallowed operation called within global scope"), and an
7
- * app built at module scope builds its exporter there. Measured 2026-08-23, the deploy
8
- * failed with error 10021. The isolate is frozen at the response anyway, so the timer
9
- * could never have fired; `ctx.waitUntil(flushTelemetry())` is what sends.
10
- */
1
+ /** How often a batch leaves, and how the beat stops. */
11
2
  export class Beat {
12
3
  private constructor(
13
4
  private readonly timer: ReturnType<typeof setInterval> | undefined,
package/src/Endpoint.ts CHANGED
@@ -1,9 +1,4 @@
1
- /**
2
- * Where a batch goes, and what a failure to send is allowed to do — nothing.
3
- *
4
- * A trace must never break the call it describes, so a refusal is reported through
5
- * `onError` or not at all, and `post` resolves either way.
6
- */
1
+ /** Where a batch goes, and what a failure to send is allowed to do — nothing. */
7
2
  export class Endpoint {
8
3
  private constructor(
9
4
  private readonly url: string,
@@ -1,16 +1,4 @@
1
- /**
2
- * workerd with no flag: there is no ambient store, so there is no parent to find.
3
- *
4
- * NOT a module-level variable standing in for one. An isolate serves many requests at
5
- * once and a shared slot would attribute one call's span to another — a trace that is
6
- * wrong is worse than a trace that is absent, which is the same answer the emission
7
- * chain gives one file over.
8
- *
9
- * What is lost is exactly this: a call that crossed NO wire starts its own trace. An
10
- * arriving call is untouched — it reads `traceparent` off the invocation — and so is a
11
- * call to a frond behind `remotes:`, which crosses one. `nodejs_als` in
12
- * `compatibility_flags` restores the rest, and the boot names it.
13
- */
1
+ /** workerd with no flag. */
14
2
  import type { SpanContext } from '../traceparent.js';
15
3
  import type { TraceContext } from './port.js';
16
4
 
@@ -1,16 +1,4 @@
1
- /**
2
- * Where the step running right now is kept — the one thing a Worker cannot do.
3
- *
4
- * A trace has TWO ways to name its parent, and only one of them is ambient: an arriving
5
- * call carries `traceparent` on the invocation, which every transport moves and which
6
- * needs nothing from the runtime. This is the other way — the parent of a call that
7
- * crossed no wire, which is in the stack and nowhere else.
8
- *
9
- * `node:async_hooks` does not exist on workerd unless the deployment asks for it, so
10
- * `#trace-context` resolves to two realizations: the real store by default, and one that
11
- * answers "no parent here" under the `workerd` condition. What that costs is stated at
12
- * boot rather than discovered in a trace viewer — see `traceContext.ambient`.
13
- */
1
+ /** Where the step running right now is kept — the one thing a Worker cannot do. */
14
2
  import type { SpanContext } from '../traceparent.js';
15
3
 
16
4
  export interface TraceContext {
package/src/extension.ts CHANGED
@@ -1,14 +1,4 @@
1
- /**
2
- * This package's own ascent and descent, in one value.
3
- *
4
- * Four gestures in a fixed order — the middleware, the accumulator, the sinks, the wire op
5
- * — is a boot sequence, and a host had to know it: `demos/observability` wrote it out and
6
- * hand-rolled its own `stop()` beside it, which is a `down` under another name. Declared as
7
- * an extension, the order is stated once here and the release is not the host's to remember.
8
- *
9
- * It is not a frond and cannot become one: a frond may move behind `remotes:`, and this
10
- * reads the process it runs in — moved, it would report the observer instead of the observed.
11
- */
1
+ /** This package's own ascent and descent, in one value. */
12
2
  import { loggerMiddleware, Logger, onLog, type App, type Extension } from '@fougere/core';
13
3
  import { traceContext } from '#trace-context';
14
4
  import { registerFlush } from './index.js';
@@ -20,34 +10,17 @@ import { logs } from './logs.js';
20
10
  export interface ObservabilityOptions {
21
11
  /** What a dashboard groups this process by, and the name a log line carries. */
22
12
  service?: string;
23
- /**
24
- * An OTLP collector's base URL — SigNoz, Jaeger, Tempo all read the same one.
25
- *
26
- * Absent, nothing leaves the process and `rpc.topology` still answers: a panel asking
27
- * the app what shape it is in needs no collector.
28
- */
13
+ /** An OTLP collector's base URL — SigNoz, Jaeger, Tempo all read the same one. */
29
14
  otlp?: string;
30
15
  flushMs?: number;
31
16
  /** A collector that cannot be reached is the app's business, not its failure. */
32
17
  onError?: (error: unknown) => void;
33
18
  }
34
19
 
35
- /**
36
- * Observe this process — one member of the ascent.
37
- *
38
- * `up` wires in the order that matters and `down` withdraws in reverse, which is the whole
39
- * reason the two halves are one value: `onSpan` and `onLog` already RETURN their withdrawal
40
- * and nothing was calling it, so a discarded app kept feeding the sinks of the app that
41
- * replaced it. That is invisible until the ring turns, and then it doubles every metric.
42
- */
20
+ /** Observe this process — one member of the ascent. */
43
21
  export function observability(options: ObservabilityOptions = {}): Extension {
44
22
  const service = options.service ?? 'fougere';
45
- /**
46
- * Per APP, not per extension. A host declares its extensions once (`configureFougere`),
47
- * so the same instance goes up on the new app before the old one is released: one shared
48
- * list meant the old app's `down` withdrew — and erased — the new app's sinks too, after
49
- * which every counter stayed frozen and nothing said so.
50
- */
23
+ /** Per APP, not per extension. */
51
24
  const undoing = new WeakMap<App, (() => void | Promise<void>)[]>();
52
25
 
53
26
  return {
package/src/index.ts CHANGED
@@ -1,20 +1,4 @@
1
- /**
2
- * @fougere/observability — one span per operation, and the trace that survives a wire.
3
- *
4
- * Named for the subject and not for today's reading of it: a span carries an op's
5
- * duration and its verdict, which is the matter of a metric as much as of a trace, and
6
- * an exporter for either hangs off the same `onSpan`.
7
- *
8
- * Optional in the strong sense: core holds no tracing code at all, only a `trace` field
9
- * on the invocation that it carries and never reads. Everything else is here, behind
10
- * `app.use(trace())`, and an app that does not install it pays nothing.
11
- *
12
- * It is an ordinary app middleware because an operation ALREADY has a lifecycle and it
13
- * is that one — a second hook system would be a second answer to a settled question.
14
- * The same middleware runs on both halves of a split: at the door a call arrives at, and
15
- * at the stand-in it leaves from. That is why the numbers line up across processes, and
16
- * why the difference between the two spans is what the wire cost.
17
- */
1
+ /** @fougere/observability — one span per operation, and the trace that survives a wire. */
18
2
  import { traceContext } from '#trace-context';
19
3
  import type { AppMiddleware } from '@fougere/core';
20
4
  import { parseTraceparent, traceparentOf, randomHex, type SpanContext } from './traceparent.js';
@@ -22,11 +6,7 @@ import { parseTraceparent, traceparentOf, randomHex, type SpanContext } from './
22
6
  export { traceparentOf, parseTraceparent } from './traceparent.js';
23
7
  export type { SpanContext } from './traceparent.js';
24
8
 
25
- /**
26
- * A step while it runs. `SpanContext` is the part that TRAVELS (W3C Trace Context, three
27
- * fields, nothing else); the frond is ours and stays in this process — which is enough,
28
- * because the only place an edge is knowable is the side that made the call.
29
- */
9
+ /** A step while it runs. */
30
10
  interface Running extends SpanContext {
31
11
  frond: string | undefined;
32
12
  }
@@ -35,24 +15,15 @@ interface Running extends SpanContext {
35
15
  export interface FinishedSpan extends SpanContext {
36
16
  parentId: string | undefined;
37
17
  /**
38
- * The frond of the step this one is nested in, when it is a DIFFERENT one — an edge of
39
- * the call graph, `shop → catalog`.
40
- *
41
- * Only the caller can say it: a traceparent carries no frond, so a receiver knows it
42
- * has a parent and not whose. That is not a gap — the caller already published the edge.
18
+ * The frond of the step this one is nested in, when it is a DIFFERENT one — an edge of the call
19
+ * graph, `shop → catalog`.
43
20
  */
44
21
  callerFrond: string | undefined;
45
22
  /** Which frond owned the op — the deployment unit, so the first thing a reader groups by. */
46
23
  frond: string | undefined;
47
24
  entity: string;
48
25
  operation: string;
49
- /**
50
- * When it started, in epoch milliseconds — an INSTANT, not an offset.
51
- *
52
- * `performance.now()` measures the duration below and nothing else: it counts from
53
- * this process's own start, so two processes' numbers cannot be put on one timeline,
54
- * which is the only thing a trace is for.
55
- */
26
+ /** When it started, in epoch milliseconds — an INSTANT, not an offset. */
56
27
  startedAt: number;
57
28
  ms: number;
58
29
  /** The FougereError code when it refused, absent when it answered. */
@@ -61,31 +32,14 @@ export interface FinishedSpan extends SpanContext {
61
32
 
62
33
  export type SpanSink = (span: FinishedSpan) => void;
63
34
 
64
- /**
65
- * The step running here and now.
66
- *
67
- * It exists for the call the wire cannot describe: a handler reaching a second frond
68
- * builds a fresh invocation, so the parent is not on that call — it is in the context
69
- * the first one is still running inside.
70
- *
71
- * Behind `#trace-context` because that context is a runtime capability, not ours: a
72
- * Worker has none unless the deployment asks. `traceContext.ambient` says which one is
73
- * running, and `trace()` reports it once at install rather than letting a reader
74
- * discover it in a trace viewer.
75
- */
35
+ /** The step running here and now. */
76
36
 
77
37
  /** The step running right now, if any. */
78
38
  export function currentSpan(): SpanContext | undefined {
79
39
  return traceContext.current<Running>();
80
40
  }
81
41
 
82
- /**
83
- * Who takes the spans this process finishes, consulted at every end like the log level.
84
- *
85
- * A list rather than one: a span is the source of a trace AND of a metric, so the two
86
- * exporters read the same value rather than the middleware producing it twice.
87
- * Returns the way to withdraw.
88
- */
42
+ /** Who takes the spans this process finishes, consulted at every end like the log level. */
89
43
  const sinks: SpanSink[] = [];
90
44
 
91
45
  /**
@@ -98,22 +52,10 @@ export function activeCalls(): number {
98
52
  return active;
99
53
  }
100
54
 
101
- /**
102
- * Every exporter this process installed, so something can make them send NOW.
103
- *
104
- * An exporter buffers and flushes on a timer, which assumes a process that lives between
105
- * two requests. An isolate does not: it is frozen the moment it answers, so the timer
106
- * never fires and what it held is lost. `ctx.waitUntil(flushTelemetry())` is the whole
107
- * remedy — the platform's way of saying "this work outlives the response".
108
- */
55
+ /** Every exporter this process installed, so something can make them send NOW. */
109
56
  const flushes: (() => Promise<void>)[] = [];
110
57
 
111
- /**
112
- * Send what is buffered, now. Safe to call where there is nothing to send.
113
- *
114
- * Module-level like `sinks`, and for the same reason: an exporter belongs to the PROCESS,
115
- * and the handler that wants to flush it holds no reference to the extension that built it.
116
- */
58
+ /** Send what is buffered, now. */
117
59
  export async function flushTelemetry(): Promise<void> {
118
60
  // Every one, and the refusals together — a flush that abandons the rest loses the
119
61
  // windows after it, which is the answer `app.deliver` gives for the same shape.
@@ -139,13 +81,7 @@ export function onSpan(next: SpanSink): () => void {
139
81
  };
140
82
  }
141
83
 
142
- /**
143
- * The middleware. `app.use(trace())` traces every operation; `app.use('post', trace())`
144
- * traces one entity's.
145
- *
146
- * Nothing is opened while no sink is set: observing is a decision, and the cost of one
147
- * nobody asked for is zero rather than small.
148
- */
84
+ /** The middleware. */
149
85
  export function trace(): AppMiddleware {
150
86
  return (ctx, next) => {
151
87
  if (sinks.length === 0) return next();
package/src/logs.ts CHANGED
@@ -1,14 +1,4 @@
1
- /**
2
- * Log export — the third signal, and the only one whose value is entirely in its links.
3
- *
4
- * A log shipped without a trace id is a log stored somewhere else. What makes it the third
5
- * pillar is landing on a trace and reading the lines that call produced, so every record
6
- * leaves with the span it was written inside — which this package knows and the logger
7
- * deliberately does not.
8
- *
9
- * The logger emits a structured record and nothing more (`onLog` in core). Attaching the
10
- * trace, naming the severity and speaking OTLP all happen here.
11
- */
1
+ /** Log export — the third signal, and the only one whose value is entirely in its links. */
12
2
  import { Beat } from './Beat.js';
13
3
  import { Endpoint } from './Endpoint.js';
14
4
  import { currentSpan } from './index.js';
@@ -46,11 +36,7 @@ export interface LogsOptions {
46
36
  flushMs?: number;
47
37
  /** Told when a batch could not be sent. Default: silence. */
48
38
  onError?: (err: unknown) => void;
49
- /**
50
- * Drop anything below this level before it leaves the process. Absent means "whatever
51
- * the logger let through" — `setLogLevel` has already filtered, and a second threshold
52
- * here would be a second place where the level lives.
53
- */
39
+ /** Drop anything below this level before it leaves the process. */
54
40
  minimum?: 'debug' | 'info' | 'warn' | 'error';
55
41
  }
56
42
 
package/src/metrics.ts CHANGED
Binary file
package/src/otlp.ts CHANGED
@@ -1,12 +1,4 @@
1
- /**
2
- * OTLP export — the spans this process finished, in the one shape every collector reads.
3
- *
4
- * OTLP has a JSON encoding over plain HTTP, so this needs no protobuf and no dependency:
5
- * a POST to `/v1/traces`, and Jaeger, Tempo, Datadog or Honeycomb ingest it as-is.
6
- *
7
- * It is a sink and nothing more — `onSpan(otlp({...}).sink)` is the whole wiring. What
8
- * a span IS was decided by the middleware; this file only renames its fields.
9
- */
1
+ /** OTLP export — the spans this process finished, in the one shape every collector reads. */
10
2
  import { Beat } from './Beat.js';
11
3
  import { Endpoint } from './Endpoint.js';
12
4
  import type { FinishedSpan, SpanSink } from './index.js';
@@ -21,14 +13,7 @@ export interface OtlpOptions {
21
13
  flushMs?: number;
22
14
  /** Told when a batch could not be sent. Default: silence — a trace must never break a call. */
23
15
  onError?: (err: unknown) => void;
24
- /**
25
- * Publish these metrics on the same beat.
26
- *
27
- * Their endpoint defaults to the traces one with its last segment swapped — the OTLP
28
- * convention when a single collector takes both. Name `metricsUrl` when they are two:
29
- * traces and metrics are stored by different engines, and a deployment is free to run
30
- * one of each rather than a collector in front.
31
- */
16
+ /** Publish these metrics on the same beat. */
32
17
  metrics?: Metrics;
33
18
  /** Where metrics go when it is not the same collector as traces. */
34
19
  metricsUrl?: string;
@@ -1,13 +1,4 @@
1
- /**
2
- * `traceparent` — the one form a trace takes between two processes (W3C Trace Context).
3
- *
4
- * A standard rather than ours, so any collector reads it. It rides `InvocationContext.trace`
5
- * and never a header: a header is HTTP's alone, and the same call over a socket would have
6
- * arrived untraced.
7
- *
8
- * Pure — no runtime, no node builtin. What holds the CURRENT trace is `index.ts`, and the
9
- * line between the two is the line between a format and the thing that carries it.
10
- */
1
+ /** `traceparent` — the one form a trace takes between two processes (W3C Trace Context). */
11
2
 
12
3
  /** A step in a trace, as both halves of a split agree on it. */
13
4
  export interface SpanContext {