@utk09/ui-observability 0.4.1 → 0.6.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 +63 -0
- package/README.md +114 -59
- package/dist/bus/bus.d.ts +10 -10
- package/dist/bus/links.d.ts +1 -1
- package/dist/bus-BTMuVkDk.js +378 -0
- package/dist/bus-BTMuVkDk.js.map +1 -0
- package/dist/bus-ChIXDAWD.cjs +2 -0
- package/dist/bus-ChIXDAWD.cjs.map +1 -0
- package/dist/capture/network.d.ts +2 -2
- package/dist/capture/types.d.ts +10 -10
- package/dist/capture/web-vitals.d.ts +7 -4
- package/dist/{constants-DVbpJ1tv.js → constants-0-YchbAL.js} +9 -8
- package/dist/constants-0-YchbAL.js.map +1 -0
- package/dist/constants-TUFcy95w.cjs +2 -0
- package/dist/constants-TUFcy95w.cjs.map +1 -0
- package/dist/constants.d.ts +55 -40
- package/dist/core/breadcrumbs.d.ts +14 -14
- package/dist/core/config.d.ts +5 -4
- package/dist/core/context.d.ts +2 -2
- package/dist/core/diagnostics.d.ts +10 -9
- package/dist/core/journey.d.ts +28 -22
- package/dist/core/logger.d.ts +29 -10
- package/dist/core/pipeline.d.ts +34 -29
- package/dist/core/record.d.ts +6 -6
- package/dist/core/runtime.d.ts +119 -35
- package/dist/core/sampling.d.ts +15 -16
- package/dist/core/sender.d.ts +58 -0
- package/dist/errors-DRXBRqvm.cjs +3 -0
- package/dist/errors-DRXBRqvm.cjs.map +1 -0
- package/dist/errors-Dwm2SzBa.js +76 -0
- package/dist/errors-Dwm2SzBa.js.map +1 -0
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +476 -2247
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-B5dwq4hW.cjs +2 -0
- package/dist/indexeddb-storage-B5dwq4hW.cjs.map +1 -0
- package/dist/{indexeddb-storage-B6uqejZb.js → indexeddb-storage-DjY4Ml6t.js} +18 -22
- package/dist/indexeddb-storage-DjY4Ml6t.js.map +1 -0
- package/dist/interactions-DVom6eYn.cjs +2 -0
- package/dist/interactions-DVom6eYn.cjs.map +1 -0
- package/dist/interactions-DZmLu7l2.js +67 -0
- package/dist/interactions-DZmLu7l2.js.map +1 -0
- package/dist/models/batch.d.ts +12 -9
- package/dist/models/bus.d.ts +12 -13
- package/dist/models/config.d.ts +84 -49
- package/dist/models/log-record.d.ts +12 -10
- package/dist/models/serializer.d.ts +3 -2
- package/dist/models/storage.d.ts +2 -2
- package/dist/network-C4d2uw2Z.js +111 -0
- package/dist/network-C4d2uw2Z.js.map +1 -0
- package/dist/network-CuqWadNn.cjs +2 -0
- package/dist/network-CuqWadNn.cjs.map +1 -0
- package/dist/platform-CXio0W2n.cjs +2 -0
- package/dist/platform-CXio0W2n.cjs.map +1 -0
- package/dist/platform-CY8S3hUs.js +48 -0
- package/dist/platform-CY8S3hUs.js.map +1 -0
- package/dist/sampling-CEthcmEX.cjs +2 -0
- package/dist/sampling-CEthcmEX.cjs.map +1 -0
- package/dist/sampling-CJsI_24L.js +251 -0
- package/dist/sampling-CJsI_24L.js.map +1 -0
- package/dist/sender-ByFAkXVd.cjs +3 -0
- package/dist/sender-ByFAkXVd.cjs.map +1 -0
- package/dist/sender-dpvR_bHM.js +907 -0
- package/dist/sender-dpvR_bHM.js.map +1 -0
- package/dist/storage/emergency-queue.d.ts +2 -2
- package/dist/storage/factory.d.ts +2 -1
- package/dist/storage/idb-driver.d.ts +19 -19
- package/dist/storage/indexeddb-storage.d.ts +18 -17
- package/dist/storage/keys.d.ts +1 -1
- package/dist/storage/local-storage.d.ts +19 -18
- package/dist/storage/memory-storage.d.ts +12 -11
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/errors.d.ts +8 -7
- package/dist/transport/exit-flush.d.ts +27 -24
- package/dist/transport/http-transport.d.ts +19 -10
- package/dist/transport/retry-engine.d.ts +33 -28
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.ts +1 -1
- package/dist/transport/serializers/select.d.ts +8 -0
- package/dist/unref-16maCyKA.js +8 -0
- package/dist/unref-16maCyKA.js.map +1 -0
- package/dist/unref-CU9Nyz_9.cjs +2 -0
- package/dist/unref-CU9Nyz_9.cjs.map +1 -0
- package/dist/utils/console.d.ts +11 -3
- package/dist/utils/identity.d.ts +53 -8
- package/dist/utils/lock.d.ts +4 -4
- package/dist/utils/platform.d.ts +5 -3
- package/dist/utils/sanitize.d.ts +5 -2
- package/dist/utils/sequence.d.ts +2 -2
- package/dist/utils/tracing.d.ts +14 -12
- package/dist/web-vitals-B2FYsEAU.cjs +2 -0
- package/dist/web-vitals-B2FYsEAU.cjs.map +1 -0
- package/dist/web-vitals-DHZ0yA_H.js +51 -0
- package/dist/web-vitals-DHZ0yA_H.js.map +1 -0
- package/package.json +21 -11
- package/dist/constants-DVbpJ1tv.js.map +0 -1
- package/dist/constants-tQpoTzkY.cjs +0 -2
- package/dist/constants-tQpoTzkY.cjs.map +0 -1
- package/dist/indexeddb-storage-B6uqejZb.js.map +0 -1
- package/dist/indexeddb-storage-CgT1GLYj.cjs +0 -2
- package/dist/indexeddb-storage-CgT1GLYj.cjs.map +0 -1
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
/** Category
|
|
1
|
+
/** Category of a breadcrumb event. */
|
|
2
2
|
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console";
|
|
3
|
-
/**
|
|
3
|
+
/** Short summary of one event that the buffer keeps for an error record. */
|
|
4
4
|
export interface Breadcrumb {
|
|
5
5
|
/** Timestamp in epoch milliseconds. */
|
|
6
6
|
t: number;
|
|
7
|
-
/**
|
|
7
|
+
/** Category of the event. */
|
|
8
8
|
category: BreadcrumbCategory;
|
|
9
|
-
/**
|
|
9
|
+
/** Description of the event for a person to read. */
|
|
10
10
|
message: string;
|
|
11
11
|
/** Optional contextual metadata. */
|
|
12
12
|
data?: Record<string, unknown>;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/** Ring buffer of fixed size. It keeps recent breadcrumbs in time order. */
|
|
15
15
|
export declare class BreadcrumbBuffer {
|
|
16
|
-
/**
|
|
16
|
+
/** Storage array of the ring buffer. */
|
|
17
17
|
private buffer;
|
|
18
18
|
/** Next write index in the circular buffer. */
|
|
19
19
|
private pointer;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* It is true after the pointer wraps past the capacity. The pointer alone cannot
|
|
22
|
+
* tell an empty ring from a ring that wrapped back to index 0.
|
|
23
23
|
*/
|
|
24
24
|
private filled;
|
|
25
|
-
/** Maximum number of breadcrumbs
|
|
25
|
+
/** Maximum number of breadcrumbs that the buffer keeps. */
|
|
26
26
|
private readonly capacity;
|
|
27
27
|
/**
|
|
28
|
-
* @param capacity Maximum
|
|
28
|
+
* @param capacity Maximum number of breadcrumbs. A smaller value changes to the minimum size.
|
|
29
29
|
*/
|
|
30
30
|
constructor(capacity: number);
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param crumb Breadcrumb
|
|
32
|
+
* Adds a breadcrumb. When the buffer is full, the new breadcrumb replaces the oldest one.
|
|
33
|
+
* @param crumb Breadcrumb to add.
|
|
34
34
|
*/
|
|
35
35
|
push(crumb: Breadcrumb): void;
|
|
36
36
|
/**
|
|
37
37
|
* Returns all stored breadcrumbs ordered from oldest to newest.
|
|
38
|
-
* @returns
|
|
38
|
+
* @returns List of breadcrumbs in time order.
|
|
39
39
|
*/
|
|
40
40
|
snapshot(): Breadcrumb[];
|
|
41
|
-
/**
|
|
41
|
+
/** Removes all breadcrumbs and resets the buffer. */
|
|
42
42
|
clear(): void;
|
|
43
43
|
}
|
package/dist/core/config.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ import type { Diagnostics } from "./diagnostics";
|
|
|
5
5
|
* @param input Partial consumer configuration options.
|
|
6
6
|
* @param diagnostics Diagnostics reporter.
|
|
7
7
|
* @param previous Active configuration instance for incremental reconfigurations.
|
|
8
|
-
* @returns
|
|
8
|
+
* @returns Complete, validated configuration object.
|
|
9
9
|
*/
|
|
10
10
|
export declare function resolveConfig(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics, previous?: ResolvedConfig): ResolvedConfig;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
12
|
+
* Changes the active configuration object in place. Subsystems that hold a section
|
|
13
|
+
* reference see the update.
|
|
14
|
+
* @param target Active configuration object to change.
|
|
15
|
+
* @param next Configuration object with the new values.
|
|
15
16
|
*/
|
|
16
17
|
export declare function applyResolvedConfig(target: ResolvedConfig, next: ResolvedConfig): void;
|
package/dist/core/context.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ export declare class ContextStore {
|
|
|
27
27
|
/** Clears all attributes from the ambient context store. */
|
|
28
28
|
clear(): void;
|
|
29
29
|
/**
|
|
30
|
-
* Returns a
|
|
31
|
-
* target or sanitizer
|
|
30
|
+
* Returns a copy of all ambient context attributes. The copy prevents a merge
|
|
31
|
+
* target or a sanitizer from changing the store.
|
|
32
32
|
* @returns Plain object containing stored key-value pairs.
|
|
33
33
|
*/
|
|
34
34
|
getAll(): Record<string, unknown>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** Closed set of diagnostic event codes emitted by library subsystems. */
|
|
2
|
-
export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.record_failed" | "openfin.unavailable" | "handler.threw";
|
|
2
|
+
export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.record_failed" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
|
|
3
3
|
/** Diagnostic event payload dispatched to consumer handlers. */
|
|
4
4
|
export interface DiagnosticEvent {
|
|
5
5
|
/** Diagnostic fault code. */
|
|
6
6
|
code: DiagnosticCode;
|
|
7
|
-
/**
|
|
7
|
+
/** Description for a person to read. */
|
|
8
8
|
message: string;
|
|
9
9
|
/** Structured context metadata. */
|
|
10
10
|
detail?: Record<string, unknown>;
|
|
@@ -12,12 +12,12 @@ export interface DiagnosticEvent {
|
|
|
12
12
|
cause?: unknown;
|
|
13
13
|
/** Event timestamp in epoch milliseconds. */
|
|
14
14
|
at: number;
|
|
15
|
-
/**
|
|
15
|
+
/** Total count of this code since startup. It includes rate-limited occurrences. */
|
|
16
16
|
count: number;
|
|
17
17
|
}
|
|
18
18
|
/** Consumer callback for receiving rate-limited diagnostic events. */
|
|
19
19
|
export type DiagnosticHandler = (event: DiagnosticEvent) => void;
|
|
20
|
-
/**
|
|
20
|
+
/** Reports internal errors. It limits the dispatch rate but counts every event. */
|
|
21
21
|
export declare class Diagnostics {
|
|
22
22
|
private handler?;
|
|
23
23
|
private readonly throttleMs;
|
|
@@ -36,14 +36,15 @@ export declare class Diagnostics {
|
|
|
36
36
|
*/
|
|
37
37
|
setHandler(handler?: DiagnosticHandler): void;
|
|
38
38
|
/**
|
|
39
|
-
* Increments the
|
|
39
|
+
* Increments the count for a code. It does not call the handler.
|
|
40
40
|
* @param code Diagnostic code to increment.
|
|
41
41
|
* @param by Increment delta.
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns New total for the code.
|
|
43
43
|
*/
|
|
44
44
|
count(code: DiagnosticCode, by?: number): number;
|
|
45
45
|
/**
|
|
46
|
-
* Increments counter
|
|
46
|
+
* Increments the counter for the code. It sends the event to the handler when the
|
|
47
|
+
* throttle window has passed. It never throws.
|
|
47
48
|
* @param code Diagnostic code.
|
|
48
49
|
* @param message Event description.
|
|
49
50
|
* @param detail Optional structured metadata.
|
|
@@ -53,7 +54,7 @@ export declare class Diagnostics {
|
|
|
53
54
|
/**
|
|
54
55
|
* Executes a synchronous function and reports any thrown error to diagnostics.
|
|
55
56
|
* @param code Diagnostic code to report on throw.
|
|
56
|
-
* @param message
|
|
57
|
+
* @param message ASD-STE100 sentence that states the failure. The handler gets it as the event message.
|
|
57
58
|
* @param fn Function to execute.
|
|
58
59
|
* @returns Function return value, or undefined on throw.
|
|
59
60
|
*/
|
|
@@ -61,7 +62,7 @@ export declare class Diagnostics {
|
|
|
61
62
|
/**
|
|
62
63
|
* Executes an asynchronous function and reports any rejected promise to diagnostics.
|
|
63
64
|
* @param code Diagnostic code to report on rejection.
|
|
64
|
-
* @param message
|
|
65
|
+
* @param message ASD-STE100 sentence that states the failure. The handler gets it as the event message.
|
|
65
66
|
* @param fn Async function to execute.
|
|
66
67
|
* @returns Promise resolving to the return value, or undefined on rejection.
|
|
67
68
|
*/
|
package/dist/core/journey.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type IdentityStores } from "../utils/identity";
|
|
1
2
|
import type { Diagnostics } from "./diagnostics";
|
|
2
|
-
/** Lifetime rules for a journey
|
|
3
|
+
/** Lifetime rules for a journey. A journey is one user task across several contexts. */
|
|
3
4
|
export interface JourneyOptions {
|
|
4
|
-
/**
|
|
5
|
+
/** Maximum open time of a journey, in milliseconds. After this time, the engine ends it. */
|
|
5
6
|
maxAgeMs: number;
|
|
6
7
|
/** Whether closing the owning context ends the journey for everyone. */
|
|
7
8
|
endOnOwnerClose: boolean;
|
|
@@ -14,13 +15,13 @@ export declare const JOURNEY_OPTIONS: JourneyOptions;
|
|
|
14
15
|
export interface Journey {
|
|
15
16
|
/** Unique journey correlation identifier. */
|
|
16
17
|
id: string;
|
|
17
|
-
/**
|
|
18
|
+
/** Journey workflow name for a person to read. */
|
|
18
19
|
name: string;
|
|
19
20
|
/** Journey start timestamp in epoch milliseconds. */
|
|
20
21
|
startedAt: number;
|
|
21
|
-
/** Optional parent journey
|
|
22
|
+
/** Optional parent journey ID when the journey branches from an earlier journey. */
|
|
22
23
|
parentId?: string;
|
|
23
|
-
/** Context identifier of the document that
|
|
24
|
+
/** Context identifier of the document that started the journey. */
|
|
24
25
|
ownerContextId: string;
|
|
25
26
|
}
|
|
26
27
|
/** Manages journey lifecycle, cross-window adoption, storage synchronization, and expiration. */
|
|
@@ -29,6 +30,7 @@ export declare class JourneyEngine {
|
|
|
29
30
|
private readonly diagnostics;
|
|
30
31
|
private readonly contextId;
|
|
31
32
|
private readonly onLocalChange;
|
|
33
|
+
private readonly stores;
|
|
32
34
|
/** Active journey context, or null if none is in progress. */
|
|
33
35
|
private journey;
|
|
34
36
|
/** Active expiration timer handle. */
|
|
@@ -38,17 +40,19 @@ export declare class JourneyEngine {
|
|
|
38
40
|
* @param diagnostics Diagnostics reporter.
|
|
39
41
|
* @param contextId Unique context identifier for this document.
|
|
40
42
|
* @param onLocalChange Callback invoked when journey state changes locally.
|
|
43
|
+
* @param stores Identity stores that hold the journey.
|
|
41
44
|
*/
|
|
42
|
-
constructor(options: JourneyOptions, diagnostics: Diagnostics, contextId: string, onLocalChange: (journey: Journey | null) => void);
|
|
45
|
+
constructor(options: JourneyOptions, diagnostics: Diagnostics, contextId: string, onLocalChange: (journey: Journey | null) => void, stores?: IdentityStores);
|
|
43
46
|
/** Returns the active journey instance or null. */
|
|
44
47
|
current(): Journey | null;
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* Finds and adopts the initial journey. It checks the URL query, then sessionStorage,
|
|
50
|
+
* then OpenFin customData.
|
|
47
51
|
* @returns Promise resolving when journey initialization completes.
|
|
48
52
|
*/
|
|
49
53
|
bootstrap(): Promise<void>;
|
|
50
54
|
/**
|
|
51
|
-
*
|
|
55
|
+
* Starts a new journey. It replaces the active journey and tells connected peers.
|
|
52
56
|
* @param name Human-readable workflow name.
|
|
53
57
|
* @param opts Optional parent linkage and pre-assigned identifier.
|
|
54
58
|
* @returns Started Journey instance.
|
|
@@ -57,18 +61,20 @@ export declare class JourneyEngine {
|
|
|
57
61
|
parent?: boolean;
|
|
58
62
|
id?: string;
|
|
59
63
|
}): Journey;
|
|
60
|
-
/**
|
|
64
|
+
/** Ends the active journey and broadcasts the change. */
|
|
61
65
|
end(): void;
|
|
62
66
|
/**
|
|
63
|
-
* Applies journey
|
|
64
|
-
*
|
|
65
|
-
*
|
|
67
|
+
* Applies a journey update from a bus peer. It does not broadcast the update again.
|
|
68
|
+
* An echo makes two windows send the change back and forth without end.
|
|
69
|
+
* It ignores a journey with the same ID as the active journey. Thus an echo cannot
|
|
70
|
+
* restart the timer.
|
|
66
71
|
* @param journey Updated Journey instance or null.
|
|
67
72
|
*/
|
|
68
73
|
applyRemote(journey: Journey | null): void;
|
|
69
74
|
/**
|
|
70
75
|
* Serializes the active journey into a compact token for URL or intent transfer.
|
|
71
|
-
* @returns Base64url token
|
|
76
|
+
* @returns Base64url token, or undefined when no journey is active or the token exceeds
|
|
77
|
+
* the size limit.
|
|
72
78
|
*/
|
|
73
79
|
getToken(): string | undefined;
|
|
74
80
|
/**
|
|
@@ -80,7 +86,7 @@ export declare class JourneyEngine {
|
|
|
80
86
|
*/
|
|
81
87
|
adopt(token: string, source: string, broadcast?: boolean): boolean;
|
|
82
88
|
/**
|
|
83
|
-
* Ends the journey
|
|
89
|
+
* Ends the journey when endOnOwnerClose is on and the closed context owns the journey.
|
|
84
90
|
* @param ownerContextId Context identifier of the closed window.
|
|
85
91
|
*/
|
|
86
92
|
ownerClosed(ownerContextId: string): void;
|
|
@@ -89,13 +95,13 @@ export declare class JourneyEngine {
|
|
|
89
95
|
/**
|
|
90
96
|
* Resumes a persisted journey from raw sessionStorage data.
|
|
91
97
|
* @param raw Serialized JSON string from storage.
|
|
92
|
-
* @returns True if
|
|
98
|
+
* @returns True if the engine restored the journey.
|
|
93
99
|
*/
|
|
94
100
|
private restore;
|
|
95
101
|
/**
|
|
96
|
-
* Decodes a base64url token into a validated Journey object.
|
|
97
|
-
*
|
|
98
|
-
*
|
|
102
|
+
* Decodes a base64url token into a validated Journey object. Anyone can edit the URL
|
|
103
|
+
* that holds a token. Each step throws on bad input. The guard reports the failure
|
|
104
|
+
* and does not throw it.
|
|
99
105
|
* @param token Encoded token string.
|
|
100
106
|
* @returns Decoded Journey instance or null on decode error.
|
|
101
107
|
*/
|
|
@@ -105,7 +111,7 @@ export declare class JourneyEngine {
|
|
|
105
111
|
* @param journey Target Journey instance or null.
|
|
106
112
|
*/
|
|
107
113
|
private setJourney;
|
|
108
|
-
/** Removes journey data from
|
|
114
|
+
/** Removes journey data from the session store. */
|
|
109
115
|
private clearStored;
|
|
110
116
|
/** Cancels any active expiration timer. */
|
|
111
117
|
private clearTimer;
|
|
@@ -115,9 +121,9 @@ export declare class JourneyEngine {
|
|
|
115
121
|
*/
|
|
116
122
|
private readUrlToken;
|
|
117
123
|
/**
|
|
118
|
-
* Reads the journey token from OpenFin window
|
|
119
|
-
* OPENFIN_OPTIONS_TIMEOUT_MS
|
|
120
|
-
* and
|
|
124
|
+
* Reads the journey token from the customData of the OpenFin window options.
|
|
125
|
+
* OPENFIN_OPTIONS_TIMEOUT_MS limits the wait. At the deadline, it reports
|
|
126
|
+
* openfin.unavailable and returns no token. A window without a token gives the same result.
|
|
121
127
|
* @returns Promise resolving to token string or null.
|
|
122
128
|
*/
|
|
123
129
|
private readOpenFinToken;
|
package/dist/core/logger.d.ts
CHANGED
|
@@ -7,15 +7,16 @@ export interface OneLoggerOptions {
|
|
|
7
7
|
}
|
|
8
8
|
/** Namespaced logger instance for recording structured events, metrics, and errors. */
|
|
9
9
|
export declare class OneLogger {
|
|
10
|
-
private readonly
|
|
10
|
+
private readonly bind;
|
|
11
11
|
readonly namespace: string;
|
|
12
12
|
private readonly options;
|
|
13
13
|
/**
|
|
14
|
-
* @param
|
|
14
|
+
* @param bind Returns the runtime for each write.
|
|
15
|
+
* A logger that exists before configure() writes to the configured runtime.
|
|
15
16
|
* @param namespace Application subsystem or module namespace.
|
|
16
17
|
* @param options Scoped context options.
|
|
17
18
|
*/
|
|
18
|
-
constructor(
|
|
19
|
+
constructor(bind: () => ObservabilityRuntime, namespace: string, options?: OneLoggerOptions);
|
|
19
20
|
/**
|
|
20
21
|
* Creates a child logger with a nested namespace and merged scoped context.
|
|
21
22
|
* @param namespace Sub-namespace appended with dot notation.
|
|
@@ -48,23 +49,23 @@ export declare class OneLogger {
|
|
|
48
49
|
*/
|
|
49
50
|
warn: (message: string, payload?: Record<string, unknown>) => void;
|
|
50
51
|
/**
|
|
51
|
-
* Logs an error record with
|
|
52
|
-
*
|
|
52
|
+
* Logs an error record with the breadcrumb history. If payload is absent, a plain
|
|
53
|
+
* object in the error slot becomes the payload.
|
|
53
54
|
* @param message Error description.
|
|
54
55
|
* @param error Caught error instance, reason, or payload.
|
|
55
56
|
* @param payload Optional contextual attributes.
|
|
56
57
|
*/
|
|
57
58
|
error: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
|
|
58
59
|
/**
|
|
59
|
-
* Logs a fatal
|
|
60
|
-
*
|
|
60
|
+
* Logs a fatal error record. If payload is absent, a plain object in the error slot
|
|
61
|
+
* becomes the payload.
|
|
61
62
|
* @param message Error description.
|
|
62
63
|
* @param error Caught error instance, reason, or payload.
|
|
63
64
|
* @param payload Optional contextual attributes.
|
|
64
65
|
*/
|
|
65
66
|
fatal: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
|
|
66
67
|
/**
|
|
67
|
-
* Logs
|
|
68
|
+
* Logs one user action.
|
|
68
69
|
* @param name Action identifier.
|
|
69
70
|
* @param payload Optional action attributes.
|
|
70
71
|
*/
|
|
@@ -101,7 +102,7 @@ export declare class OneLogger {
|
|
|
101
102
|
*/
|
|
102
103
|
timeAsync: <T>(label: string, fn: () => Promise<T>, attributes?: Record<string, unknown>) => Promise<T>;
|
|
103
104
|
/**
|
|
104
|
-
* Builds
|
|
105
|
+
* Builds and emits a standard log record. It also prints the record to the console.
|
|
105
106
|
* @param level Severity level.
|
|
106
107
|
* @param type Record classification.
|
|
107
108
|
* @param body Primary message.
|
|
@@ -109,11 +110,29 @@ export declare class OneLogger {
|
|
|
109
110
|
*/
|
|
110
111
|
private write;
|
|
111
112
|
/**
|
|
112
|
-
* Builds
|
|
113
|
+
* Builds and emits an error record with breadcrumbs. It also prints the record to the console.
|
|
113
114
|
* @param level Severity level ("ERROR" or "FATAL").
|
|
114
115
|
* @param message Error description.
|
|
115
116
|
* @param error Caught error instance, reason, or payload.
|
|
116
117
|
* @param payload Optional contextual attributes.
|
|
117
118
|
*/
|
|
118
119
|
private writeError;
|
|
120
|
+
/**
|
|
121
|
+
* Prints one log line. With a redact hook, the line shows only what redact returned.
|
|
122
|
+
* A host can record console arguments. The console must not show what redact removes.
|
|
123
|
+
* @param runtime Runtime of this write.
|
|
124
|
+
* @param level Severity level.
|
|
125
|
+
* @param message Primary message.
|
|
126
|
+
* @param payload Caller payload.
|
|
127
|
+
* @param error Error of an error call.
|
|
128
|
+
* @param record Built record, or null if the library did not build it or redact dropped it.
|
|
129
|
+
*/
|
|
130
|
+
private print;
|
|
131
|
+
/**
|
|
132
|
+
* Tests whether the console prints a level that the library does not send.
|
|
133
|
+
* @param runtime Runtime of this write.
|
|
134
|
+
* @param level Severity level.
|
|
135
|
+
* @returns True if logging is on and the console accepts the level.
|
|
136
|
+
*/
|
|
137
|
+
private mirrors;
|
|
119
138
|
}
|
package/dist/core/pipeline.d.ts
CHANGED
|
@@ -4,18 +4,21 @@ import type { StorageAdapter } from "../models/storage";
|
|
|
4
4
|
import type { HttpTransport } from "../transport/http-transport";
|
|
5
5
|
import type { RetryEngine } from "../transport/retry-engine";
|
|
6
6
|
import type { Diagnostics } from "./diagnostics";
|
|
7
|
-
/**
|
|
7
|
+
/** Name of a pipeline stream. */
|
|
8
8
|
export type StreamName = "logs" | "metrics";
|
|
9
9
|
/** Batching policy for one record stream. */
|
|
10
10
|
export interface StreamOptions {
|
|
11
|
-
/**
|
|
11
|
+
/** Maximum time in milliseconds that a partial batch waits before the pipeline sends it. */
|
|
12
12
|
flushIntervalMs: number;
|
|
13
|
-
/**
|
|
13
|
+
/** Maximum records in a batch. At this count, the pipeline sends the batch early. */
|
|
14
14
|
batchSize: number;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Batching policy per stream. Metrics use larger batches and a longer interval.
|
|
18
|
+
* Metrics have a higher volume, and no process waits for them.
|
|
19
|
+
*/
|
|
17
20
|
export declare const STREAM_OPTIONS: Record<StreamName, StreamOptions>;
|
|
18
|
-
/**
|
|
21
|
+
/** Buffers log and metric streams, makes batches and sends them over HTTP. */
|
|
19
22
|
export declare class LogPipeline {
|
|
20
23
|
private readonly transport;
|
|
21
24
|
private readonly storage;
|
|
@@ -23,7 +26,7 @@ export declare class LogPipeline {
|
|
|
23
26
|
private readonly diagnostics;
|
|
24
27
|
/** Buffer instances for logs and metrics streams. */
|
|
25
28
|
private readonly streams;
|
|
26
|
-
/**
|
|
29
|
+
/** In-flight batches without delivery confirmation. The exit flush sends them again. */
|
|
27
30
|
private readonly unconfirmed;
|
|
28
31
|
/** Closed batches waiting for a free dispatch slot. */
|
|
29
32
|
private readonly queue;
|
|
@@ -31,7 +34,7 @@ export declare class LogPipeline {
|
|
|
31
34
|
private readonly ceiling;
|
|
32
35
|
/** Dispatches currently in flight, capped at MAX_CONCURRENT_REQUESTS. */
|
|
33
36
|
private inFlight;
|
|
34
|
-
/**
|
|
37
|
+
/** It is true when a pump is in the queue. One microtask then drains a burst. */
|
|
35
38
|
private pumpScheduled;
|
|
36
39
|
/** Indicates whether the pipeline has been destroyed. */
|
|
37
40
|
private stopped;
|
|
@@ -44,22 +47,23 @@ export declare class LogPipeline {
|
|
|
44
47
|
*/
|
|
45
48
|
constructor(transport: HttpTransport, storage: StorageAdapter, retry: RetryEngine, diagnostics: Diagnostics, streamOptions?: Record<StreamName, StreamOptions>);
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
50
|
+
* Sets the observed timestamp and adds a record to the pipeline.
|
|
48
51
|
* @param record Record to push.
|
|
49
52
|
*/
|
|
50
53
|
push(record: LogRecord): void;
|
|
51
54
|
/**
|
|
52
|
-
* Drains the stream buffers into one batch.
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
+
* Drains the stream buffers into one batch. It does not take in-flight batches.
|
|
56
|
+
* An in-flight batch has its own ID and its send is not complete. If this method
|
|
57
|
+
* takes it, the pipeline sends each record again under a new ID. The server cannot
|
|
58
|
+
* deduplicate that ID.
|
|
55
59
|
* @returns Combined LogBatch or null if no records are buffered.
|
|
56
60
|
*/
|
|
57
61
|
drainPending(): LogBatch | null;
|
|
58
62
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* A document
|
|
63
|
+
* Drains all buffered and unconfirmed in-flight records into one exit batch in one step.
|
|
64
|
+
* Records already given to fetch go again under a new batch ID. The server cannot
|
|
65
|
+
* deduplicate them. Thus the exit flush can deliver duplicates. This is intentional.
|
|
66
|
+
* A closing document cannot confirm delivery.
|
|
63
67
|
* @returns Combined LogBatch or null if no records are pending.
|
|
64
68
|
*/
|
|
65
69
|
drainForExit(): LogBatch | null;
|
|
@@ -72,23 +76,23 @@ export declare class LogPipeline {
|
|
|
72
76
|
*/
|
|
73
77
|
private toBatch;
|
|
74
78
|
/**
|
|
75
|
-
* Sorts a record into its stream. Sampling already ran
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
+
* Sorts a record into its stream. Sampling already ran. RecordBuilder samples a local
|
|
80
|
+
* record. The runtime samples a forwarded record. This method catches each fault.
|
|
81
|
+
* A record without `attributes` makes isMetric throw. An uncaught throw goes into the
|
|
82
|
+
* log call of the caller.
|
|
79
83
|
* @param record Record to sort.
|
|
80
84
|
*/
|
|
81
85
|
private route;
|
|
82
86
|
/**
|
|
83
|
-
* Drains a stream buffer into a new batch and queues
|
|
84
|
-
* buffer always
|
|
85
|
-
*
|
|
87
|
+
* Drains a stream buffer into a new batch and queues the batch for dispatch.
|
|
88
|
+
* The buffer always has one or more records here. Only a push starts a timer.
|
|
89
|
+
* Each `take` stops the timer that calls this method.
|
|
86
90
|
* @param stream Stream buffer to drain.
|
|
87
91
|
*/
|
|
88
92
|
private claim;
|
|
89
93
|
/**
|
|
90
|
-
* Queues a batch and schedules the pump on a microtask.
|
|
91
|
-
*
|
|
94
|
+
* Queues a batch and schedules the pump on a microtask. An inline dispatch starts
|
|
95
|
+
* a fetch inside the log call of the application.
|
|
92
96
|
* @param batch Batch ready for delivery.
|
|
93
97
|
*/
|
|
94
98
|
private enqueue;
|
|
@@ -100,20 +104,21 @@ export declare class LogPipeline {
|
|
|
100
104
|
*/
|
|
101
105
|
private run;
|
|
102
106
|
/**
|
|
103
|
-
* Sends a batch over HTTP transport
|
|
107
|
+
* Sends a batch over the HTTP transport. If the transport throttles or fails, it stores
|
|
108
|
+
* the batch.
|
|
104
109
|
* @param batch Batch to deliver.
|
|
105
110
|
*/
|
|
106
111
|
private dispatch;
|
|
107
112
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
113
|
+
* Stores a batch that the transport refused. The retry engine splits a 413 and
|
|
114
|
+
* drops a batch that the server does not accept.
|
|
110
115
|
* @param batch Batch to persist, with its attempt already counted.
|
|
111
116
|
* @param error Failure thrown by the transport.
|
|
112
117
|
*/
|
|
113
118
|
private storeFailed;
|
|
114
119
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
120
|
+
* Stores an undelivered batch and triggers the retry engine. A deadline limits the
|
|
121
|
+
* wait. A storage call that does not settle holds this dispatch slot. Two such calls
|
|
117
122
|
* stop the pipeline.
|
|
118
123
|
* @param batch Batch to persist.
|
|
119
124
|
*/
|
package/dist/core/record.d.ts
CHANGED
|
@@ -24,12 +24,12 @@ export interface RecordBuilderDeps {
|
|
|
24
24
|
tracing: TraceEngine;
|
|
25
25
|
/** Monotonic sequence counter. */
|
|
26
26
|
sequence: Sequence;
|
|
27
|
-
/** Context, session
|
|
27
|
+
/** Context, session and tab identity. */
|
|
28
28
|
identity: Identity;
|
|
29
29
|
/** Detected host platform metadata. */
|
|
30
30
|
platform: PlatformMetadata;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
32
|
+
/** Size limits for each record. The builder applies them after sanitize and after redact. */
|
|
33
33
|
export interface RecordLimits extends SanitizeLimits {
|
|
34
34
|
/** Max record body length, in characters. */
|
|
35
35
|
maxBodyChars: number;
|
|
@@ -42,7 +42,7 @@ export type DropReason = "level" | "sampling" | "redact";
|
|
|
42
42
|
export interface BuildResult {
|
|
43
43
|
/** Completed record, or null when it was dropped. */
|
|
44
44
|
record: LogRecord | null;
|
|
45
|
-
/**
|
|
45
|
+
/** Reason for the drop. It is absent when the builder built a record. */
|
|
46
46
|
dropped?: DropReason;
|
|
47
47
|
}
|
|
48
48
|
/** Input parameters for constructing a single log record. */
|
|
@@ -69,16 +69,16 @@ export declare class RecordBuilder {
|
|
|
69
69
|
* @param deps Injected builder dependencies.
|
|
70
70
|
*/
|
|
71
71
|
constructor(deps: RecordBuilderDeps);
|
|
72
|
-
/**
|
|
72
|
+
/** Clears the cached resource attributes. The next build computes them again. */
|
|
73
73
|
invalidateResource(): void;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Checks if logging is on and the level is at or above minLevel.
|
|
76
76
|
* @param level Target log severity level.
|
|
77
77
|
* @returns True if the level is enabled.
|
|
78
78
|
*/
|
|
79
79
|
isEnabled(level: LogLevel): boolean;
|
|
80
80
|
/**
|
|
81
|
-
* Builds a structured LogRecord from input
|
|
81
|
+
* Builds a structured LogRecord from the input. It sanitizes attributes and applies size limits.
|
|
82
82
|
* @param input Logger call input parameters.
|
|
83
83
|
* @returns The record, or null with the reason it was dropped.
|
|
84
84
|
*/
|