@pristine-ts/common 2.0.5 → 2.0.7
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/models/models.js +1 -1
- package/dist/lib/cjs/models/models.js.map +1 -1
- package/dist/lib/cjs/models/span-marker.model.js +34 -0
- package/dist/lib/cjs/models/span-marker.model.js.map +1 -0
- package/dist/lib/cjs/models/span.model.js +5 -2
- package/dist/lib/cjs/models/span.model.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/esm/models/models.js +1 -1
- package/dist/lib/esm/models/models.js.map +1 -1
- package/dist/lib/esm/models/span-marker.model.js +30 -0
- package/dist/lib/esm/models/span-marker.model.js.map +1 -0
- package/dist/lib/esm/models/span.model.js +5 -2
- package/dist/lib/esm/models/span.model.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/contexts/event-context.d.ts +1 -1
- package/dist/types/interfaces/tracing-manager.interface.d.ts +4 -4
- package/dist/types/models/models.d.ts +1 -1
- package/dist/types/models/span-marker.model.d.ts +36 -0
- package/dist/types/models/span.model.d.ts +6 -3
- package/package.json +2 -2
- package/dist/lib/cjs/models/span-event.model.js +0 -28
- package/dist/lib/cjs/models/span-event.model.js.map +0 -1
- package/dist/lib/esm/models/span-event.model.js +0 -24
- package/dist/lib/esm/models/span-event.model.js.map +0 -1
- package/dist/types/models/span-event.model.d.ts +0 -30
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A named, timestamped marker attached to a `Span`. Represents a noteworthy moment
|
|
3
|
+
* inside the span's lifetime that doesn't warrant a child span of its own — e.g.
|
|
4
|
+
* "validation passed", "rate limit check ok", "found 50 rows in DB".
|
|
5
|
+
*
|
|
6
|
+
* **Markers are instants, not durations.** They carry a single timestamp; they have no
|
|
7
|
+
* children and no end date. If you need hierarchical timing, spawn a child `Span`
|
|
8
|
+
* instead — that gives you start/end semantics and its own marker list.
|
|
9
|
+
*
|
|
10
|
+
* Modeled after OpenTelemetry's "span events" concept (we renamed `event` → `marker`
|
|
11
|
+
* here because `Event` is heavily overloaded in Pristine's dispatched-event domain —
|
|
12
|
+
* `Event<T>`, `EventHandler`, `EventPipeline`, `EventDispatcher`, etc.). A `Span` carries
|
|
13
|
+
* `markers: SpanMarker[]` alongside its `children: Span[]`. Renderers interleave markers
|
|
14
|
+
* with child spans by timestamp to produce a chronological trail of what happened.
|
|
15
|
+
*
|
|
16
|
+
* Use `TracingManager.addMarkerToCurrentSpan(message, attributes?)` to add one — it
|
|
17
|
+
* finds the most-recently-started in-progress span and attaches the marker there.
|
|
18
|
+
*/
|
|
19
|
+
export declare class SpanMarker {
|
|
20
|
+
readonly message: string;
|
|
21
|
+
/**
|
|
22
|
+
* The timestamp in milliseconds at which the marker was created. Used to interleave
|
|
23
|
+
* markers with sibling spans when rendering a sorted trail.
|
|
24
|
+
*/
|
|
25
|
+
readonly timestamp: number;
|
|
26
|
+
/**
|
|
27
|
+
* Free-form attributes attached to the marker. String-keyed for cheap serialization,
|
|
28
|
+
* mirroring `Span.context`'s shape. `undefined` when the marker carries no metadata.
|
|
29
|
+
*/
|
|
30
|
+
readonly attributes?: {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
constructor(message: string, attributes?: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SpanEvent } from "./span-event.model";
|
|
2
1
|
import { SpanLifecycleOwnerInterface } from "./span-lifecycle-owner.interface";
|
|
2
|
+
import { SpanMarker } from "./span-marker.model";
|
|
3
3
|
import { Trace } from "./trace.model";
|
|
4
4
|
/**
|
|
5
5
|
* This model represents a span.
|
|
@@ -39,9 +39,12 @@ export declare class Span {
|
|
|
39
39
|
* Named, timestamped markers attached to this span. Use these for noteworthy moments
|
|
40
40
|
* inside the span's lifetime that don't warrant their own child span — e.g.
|
|
41
41
|
* "validation passed", "found 50 rows in DB". Empty by default; populated by
|
|
42
|
-
* `TracingManager.
|
|
42
|
+
* `TracingManager.addMarkerToCurrentSpan(...)`.
|
|
43
|
+
*
|
|
44
|
+
* Markers are flat by design (instants, not durations). For hierarchical timing, use
|
|
45
|
+
* child spans.
|
|
43
46
|
*/
|
|
44
|
-
|
|
47
|
+
markers: SpanMarker[];
|
|
45
48
|
/**
|
|
46
49
|
* The context associated with the span.
|
|
47
50
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/common.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/common.module.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"src/*.{js,ts}"
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "8788c711f72b7ebdcec76bc8f6a56d51af143087"
|
|
67
67
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpanEvent = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A named, timestamped marker attached to a `Span`. Represents a noteworthy moment
|
|
6
|
-
* inside the span's lifetime that doesn't warrant a child span of its own — e.g.
|
|
7
|
-
* "validation passed", "rate limit check ok", "found 50 rows in DB".
|
|
8
|
-
*
|
|
9
|
-
* Modeled after OpenTelemetry's "span events" concept: a `Span` carries `events: SpanEvent[]`
|
|
10
|
-
* alongside its `children: Span[]`. Renderers (the console/file tracer output, etc.) interleave
|
|
11
|
-
* events with spans by timestamp to produce a chronological trail of what happened during the span.
|
|
12
|
-
*
|
|
13
|
-
* Use `TracingManager.addEventToCurrentSpan(message, attributes?)` to add one — it finds
|
|
14
|
-
* the most-recently-started in-progress span and attaches the event there.
|
|
15
|
-
*/
|
|
16
|
-
class SpanEvent {
|
|
17
|
-
constructor(message, attributes) {
|
|
18
|
-
this.message = message;
|
|
19
|
-
/**
|
|
20
|
-
* The timestamp in milliseconds at which the event was created. Used to interleave
|
|
21
|
-
* events with sibling spans when rendering a sorted trail.
|
|
22
|
-
*/
|
|
23
|
-
this.timestamp = Date.now();
|
|
24
|
-
this.attributes = attributes;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.SpanEvent = SpanEvent;
|
|
28
|
-
//# sourceMappingURL=span-event.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"span-event.model.js","sourceRoot":"","sources":["../../../../src/models/span-event.model.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,MAAa,SAAS;IAapB,YAA4B,OAAe,EAAE,UAAsC;QAAvD,YAAO,GAAP,OAAO,CAAQ;QAZ3C;;;WAGG;QACa,cAAS,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;QAS7C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAhBD,8BAgBC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A named, timestamped marker attached to a `Span`. Represents a noteworthy moment
|
|
3
|
-
* inside the span's lifetime that doesn't warrant a child span of its own — e.g.
|
|
4
|
-
* "validation passed", "rate limit check ok", "found 50 rows in DB".
|
|
5
|
-
*
|
|
6
|
-
* Modeled after OpenTelemetry's "span events" concept: a `Span` carries `events: SpanEvent[]`
|
|
7
|
-
* alongside its `children: Span[]`. Renderers (the console/file tracer output, etc.) interleave
|
|
8
|
-
* events with spans by timestamp to produce a chronological trail of what happened during the span.
|
|
9
|
-
*
|
|
10
|
-
* Use `TracingManager.addEventToCurrentSpan(message, attributes?)` to add one — it finds
|
|
11
|
-
* the most-recently-started in-progress span and attaches the event there.
|
|
12
|
-
*/
|
|
13
|
-
export class SpanEvent {
|
|
14
|
-
constructor(message, attributes) {
|
|
15
|
-
this.message = message;
|
|
16
|
-
/**
|
|
17
|
-
* The timestamp in milliseconds at which the event was created. Used to interleave
|
|
18
|
-
* events with sibling spans when rendering a sorted trail.
|
|
19
|
-
*/
|
|
20
|
-
this.timestamp = Date.now();
|
|
21
|
-
this.attributes = attributes;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=span-event.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"span-event.model.js","sourceRoot":"","sources":["../../../../src/models/span-event.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAS;IAapB,YAA4B,OAAe,EAAE,UAAsC;QAAvD,YAAO,GAAP,OAAO,CAAQ;QAZ3C;;;WAGG;QACa,cAAS,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;QAS7C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A named, timestamped marker attached to a `Span`. Represents a noteworthy moment
|
|
3
|
-
* inside the span's lifetime that doesn't warrant a child span of its own — e.g.
|
|
4
|
-
* "validation passed", "rate limit check ok", "found 50 rows in DB".
|
|
5
|
-
*
|
|
6
|
-
* Modeled after OpenTelemetry's "span events" concept: a `Span` carries `events: SpanEvent[]`
|
|
7
|
-
* alongside its `children: Span[]`. Renderers (the console/file tracer output, etc.) interleave
|
|
8
|
-
* events with spans by timestamp to produce a chronological trail of what happened during the span.
|
|
9
|
-
*
|
|
10
|
-
* Use `TracingManager.addEventToCurrentSpan(message, attributes?)` to add one — it finds
|
|
11
|
-
* the most-recently-started in-progress span and attaches the event there.
|
|
12
|
-
*/
|
|
13
|
-
export declare class SpanEvent {
|
|
14
|
-
readonly message: string;
|
|
15
|
-
/**
|
|
16
|
-
* The timestamp in milliseconds at which the event was created. Used to interleave
|
|
17
|
-
* events with sibling spans when rendering a sorted trail.
|
|
18
|
-
*/
|
|
19
|
-
readonly timestamp: number;
|
|
20
|
-
/**
|
|
21
|
-
* Free-form attributes attached to the event. String-keyed for cheap serialization,
|
|
22
|
-
* mirroring `Span.context`'s shape. `undefined` when the event carries no metadata.
|
|
23
|
-
*/
|
|
24
|
-
readonly attributes?: {
|
|
25
|
-
[key: string]: string;
|
|
26
|
-
};
|
|
27
|
-
constructor(message: string, attributes?: {
|
|
28
|
-
[key: string]: string;
|
|
29
|
-
});
|
|
30
|
-
}
|