@pristine-ts/telemetry 2.0.2 → 2.0.4
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/dist/lib/cjs/enums/span-keyname.enum.js +2 -30
- package/dist/lib/cjs/enums/span-keyname.enum.js.map +1 -1
- package/dist/lib/cjs/managers/tracing.manager.js +182 -37
- package/dist/lib/cjs/managers/tracing.manager.js.map +1 -1
- package/dist/lib/cjs/models/models.js +1 -0
- package/dist/lib/cjs/models/models.js.map +1 -1
- package/dist/lib/cjs/models/span-event.model.js +6 -0
- package/dist/lib/cjs/models/span-event.model.js.map +1 -0
- package/dist/lib/cjs/models/span.model.js +2 -68
- package/dist/lib/cjs/models/span.model.js.map +1 -1
- package/dist/lib/cjs/models/trace.model.js +2 -35
- package/dist/lib/cjs/models/trace.model.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/cjs/utils/span-runner.js +3 -77
- package/dist/lib/cjs/utils/span-runner.js.map +1 -1
- package/dist/lib/esm/enums/span-keyname.enum.js +1 -30
- package/dist/lib/esm/enums/span-keyname.enum.js.map +1 -1
- package/dist/lib/esm/managers/tracing.manager.js +184 -39
- package/dist/lib/esm/managers/tracing.manager.js.map +1 -1
- package/dist/lib/esm/models/models.js +1 -0
- package/dist/lib/esm/models/models.js.map +1 -1
- package/dist/lib/esm/models/span-event.model.js +2 -0
- package/dist/lib/esm/models/span-event.model.js.map +1 -0
- package/dist/lib/esm/models/span.model.js +1 -67
- package/dist/lib/esm/models/span.model.js.map +1 -1
- package/dist/lib/esm/models/trace.model.js +1 -34
- package/dist/lib/esm/models/trace.model.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/esm/utils/span-runner.js +1 -76
- package/dist/lib/esm/utils/span-runner.js.map +1 -1
- package/dist/types/enums/span-keyname.enum.d.ts +1 -29
- package/dist/types/interfaces/tracing-manager.interface.d.ts +1 -50
- package/dist/types/managers/tracing.manager.d.ts +73 -7
- package/dist/types/models/models.d.ts +1 -0
- package/dist/types/models/span-event.model.d.ts +1 -0
- package/dist/types/models/span.model.d.ts +1 -73
- package/dist/types/models/trace.model.d.ts +1 -44
- package/dist/types/utils/span-runner.d.ts +1 -59
- package/package.json +4 -4
|
@@ -10,17 +10,36 @@ 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,
|
|
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
|
+
import { SpanEvent } from "../models/span-event.model";
|
|
20
21
|
/**
|
|
21
22
|
* The Tracing Manager provides methods to help with tracing.
|
|
22
23
|
* It is tagged and can be injected using TracingManagerInterface which facilitates mocking.
|
|
23
24
|
* It is module scoped to the TelemetryModuleKeyname.
|
|
25
|
+
*
|
|
26
|
+
* **Where the active `Trace` lives.** The active trace is stored on `EventContext.trace`,
|
|
27
|
+
* propagated via `AsyncLocalStorage`. Every `TracingManager` instance — whether resolved
|
|
28
|
+
* from the root container (kernel boot) or from a per-event child container — reads and
|
|
29
|
+
* writes spans through the same `EventContext.trace` reference, so a span started in the
|
|
30
|
+
* kernel and an event added in a controller belong to the same trace tree.
|
|
31
|
+
*
|
|
32
|
+
* **Fallback `this.trace`.** During kernel boot (`Kernel.start()` and friends), there is
|
|
33
|
+
* no `EventContext` yet — the framework hasn't started handling an event. In that window
|
|
34
|
+
* the manager falls back to `this.trace`. This is the only time `this.trace` is touched.
|
|
35
|
+
*
|
|
36
|
+
* **Lifecycle: container-scoped, not singleton.** Each per-event DI child container gets
|
|
37
|
+
* its own `TracingManager` instance. The per-instance `this.trace` fallback is what keeps
|
|
38
|
+
* parallel events isolated *if* tracing is somehow started outside an EventContext.
|
|
39
|
+
* Resolving `TracingManager` from the root container returns the root instance (used for
|
|
40
|
+
* kernel-initialization spans); resolving from a child container returns the per-event
|
|
41
|
+
* instance — both will agree on what trace is active inside an event because they read
|
|
42
|
+
* from EventContext.
|
|
24
43
|
*/
|
|
25
44
|
let TracingManager = class TracingManager {
|
|
26
45
|
/**
|
|
@@ -40,10 +59,27 @@ let TracingManager = class TracingManager {
|
|
|
40
59
|
this.isActive = isActive;
|
|
41
60
|
this.debug = debug;
|
|
42
61
|
this.tracingContext = tracingContext;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the currently active trace from the EventContext, falling back to the
|
|
65
|
+
* per-instance `this.trace` when no EventContext is active (kernel boot).
|
|
66
|
+
*/
|
|
67
|
+
getActiveTrace() {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return (_b = (_a = EventContextManager.current()) === null || _a === void 0 ? void 0 : _a.trace) !== null && _b !== void 0 ? _b : this.trace;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Stores `trace` as the active trace — on `EventContext.trace` when an event is active,
|
|
73
|
+
* otherwise on the instance fallback `this.trace`.
|
|
74
|
+
*/
|
|
75
|
+
setActiveTrace(trace) {
|
|
76
|
+
const eventContext = EventContextManager.current();
|
|
77
|
+
if (eventContext !== undefined) {
|
|
78
|
+
eventContext.trace = trace;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.trace = trace;
|
|
82
|
+
}
|
|
47
83
|
}
|
|
48
84
|
/**
|
|
49
85
|
* This methods starts the Tracing. This should be the first method called before doing anything else.
|
|
@@ -52,10 +88,19 @@ let TracingManager = class TracingManager {
|
|
|
52
88
|
* @param context The context if there is one.
|
|
53
89
|
*/
|
|
54
90
|
startTracing(spanRootKeyname = SpanKeynameEnum.RootExecution, traceId, context) {
|
|
55
|
-
|
|
91
|
+
const trace = new Trace(traceId, context);
|
|
92
|
+
this.setActiveTrace(trace);
|
|
56
93
|
const span = new Span(spanRootKeyname, undefined, context);
|
|
57
|
-
//
|
|
58
|
-
|
|
94
|
+
// Mirror the trace id into both the legacy `TracingContext` (back-compat for any
|
|
95
|
+
// existing consumer that still injects it) and the new ALS-propagated `EventContext`
|
|
96
|
+
// (the path forward; what `LogHandler` and other ALS-aware consumers will read).
|
|
97
|
+
// Both writes are cheap; the dual write is just a transition aid until TracingContext
|
|
98
|
+
// is fully removed in a later major.
|
|
99
|
+
this.tracingContext.traceId = trace.id;
|
|
100
|
+
const eventContext = EventContextManager.current();
|
|
101
|
+
if (eventContext !== undefined) {
|
|
102
|
+
eventContext.traceId = trace.id;
|
|
103
|
+
}
|
|
59
104
|
// If the tracing is not active, simply return the created span but don't send to the tracers.
|
|
60
105
|
if (this.isActive === false) {
|
|
61
106
|
return span;
|
|
@@ -66,17 +111,17 @@ let TracingManager = class TracingManager {
|
|
|
66
111
|
spanRootKeyname,
|
|
67
112
|
traceId,
|
|
68
113
|
context,
|
|
69
|
-
trace
|
|
114
|
+
trace,
|
|
70
115
|
span,
|
|
71
116
|
});
|
|
72
117
|
}
|
|
73
118
|
// Call the tracers and push the trace that was just started
|
|
74
119
|
this.tracers.forEach((tracer) => {
|
|
75
120
|
var _a;
|
|
76
|
-
(_a = tracer.traceStartedStream) === null || _a === void 0 ? void 0 : _a.push(
|
|
121
|
+
(_a = tracer.traceStartedStream) === null || _a === void 0 ? void 0 : _a.push(trace);
|
|
77
122
|
});
|
|
78
123
|
// Define the rootSpan of the trace as the newly created Span. This is the root span.
|
|
79
|
-
|
|
124
|
+
trace.rootSpan = span;
|
|
80
125
|
// Call the addSpan method to ensure that the span will be added.
|
|
81
126
|
this.addSpan(span);
|
|
82
127
|
return span;
|
|
@@ -92,29 +137,31 @@ let TracingManager = class TracingManager {
|
|
|
92
137
|
var _a;
|
|
93
138
|
// Make sure a trace exists. `startTracing` is the canonical entry point, but a direct
|
|
94
139
|
// `startSpan` call (e.g. from project code) should auto-start a trace rather than fail.
|
|
95
|
-
|
|
140
|
+
let trace = this.getActiveTrace();
|
|
141
|
+
if (trace === undefined) {
|
|
96
142
|
this.startTracing(SpanKeynameEnum.RootExecution, undefined, context);
|
|
143
|
+
trace = this.getActiveTrace();
|
|
97
144
|
}
|
|
98
145
|
// Construct the span. NOTE the third constructor argument: `Span(keyname, id?, context?)`.
|
|
99
146
|
// A previous version of this code passed `context` in the `id` slot, which corrupted span
|
|
100
|
-
// identities and broke parent-by-id lookup
|
|
147
|
+
// identities and broke parent-by-id lookup silently. Always pass `undefined`
|
|
101
148
|
// for the id so a fresh UUID is generated, and put context in the third slot.
|
|
102
149
|
const span = new Span(keyname, undefined, context);
|
|
103
150
|
// Defensive: tracing must never throw. If the trace is somehow still undefined here
|
|
104
151
|
// (an exception inside `startTracing` that we swallowed and logged), return the bare
|
|
105
152
|
// span so the caller can still call `.end()` on it without exploding.
|
|
106
|
-
if (
|
|
153
|
+
if (trace === undefined) {
|
|
107
154
|
this.loghandler.error("Trace is undefined after startTracing; returning unattached span.", { span });
|
|
108
155
|
return span;
|
|
109
156
|
}
|
|
110
|
-
span.trace =
|
|
157
|
+
span.trace = trace;
|
|
111
158
|
// Resolve the parent span. The default parent is the trace's rootSpan, but we may not
|
|
112
159
|
// have one if the trace was started via a path that didn't set it (programming error
|
|
113
160
|
// upstream, but we tolerate it). When no rootSpan exists, attach the new span as a
|
|
114
161
|
// top-level orphan and warn-log once instead of crashing.
|
|
115
|
-
let parentSpan =
|
|
162
|
+
let parentSpan = trace.rootSpan;
|
|
116
163
|
if (parentKeyname) {
|
|
117
|
-
const parentSpans =
|
|
164
|
+
const parentSpans = trace.spansByKeyname[parentKeyname];
|
|
118
165
|
if (parentSpans) {
|
|
119
166
|
if (parentSpans.length > 1) {
|
|
120
167
|
if (parentId) {
|
|
@@ -133,7 +180,7 @@ let TracingManager = class TracingManager {
|
|
|
133
180
|
this.loghandler.warning("startSpan: no parent span available (rootSpan is undefined). Attaching as orphan.", {
|
|
134
181
|
keyname,
|
|
135
182
|
parentKeyname,
|
|
136
|
-
traceId:
|
|
183
|
+
traceId: trace.id,
|
|
137
184
|
});
|
|
138
185
|
}
|
|
139
186
|
else {
|
|
@@ -150,18 +197,20 @@ let TracingManager = class TracingManager {
|
|
|
150
197
|
// Tracing must never throw. If there's no active trace, log and return the span
|
|
151
198
|
// unchanged — caller can still call `.end()` on it because Span.end uses optional
|
|
152
199
|
// chaining on tracingManager.
|
|
153
|
-
|
|
200
|
+
const trace = this.getActiveTrace();
|
|
201
|
+
if (trace === undefined) {
|
|
154
202
|
this.loghandler.error("You cannot call 'addSpan' without having an existing Trace.", { span });
|
|
155
203
|
return span;
|
|
156
204
|
}
|
|
157
205
|
span.tracingManager = this;
|
|
158
|
-
span.trace =
|
|
159
|
-
// Add it to the
|
|
160
|
-
|
|
161
|
-
|
|
206
|
+
span.trace = trace;
|
|
207
|
+
// Add it to the trace's by-keyname index so any TracingManager instance sharing this
|
|
208
|
+
// trace (via EventContext) can find it.
|
|
209
|
+
if (!trace.spansByKeyname[span.keyname]) {
|
|
210
|
+
trace.spansByKeyname[span.keyname] = [span];
|
|
162
211
|
}
|
|
163
212
|
else {
|
|
164
|
-
|
|
213
|
+
trace.spansByKeyname[span.keyname].push(span);
|
|
165
214
|
}
|
|
166
215
|
// If the tracing is deactivated, simply return the span and don't complain.
|
|
167
216
|
if (this.isActive === false) {
|
|
@@ -170,7 +219,7 @@ let TracingManager = class TracingManager {
|
|
|
170
219
|
if (this.debug) {
|
|
171
220
|
this.loghandler.debug(`[span:start] - ${span.keyname}`, {
|
|
172
221
|
keyname: span.keyname,
|
|
173
|
-
trace
|
|
222
|
+
trace,
|
|
174
223
|
span,
|
|
175
224
|
});
|
|
176
225
|
}
|
|
@@ -188,11 +237,16 @@ let TracingManager = class TracingManager {
|
|
|
188
237
|
* @param keyname The keyname of the span to end.
|
|
189
238
|
*/
|
|
190
239
|
endSpanKeyname(keyname) {
|
|
191
|
-
|
|
240
|
+
const trace = this.getActiveTrace();
|
|
241
|
+
if (trace === undefined) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const spans = trace.spansByKeyname[keyname];
|
|
245
|
+
if (!spans) {
|
|
192
246
|
return;
|
|
193
247
|
}
|
|
194
|
-
if (
|
|
195
|
-
return this.endSpan(
|
|
248
|
+
if (spans.length === 1) {
|
|
249
|
+
return this.endSpan(spans[0]);
|
|
196
250
|
}
|
|
197
251
|
this.loghandler.error("Error ending span by keyname since multiple spans exist with this keyname");
|
|
198
252
|
}
|
|
@@ -202,7 +256,7 @@ let TracingManager = class TracingManager {
|
|
|
202
256
|
* @param span The span to end.
|
|
203
257
|
*/
|
|
204
258
|
endSpan(span) {
|
|
205
|
-
var _a
|
|
259
|
+
var _a;
|
|
206
260
|
if (span.inProgress === false) {
|
|
207
261
|
return;
|
|
208
262
|
}
|
|
@@ -217,7 +271,7 @@ let TracingManager = class TracingManager {
|
|
|
217
271
|
}
|
|
218
272
|
if (this.debug) {
|
|
219
273
|
this.loghandler.debug(`[span:end] - ${span.keyname}`, {
|
|
220
|
-
trace: this.
|
|
274
|
+
trace: this.getActiveTrace(),
|
|
221
275
|
span,
|
|
222
276
|
});
|
|
223
277
|
}
|
|
@@ -227,7 +281,8 @@ let TracingManager = class TracingManager {
|
|
|
227
281
|
(_a = tracer.spanEndedStream) === null || _a === void 0 ? void 0 : _a.push(span);
|
|
228
282
|
});
|
|
229
283
|
// If the span is the root span, the trace has ended
|
|
230
|
-
|
|
284
|
+
const trace = this.getActiveTrace();
|
|
285
|
+
if (span.keyname === ((_a = trace === null || trace === void 0 ? void 0 : trace.rootSpan) === null || _a === void 0 ? void 0 : _a.keyname)) {
|
|
231
286
|
this.endTrace();
|
|
232
287
|
}
|
|
233
288
|
}
|
|
@@ -235,16 +290,17 @@ let TracingManager = class TracingManager {
|
|
|
235
290
|
* This method ends the trace entirely.
|
|
236
291
|
*/
|
|
237
292
|
endTrace() {
|
|
238
|
-
|
|
293
|
+
const trace = this.getActiveTrace();
|
|
294
|
+
if (trace === undefined || trace.hasEnded) {
|
|
239
295
|
return;
|
|
240
296
|
}
|
|
241
297
|
// End the trace by setting the end date.
|
|
242
|
-
|
|
298
|
+
trace.endDate = Date.now();
|
|
243
299
|
// End the trace.
|
|
244
|
-
|
|
300
|
+
trace.hasEnded = true;
|
|
245
301
|
// This method will recursively end all the spans
|
|
246
|
-
if (
|
|
247
|
-
this.endSpan(
|
|
302
|
+
if (trace.rootSpan !== undefined) {
|
|
303
|
+
this.endSpan(trace.rootSpan);
|
|
248
304
|
}
|
|
249
305
|
if (this.isActive === false) {
|
|
250
306
|
return;
|
|
@@ -255,14 +311,103 @@ let TracingManager = class TracingManager {
|
|
|
255
311
|
// tree-formatted output when the user opts into it.
|
|
256
312
|
this.tracers.forEach((tracer) => {
|
|
257
313
|
var _a;
|
|
258
|
-
(_a = tracer.traceEndedStream) === null || _a === void 0 ? void 0 : _a.push(
|
|
314
|
+
(_a = tracer.traceEndedStream) === null || _a === void 0 ? void 0 : _a.push(trace);
|
|
259
315
|
});
|
|
260
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Attaches a named, timestamped event to the most-recently-started in-progress span.
|
|
319
|
+
* Use for noteworthy moments that don't warrant a child span — "validation passed",
|
|
320
|
+
* "found 50 rows", "rate limit ok". Cheap (just pushes onto an array); shows up in
|
|
321
|
+
* the trace rendered by tracers (ConsoleTracer, FileTracer, X-Ray, etc.).
|
|
322
|
+
*
|
|
323
|
+
* If no span is currently active (no trace started, or every span has already ended),
|
|
324
|
+
* a warning is logged and the marker is dropped. The warning is the explicit signal
|
|
325
|
+
* that "this marker call had nowhere to go" — usually the sign of a missing
|
|
326
|
+
* `startTracing()` call earlier in the flow.
|
|
327
|
+
*/
|
|
328
|
+
addEventToCurrentSpan(message, attributes) {
|
|
329
|
+
const target = this.findActiveLeafSpan();
|
|
330
|
+
if (target === undefined) {
|
|
331
|
+
this.loghandler.warning("TracingManager.addEventToCurrentSpan called outside any active trace; marker dropped.", { extra: { message, attributes } });
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
target.events.push(new SpanEvent(message, attributes));
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Returns the active trace's spans + their events as a flat, timestamp-sorted list of
|
|
338
|
+
* `{kind, name, date, attributes}` entries. Public utility for custom tracers, debug
|
|
339
|
+
* endpoints, test helpers, or anyone who wants "the active trace as a flat list."
|
|
340
|
+
* Returns an empty array when no active trace exists.
|
|
341
|
+
*/
|
|
342
|
+
getCurrentTrail() {
|
|
343
|
+
const trace = this.getActiveTrace();
|
|
344
|
+
if ((trace === null || trace === void 0 ? void 0 : trace.rootSpan) === undefined)
|
|
345
|
+
return [];
|
|
346
|
+
const out = [];
|
|
347
|
+
const walk = (span) => {
|
|
348
|
+
var _a, _b;
|
|
349
|
+
const suffix = span.inProgress ? " (active)" : "";
|
|
350
|
+
out.push({
|
|
351
|
+
kind: "span",
|
|
352
|
+
name: `${span.keyname}${suffix}`,
|
|
353
|
+
date: new Date(span.startDate),
|
|
354
|
+
attributes: Object.assign({ spanId: span.id }, ((_a = span.context) !== null && _a !== void 0 ? _a : {})),
|
|
355
|
+
});
|
|
356
|
+
for (const event of span.events) {
|
|
357
|
+
out.push({
|
|
358
|
+
kind: "event",
|
|
359
|
+
name: event.message,
|
|
360
|
+
date: new Date(event.timestamp),
|
|
361
|
+
attributes: Object.assign({ spanKeyname: span.keyname }, ((_b = event.attributes) !== null && _b !== void 0 ? _b : {})),
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
for (const child of span.children) {
|
|
365
|
+
walk(child);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
walk(trace.rootSpan);
|
|
369
|
+
out.sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
370
|
+
return out;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Finds the deepest in-progress span — the leaf of the still-open subtree. Used as
|
|
374
|
+
* the target for `addEventToCurrentSpan`. Intuition: events attach to whatever is
|
|
375
|
+
* currently open at the bottom of the call stack.
|
|
376
|
+
*
|
|
377
|
+
* Walking the in-progress subtree (rather than ranking all spans by start date)
|
|
378
|
+
* avoids the edge case where a parent and child have the same `Date.now()` value —
|
|
379
|
+
* picking the "latest started" by raw timestamp would incorrectly attach to the
|
|
380
|
+
* parent. Depth-first traversal of in-progress children naturally lands on the
|
|
381
|
+
* deepest leaf. Tie-broken by latest start date when multiple leaves exist.
|
|
382
|
+
*
|
|
383
|
+
* Returns undefined when nothing is in progress (no trace, or every span has ended).
|
|
384
|
+
* @private
|
|
385
|
+
*/
|
|
386
|
+
findActiveLeafSpan() {
|
|
387
|
+
const trace = this.getActiveTrace();
|
|
388
|
+
if ((trace === null || trace === void 0 ? void 0 : trace.rootSpan) === undefined)
|
|
389
|
+
return undefined;
|
|
390
|
+
let best;
|
|
391
|
+
const walk = (span) => {
|
|
392
|
+
const inProgressChildren = span.children.filter(c => c.inProgress);
|
|
393
|
+
if (span.inProgress && inProgressChildren.length === 0) {
|
|
394
|
+
// This span is a leaf of the in-progress subtree. Among multiple such leaves,
|
|
395
|
+
// prefer the latest-started one (most recent in time).
|
|
396
|
+
if (best === undefined || span.startDate >= best.startDate) {
|
|
397
|
+
best = span;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
for (const child of inProgressChildren)
|
|
401
|
+
walk(child);
|
|
402
|
+
};
|
|
403
|
+
walk(trace.rootSpan);
|
|
404
|
+
return best;
|
|
405
|
+
}
|
|
261
406
|
};
|
|
262
407
|
TracingManager = __decorate([
|
|
263
408
|
moduleScoped(TelemetryModuleKeyname),
|
|
264
409
|
tag("TracingManagerInterface"),
|
|
265
|
-
|
|
410
|
+
scoped(Lifecycle.ContainerScoped),
|
|
266
411
|
injectable(),
|
|
267
412
|
__param(0, injectAll(ServiceDefinitionTagEnum.Tracer, { isOptional: true })),
|
|
268
413
|
__param(1, inject("LogHandlerInterface")),
|
|
@@ -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;
|
|
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,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC1E,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,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnI,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAC;AAGnE,OAAO,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKI,IAAM,cAAc,GAApB,MAAM,cAAc;IAOzB;;;;;;;;;;OAUG;IACH,YAA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BAAkB;gBAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAlaY,cAAc;IAJ1B,YAAY,CAAC,sBAAsB,CAAC;IACpC,GAAG,CAAC,yBAAyB,CAAC;IAC9B,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;IACjC,UAAU,EAAE;IAmBS,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;GAtBvD,cAAc,CAka1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-event.model.js","sourceRoot":"","sources":["../../../../src/models/span-event.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,68 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This model represents a span.
|
|
4
|
-
*/
|
|
5
|
-
export class Span {
|
|
6
|
-
/**
|
|
7
|
-
* This model represents a span.
|
|
8
|
-
* @param keyname The keyname of the span.
|
|
9
|
-
* @param id The unique id of the span.
|
|
10
|
-
* @param context The context to associate with the span.
|
|
11
|
-
*/
|
|
12
|
-
constructor(keyname, id, context) {
|
|
13
|
-
this.keyname = keyname;
|
|
14
|
-
/**
|
|
15
|
-
* The timestamp in milliseconds at which the span was started.
|
|
16
|
-
*/
|
|
17
|
-
this.startDate = Date.now();
|
|
18
|
-
/**
|
|
19
|
-
* The children spans.
|
|
20
|
-
*/
|
|
21
|
-
this.children = [];
|
|
22
|
-
/**
|
|
23
|
-
* The context associated with the span.
|
|
24
|
-
*/
|
|
25
|
-
this.context = {};
|
|
26
|
-
/**
|
|
27
|
-
* Whether or not the span is in progress, meaning it has not ended.
|
|
28
|
-
*/
|
|
29
|
-
this.inProgress = true;
|
|
30
|
-
this.id = id !== null && id !== void 0 ? id : uuidv4();
|
|
31
|
-
this.context = context !== null && context !== void 0 ? context : {};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* This method returns the duration of the span in milliseconds.
|
|
35
|
-
*/
|
|
36
|
-
getDuration() {
|
|
37
|
-
var _a;
|
|
38
|
-
return ((_a = this.endDate) !== null && _a !== void 0 ? _a : Date.now()) - this.startDate;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* This method ends the span.
|
|
42
|
-
*/
|
|
43
|
-
end() {
|
|
44
|
-
var _a;
|
|
45
|
-
(_a = this.tracingManager) === null || _a === void 0 ? void 0 : _a.endSpan(this);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* This method sets the trace for the span and all of its children.
|
|
49
|
-
* @param trace The trace the span should be attached to.
|
|
50
|
-
*/
|
|
51
|
-
setTrace(trace) {
|
|
52
|
-
this.trace = trace;
|
|
53
|
-
this.children.forEach(childSpan => childSpan.setTrace(trace));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* This method adds a child span to the current span. It only adds it if it's not already part of the children.
|
|
57
|
-
* @param span The span to add as a child.
|
|
58
|
-
*/
|
|
59
|
-
addChild(span) {
|
|
60
|
-
const existingChildSpan = this.children.find(childSpan => childSpan.id === span.id);
|
|
61
|
-
if (existingChildSpan) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
span.parentSpan = this;
|
|
65
|
-
this.children.push(span);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
export { Span } from "@pristine-ts/common";
|
|
68
2
|
//# sourceMappingURL=span.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"span.model.js","sourceRoot":"","sources":["../../../../src/models/span.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"span.model.js","sourceRoot":"","sources":["../../../../src/models/span.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAA8B,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This model represents a trace.
|
|
4
|
-
*/
|
|
5
|
-
export class Trace {
|
|
6
|
-
/**
|
|
7
|
-
* This model represents a trace.
|
|
8
|
-
* @param id The unique id of the trace.
|
|
9
|
-
* @param context The context associated with the trace.
|
|
10
|
-
*/
|
|
11
|
-
constructor(id, context) {
|
|
12
|
-
/**
|
|
13
|
-
* The timestamp in milliseconds at which the trace was started.
|
|
14
|
-
*/
|
|
15
|
-
this.startDate = Date.now();
|
|
16
|
-
/**
|
|
17
|
-
* The context associated with the trace.
|
|
18
|
-
*/
|
|
19
|
-
this.context = {};
|
|
20
|
-
/**
|
|
21
|
-
* Whether or not the trace was ended.
|
|
22
|
-
*/
|
|
23
|
-
this.hasEnded = false;
|
|
24
|
-
this.id = id !== null && id !== void 0 ? id : uuidv4();
|
|
25
|
-
this.context = context !== null && context !== void 0 ? context : {};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* This returns the duration of the trace in miliseconds.
|
|
29
|
-
*/
|
|
30
|
-
getDuration() {
|
|
31
|
-
var _a;
|
|
32
|
-
return ((_a = this.endDate) !== null && _a !== void 0 ? _a : Date.now()) - this.startDate;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
export { Trace } from "@pristine-ts/common";
|
|
35
2
|
//# sourceMappingURL=trace.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.model.js","sourceRoot":"","sources":["../../../../src/models/trace.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trace.model.js","sourceRoot":"","sources":["../../../../src/models/trace.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC"}
|