@dudousxd/nestjs-diagnostics-telescope 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/dist/diagnostic.watcher.d.ts +129 -15
- package/dist/diagnostic.watcher.d.ts.map +1 -1
- package/dist/diagnostic.watcher.js +190 -9
- package/dist/diagnostic.watcher.js.map +1 -1
- package/dist/diagnostics-telescope.extension.d.ts +8 -0
- package/dist/diagnostics-telescope.extension.d.ts.map +1 -1
- package/dist/diagnostics-telescope.extension.js +6 -1
- package/dist/diagnostics-telescope.extension.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @dudousxd/nestjs-diagnostics-telescope
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`477612f`](https://github.com/DavideCarvalho/nestjs-diagnostics/commit/477612f737fe45fe41fab5c6d95216fecd25a670) - Span recording — the generic watcher now records `trace()` traffic, not just `emit()` points: for
|
|
8
|
+
every registered `(lib, event)` pair it subscribes the three terminal span sub-channels
|
|
9
|
+
(`end`/`asyncEnd`/`error`) and records ONE `diagnostic` entry per completed span (tagged
|
|
10
|
+
`kind:span`), carrying `spanId`/`phase`/`result`-or-`error`, `durationMs`, `startedAt` derived as
|
|
11
|
+
terminal-ts − duration (so waterfall containment nests correctly), and the envelope's `traceId`
|
|
12
|
+
passed EXPLICITLY through `RecordInput.traceId` (telescope core 1.17+) — spans land in the TRACES
|
|
13
|
+
tab's waterfall under their producer-chosen trace id. The premature async `end` marker (no `result`
|
|
14
|
+
key) is filtered, so counts stay one-entry-per-operation, coherent with the OTel counters. Claims
|
|
15
|
+
and `exclude` apply to span traffic identically. `start`/`asyncStart` are never subscribed — their
|
|
16
|
+
envelopes aren't even built (subscriber-gated), keeping unobserved spans free.
|
|
17
|
+
|
|
18
|
+
Requires `@dudousxd/nestjs-telescope` >= 1.17.0 (peer bumped).
|
|
19
|
+
|
|
20
|
+
## 0.6.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [`1568de4`](https://github.com/DavideCarvalho/nestjs-diagnostics/commit/1568de44f05770ad2559f7d6d4ea38d9d213d7e5) - Cross-lib dedup, no consumer config: lib-specific telescope watchers (nestjs-agent's,
|
|
25
|
+
nestjs-media's) record their `aviary:<lib>:<event>` channels as first-class typed entries — and
|
|
26
|
+
the generic bridge recorded them AGAIN as `diagnostic` entries unless the consumer hand-maintained
|
|
27
|
+
an exclude list. Now the libs resolve it themselves:
|
|
28
|
+
|
|
29
|
+
- core: `claimDiagnostics(lib, events)` registers `lib:event` keys in a process-global,
|
|
30
|
+
refcounted claim registry (`Symbol.for('aviary:diagnostics:claims')` — the raw convention is
|
|
31
|
+
documented so packages without this dependency can participate); returns a release fn.
|
|
32
|
+
`isDiagnosticClaimed(lib, event)` reads it.
|
|
33
|
+
- telescope: the generic watcher checks claims AT RECORD TIME (order-independent) and skips
|
|
34
|
+
claimed keys by default. `recordClaimed: true` opts back in; `exclude` still exists — its job
|
|
35
|
+
is muting noisy events (e.g. `media:upload.progress`), not dedup.
|
|
36
|
+
|
|
37
|
+
Lib watchers claim in their own upcoming releases; until then behavior is unchanged (nothing
|
|
38
|
+
claims → everything records, exactly as today).
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`1568de4`](https://github.com/DavideCarvalho/nestjs-diagnostics/commit/1568de44f05770ad2559f7d6d4ea38d9d213d7e5)]:
|
|
43
|
+
- @dudousxd/nestjs-diagnostics@0.7.0
|
|
44
|
+
|
|
3
45
|
## 0.5.1
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type DiagnosticEvent } from '@dudousxd/nestjs-diagnostics';
|
|
1
|
+
import { type DiagnosticEvent, type SpanEvent, type SpanPhase } from '@dudousxd/nestjs-diagnostics';
|
|
2
2
|
import type { RecordInput, Watcher, WatcherContext } from '@dudousxd/nestjs-telescope';
|
|
3
|
-
/** Telescope entry `type` produced by this watcher. */
|
|
3
|
+
/** Telescope entry `type` produced by this watcher. Shared by point AND span entries. */
|
|
4
4
|
export declare const DIAGNOSTIC_ENTRY_TYPE = "diagnostic";
|
|
5
5
|
/** Construction options for {@link DiagnosticWatcher}. */
|
|
6
6
|
export interface DiagnosticWatcherOptions {
|
|
@@ -12,13 +12,22 @@ export interface DiagnosticWatcherOptions {
|
|
|
12
12
|
* subscribers (OTel, custom watchers) keep seeing it.
|
|
13
13
|
*/
|
|
14
14
|
exclude?: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Record events whose `lib:event` key is CLAIMED by a lib-specific watcher —
|
|
17
|
+
* e.g. nestjs-agent's or nestjs-media's own Telescope watcher, via
|
|
18
|
+
* `claimDiagnostics` from `@dudousxd/nestjs-diagnostics`. Default `false`:
|
|
19
|
+
* claimed keys are skipped here because the claiming lib already records them
|
|
20
|
+
* as a typed entry, and recording them again would duplicate every such event
|
|
21
|
+
* (once typed, once as a generic `diagnostic` entry). Set `true` to record
|
|
22
|
+
* everything regardless of claims, e.g. to see the raw feed alongside the
|
|
23
|
+
* typed one while debugging. Independent of `exclude`: `exclude` mutes noisy
|
|
24
|
+
* events outright; `recordClaimed` only concerns events another watcher
|
|
25
|
+
* already records.
|
|
26
|
+
*/
|
|
27
|
+
recordClaimed?: boolean;
|
|
15
28
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
* Mirrors the {@link DiagnosticEvent} envelope, with the library-defined data
|
|
19
|
-
* preserved verbatim under `payload`.
|
|
20
|
-
*/
|
|
21
|
-
export interface DiagnosticEntryContent {
|
|
29
|
+
/** Fields common to both a point {@link DiagnosticEntryContent} and a {@link DiagnosticSpanEntryContent}. */
|
|
30
|
+
export interface DiagnosticEntryContentBase {
|
|
22
31
|
/**
|
|
23
32
|
* Envelope schema version the producer stamped, or `null` for a legacy
|
|
24
33
|
* envelope published before schema versioning existed.
|
|
@@ -32,26 +41,87 @@ export interface DiagnosticEntryContent {
|
|
|
32
41
|
ts: number;
|
|
33
42
|
/** The trace id the producer resolved, or `null` when none. */
|
|
34
43
|
traceId: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* What a single recorded POINT diagnostic entry looks like in the Telescope
|
|
47
|
+
* dashboard. Mirrors the {@link DiagnosticEvent} envelope, with the
|
|
48
|
+
* library-defined data preserved verbatim under `payload`.
|
|
49
|
+
*/
|
|
50
|
+
export interface DiagnosticEntryContent extends DiagnosticEntryContentBase {
|
|
35
51
|
/** The library-defined payload, recorded as-is. */
|
|
36
52
|
payload: unknown;
|
|
37
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* What a single recorded SPAN diagnostic entry looks like — one per `trace()`
|
|
56
|
+
* call, built from its TERMINAL {@link SpanEvent} (`end`/`asyncEnd`/`error`;
|
|
57
|
+
* see {@link DiagnosticWatcher}). Unlike the point shape there is no `payload`:
|
|
58
|
+
* the terminal envelope carries `result` (success) or `error` (failure)
|
|
59
|
+
* instead, mirrored here verbatim.
|
|
60
|
+
*/
|
|
61
|
+
export interface DiagnosticSpanEntryContent extends DiagnosticEntryContentBase {
|
|
62
|
+
/** Per-span correlation id shared by every phase event of one `trace()` call. */
|
|
63
|
+
spanId: string;
|
|
64
|
+
/**
|
|
65
|
+
* The terminal phase that produced this entry. Typed as the full
|
|
66
|
+
* {@link SpanPhase} union for simplicity, but in practice always `'end'`
|
|
67
|
+
* (sync success), `'asyncEnd'` (async success), or `'error'` — the
|
|
68
|
+
* `DiagnosticWatcher` only ever subscribes those three terminal sub-channels.
|
|
69
|
+
*/
|
|
70
|
+
phase: SpanPhase;
|
|
71
|
+
/** The operation's return value; present when `phase` is a success terminal. */
|
|
72
|
+
result?: unknown;
|
|
73
|
+
/** The thrown/rejected value; present when `phase` is `'error'`. */
|
|
74
|
+
error?: unknown;
|
|
75
|
+
}
|
|
38
76
|
/**
|
|
39
77
|
* The ONE generic nestjs-telescope watcher behind
|
|
40
78
|
* `@dudousxd/nestjs-diagnostics-telescope`. It records every event any
|
|
41
79
|
* `@dudousxd/nestjs-*` library emits through `@dudousxd/nestjs-diagnostics` —
|
|
42
|
-
* one `diagnostic` entry per `aviary:<lib>:<event>` publish
|
|
43
|
-
*
|
|
80
|
+
* one `diagnostic` entry per `aviary:<lib>:<event>` publish (POINT traffic, via
|
|
81
|
+
* `emit()`), plus one `diagnostic` entry per completed span (SPAN traffic, via
|
|
82
|
+
* `trace()`) — without needing a bespoke watcher per library.
|
|
83
|
+
*
|
|
84
|
+
* ## Point vs span, same entry `type`
|
|
85
|
+
* Both shapes are recorded as `type: 'diagnostic'` so they share the existing
|
|
86
|
+
* dashboards/panels/OTel counters unchanged — one recorded entry per logical
|
|
87
|
+
* operation either way, so counts stay directly comparable whether a producer
|
|
88
|
+
* used `emit()` or `trace()`. A span entry carries a `kind:span` tag (point
|
|
89
|
+
* entries carry no `kind:*` tag) and its `content.phase`/`spanId`/`result`/
|
|
90
|
+
* `error` fields — see {@link DiagnosticSpanEntryContent} — so a panel or
|
|
91
|
+
* filter CAN tell them apart without a second dashboard.
|
|
44
92
|
*
|
|
45
93
|
* ## How it auto-subscribes to current + future channels
|
|
46
94
|
* `node:diagnostics_channel` has no wildcard, so on `register` the watcher:
|
|
47
95
|
* 1. subscribes to every channel already in the diagnostics
|
|
48
96
|
* {@link registeredChannels registry}, and
|
|
49
97
|
* 2. registers an {@link onChannelRegistered} callback so any channel that
|
|
50
|
-
* appears later (a library's first `emit('newlib', …)`
|
|
98
|
+
* appears later (a library's first `emit('newlib', …)` OR first
|
|
99
|
+
* `trace('newlib', …)`) is subscribed too.
|
|
51
100
|
*
|
|
52
101
|
* Subscribing also flips each producer's `channel.hasSubscribers` to `true`,
|
|
53
|
-
* which is what makes `emit()` start building + publishing envelopes
|
|
54
|
-
* (zero-overhead when nobody listens).
|
|
102
|
+
* which is what makes `emit()`/`trace()` start building + publishing envelopes
|
|
103
|
+
* at all (zero-overhead when nobody listens).
|
|
104
|
+
*
|
|
105
|
+
* ## Span recording (GAP 1 fix)
|
|
106
|
+
* `trace()` never publishes to the BASE channel name itself (only `emit()`
|
|
107
|
+
* does) — it publishes on the five {@link traceChannelNames} sub-channels
|
|
108
|
+
* instead, and only the `start` phase carries a `payload` key. The registry
|
|
109
|
+
* only ever records the base name (see `registerChannel(channels.base)` in
|
|
110
|
+
* `trace.ts`), so `registeredChannels()`/`onChannelRegistered` still tell us
|
|
111
|
+
* WHICH `(lib, event)` pairs exist; for each we derive the five span names via
|
|
112
|
+
* `traceChannelNames` and subscribe the THREE terminal-carrying ones
|
|
113
|
+
* (`end`/`asyncEnd`/`error`) — one entry is recorded per span, on whichever
|
|
114
|
+
* terminal fires. `start`/`asyncStart` are deliberately left unsubscribed:
|
|
115
|
+
* `trace()` gates each phase's publish on that phase's OWN
|
|
116
|
+
* `channel.hasSubscribers`, so skipping them also skips building their
|
|
117
|
+
* envelopes, for free.
|
|
118
|
+
*
|
|
119
|
+
* `end` is subtler than `asyncEnd`/`error`: for an ASYNC `trace()` call it
|
|
120
|
+
* ALSO fires first as a "synchronous portion done" marker (no `result` key),
|
|
121
|
+
* ahead of the real terminal on `asyncEnd`/`error` — recording that one too
|
|
122
|
+
* would double-count the span. `safeRecordSpan` skips it via the same
|
|
123
|
+
* present-vs-absent-key signal GAP 1 relies on for `payload`: a genuine sync
|
|
124
|
+
* completion's `end` always carries the `result` key (even `undefined`-valued).
|
|
55
125
|
*/
|
|
56
126
|
export declare class DiagnosticWatcher implements Watcher {
|
|
57
127
|
readonly type = "diagnostic";
|
|
@@ -61,17 +131,61 @@ export declare class DiagnosticWatcher implements Watcher {
|
|
|
61
131
|
private readonly subscriptions;
|
|
62
132
|
/** `lib:event` keys whose events are dropped instead of recorded. */
|
|
63
133
|
private readonly excluded;
|
|
134
|
+
/** See {@link DiagnosticWatcherOptions.recordClaimed}. */
|
|
135
|
+
private readonly recordClaimed;
|
|
64
136
|
constructor(options?: DiagnosticWatcherOptions);
|
|
65
137
|
register(ctx: WatcherContext): void;
|
|
66
138
|
/** Unsubscribe from every channel and stop watching for new ones. */
|
|
67
139
|
cleanup(): void;
|
|
68
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* Subscribe `name` (a registered BASE channel) for POINT traffic, and derive
|
|
142
|
+
* + subscribe its span traffic — current AND future registrations both funnel
|
|
143
|
+
* through here (see the class doc).
|
|
144
|
+
*/
|
|
69
145
|
private subscribe;
|
|
70
|
-
/**
|
|
146
|
+
/** Subscribe once to the base channel `name`, recording each publish as a `diagnostic` entry. */
|
|
147
|
+
private subscribePoint;
|
|
148
|
+
/** Derive `baseName`'s span sub-channels and subscribe the three terminal ones — see the class doc's "Span recording" section. */
|
|
149
|
+
private subscribeSpans;
|
|
150
|
+
/** Validate + record a POINT event, swallowing any failure so a producer can never break. */
|
|
71
151
|
private safeRecord;
|
|
152
|
+
/**
|
|
153
|
+
* Validate + record a TERMINAL span event, swallowing any failure so a
|
|
154
|
+
* traced call can never break. Same `exclude`/`recordClaimed` gating as
|
|
155
|
+
* point traffic, keyed by the same `lib:event` pair (phase-independent).
|
|
156
|
+
*
|
|
157
|
+
* `end` is subscribed but is NOT always the terminal: for an async `trace()`
|
|
158
|
+
* call, `core`'s `trace()` publishes `end` first to mark the SYNCHRONOUS
|
|
159
|
+
* portion completing (no `result` key at all — see `trace.ts`), then later
|
|
160
|
+
* the REAL terminal on `asyncEnd`/`error`. Recording that premature `end` too
|
|
161
|
+
* would double-count the span (two entries for one `trace()` call). A
|
|
162
|
+
* genuine sync completion's `end` always carries the `result` key — even
|
|
163
|
+
* when the value itself is `undefined` — so `'result' in msg` is the exact
|
|
164
|
+
* same present-vs-absent-key signal GAP 1 already relies on for `payload`.
|
|
165
|
+
*/
|
|
166
|
+
private safeRecordSpan;
|
|
72
167
|
}
|
|
73
168
|
/** Map a {@link DiagnosticEvent} envelope to a Telescope `RecordInput`. */
|
|
74
169
|
export declare function buildDiagnosticEntry(msg: DiagnosticEvent): RecordInput<DiagnosticEntryContent>;
|
|
75
170
|
/** Strict structural validation of a diagnostics envelope. */
|
|
76
171
|
export declare function isDiagnosticEvent(msg: unknown): msg is DiagnosticEvent;
|
|
172
|
+
/**
|
|
173
|
+
* Map a TERMINAL {@link SpanEvent} envelope (`end`/`asyncEnd`/`error` — the
|
|
174
|
+
* only phases `DiagnosticWatcher` subscribes) to a Telescope `RecordInput`,
|
|
175
|
+
* one entry per span:
|
|
176
|
+
*
|
|
177
|
+
* - `durationMs` is forwarded from the envelope (always stamped by `trace()`
|
|
178
|
+
* on a terminal phase); `startedAt` is derived as `ts - durationMs` so the
|
|
179
|
+
* entry's `createdAt` reflects the span's START, not the time this terminal
|
|
180
|
+
* event fired — required for `buildWaterfall`'s time-interval containment
|
|
181
|
+
* to nest spans correctly. Falls back to the terminal `ts` itself (a
|
|
182
|
+
* zero-length span) on the defensive path where `durationMs` is absent.
|
|
183
|
+
* - `traceId` is passed EXPLICITLY on `RecordInput` (GAP 1 fix, honored by the
|
|
184
|
+
* core Recorder with explicit-wins-over-ambient precedence — see
|
|
185
|
+
* `RecordInput.traceId` (telescope core 1.17+)) rather than relying on ambient OTel/context
|
|
186
|
+
* enrichment, which may not correlate with the diagnostics `traceId` at all.
|
|
187
|
+
*/
|
|
188
|
+
export declare function buildDiagnosticSpanEntry(msg: SpanEvent): RecordInput<DiagnosticSpanEntryContent>;
|
|
189
|
+
/** Strict structural validation of a span envelope. */
|
|
190
|
+
export declare function isSpanEvent(msg: unknown): msg is SpanEvent;
|
|
77
191
|
//# sourceMappingURL=diagnostic.watcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic.watcher.d.ts","sourceRoot":"","sources":["../src/diagnostic.watcher.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"diagnostic.watcher.d.ts","sourceRoot":"","sources":["../src/diagnostic.watcher.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,SAAS,EAKf,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEvF,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,0DAA0D;AAC1D,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,6GAA6G;AAC7G,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,0BAA0B;IACxE,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA2B,SAAQ,0BAA0B;IAC5E,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB,gFAAgF;IAChF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;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** Telescope entry `type` produced by this watcher. */
|
|
2
|
+
import { CHANNEL_PREFIX, isDiagnosticClaimed, onChannelRegistered, registeredChannels, traceChannelNames, } from '@dudousxd/nestjs-diagnostics';
|
|
3
|
+
/** Telescope entry `type` produced by this watcher. Shared by point AND span entries. */
|
|
4
4
|
export const DIAGNOSTIC_ENTRY_TYPE = 'diagnostic';
|
|
5
5
|
/**
|
|
6
6
|
* The ONE generic nestjs-telescope watcher behind
|
|
7
7
|
* `@dudousxd/nestjs-diagnostics-telescope`. It records every event any
|
|
8
8
|
* `@dudousxd/nestjs-*` library emits through `@dudousxd/nestjs-diagnostics` —
|
|
9
|
-
* one `diagnostic` entry per `aviary:<lib>:<event>` publish
|
|
10
|
-
*
|
|
9
|
+
* one `diagnostic` entry per `aviary:<lib>:<event>` publish (POINT traffic, via
|
|
10
|
+
* `emit()`), plus one `diagnostic` entry per completed span (SPAN traffic, via
|
|
11
|
+
* `trace()`) — without needing a bespoke watcher per library.
|
|
12
|
+
*
|
|
13
|
+
* ## Point vs span, same entry `type`
|
|
14
|
+
* Both shapes are recorded as `type: 'diagnostic'` so they share the existing
|
|
15
|
+
* dashboards/panels/OTel counters unchanged — one recorded entry per logical
|
|
16
|
+
* operation either way, so counts stay directly comparable whether a producer
|
|
17
|
+
* used `emit()` or `trace()`. A span entry carries a `kind:span` tag (point
|
|
18
|
+
* entries carry no `kind:*` tag) and its `content.phase`/`spanId`/`result`/
|
|
19
|
+
* `error` fields — see {@link DiagnosticSpanEntryContent} — so a panel or
|
|
20
|
+
* filter CAN tell them apart without a second dashboard.
|
|
11
21
|
*
|
|
12
22
|
* ## How it auto-subscribes to current + future channels
|
|
13
23
|
* `node:diagnostics_channel` has no wildcard, so on `register` the watcher:
|
|
14
24
|
* 1. subscribes to every channel already in the diagnostics
|
|
15
25
|
* {@link registeredChannels registry}, and
|
|
16
26
|
* 2. registers an {@link onChannelRegistered} callback so any channel that
|
|
17
|
-
* appears later (a library's first `emit('newlib', …)`
|
|
27
|
+
* appears later (a library's first `emit('newlib', …)` OR first
|
|
28
|
+
* `trace('newlib', …)`) is subscribed too.
|
|
18
29
|
*
|
|
19
30
|
* Subscribing also flips each producer's `channel.hasSubscribers` to `true`,
|
|
20
|
-
* which is what makes `emit()` start building + publishing envelopes
|
|
21
|
-
* (zero-overhead when nobody listens).
|
|
31
|
+
* which is what makes `emit()`/`trace()` start building + publishing envelopes
|
|
32
|
+
* at all (zero-overhead when nobody listens).
|
|
33
|
+
*
|
|
34
|
+
* ## Span recording (GAP 1 fix)
|
|
35
|
+
* `trace()` never publishes to the BASE channel name itself (only `emit()`
|
|
36
|
+
* does) — it publishes on the five {@link traceChannelNames} sub-channels
|
|
37
|
+
* instead, and only the `start` phase carries a `payload` key. The registry
|
|
38
|
+
* only ever records the base name (see `registerChannel(channels.base)` in
|
|
39
|
+
* `trace.ts`), so `registeredChannels()`/`onChannelRegistered` still tell us
|
|
40
|
+
* WHICH `(lib, event)` pairs exist; for each we derive the five span names via
|
|
41
|
+
* `traceChannelNames` and subscribe the THREE terminal-carrying ones
|
|
42
|
+
* (`end`/`asyncEnd`/`error`) — one entry is recorded per span, on whichever
|
|
43
|
+
* terminal fires. `start`/`asyncStart` are deliberately left unsubscribed:
|
|
44
|
+
* `trace()` gates each phase's publish on that phase's OWN
|
|
45
|
+
* `channel.hasSubscribers`, so skipping them also skips building their
|
|
46
|
+
* envelopes, for free.
|
|
47
|
+
*
|
|
48
|
+
* `end` is subtler than `asyncEnd`/`error`: for an ASYNC `trace()` call it
|
|
49
|
+
* ALSO fires first as a "synchronous portion done" marker (no `result` key),
|
|
50
|
+
* ahead of the real terminal on `asyncEnd`/`error` — recording that one too
|
|
51
|
+
* would double-count the span. `safeRecordSpan` skips it via the same
|
|
52
|
+
* present-vs-absent-key signal GAP 1 relies on for `payload`: a genuine sync
|
|
53
|
+
* completion's `end` always carries the `result` key (even `undefined`-valued).
|
|
22
54
|
*/
|
|
23
55
|
export class DiagnosticWatcher {
|
|
24
56
|
type = DIAGNOSTIC_ENTRY_TYPE;
|
|
@@ -28,8 +60,11 @@ export class DiagnosticWatcher {
|
|
|
28
60
|
subscriptions = new Map();
|
|
29
61
|
/** `lib:event` keys whose events are dropped instead of recorded. */
|
|
30
62
|
excluded;
|
|
63
|
+
/** See {@link DiagnosticWatcherOptions.recordClaimed}. */
|
|
64
|
+
recordClaimed;
|
|
31
65
|
constructor(options = {}) {
|
|
32
66
|
this.excluded = new Set(options.exclude ?? []);
|
|
67
|
+
this.recordClaimed = options.recordClaimed ?? false;
|
|
33
68
|
}
|
|
34
69
|
register(ctx) {
|
|
35
70
|
if (this.registered)
|
|
@@ -49,8 +84,17 @@ export class DiagnosticWatcher {
|
|
|
49
84
|
this.subscriptions.clear();
|
|
50
85
|
this.registered = false;
|
|
51
86
|
}
|
|
52
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe `name` (a registered BASE channel) for POINT traffic, and derive
|
|
89
|
+
* + subscribe its span traffic — current AND future registrations both funnel
|
|
90
|
+
* through here (see the class doc).
|
|
91
|
+
*/
|
|
53
92
|
subscribe(ctx, name) {
|
|
93
|
+
this.subscribePoint(ctx, name);
|
|
94
|
+
this.subscribeSpans(ctx, name);
|
|
95
|
+
}
|
|
96
|
+
/** Subscribe once to the base channel `name`, recording each publish as a `diagnostic` entry. */
|
|
97
|
+
subscribePoint(ctx, name) {
|
|
54
98
|
if (this.subscriptions.has(name))
|
|
55
99
|
return;
|
|
56
100
|
const listener = (msg) => this.safeRecord(ctx, msg);
|
|
@@ -58,13 +102,31 @@ export class DiagnosticWatcher {
|
|
|
58
102
|
const channel = diagnostics_channel.channel(name);
|
|
59
103
|
channel.subscribe(listener);
|
|
60
104
|
}
|
|
61
|
-
/**
|
|
105
|
+
/** Derive `baseName`'s span sub-channels and subscribe the three terminal ones — see the class doc's "Span recording" section. */
|
|
106
|
+
subscribeSpans(ctx, baseName) {
|
|
107
|
+
const parsed = parseChannelName(baseName);
|
|
108
|
+
if (parsed === null)
|
|
109
|
+
return;
|
|
110
|
+
const names = traceChannelNames(parsed.lib, parsed.event);
|
|
111
|
+
for (const name of [names.end, names.asyncEnd, names.error]) {
|
|
112
|
+
if (this.subscriptions.has(name))
|
|
113
|
+
continue;
|
|
114
|
+
const listener = (msg) => this.safeRecordSpan(ctx, msg);
|
|
115
|
+
this.subscriptions.set(name, listener);
|
|
116
|
+
diagnostics_channel.channel(name).subscribe(listener);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Validate + record a POINT event, swallowing any failure so a producer can never break. */
|
|
62
120
|
safeRecord(ctx, msg) {
|
|
63
121
|
try {
|
|
64
122
|
if (!isDiagnosticEvent(msg))
|
|
65
123
|
return;
|
|
66
124
|
if (this.excluded.has(`${msg.lib}:${msg.event}`))
|
|
67
125
|
return;
|
|
126
|
+
// Checked at RECORD time (not subscribe time) so claiming stays
|
|
127
|
+
// order-independent — see the contract documented on isDiagnosticClaimed.
|
|
128
|
+
if (!this.recordClaimed && isDiagnosticClaimed(msg.lib, msg.event))
|
|
129
|
+
return;
|
|
68
130
|
ctx.record(buildDiagnosticEntry(msg));
|
|
69
131
|
}
|
|
70
132
|
catch (err) {
|
|
@@ -72,6 +134,54 @@ export class DiagnosticWatcher {
|
|
|
72
134
|
console.error('DiagnosticWatcher: failed to record diagnostic event:', err);
|
|
73
135
|
}
|
|
74
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Validate + record a TERMINAL span event, swallowing any failure so a
|
|
139
|
+
* traced call can never break. Same `exclude`/`recordClaimed` gating as
|
|
140
|
+
* point traffic, keyed by the same `lib:event` pair (phase-independent).
|
|
141
|
+
*
|
|
142
|
+
* `end` is subscribed but is NOT always the terminal: for an async `trace()`
|
|
143
|
+
* call, `core`'s `trace()` publishes `end` first to mark the SYNCHRONOUS
|
|
144
|
+
* portion completing (no `result` key at all — see `trace.ts`), then later
|
|
145
|
+
* the REAL terminal on `asyncEnd`/`error`. Recording that premature `end` too
|
|
146
|
+
* would double-count the span (two entries for one `trace()` call). A
|
|
147
|
+
* genuine sync completion's `end` always carries the `result` key — even
|
|
148
|
+
* when the value itself is `undefined` — so `'result' in msg` is the exact
|
|
149
|
+
* same present-vs-absent-key signal GAP 1 already relies on for `payload`.
|
|
150
|
+
*/
|
|
151
|
+
safeRecordSpan(ctx, msg) {
|
|
152
|
+
try {
|
|
153
|
+
if (!isSpanEvent(msg))
|
|
154
|
+
return;
|
|
155
|
+
if (msg.phase === 'end' && !('result' in msg))
|
|
156
|
+
return;
|
|
157
|
+
if (this.excluded.has(`${msg.lib}:${msg.event}`))
|
|
158
|
+
return;
|
|
159
|
+
if (!this.recordClaimed && isDiagnosticClaimed(msg.lib, msg.event))
|
|
160
|
+
return;
|
|
161
|
+
ctx.record(buildDiagnosticSpanEntry(msg));
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
console.error('DiagnosticWatcher: failed to record span event:', err);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Reverse `channelName(lib, event)` (`` `${CHANNEL_PREFIX}:${lib}:${event}` ``)
|
|
170
|
+
* back into its `(lib, event)` parts, or `null` if `name` isn't shaped like an
|
|
171
|
+
* `aviary:` channel. Splits on the FIRST remaining `:` — library names never
|
|
172
|
+
* contain one (see every registered example: `billing`, `media`, `agent`…),
|
|
173
|
+
* while event names may (`upload.progress` uses a dot, not a colon), so `event`
|
|
174
|
+
* safely takes everything after that first separator.
|
|
175
|
+
*/
|
|
176
|
+
function parseChannelName(name) {
|
|
177
|
+
const prefix = `${CHANNEL_PREFIX}:`;
|
|
178
|
+
if (!name.startsWith(prefix))
|
|
179
|
+
return null;
|
|
180
|
+
const rest = name.slice(prefix.length);
|
|
181
|
+
const separatorIndex = rest.indexOf(':');
|
|
182
|
+
if (separatorIndex === -1)
|
|
183
|
+
return null;
|
|
184
|
+
return { lib: rest.slice(0, separatorIndex), event: rest.slice(separatorIndex + 1) };
|
|
75
185
|
}
|
|
76
186
|
/** Map a {@link DiagnosticEvent} envelope to a Telescope `RecordInput`. */
|
|
77
187
|
export function buildDiagnosticEntry(msg) {
|
|
@@ -114,4 +224,75 @@ export function isDiagnosticEvent(msg) {
|
|
|
114
224
|
// Tolerate legacy envelopes without `v`; reject a malformed (non-number) one.
|
|
115
225
|
(m.v === undefined || typeof m.v === 'number'));
|
|
116
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Map a TERMINAL {@link SpanEvent} envelope (`end`/`asyncEnd`/`error` — the
|
|
229
|
+
* only phases `DiagnosticWatcher` subscribes) to a Telescope `RecordInput`,
|
|
230
|
+
* one entry per span:
|
|
231
|
+
*
|
|
232
|
+
* - `durationMs` is forwarded from the envelope (always stamped by `trace()`
|
|
233
|
+
* on a terminal phase); `startedAt` is derived as `ts - durationMs` so the
|
|
234
|
+
* entry's `createdAt` reflects the span's START, not the time this terminal
|
|
235
|
+
* event fired — required for `buildWaterfall`'s time-interval containment
|
|
236
|
+
* to nest spans correctly. Falls back to the terminal `ts` itself (a
|
|
237
|
+
* zero-length span) on the defensive path where `durationMs` is absent.
|
|
238
|
+
* - `traceId` is passed EXPLICITLY on `RecordInput` (GAP 1 fix, honored by the
|
|
239
|
+
* core Recorder with explicit-wins-over-ambient precedence — see
|
|
240
|
+
* `RecordInput.traceId` (telescope core 1.17+)) rather than relying on ambient OTel/context
|
|
241
|
+
* enrichment, which may not correlate with the diagnostics `traceId` at all.
|
|
242
|
+
*/
|
|
243
|
+
export function buildDiagnosticSpanEntry(msg) {
|
|
244
|
+
const durationMs = msg.durationMs;
|
|
245
|
+
const startedAt = new Date(typeof durationMs === 'number' ? msg.ts - durationMs : msg.ts);
|
|
246
|
+
const content = {
|
|
247
|
+
v: msg.v ?? null,
|
|
248
|
+
lib: msg.lib,
|
|
249
|
+
event: msg.event,
|
|
250
|
+
ts: msg.ts,
|
|
251
|
+
traceId: msg.traceId ?? null,
|
|
252
|
+
spanId: msg.spanId,
|
|
253
|
+
phase: msg.phase,
|
|
254
|
+
...(msg.phase === 'error' ? { error: msg.error } : { result: msg.result }),
|
|
255
|
+
};
|
|
256
|
+
return {
|
|
257
|
+
type: DIAGNOSTIC_ENTRY_TYPE,
|
|
258
|
+
// Same family-hash convention as point traffic so a span-only (lib, event)
|
|
259
|
+
// pair still rolls up in "Busiest events" — one recorded entry per
|
|
260
|
+
// completed span, keeping the count directly comparable to `emit()`'s one
|
|
261
|
+
// entry per call (see the class doc's "Point vs span" section).
|
|
262
|
+
familyHash: `${msg.lib}:${msg.event}`,
|
|
263
|
+
tags: [
|
|
264
|
+
`lib:${msg.lib}`,
|
|
265
|
+
`event:${msg.event}`,
|
|
266
|
+
'kind:span',
|
|
267
|
+
...(msg.traceId ? [`trace:${msg.traceId}`] : []),
|
|
268
|
+
],
|
|
269
|
+
content,
|
|
270
|
+
startedAt,
|
|
271
|
+
...(durationMs !== undefined && { durationMs }),
|
|
272
|
+
...(msg.traceId !== undefined && { traceId: msg.traceId }),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/** Strict structural validation of a span envelope. */
|
|
276
|
+
export function isSpanEvent(msg) {
|
|
277
|
+
if (typeof msg !== 'object' || msg === null)
|
|
278
|
+
return false;
|
|
279
|
+
const m = msg;
|
|
280
|
+
return (typeof m.ts === 'number' &&
|
|
281
|
+
typeof m.lib === 'string' &&
|
|
282
|
+
typeof m.event === 'string' &&
|
|
283
|
+
typeof m.spanId === 'string' &&
|
|
284
|
+
isSpanPhase(m.phase) &&
|
|
285
|
+
(m.traceId === undefined || typeof m.traceId === 'string') &&
|
|
286
|
+
(m.durationMs === undefined || typeof m.durationMs === 'number') &&
|
|
287
|
+
// Tolerate legacy envelopes without `v`; reject a malformed (non-number) one.
|
|
288
|
+
(m.v === undefined || typeof m.v === 'number'));
|
|
289
|
+
}
|
|
290
|
+
/** Narrow an unknown `phase` field to the {@link SpanPhase} union. */
|
|
291
|
+
function isSpanPhase(phase) {
|
|
292
|
+
return (phase === 'start' ||
|
|
293
|
+
phase === 'end' ||
|
|
294
|
+
phase === 'asyncStart' ||
|
|
295
|
+
phase === 'asyncEnd' ||
|
|
296
|
+
phase === 'error');
|
|
297
|
+
}
|
|
117
298
|
//# sourceMappingURL=diagnostic.watcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic.watcher.js","sourceRoot":"","sources":["../src/diagnostic.watcher.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAqC,MAAM,0BAA0B,CAAC;AAC7E,OAAO,
|
|
1
|
+
{"version":3,"file":"diagnostic.watcher.js","sourceRoot":"","sources":["../src/diagnostic.watcher.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAqC,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EACL,cAAc,EAId,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAGtC,yFAAyF;AACzF,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AA6ElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,OAAO,iBAAiB;IACnB,IAAI,GAAG,qBAAqB,CAAC;IAC9B,UAAU,GAAG,KAAK,CAAC;IACnB,oBAAoB,GAAwB,IAAI,CAAC;IACzD,gFAAgF;IAC/D,aAAa,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC3E,qEAAqE;IACpD,QAAQ,CAAsB;IAC/C,0DAA0D;IACzC,aAAa,CAAU;IAExC,YAAY,UAAoC,EAAE;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC;IACtD,CAAC;IAED,QAAQ,CAAC,GAAmB;QAC1B,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC5B,IAAI,CAAC,UAAU,GAAG,I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C,CAC/C,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,CACL,KAAK,KAAK,OAAO;QACjB,KAAK,KAAK,KAAK;QACf,KAAK,KAAK,YAAY;QACtB,KAAK,KAAK,UAAU;QACpB,KAAK,KAAK,OAAO,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -12,6 +12,14 @@ export interface DiagnosticsTelescopeOptions {
|
|
|
12
12
|
* diagnostics channel for other subscribers (OTel, custom watchers).
|
|
13
13
|
*/
|
|
14
14
|
exclude?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Record events whose `lib:event` key is claimed by a lib-specific watcher
|
|
17
|
+
* (nestjs-agent's, nestjs-media's own Telescope watcher) via
|
|
18
|
+
* `claimDiagnostics`, instead of skipping them by default. See
|
|
19
|
+
* {@link DiagnosticWatcherOptions.recordClaimed} for the full rationale.
|
|
20
|
+
* `exclude` remains the way to mute noisy events regardless of claim status.
|
|
21
|
+
*/
|
|
22
|
+
recordClaimed?: boolean;
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
25
|
* A `@dudousxd/nestjs-telescope` extension that records every diagnostics event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics-telescope.extension.d.ts","sourceRoot":"","sources":["../src/diagnostics-telescope.extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAExB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"diagnostics-telescope.extension.d.ts","sourceRoot":"","sources":["../src/diagnostics-telescope.extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAExB,MAAM,4BAA4B,CAAC;AAcpC,sDAAsD;AACtD,MAAM,WAAW,2BAA2B;IAC1C,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,2BAAgC,GACxC,kBAAkB,CA2IpB;AAmBD,eAAe,0BAA0B,CAAC"}
|
|
@@ -35,7 +35,12 @@ export function nestjsDiagnosticsTelescope(options = {}) {
|
|
|
35
35
|
// Diagnostics dashboard rendered empty.
|
|
36
36
|
name: 'diagnostics',
|
|
37
37
|
watchers() {
|
|
38
|
-
return [
|
|
38
|
+
return [
|
|
39
|
+
new DiagnosticWatcher({
|
|
40
|
+
exclude: options.exclude ?? [],
|
|
41
|
+
recordClaimed: options.recordClaimed ?? false,
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
39
44
|
},
|
|
40
45
|
entryTypes() {
|
|
41
46
|
return [{ id: DIAGNOSTIC_ENTRY_TYPE, label: 'Diagnostics', dot: 'bg-sky-400' }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics-telescope.extension.js","sourceRoot":"","sources":["../src/diagnostics-telescope.extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,iBAAiB,GAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EAErB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"diagnostics-telescope.extension.js","sourceRoot":"","sources":["../src/diagnostics-telescope.extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,iBAAiB,GAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EAErB,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AAEjC,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AACpD,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAC1D,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,eAAe,GAAG,mBAAmB,CAA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AE,CAAC;oBAClB,CAAC;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,KAAK,UAAU,eAAe,CAAC,GAAqB,EAAE,KAAK,GAAG,GAAG;IAC/D,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAkB,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACzF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAgB;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,2FAA2F;AAC3F,SAAS,UAAU,CAAC,EAAsB;IACxC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9D,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,eAAe,0BAA0B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './diagnostics-telescope.extension.js';
|
|
2
2
|
export { type DiagnosticsTelescopeOptions, nestjsDiagnosticsTelescope, } from './diagnostics-telescope.extension.js';
|
|
3
|
-
export { buildDiagnosticEntry, DIAGNOSTIC_ENTRY_TYPE, type DiagnosticEntryContent, DiagnosticWatcher, isDiagnosticEvent, } from './diagnostic.watcher.js';
|
|
3
|
+
export { buildDiagnosticEntry, buildDiagnosticSpanEntry, DIAGNOSTIC_ENTRY_TYPE, type DiagnosticEntryContent, type DiagnosticEntryContentBase, type DiagnosticSpanEntryContent, DiagnosticWatcher, type DiagnosticWatcherOptions, isDiagnosticEvent, isSpanEvent, } from './diagnostic.watcher.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EACL,KAAK,2BAA2B,EAChC,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EACL,KAAK,2BAA2B,EAChC,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,WAAW,GACZ,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './diagnostics-telescope.extension.js';
|
|
2
2
|
export { nestjsDiagnosticsTelescope, } from './diagnostics-telescope.extension.js';
|
|
3
|
-
export { buildDiagnosticEntry, DIAGNOSTIC_ENTRY_TYPE, DiagnosticWatcher, isDiagnosticEvent, } from './diagnostic.watcher.js';
|
|
3
|
+
export { buildDiagnosticEntry, buildDiagnosticSpanEntry, DIAGNOSTIC_ENTRY_TYPE, DiagnosticWatcher, isDiagnosticEvent, isSpanEvent, } from './diagnostic.watcher.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAEL,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAEL,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EAIrB,iBAAiB,EAEjB,iBAAiB,EACjB,WAAW,GACZ,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-diagnostics-telescope",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "nestjs-telescope extension for @dudousxd/nestjs-diagnostics — one generic watcher records every aviary:<lib>:<event> diagnostic event in the Telescope dashboard.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"//sideEffects": "Safe to be false: this package has NO module-level side effects. The watcher subscribes to diagnostics channels only inside register() at runtime, never at import time, and the rest are pure declarations/exports. Enables tree-shaking for consumers.",
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@dudousxd/nestjs-diagnostics": "^0.
|
|
31
|
+
"@dudousxd/nestjs-diagnostics": "^0.7.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@dudousxd/nestjs-telescope": "^1.
|
|
34
|
+
"@dudousxd/nestjs-telescope": "^1.17.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@dudousxd/nestjs-telescope": "1.
|
|
37
|
+
"@dudousxd/nestjs-telescope": "1.17.0",
|
|
38
38
|
"@dudousxd/nestjs-telescope-testing": "1.9.0",
|
|
39
39
|
"@types/node": "^20.0.0",
|
|
40
40
|
"typescript": "^5.4.0",
|