@pristine-ts/telemetry 2.0.1 → 2.0.3

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 (73) hide show
  1. package/dist/lib/cjs/decorators/decorators.js +18 -0
  2. package/dist/lib/cjs/decorators/decorators.js.map +1 -0
  3. package/dist/lib/cjs/decorators/traced.decorator.js +60 -0
  4. package/dist/lib/cjs/decorators/traced.decorator.js.map +1 -0
  5. package/dist/lib/cjs/enums/console-tracer-output-mode.enum.js +16 -0
  6. package/dist/lib/cjs/enums/console-tracer-output-mode.enum.js.map +1 -0
  7. package/dist/lib/cjs/enums/enums.js +1 -0
  8. package/dist/lib/cjs/enums/enums.js.map +1 -1
  9. package/dist/lib/cjs/managers/tracing.manager.js +56 -41
  10. package/dist/lib/cjs/managers/tracing.manager.js.map +1 -1
  11. package/dist/lib/cjs/telemetry.configuration-keys.js +7 -0
  12. package/dist/lib/cjs/telemetry.configuration-keys.js.map +1 -1
  13. package/dist/lib/cjs/telemetry.module.js +90 -0
  14. package/dist/lib/cjs/telemetry.module.js.map +1 -1
  15. package/dist/lib/cjs/tracers/console.tracer.js +106 -0
  16. package/dist/lib/cjs/tracers/console.tracer.js.map +1 -0
  17. package/dist/lib/cjs/tracers/file.tracer.js +161 -0
  18. package/dist/lib/cjs/tracers/file.tracer.js.map +1 -0
  19. package/dist/lib/cjs/tracers/tracers.js +2 -1
  20. package/dist/lib/cjs/tracers/tracers.js.map +1 -1
  21. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  22. package/dist/lib/cjs/utils/span-runner.js +112 -0
  23. package/dist/lib/cjs/utils/span-runner.js.map +1 -0
  24. package/dist/lib/cjs/utils/trace-renderer.js +128 -0
  25. package/dist/lib/cjs/utils/trace-renderer.js.map +1 -0
  26. package/dist/lib/cjs/utils/utils.js +19 -0
  27. package/dist/lib/cjs/utils/utils.js.map +1 -0
  28. package/dist/lib/esm/decorators/decorators.js +2 -0
  29. package/dist/lib/esm/decorators/decorators.js.map +1 -0
  30. package/dist/lib/esm/decorators/traced.decorator.js +57 -0
  31. package/dist/lib/esm/decorators/traced.decorator.js.map +1 -0
  32. package/dist/lib/esm/enums/console-tracer-output-mode.enum.js +13 -0
  33. package/dist/lib/esm/enums/console-tracer-output-mode.enum.js.map +1 -0
  34. package/dist/lib/esm/enums/enums.js +1 -0
  35. package/dist/lib/esm/enums/enums.js.map +1 -1
  36. package/dist/lib/esm/managers/tracing.manager.js +58 -43
  37. package/dist/lib/esm/managers/tracing.manager.js.map +1 -1
  38. package/dist/lib/esm/telemetry.configuration-keys.js +7 -0
  39. package/dist/lib/esm/telemetry.configuration-keys.js.map +1 -1
  40. package/dist/lib/esm/telemetry.module.js +91 -1
  41. package/dist/lib/esm/telemetry.module.js.map +1 -1
  42. package/dist/lib/esm/tracers/console.tracer.js +103 -0
  43. package/dist/lib/esm/tracers/console.tracer.js.map +1 -0
  44. package/dist/lib/esm/tracers/file.tracer.js +125 -0
  45. package/dist/lib/esm/tracers/file.tracer.js.map +1 -0
  46. package/dist/lib/esm/tracers/tracers.js +2 -1
  47. package/dist/lib/esm/tracers/tracers.js.map +1 -1
  48. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  49. package/dist/lib/esm/utils/span-runner.js +108 -0
  50. package/dist/lib/esm/utils/span-runner.js.map +1 -0
  51. package/dist/lib/esm/utils/trace-renderer.js +124 -0
  52. package/dist/lib/esm/utils/trace-renderer.js.map +1 -0
  53. package/dist/lib/esm/utils/utils.js +3 -0
  54. package/dist/lib/esm/utils/utils.js.map +1 -0
  55. package/dist/types/decorators/decorators.d.ts +1 -0
  56. package/dist/types/decorators/traced.decorator.d.ts +35 -0
  57. package/dist/types/enums/console-tracer-output-mode.enum.d.ts +11 -0
  58. package/dist/types/enums/enums.d.ts +1 -0
  59. package/dist/types/managers/tracing.manager.d.ts +11 -1
  60. package/dist/types/telemetry.configuration-keys.d.ts +15 -0
  61. package/dist/types/telemetry.module.d.ts +2 -0
  62. package/dist/types/tracers/console.tracer.d.ts +28 -0
  63. package/dist/types/tracers/file.tracer.d.ts +34 -0
  64. package/dist/types/tracers/tracers.d.ts +2 -1
  65. package/dist/types/utils/span-runner.d.ts +55 -0
  66. package/dist/types/utils/trace-renderer.d.ts +41 -0
  67. package/dist/types/utils/utils.d.ts +2 -0
  68. package/package.json +4 -4
  69. package/dist/lib/cjs/tracers/basic.tracer.js +0 -50
  70. package/dist/lib/cjs/tracers/basic.tracer.js.map +0 -1
  71. package/dist/lib/esm/tracers/basic.tracer.js +0 -47
  72. package/dist/lib/esm/tracers/basic.tracer.js.map +0 -1
  73. package/dist/types/tracers/basic.tracer.d.ts +0 -12
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.traceRenderer = exports.TraceRenderer = void 0;
4
+ /**
5
+ * Pure-function renderers for `Trace` objects. Used by both `ConsoleTracer` (writes to
6
+ * stdout) and `FileTracer` (writes to disk) so the visual output is identical regardless
7
+ * of destination. All methods are stateless — instantiate once and reuse, or use the
8
+ * exported singleton `traceRenderer` if you don't care.
9
+ */
10
+ class TraceRenderer {
11
+ /**
12
+ * Indented ASCII tree mirroring the span hierarchy. Right-aligned durations, slowest
13
+ * leaf span flagged as `← bottleneck`. Best for human readers.
14
+ *
15
+ * Internal/parent spans are skipped for bottleneck detection on purpose: a parent's
16
+ * duration is the sum of its children's work, so it would always dwarf any single
17
+ * leaf and the flag would never highlight where the actual time was spent.
18
+ */
19
+ renderTree(trace) {
20
+ const lines = [];
21
+ lines.push(`Trace ${trace.id} — ${trace.getDuration()}ms`);
22
+ if (trace.rootSpan === undefined) {
23
+ lines.push(" (no rootSpan)");
24
+ return lines.join("\n");
25
+ }
26
+ // Pre-walk to find the slowest leaf for the bottleneck flag.
27
+ let slowestSpan;
28
+ let slowestDuration = -1;
29
+ this.walkSpans(trace.rootSpan, (s) => {
30
+ if (s.children.length > 0)
31
+ return;
32
+ const d = s.getDuration();
33
+ if (d > slowestDuration) {
34
+ slowestDuration = d;
35
+ slowestSpan = s;
36
+ }
37
+ });
38
+ const rows = [];
39
+ const renderNode = (span, ancestorIsLast) => {
40
+ const prefix = ancestorIsLast.length === 0
41
+ ? ""
42
+ : ancestorIsLast.slice(0, -1).map(isLast => isLast ? " " : "│ ").join("")
43
+ + (ancestorIsLast[ancestorIsLast.length - 1] ? "└── " : "├── ");
44
+ rows.push({
45
+ prefix,
46
+ name: span.keyname,
47
+ duration: span.getDuration(),
48
+ isBottleneck: span === slowestSpan && slowestDuration > 0,
49
+ });
50
+ span.children.forEach((child, idx) => {
51
+ const isLast = idx === span.children.length - 1;
52
+ renderNode(child, [...ancestorIsLast, isLast]);
53
+ });
54
+ };
55
+ renderNode(trace.rootSpan, []);
56
+ // Pad name column so durations line up.
57
+ const nameColumnWidth = Math.max(...rows.map(r => r.prefix.length + r.name.length));
58
+ for (const row of rows) {
59
+ const padding = " ".repeat(Math.max(1, nameColumnWidth - row.prefix.length - row.name.length + 2));
60
+ const durationCell = `${row.duration}ms`.padStart(8);
61
+ const marker = row.isBottleneck ? " ← bottleneck" : "";
62
+ lines.push(`${row.prefix}${row.name}${padding}${durationCell}${marker}`);
63
+ }
64
+ return lines.join("\n");
65
+ }
66
+ /**
67
+ * One line per span sorted by start time, no indentation. Best for grep / log
68
+ * aggregation.
69
+ */
70
+ renderFlat(trace) {
71
+ const lines = [`Trace ${trace.id} — ${trace.getDuration()}ms`];
72
+ const all = [];
73
+ if (trace.rootSpan !== undefined) {
74
+ this.walkSpans(trace.rootSpan, (s) => all.push(s));
75
+ }
76
+ all.sort((a, b) => a.startDate - b.startDate);
77
+ for (const span of all) {
78
+ lines.push(` ${span.keyname.padEnd(48)} ${`${span.getDuration()}ms`.padStart(8)}`);
79
+ }
80
+ return lines.join("\n");
81
+ }
82
+ /**
83
+ * Pretty-printed JSON dump of the trace + every span. Best for piping into a downstream
84
+ * tool that wants structured access.
85
+ */
86
+ renderJson(trace) {
87
+ return JSON.stringify(this.serialize(trace), null, 2);
88
+ }
89
+ /**
90
+ * Serializes a trace to a plain JSON-friendly object. Exposed for callers that want to
91
+ * embed the structured form in a larger payload (e.g. a NDJSON line).
92
+ */
93
+ serialize(trace) {
94
+ return {
95
+ id: trace.id,
96
+ startDate: trace.startDate,
97
+ endDate: trace.endDate,
98
+ duration: trace.getDuration(),
99
+ context: trace.context,
100
+ rootSpan: trace.rootSpan ? this.serializeSpan(trace.rootSpan) : undefined,
101
+ };
102
+ }
103
+ serializeSpan(span) {
104
+ return {
105
+ id: span.id,
106
+ keyname: span.keyname,
107
+ startDate: span.startDate,
108
+ endDate: span.endDate,
109
+ duration: span.getDuration(),
110
+ context: span.context,
111
+ children: span.children.map(s => this.serializeSpan(s)),
112
+ };
113
+ }
114
+ /** Depth-first traversal helper. Visits the root and every descendant once. */
115
+ walkSpans(span, visit) {
116
+ visit(span);
117
+ for (const child of span.children) {
118
+ this.walkSpans(child, visit);
119
+ }
120
+ }
121
+ }
122
+ exports.TraceRenderer = TraceRenderer;
123
+ /**
124
+ * Default singleton. Use this from any caller that doesn't care to construct its own —
125
+ * the class is stateless so sharing is safe.
126
+ */
127
+ exports.traceRenderer = new TraceRenderer();
128
+ //# sourceMappingURL=trace-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-renderer.js","sourceRoot":"","sources":["../../../../src/utils/trace-renderer.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,MAAa,aAAa;IACxB;;;;;;;OAOG;IACH,UAAU,CAAC,KAAY;QACrB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAE3D,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC,IAA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;SAC1E,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,IAAU;QAC9B,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;SACxD,CAAC;IACJ,CAAC;IAED,+EAA+E;IACvE,SAAS,CAAC,IAAU,EAAE,KAAwB;QACpD,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AA5HD,sCA4HC;AAED;;;GAGG;AACU,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./span-runner"), exports);
18
+ __exportStar(require("./trace-renderer"), exports);
19
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,mDAAiC"}
@@ -0,0 +1,2 @@
1
+ export * from "./traced.decorator";
2
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../src/decorators/decorators.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { spanRunner } from "../utils/span-runner";
2
+ /**
3
+ * Method decorator that wraps the decorated method in a span. The span is automatically
4
+ * ended when the method returns or throws, and the `TracingManager` is auto-resolved
5
+ * from the active `EventContext` — no need to inject it manually.
6
+ *
7
+ * ```ts
8
+ * class PaymentService {
9
+ * @traced() // span name = "PaymentService.charge"
10
+ * async charge(amount: number) { ... }
11
+ *
12
+ * @traced("payment.refund.action") // explicit name
13
+ * async refund(chargeId: string) { ... }
14
+ * }
15
+ * ```
16
+ *
17
+ * **Behavior outside an event context.** When the decorated method runs without an
18
+ * active `EventContext` (e.g. a unit test calling the method directly, or background
19
+ * work that escaped the event lifecycle), the decorator is a no-op — the original
20
+ * method runs unchanged. Tracing must never throw or alter semantics.
21
+ *
22
+ * **Sync methods become async.** The decorator awaits the wrapped method internally,
23
+ * so any decorated method returns a `Promise`. Decorating a sync method changes its
24
+ * signature visible to callers — apply `@traced` to methods you'd already be awaiting
25
+ * (DB calls, HTTP, expensive computations), not to tight sync helpers.
26
+ *
27
+ * **Type-level caveat.** TypeScript's parameter and method decorator types don't carry
28
+ * enough information for the compiler to verify that the wrapped method's return type
29
+ * is compatible with `Promise<T>`. The wrapper is type-safe at runtime; the call site's
30
+ * static types are unchanged. Pair with explicit `: Promise<T>` annotations on the
31
+ * method when you want the static type to match what's actually returned.
32
+ *
33
+ * @param spanName Optional explicit name for the span. Defaults to
34
+ * `${ClassName}.${methodName}`.
35
+ */
36
+ export function traced(spanName) {
37
+ return (target, propertyKey, descriptor) => {
38
+ var _a, _b, _c;
39
+ const original = descriptor.value;
40
+ if (typeof original !== "function") {
41
+ // Decorator was applied to something other than a method (a getter, a property
42
+ // with no initial value, etc.). Leave it alone — silently no-op rather than
43
+ // throw at decoration time.
44
+ return descriptor;
45
+ }
46
+ // Resolve a stable default name at decoration time. `target.constructor.name` is
47
+ // the class name for instance methods; for static methods, `target.name` is the
48
+ // class. We cover both via the fallback chain.
49
+ const className = (_c = (_b = (_a = target === null || target === void 0 ? void 0 : target.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : target === null || target === void 0 ? void 0 : target.name) !== null && _c !== void 0 ? _c : "anonymous";
50
+ const resolvedName = spanName !== null && spanName !== void 0 ? spanName : `${className}.${String(propertyKey)}`;
51
+ descriptor.value = function (...args) {
52
+ return spanRunner.runWithSpan(resolvedName, () => original.apply(this, args));
53
+ };
54
+ return descriptor;
55
+ };
56
+ }
57
+ //# sourceMappingURL=traced.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traced.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/traced.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,MAAM,CAAC,QAAiB;IACtC,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,UAA8B,EAAE,EAAE;;QACnF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,+EAA+E;YAC/E,4EAA4E;YAC5E,4BAA4B;YAC5B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,iFAAiF;QACjF,gFAAgF;QAChF,+CAA+C;QAC/C,MAAM,SAAS,GAAW,MAAA,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,0CAAE,IAAI,mCAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,WAAW,CAAC;QACnF,MAAM,YAAY,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,GAAG,SAAS,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAEvE,UAAU,CAAC,KAAK,GAAG,UAAyB,GAAG,IAAW;YACxD,OAAO,UAAU,CAAC,WAAW,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * How `ConsoleTracer` renders a completed trace.
3
+ */
4
+ export var ConsoleTracerOutputModeEnum;
5
+ (function (ConsoleTracerOutputModeEnum) {
6
+ /** Indented ASCII tree mirroring the span hierarchy. Best for human readers. */
7
+ ConsoleTracerOutputModeEnum["Tree"] = "tree";
8
+ /** Pretty-printed JSON dump of the trace + every span. Best for piping into a tool. */
9
+ ConsoleTracerOutputModeEnum["Json"] = "json";
10
+ /** One span per line, no indentation, sorted by start time. Best for grep. */
11
+ ConsoleTracerOutputModeEnum["Flat"] = "flat";
12
+ })(ConsoleTracerOutputModeEnum || (ConsoleTracerOutputModeEnum = {}));
13
+ //# sourceMappingURL=console-tracer-output-mode.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-tracer-output-mode.enum.js","sourceRoot":"","sources":["../../../../src/enums/console-tracer-output-mode.enum.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,2BAOX;AAPD,WAAY,2BAA2B;IACrC,gFAAgF;IAChF,4CAAa,CAAA;IACb,uFAAuF;IACvF,4CAAa,CAAA;IACb,8EAA8E;IAC9E,4CAAa,CAAA;AACf,CAAC,EAPW,2BAA2B,KAA3B,2BAA2B,QAOtC"}
@@ -1,2 +1,3 @@
1
+ export * from "./console-tracer-output-mode.enum";
1
2
  export * from "./span-keyname.enum";
2
3
  //# sourceMappingURL=enums.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../../src/enums/enums.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../../src/enums/enums.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC"}
@@ -10,17 +10,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
- import { inject, injectable, injectAll, singleton } from "tsyringe";
13
+ import { inject, injectable, injectAll, Lifecycle, scoped } from "tsyringe";
14
14
  import { TelemetryConfigurationKeys } from "../telemetry.configuration-keys";
15
15
  import { Trace } from "../models/trace.model";
16
16
  import { Span } from "../models/span.model";
17
- import { injectConfig, moduleScoped, ServiceDefinitionTagEnum, tag, TracingContext } from "@pristine-ts/common";
17
+ import { EventContextManager, injectConfig, moduleScoped, ServiceDefinitionTagEnum, tag, TracingContext } from "@pristine-ts/common";
18
18
  import { SpanKeynameEnum } from "../enums/span-keyname.enum";
19
19
  import { TelemetryModuleKeyname } from "../telemetry.module.keyname";
20
20
  /**
21
21
  * The Tracing Manager provides methods to help with tracing.
22
22
  * It is tagged and can be injected using TracingManagerInterface which facilitates mocking.
23
23
  * It is module scoped to the TelemetryModuleKeyname.
24
+ *
25
+ * **Lifecycle: container-scoped, not singleton.** Each per-event DI child container gets
26
+ * its own `TracingManager` instance with its own `trace` and `spans` state. Earlier
27
+ * versions used `@singleton()` — a single instance shared across every event — which
28
+ * was a latent bug: parallel events would clobber each other's `this.trace`. Resolving
29
+ * `TracingManager` from the root container still returns the root instance (used for
30
+ * kernel-initialization spans before any event has started); resolving from a child
31
+ * container returns the per-event instance, which is what application code wants.
24
32
  */
25
33
  let TracingManager = class TracingManager {
26
34
  /**
@@ -54,8 +62,16 @@ let TracingManager = class TracingManager {
54
62
  startTracing(spanRootKeyname = SpanKeynameEnum.RootExecution, traceId, context) {
55
63
  this.trace = new Trace(traceId, context);
56
64
  const span = new Span(spanRootKeyname, undefined, context);
57
- // Set the trace id into the Tracing Context. This can be used to retrieve the current trace.
65
+ // Mirror the trace id into both the legacy `TracingContext` (back-compat for any
66
+ // existing consumer that still injects it) and the new ALS-propagated `EventContext`
67
+ // (the path forward; what `LogHandler` and other ALS-aware consumers will read).
68
+ // Both writes are cheap; the dual write is just a transition aid until TracingContext
69
+ // is fully removed in a later major.
58
70
  this.tracingContext.traceId = this.trace.id;
71
+ const eventContext = EventContextManager.current();
72
+ if (eventContext !== undefined) {
73
+ eventContext.traceId = this.trace.id;
74
+ }
59
75
  // If the tracing is not active, simply return the created span but don't send to the tracers.
60
76
  if (this.isActive === false) {
61
77
  return span;
@@ -90,43 +106,55 @@ let TracingManager = class TracingManager {
90
106
  */
91
107
  startSpan(keyname, parentKeyname, parentId, context) {
92
108
  var _a;
93
- // Check if there's an active trace. If not, start one.
109
+ // Make sure a trace exists. `startTracing` is the canonical entry point, but a direct
110
+ // `startSpan` call (e.g. from project code) should auto-start a trace rather than fail.
94
111
  if (this.trace === undefined) {
95
112
  this.startTracing(SpanKeynameEnum.RootExecution, undefined, context);
96
113
  }
97
- // Create the new span
98
- const span = new Span(keyname, context);
114
+ // Construct the span. NOTE the third constructor argument: `Span(keyname, id?, context?)`.
115
+ // A previous version of this code passed `context` in the `id` slot, which corrupted span
116
+ // identities and broke parent-by-id lookup at line 133 silently. Always pass `undefined`
117
+ // for the id so a fresh UUID is generated, and put context in the third slot.
118
+ const span = new Span(keyname, undefined, context);
119
+ // Defensive: tracing must never throw. If the trace is somehow still undefined here
120
+ // (an exception inside `startTracing` that we swallowed and logged), return the bare
121
+ // span so the caller can still call `.end()` on it without exploding.
99
122
  if (this.trace === undefined) {
100
- this.loghandler.error("The trace should not be undefined at this point.");
101
- return span; // Return because tracing should not throw.
123
+ this.loghandler.error("Trace is undefined after startTracing; returning unattached span.", { span });
124
+ return span;
102
125
  }
103
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
104
126
  span.trace = this.trace;
105
- // Retrieve the parent and add it to the span.
106
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
127
+ // Resolve the parent span. The default parent is the trace's rootSpan, but we may not
128
+ // have one if the trace was started via a path that didn't set it (programming error
129
+ // upstream, but we tolerate it). When no rootSpan exists, attach the new span as a
130
+ // top-level orphan and warn-log once instead of crashing.
107
131
  let parentSpan = this.trace.rootSpan;
108
- // Check to find the parentKeyname in our internal map of spans. If n ot, the rootSpan will be the parent since every span
109
- // needs at least one parent.
110
132
  if (parentKeyname) {
111
133
  const parentSpans = this.spans[parentKeyname];
112
- // If multiple spans have the same keyname we need an id to find the parent
113
134
  if (parentSpans) {
114
135
  if (parentSpans.length > 1) {
115
- if (!parentId) {
116
- //this.loghandler.error("Error finding the parent span, there are multiple spans with that keyname and no id is provided.", {parentKeyname});
117
- }
118
- else {
136
+ if (parentId) {
119
137
  parentSpan = (_a = parentSpans.find(span => span.id === parentId)) !== null && _a !== void 0 ? _a : parentSpan;
120
138
  }
139
+ // If multiple parents exist with the same keyname and no id was provided, fall back
140
+ // to the existing default (rootSpan or whatever parentSpan was) — silent rather
141
+ // than noisy because this is recoverable.
121
142
  }
122
143
  else if (parentSpans.length === 1) {
123
- // If only one span has the keyname we can use it
124
144
  parentSpan = parentSpans[0];
125
145
  }
126
146
  }
127
147
  }
128
- // Add the new span as a child of its parent.
129
- parentSpan.addChild(span);
148
+ if (parentSpan === undefined) {
149
+ this.loghandler.warning("startSpan: no parent span available (rootSpan is undefined). Attaching as orphan.", {
150
+ keyname,
151
+ parentKeyname,
152
+ traceId: this.trace.id,
153
+ });
154
+ }
155
+ else {
156
+ parentSpan.addChild(span);
157
+ }
130
158
  this.addSpan(span);
131
159
  return span;
132
160
  }
@@ -135,18 +163,14 @@ let TracingManager = class TracingManager {
135
163
  * @param span The span to add.
136
164
  */
137
165
  addSpan(span) {
138
- // Check if there's an active trace. If not, log an error and return;
166
+ // Tracing must never throw. If there's no active trace, log and return the span
167
+ // unchanged — caller can still call `.end()` on it because Span.end uses optional
168
+ // chaining on tracingManager.
139
169
  if (this.trace === undefined) {
140
170
  this.loghandler.error("You cannot call 'addSpan' without having an existing Trace.", { span });
141
171
  return span;
142
172
  }
143
- // Assign the tracing manager and the current trace to the span.
144
173
  span.tracingManager = this;
145
- if (this.trace === undefined) {
146
- this.loghandler.error("The trace should not be undefined at this point.");
147
- return span; // Return because tracing should not throw.
148
- }
149
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
150
174
  span.trace = this.trace;
151
175
  // Add it to the map of spans
152
176
  if (!this.spans[span.keyname]) {
@@ -241,31 +265,22 @@ let TracingManager = class TracingManager {
241
265
  if (this.isActive === false) {
242
266
  return;
243
267
  }
244
- // Notify the TraceListeners that the Trace was ended.
268
+ // Notify every registered tracer that the trace ended. The tracers handle their own
269
+ // formatting + transport (console pretty-print, file dump, X-Ray export, etc.). The
270
+ // manager itself no longer logs a summary here — `ConsoleTracer` produces a richer
271
+ // tree-formatted output when the user opts into it.
245
272
  this.tracers.forEach((tracer) => {
246
273
  var _a;
247
274
  (_a = tracer.traceEndedStream) === null || _a === void 0 ? void 0 : _a.push(this.trace);
248
275
  });
249
- // Trace time
250
- // Top 5 longest spans
251
- const longestSpans = Object.values(this.spans).flat(2).sort((a, b) => b.getDuration() - a.getDuration());
252
- longestSpans.splice(5);
253
- this.loghandler.debug("Ending the trace. \n" +
254
- "Trace duration: " + this.trace.getDuration() + " ms \n" +
255
- "Top 5 longest spans: \n" + longestSpans.map(span => "\t" + span.getDuration() + " ms - " + span.keyname).join("\n"), {
256
- extra: {
257
- trace: this.trace,
258
- },
259
- eventId: this.trace.id,
260
- });
261
276
  }
262
277
  };
263
278
  TracingManager = __decorate([
264
279
  moduleScoped(TelemetryModuleKeyname),
265
280
  tag("TracingManagerInterface"),
266
- singleton(),
281
+ scoped(Lifecycle.ContainerScoped),
267
282
  injectable(),
268
- __param(0, injectAll(ServiceDefinitionTagEnum.Tracer)),
283
+ __param(0, injectAll(ServiceDefinitionTagEnum.Tracer, { isOptional: true })),
269
284
  __param(1, inject("LogHandlerInterface")),
270
285
  __param(2, injectConfig(TelemetryConfigurationKeys.Active)),
271
286
  __param(3, injectConfig(TelemetryConfigurationKeys.Debug)),
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.manager.js","sourceRoot":"","sources":["../../../../src/managers/tracing.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAC,IAAI,EAAC,MAAM,sBAAsB,CAAC;AAE1C,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAC;AAInE;;;;GAIG;AAKI,IAAM,cAAc,GAApB,MAAM,cAAc;IAWzB;;;;;;;;;;OAUG;IACH,YAA+D,OAA2C,EACxD,UAAgD,EAC9B,QAAkC,EACnC,KAA+B,EAC9D,cAA8B;QAJc,YAAO,GAAP,OAAO,CAAmB;QACvC,eAAU,GAAV,UAAU,CAAqB;QACb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,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,oFAAoF;QACpF,oFAAoF;QACpF,mFAAmF;QACnF,oDAAoD;QACpD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAuB,EAAE,EAAE;;YAC/C,MAAA,MAAM,CAAC,gBAAgB,0CAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA1RY,cAAc;IAJ1B,YAAY,CAAC,sBAAsB,CAAC;IACpC,GAAG,CAAC,yBAAyB,CAAC;IAC9B,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;IACjC,UAAU,EAAE;IAuBS,WAAA,SAAS,CAAC,wBAAwB,CAAC,MAAM,EAAE,EAAC,UAAU,EAAE,IAAI,EAAC,CAAC,CAAA;IAC9D,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,YAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAA;IAC/C,WAAA,YAAY,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAA;sEACd,cAAc;GA1BvD,cAAc,CA0R1B"}
@@ -12,5 +12,12 @@
12
12
  export const TelemetryConfigurationKeys = {
13
13
  Active: "pristine.telemetry.active",
14
14
  Debug: "pristine.telemetry.debug",
15
+ ConsoleTracerActivated: "pristine.telemetry.console-tracer.activated",
16
+ ConsoleTracerOutputMode: "pristine.telemetry.console-tracer.output-mode",
17
+ ConsoleTracerMinimumDurationMs: "pristine.telemetry.console-tracer.minimum-duration-ms",
18
+ FileTracerActivated: "pristine.telemetry.file-tracer.activated",
19
+ FileTracerOutputMode: "pristine.telemetry.file-tracer.output-mode",
20
+ FileTracerDirectory: "pristine.telemetry.file-tracer.directory",
21
+ FileTracerFilenamePattern: "pristine.telemetry.file-tracer.filename-pattern",
15
22
  };
16
23
  //# sourceMappingURL=telemetry.configuration-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.configuration-keys.js","sourceRoot":"","sources":["../../../src/telemetry.configuration-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,MAAM,EAAE,2BAA2B;IACnC,KAAK,EAAE,0BAA0B;CACzB,CAAC"}
1
+ {"version":3,"file":"telemetry.configuration-keys.js","sourceRoot":"","sources":["../../../src/telemetry.configuration-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,MAAM,EAAE,2BAA2B;IACnC,KAAK,EAAE,0BAA0B;IACjC,sBAAsB,EAAE,6CAA6C;IACrE,uBAAuB,EAAE,+CAA+C;IACxE,8BAA8B,EAAE,uDAAuD;IACvF,mBAAmB,EAAE,0CAA0C;IAC/D,oBAAoB,EAAE,4CAA4C;IAClE,mBAAmB,EAAE,0CAA0C;IAC/D,yBAAyB,EAAE,iDAAiD;CACpE,CAAC"}
@@ -1,12 +1,15 @@
1
1
  import { CommonModule } from "@pristine-ts/common";
2
2
  import { TelemetryModuleKeyname } from "./telemetry.module.keyname";
3
3
  import { LoggingModule } from "@pristine-ts/logging";
4
- import { BooleanResolver, EnvironmentVariableResolver } from "@pristine-ts/configuration";
4
+ import { BooleanResolver, EnumResolver, EnvironmentVariableResolver, NumberResolver } from "@pristine-ts/configuration";
5
+ import { ConsoleTracerOutputModeEnum } from "./enums/console-tracer-output-mode.enum";
6
+ export * from "./decorators/decorators";
5
7
  export * from "./enums/enums";
6
8
  export * from "./interfaces/interfaces";
7
9
  export * from "./managers/managers";
8
10
  export * from "./models/models";
9
11
  export * from "./tracers/tracers";
12
+ export * from "./utils/utils";
10
13
  export * from "./telemetry.configuration-keys";
11
14
  export const TelemetryModule = {
12
15
  keyname: TelemetryModuleKeyname,
@@ -38,6 +41,93 @@ export const TelemetryModule = {
38
41
  defaultResolvers: [
39
42
  new BooleanResolver(new EnvironmentVariableResolver("PRISTINE_TRACING_DEBUG")),
40
43
  ]
44
+ },
45
+ /**
46
+ * Whether `ConsoleTracer` should print completed traces to stdout. Off by default —
47
+ * when on, every trace whose duration exceeds `console-tracer.minimum-duration-ms`
48
+ * is rendered. Best for local development; in production prefer a real backend.
49
+ */
50
+ {
51
+ parameterName: TelemetryModuleKeyname + ".console-tracer.activated",
52
+ defaultValue: false,
53
+ isRequired: false,
54
+ defaultResolvers: [
55
+ new BooleanResolver(new EnvironmentVariableResolver("PRISTINE_TELEMETRY_CONSOLE_TRACER_ACTIVATED")),
56
+ ]
57
+ },
58
+ /**
59
+ * Output format for `ConsoleTracer`. See `ConsoleTracerOutputModeEnum`.
60
+ */
61
+ {
62
+ parameterName: TelemetryModuleKeyname + ".console-tracer.output-mode",
63
+ defaultValue: ConsoleTracerOutputModeEnum.Tree,
64
+ isRequired: false,
65
+ defaultResolvers: [
66
+ new EnumResolver(new EnvironmentVariableResolver("PRISTINE_TELEMETRY_CONSOLE_TRACER_OUTPUT_MODE"), ConsoleTracerOutputModeEnum),
67
+ ]
68
+ },
69
+ /**
70
+ * Skip rendering traces shorter than this many milliseconds. Useful when most requests
71
+ * are fast and you only want to see the slow outliers. `0` means render everything.
72
+ */
73
+ {
74
+ parameterName: TelemetryModuleKeyname + ".console-tracer.minimum-duration-ms",
75
+ defaultValue: 0,
76
+ isRequired: false,
77
+ defaultResolvers: [
78
+ new NumberResolver(new EnvironmentVariableResolver("PRISTINE_TELEMETRY_CONSOLE_TRACER_MINIMUM_DURATION_MS")),
79
+ ]
80
+ },
81
+ /**
82
+ * Whether `FileTracer` should write completed traces to disk. Off by default. When on,
83
+ * one file per trace is written to `directory` using `filename-pattern`.
84
+ */
85
+ {
86
+ parameterName: TelemetryModuleKeyname + ".file-tracer.activated",
87
+ defaultValue: false,
88
+ isRequired: false,
89
+ defaultResolvers: [
90
+ new BooleanResolver(new EnvironmentVariableResolver("PRISTINE_TELEMETRY_FILE_TRACER_ACTIVATED")),
91
+ ]
92
+ },
93
+ /**
94
+ * Output format for `FileTracer`. Reuses the same enum as `ConsoleTracer` — `json`
95
+ * is the practical default for files since it's machine-readable.
96
+ */
97
+ {
98
+ parameterName: TelemetryModuleKeyname + ".file-tracer.output-mode",
99
+ defaultValue: ConsoleTracerOutputModeEnum.Json,
100
+ isRequired: false,
101
+ defaultResolvers: [
102
+ new EnumResolver(new EnvironmentVariableResolver("PRISTINE_TELEMETRY_FILE_TRACER_OUTPUT_MODE"), ConsoleTracerOutputModeEnum),
103
+ ]
104
+ },
105
+ /**
106
+ * Directory where `FileTracer` writes trace files. Resolved relative to `process.cwd()`
107
+ * if not absolute. The directory is created on demand if it doesn't exist.
108
+ */
109
+ {
110
+ parameterName: TelemetryModuleKeyname + ".file-tracer.directory",
111
+ defaultValue: "./traces",
112
+ isRequired: false,
113
+ defaultResolvers: [
114
+ new EnvironmentVariableResolver("PRISTINE_TELEMETRY_FILE_TRACER_DIRECTORY"),
115
+ ]
116
+ },
117
+ /**
118
+ * Filename pattern for `FileTracer`. Supports the placeholders:
119
+ * - `<traceId>` — the trace's UUID (also used as the eventId throughout Pristine)
120
+ * - `<date>` — UTC date as `YYYY-MM-DD`
121
+ * - `<timestamp>` — milliseconds since epoch at the moment the trace ended
122
+ * Default: `<traceId>.json` (or `.txt` if you change the output mode away from json).
123
+ */
124
+ {
125
+ parameterName: TelemetryModuleKeyname + ".file-tracer.filename-pattern",
126
+ defaultValue: "<traceId>.json",
127
+ isRequired: false,
128
+ defaultResolvers: [
129
+ new EnvironmentVariableResolver("PRISTINE_TELEMETRY_FILE_TRACER_FILENAME_PATTERN"),
130
+ ]
41
131
  }
42
132
  ]
43
133
  };
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.module.js","sourceRoot":"","sources":["../../../src/telemetry.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAA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