@utk09/ui-observability 0.5.0 → 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 +16 -0
- package/README.md +77 -60
- package/dist/bus/bus.d.ts +10 -10
- package/dist/bus/links.d.ts +1 -1
- package/dist/{bus-D3OO0OcL.js → bus-BTMuVkDk.js} +19 -19
- 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 +3 -3
- package/dist/{constants-B6kdsCzF.js → constants-0-YchbAL.js} +2 -2
- package/dist/constants-0-YchbAL.js.map +1 -0
- package/dist/{constants-DZH04585.cjs → constants-TUFcy95w.cjs} +2 -2
- package/dist/constants-TUFcy95w.cjs.map +1 -0
- package/dist/constants.d.ts +53 -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 +23 -20
- package/dist/core/logger.d.ts +7 -7
- package/dist/core/pipeline.d.ts +34 -29
- package/dist/core/record.d.ts +6 -6
- package/dist/core/runtime.d.ts +20 -18
- package/dist/core/sampling.d.ts +15 -16
- package/dist/core/sender.d.ts +1 -1
- package/dist/{errors-DPju_xSI.cjs → errors-DRXBRqvm.cjs} +2 -2
- package/dist/errors-DRXBRqvm.cjs.map +1 -0
- package/dist/{errors-Dme9tz-6.js → errors-Dwm2SzBa.js} +4 -4
- package/dist/errors-Dwm2SzBa.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +61 -61
- 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-nxs_rxGx.js → indexeddb-storage-DjY4Ml6t.js} +16 -16
- package/dist/indexeddb-storage-DjY4Ml6t.js.map +1 -0
- package/dist/{interactions-DP0-rIPJ.cjs → interactions-DVom6eYn.cjs} +2 -2
- package/dist/interactions-DVom6eYn.cjs.map +1 -0
- package/dist/{interactions-C1romMpE.js → interactions-DZmLu7l2.js} +2 -2
- 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 +58 -41
- 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-au-Tqt1n.js → network-C4d2uw2Z.js} +4 -4
- 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-DMYo3AX3.js → platform-CY8S3hUs.js} +8 -8
- 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-ByI5H44E.js → sampling-CJsI_24L.js} +21 -18
- 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-R7lOpyNc.js → sender-dpvR_bHM.js} +60 -60
- 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 +18 -11
- 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/unref-16maCyKA.js.map +1 -1
- package/dist/unref-CU9Nyz_9.cjs.map +1 -1
- package/dist/utils/identity.d.ts +6 -5
- 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 +8 -7
- package/dist/web-vitals-B2FYsEAU.cjs +2 -0
- package/dist/web-vitals-B2FYsEAU.cjs.map +1 -0
- package/dist/{web-vitals-DwWdLBq6.js → web-vitals-DHZ0yA_H.js} +4 -4
- package/dist/web-vitals-DHZ0yA_H.js.map +1 -0
- package/package.json +1 -1
- package/dist/bus-D3OO0OcL.js.map +0 -1
- package/dist/bus-OdRJVUzr.cjs +0 -2
- package/dist/bus-OdRJVUzr.cjs.map +0 -1
- package/dist/constants-B6kdsCzF.js.map +0 -1
- package/dist/constants-DZH04585.cjs.map +0 -1
- package/dist/errors-DPju_xSI.cjs.map +0 -1
- package/dist/errors-Dme9tz-6.js.map +0 -1
- package/dist/indexeddb-storage-lGdoHGHy.cjs +0 -2
- package/dist/indexeddb-storage-lGdoHGHy.cjs.map +0 -1
- package/dist/indexeddb-storage-nxs_rxGx.js.map +0 -1
- package/dist/interactions-C1romMpE.js.map +0 -1
- package/dist/interactions-DP0-rIPJ.cjs.map +0 -1
- package/dist/network-DDVIJSHd.cjs +0 -2
- package/dist/network-DDVIJSHd.cjs.map +0 -1
- package/dist/network-au-Tqt1n.js.map +0 -1
- package/dist/platform-DMYo3AX3.js.map +0 -1
- package/dist/platform-g99Kn755.cjs +0 -2
- package/dist/platform-g99Kn755.cjs.map +0 -1
- package/dist/sampling-ByI5H44E.js.map +0 -1
- package/dist/sampling-Dui-Fp3u.cjs +0 -2
- package/dist/sampling-Dui-Fp3u.cjs.map +0 -1
- package/dist/sender-R7lOpyNc.js.map +0 -1
- package/dist/sender-vLcbQhiB.cjs +0 -3
- package/dist/sender-vLcbQhiB.cjs.map +0 -1
- package/dist/web-vitals-DM2nvcMJ.cjs +0 -2
- package/dist/web-vitals-DM2nvcMJ.cjs.map +0 -1
- package/dist/web-vitals-DwWdLBq6.js.map +0 -1
package/dist/constants.d.ts
CHANGED
|
@@ -3,7 +3,10 @@ import type { LogLevel, LogType } from "./models/log-record";
|
|
|
3
3
|
import type { StorageLimits } from "./models/storage";
|
|
4
4
|
/** Prefix on console messages this library writes. */
|
|
5
5
|
export declare const LIBRARY_LOG_PREFIX = "[ui-observability]";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Throttle window for each diagnostic code, in milliseconds. It limits how often an error
|
|
8
|
+
* loop calls the handler.
|
|
9
|
+
*/
|
|
7
10
|
export declare const DIAGNOSTIC_THROTTLE_MS = 1000;
|
|
8
11
|
/** `localStorage` key for the session id and its last-seen time. */
|
|
9
12
|
export declare const SESSION_ID_KEY = "ui-observability.session";
|
|
@@ -54,7 +57,7 @@ export declare const BYTES_PER_QUOTED_STRING = 2;
|
|
|
54
57
|
/** Byte cost of one key's punctuation: quotes, colon, comma. */
|
|
55
58
|
export declare const BYTES_PER_KEY_OVERHEAD = 4;
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
60
|
+
* Maps each log level to its OpenTelemetry severity number.
|
|
58
61
|
* @see {@link LEVEL_ORDER}
|
|
59
62
|
*/
|
|
60
63
|
export declare const SEVERITY_NUMBER: Record<LogLevel, number>;
|
|
@@ -65,14 +68,15 @@ export declare const SEVERITY_NUMBER: Record<LogLevel, number>;
|
|
|
65
68
|
export declare const LEVEL_ORDER: Record<LogLevel, number>;
|
|
66
69
|
/** Record kind attribute key. */
|
|
67
70
|
export declare const ATTR_LOG_TYPE = "log.type";
|
|
68
|
-
/** Record sequence number
|
|
71
|
+
/** Record sequence number in its context. It starts at 1. */
|
|
69
72
|
export declare const ATTR_LOG_SEQ = "log.seq";
|
|
70
73
|
/** Logger namespace attribute key. */
|
|
71
74
|
export declare const ATTR_APP_NAMESPACE = "app.namespace";
|
|
72
75
|
/** Document URL when the record was built. */
|
|
73
76
|
export declare const ATTR_PAGE_URL = "page.url";
|
|
74
77
|
/**
|
|
75
|
-
* HTTP request URL attribute key
|
|
78
|
+
* HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.
|
|
79
|
+
* The page URL overwrites the request target under that key.
|
|
76
80
|
* @see {@link ATTR_PAGE_URL}
|
|
77
81
|
*/
|
|
78
82
|
export declare const ATTR_URL_FULL = "url.full";
|
|
@@ -85,7 +89,7 @@ export declare const ATTR_JOURNEY_PARENT_ID = "journey.parent_id";
|
|
|
85
89
|
/** Marks a record whose attributes failed to sanitize. */
|
|
86
90
|
export declare const ATTR_SANITIZE_FAILED = "uiobs.sanitize_failed";
|
|
87
91
|
/**
|
|
88
|
-
* Marks a record
|
|
92
|
+
* Marks a record when the library drops its attributes because they exceed the byte budget.
|
|
89
93
|
* @see {@link ATTR_ATTRIBUTES_BYTES}
|
|
90
94
|
*/
|
|
91
95
|
export declare const ATTR_ATTRIBUTES_DROPPED = "uiobs.attributes_dropped";
|
|
@@ -135,10 +139,11 @@ export declare const RESOURCE_OPENFIN_NAME = "openfin.name";
|
|
|
135
139
|
*/
|
|
136
140
|
export declare const TELEMETRY_SDK_NAME = "@utk09/ui-observability";
|
|
137
141
|
/**
|
|
138
|
-
* Value of `telemetry.sdk.version`.
|
|
142
|
+
* Value of `telemetry.sdk.version`. The code does not read it from package.json.
|
|
143
|
+
* Change it by hand when you change the version in package.json.
|
|
139
144
|
* @see {@link RESOURCE_TELEMETRY_SDK_VERSION}
|
|
140
145
|
*/
|
|
141
|
-
export declare const TELEMETRY_SDK_VERSION = "0.
|
|
146
|
+
export declare const TELEMETRY_SDK_VERSION = "0.6.0";
|
|
142
147
|
/**
|
|
143
148
|
* Value of `telemetry.sdk.language`.
|
|
144
149
|
* @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}
|
|
@@ -149,8 +154,8 @@ export declare const SERIALIZER_NAME_OTLP = "otlp";
|
|
|
149
154
|
/** ECS serializer name. */
|
|
150
155
|
export declare const SERIALIZER_NAME_ECS = "ecs";
|
|
151
156
|
/**
|
|
152
|
-
* ECS `log.level` names that differ from the
|
|
153
|
-
* the warning level in full
|
|
157
|
+
* ECS `log.level` names that differ from the lowercase severity text. ECS spells
|
|
158
|
+
* the warning level in full. All other levels match in lowercase.
|
|
154
159
|
* @see {@link SERIALIZER_NAME_ECS}
|
|
155
160
|
*/
|
|
156
161
|
export declare const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>>;
|
|
@@ -184,9 +189,9 @@ export declare const ENCODING_GZIP = "gzip";
|
|
|
184
189
|
export declare const HTTP_UNAUTHORIZED = 401;
|
|
185
190
|
/** 403, valid credentials but access denied. */
|
|
186
191
|
export declare const HTTP_FORBIDDEN = 403;
|
|
187
|
-
/** 408, the server closed the connection after a timeout.
|
|
192
|
+
/** 408, the server closed the connection after a timeout. The transport can retry. */
|
|
188
193
|
export declare const HTTP_REQUEST_TIMEOUT = 408;
|
|
189
|
-
/** 413, payload too large
|
|
194
|
+
/** 413, payload too large. The transport must split the batch. */
|
|
190
195
|
export declare const HTTP_PAYLOAD_TOO_LARGE = 413;
|
|
191
196
|
/** 429, backpressure. */
|
|
192
197
|
export declare const HTTP_TOO_MANY_REQUESTS = 429;
|
|
@@ -198,7 +203,7 @@ export declare const HTTP_SERVICE_UNAVAILABLE = 503;
|
|
|
198
203
|
export declare const MILLIS_PER_SECOND = 1000;
|
|
199
204
|
/** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */
|
|
200
205
|
export declare const BEACON_LIMIT_BYTES = 60000;
|
|
201
|
-
/** Content type for an exit payload. CORS-safelisted
|
|
206
|
+
/** Content type for an exit payload. It is CORS-safelisted and does not cause a preflight. */
|
|
202
207
|
export declare const CONTENT_TYPE_TEXT_PLAIN = "text/plain;charset=UTF-8";
|
|
203
208
|
/**
|
|
204
209
|
* Batch id query param name, for the exit path.
|
|
@@ -207,28 +212,28 @@ export declare const CONTENT_TYPE_TEXT_PLAIN = "text/plain;charset=UTF-8";
|
|
|
207
212
|
export declare const QUERY_PARAM_BATCH_ID = "uiobs_batch_id";
|
|
208
213
|
/** Exit reason query param name, for logs only. */
|
|
209
214
|
export declare const QUERY_PARAM_EXIT_REASON = "uiobs_exit";
|
|
210
|
-
/** localStorage key prefix for a
|
|
215
|
+
/** localStorage key prefix for a stored batch. */
|
|
211
216
|
export declare const BATCH_STORAGE_KEY_PREFIX = "ui-observability.batch.";
|
|
212
217
|
/** Zero-padded digit width for the creation time in a batch key. */
|
|
213
218
|
export declare const BATCH_KEY_TIME_WIDTH = 14;
|
|
214
|
-
/** localStorage key prefix for a batch
|
|
219
|
+
/** localStorage key prefix for a batch that exit flush stores. */
|
|
215
220
|
export declare const EMERGENCY_STORAGE_KEY_PREFIX = "ui-observability.emergency.";
|
|
216
221
|
/** Max exit batches held at once. */
|
|
217
222
|
export declare const EMERGENCY_MAX_ENTRIES = 20;
|
|
218
223
|
/** Key used to test whether localStorage accepts writes. */
|
|
219
224
|
export declare const STORAGE_PROBE_KEY = "ui-observability.probe";
|
|
220
|
-
/** Fraction of the store
|
|
225
|
+
/** Fraction of the store to evict on a quota error (1 in N). */
|
|
221
226
|
export declare const QUOTA_EVICTION_DIVISOR = 4;
|
|
222
227
|
/** DOMException name for a full store. */
|
|
223
228
|
export declare const QUOTA_EXCEEDED_ERROR = "QuotaExceededError";
|
|
224
229
|
/**
|
|
225
|
-
* Native IndexedDB version. It starts at 11
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
230
|
+
* Native IndexedDB version. It starts at 11. Dexie, the previous adapter, opened the
|
|
231
|
+
* same database at ten times its declared version. A version below 11 makes open()
|
|
232
|
+
* fail with VersionError for an existing installation. Then no code can read the
|
|
233
|
+
* batches in that database.
|
|
229
234
|
*/
|
|
230
235
|
export declare const INDEXEDDB_SCHEMA_VERSION = 11;
|
|
231
|
-
/** IndexedDB object store
|
|
236
|
+
/** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */
|
|
232
237
|
export declare const INDEXEDDB_STORE_NAME = "batches";
|
|
233
238
|
/** Index on the batch store that orders reads by creation time. */
|
|
234
239
|
export declare const INDEXEDDB_CREATED_AT_INDEX = "createdAt";
|
|
@@ -260,13 +265,14 @@ export declare const JOURNEY_STORAGE_KEY = "ui-observability.journey";
|
|
|
260
265
|
*/
|
|
261
266
|
export declare const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;
|
|
262
267
|
/**
|
|
263
|
-
* Max whole-token length, in characters.
|
|
268
|
+
* Max whole-token length, in characters. It rejects an oversized token. It does not
|
|
269
|
+
* validate the token content.
|
|
264
270
|
* @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}
|
|
265
271
|
*/
|
|
266
272
|
export declare const JOURNEY_TOKEN_MAX_CHARS = 256;
|
|
267
273
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
274
|
+
* Time to wait for `fin.me.getOptions()`, in milliseconds. After this time, the
|
|
275
|
+
* runtime continues without a seeded journey.
|
|
270
276
|
* @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}
|
|
271
277
|
*/
|
|
272
278
|
export declare const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;
|
|
@@ -311,7 +317,7 @@ export declare const FNV_PRIME = 16777619;
|
|
|
311
317
|
export declare const UINT32_MAX = 4294967295;
|
|
312
318
|
/** Record kind routed to the metric stream. */
|
|
313
319
|
export declare const LOG_TYPE_METRIC: LogType;
|
|
314
|
-
/** Protocol identifier for bus envelopes.
|
|
320
|
+
/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */
|
|
315
321
|
export declare const BUS_PROTOCOL = "ui-observability/1";
|
|
316
322
|
/** Global window property key used to locate a same-origin runtime instance. */
|
|
317
323
|
export declare const RUNTIME_GLOBAL_KEY = "ui-observability.runtime";
|
|
@@ -322,9 +328,9 @@ export declare const ERROR_STORM_MAX_PER_WINDOW = 20;
|
|
|
322
328
|
/** Error rate-limiting window duration in milliseconds. */
|
|
323
329
|
export declare const ERROR_STORM_WINDOW_MS = 10000;
|
|
324
330
|
/**
|
|
325
|
-
* Max ERROR and FATAL records
|
|
326
|
-
*
|
|
327
|
-
* and
|
|
331
|
+
* Max ERROR and FATAL records that the pipeline admits in each storm window.
|
|
332
|
+
* It is a safety limit for a render loop. It does not shape normal traffic.
|
|
333
|
+
* ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.
|
|
328
334
|
*/
|
|
329
335
|
export declare const ERROR_CEILING_MAX_PER_WINDOW = 500;
|
|
330
336
|
/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */
|
|
@@ -374,25 +380,29 @@ export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "capture"];
|
|
|
374
380
|
*/
|
|
375
381
|
export declare const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]>;
|
|
376
382
|
/**
|
|
377
|
-
* Default runtime config
|
|
378
|
-
*
|
|
383
|
+
* Default runtime config before the consumer calls `configure()`. It excludes `serializer`.
|
|
384
|
+
* `resolveConfig` supplies that default to prevent a circular import.
|
|
379
385
|
* @see {@link ResolvedConfig}
|
|
380
386
|
* @see {@link UNDEFAULTED_CONFIG_KEYS}
|
|
381
387
|
*/
|
|
382
388
|
export declare const DEFAULT_CONFIG: Omit<ResolvedConfig, "serializer">;
|
|
383
389
|
/** Console mirroring level used when a consumer passes `console: true`. */
|
|
384
390
|
export declare const CONSOLE_DEFAULT_LEVEL: LogLevel;
|
|
385
|
-
/** Max time a partial log batch waits before
|
|
391
|
+
/** Max time a partial log batch waits before the pipeline sends it, in milliseconds. */
|
|
386
392
|
export declare const LOG_FLUSH_INTERVAL_MS = 2000;
|
|
387
|
-
/** Max records per log batch
|
|
393
|
+
/** Max records per log batch. At this count, the pipeline sends the batch early. */
|
|
388
394
|
export declare const LOG_BATCH_SIZE = 100;
|
|
389
|
-
/**
|
|
395
|
+
/**
|
|
396
|
+
* Max time a partial metric batch waits before the pipeline sends it, in milliseconds.
|
|
397
|
+
* Metric batches wait longer than log batches. Metrics have a higher volume, and no
|
|
398
|
+
* caller waits for them.
|
|
399
|
+
*/
|
|
390
400
|
export declare const METRIC_FLUSH_INTERVAL_MS = 10000;
|
|
391
|
-
/** Max records per metric batch
|
|
401
|
+
/** Max records per metric batch. At this count, the pipeline sends the batch early. */
|
|
392
402
|
export declare const METRIC_BATCH_SIZE = 500;
|
|
393
403
|
/** Max concurrent ingest requests, across both streams. */
|
|
394
404
|
export declare const MAX_CONCURRENT_REQUESTS = 2;
|
|
395
|
-
/** Max time one ingest request
|
|
405
|
+
/** Max time for one ingest request, in milliseconds. Then the transport aborts and retries it. */
|
|
396
406
|
export declare const REQUEST_TIMEOUT_MS = 15000;
|
|
397
407
|
/** Min payload size to compress, in bytes. */
|
|
398
408
|
export declare const COMPRESSION_THRESHOLD_BYTES = 1024;
|
|
@@ -401,8 +411,8 @@ export declare const STORAGE_DB_NAME = "UiObservability";
|
|
|
401
411
|
/** Capacity and retention thresholds every storage adapter enforces. */
|
|
402
412
|
export declare const STORAGE_LIMITS: StorageLimits;
|
|
403
413
|
/**
|
|
404
|
-
* Max time one storage call
|
|
405
|
-
* A call that does not settle
|
|
414
|
+
* Max time for one storage call, in milliseconds. Then the library treats the call as failed.
|
|
415
|
+
* A call that does not settle keeps a dispatch slot or the drain flag.
|
|
406
416
|
*/
|
|
407
417
|
export declare const STORAGE_DEADLINE_MS = 10000;
|
|
408
418
|
/** First backoff step, in milliseconds. Each attempt doubles it. */
|
|
@@ -411,7 +421,7 @@ export declare const RETRY_BASE_DELAY_MS = 2000;
|
|
|
411
421
|
export declare const RETRY_MAX_DELAY_MS = 60000;
|
|
412
422
|
/** How often to check for stored work when nothing has failed recently, in milliseconds. */
|
|
413
423
|
export declare const RETRY_IDLE_DELAY_MS = 30000;
|
|
414
|
-
/** Max time a journey stays open
|
|
424
|
+
/** Max time a journey stays open, in milliseconds. Then the library treats it as abandoned. */
|
|
415
425
|
export declare const JOURNEY_MAX_AGE_MS: number;
|
|
416
426
|
/** Whether closing the owning context ends the journey for everyone. */
|
|
417
427
|
export declare const JOURNEY_END_ON_OWNER_CLOSE = false;
|
|
@@ -423,13 +433,16 @@ export declare const BUS_CHANNEL_NAME = "ui_observability_control";
|
|
|
423
433
|
export declare const BUS_HANDSHAKE_TIMEOUT_MS = 1500;
|
|
424
434
|
/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */
|
|
425
435
|
export declare const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;
|
|
426
|
-
/** Max records a context buffers before its bus role
|
|
436
|
+
/** Max records a context buffers before it knows its bus role. */
|
|
427
437
|
export declare const BUS_MAX_BOOT_BUFFER_RECORDS = 500;
|
|
428
438
|
/** Breadcrumbs kept as context for the next error. */
|
|
429
439
|
export declare const MAX_BREADCRUMBS = 50;
|
|
430
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* Time window in which the library counts identical errors but does not send them again,
|
|
442
|
+
* in milliseconds.
|
|
443
|
+
*/
|
|
431
444
|
export declare const ERROR_DEDUPE_MS = 5000;
|
|
432
|
-
/** Size caps
|
|
445
|
+
/** Size caps for every record. The library applies them after sanitize and after redact. */
|
|
433
446
|
export declare const RECORD_LIMITS: {
|
|
434
447
|
maxBodyChars: number;
|
|
435
448
|
maxAttributeChars: number;
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import { type IdentityStores } from "../utils/identity";
|
|
2
2
|
import type { Diagnostics } from "./diagnostics";
|
|
3
|
-
/** Lifetime rules for a journey
|
|
3
|
+
/** Lifetime rules for a journey. A journey is one user task across several contexts. */
|
|
4
4
|
export interface JourneyOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** Maximum open time of a journey, in milliseconds. After this time, the engine ends it. */
|
|
6
6
|
maxAgeMs: number;
|
|
7
7
|
/** Whether closing the owning context ends the journey for everyone. */
|
|
8
8
|
endOnOwnerClose: boolean;
|
|
@@ -15,13 +15,13 @@ export declare const JOURNEY_OPTIONS: JourneyOptions;
|
|
|
15
15
|
export interface Journey {
|
|
16
16
|
/** Unique journey correlation identifier. */
|
|
17
17
|
id: string;
|
|
18
|
-
/**
|
|
18
|
+
/** Journey workflow name for a person to read. */
|
|
19
19
|
name: string;
|
|
20
20
|
/** Journey start timestamp in epoch milliseconds. */
|
|
21
21
|
startedAt: number;
|
|
22
|
-
/** Optional parent journey
|
|
22
|
+
/** Optional parent journey ID when the journey branches from an earlier journey. */
|
|
23
23
|
parentId?: string;
|
|
24
|
-
/** Context identifier of the document that
|
|
24
|
+
/** Context identifier of the document that started the journey. */
|
|
25
25
|
ownerContextId: string;
|
|
26
26
|
}
|
|
27
27
|
/** Manages journey lifecycle, cross-window adoption, storage synchronization, and expiration. */
|
|
@@ -46,12 +46,13 @@ export declare class JourneyEngine {
|
|
|
46
46
|
/** Returns the active journey instance or null. */
|
|
47
47
|
current(): Journey | null;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* Finds and adopts the initial journey. It checks the URL query, then sessionStorage,
|
|
50
|
+
* then OpenFin customData.
|
|
50
51
|
* @returns Promise resolving when journey initialization completes.
|
|
51
52
|
*/
|
|
52
53
|
bootstrap(): Promise<void>;
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
+
* Starts a new journey. It replaces the active journey and tells connected peers.
|
|
55
56
|
* @param name Human-readable workflow name.
|
|
56
57
|
* @param opts Optional parent linkage and pre-assigned identifier.
|
|
57
58
|
* @returns Started Journey instance.
|
|
@@ -60,18 +61,20 @@ export declare class JourneyEngine {
|
|
|
60
61
|
parent?: boolean;
|
|
61
62
|
id?: string;
|
|
62
63
|
}): Journey;
|
|
63
|
-
/**
|
|
64
|
+
/** Ends the active journey and broadcasts the change. */
|
|
64
65
|
end(): void;
|
|
65
66
|
/**
|
|
66
|
-
* Applies journey
|
|
67
|
-
*
|
|
68
|
-
*
|
|
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.
|
|
69
71
|
* @param journey Updated Journey instance or null.
|
|
70
72
|
*/
|
|
71
73
|
applyRemote(journey: Journey | null): void;
|
|
72
74
|
/**
|
|
73
75
|
* Serializes the active journey into a compact token for URL or intent transfer.
|
|
74
|
-
* @returns Base64url token
|
|
76
|
+
* @returns Base64url token, or undefined when no journey is active or the token exceeds
|
|
77
|
+
* the size limit.
|
|
75
78
|
*/
|
|
76
79
|
getToken(): string | undefined;
|
|
77
80
|
/**
|
|
@@ -83,7 +86,7 @@ export declare class JourneyEngine {
|
|
|
83
86
|
*/
|
|
84
87
|
adopt(token: string, source: string, broadcast?: boolean): boolean;
|
|
85
88
|
/**
|
|
86
|
-
* Ends the journey
|
|
89
|
+
* Ends the journey when endOnOwnerClose is on and the closed context owns the journey.
|
|
87
90
|
* @param ownerContextId Context identifier of the closed window.
|
|
88
91
|
*/
|
|
89
92
|
ownerClosed(ownerContextId: string): void;
|
|
@@ -92,13 +95,13 @@ export declare class JourneyEngine {
|
|
|
92
95
|
/**
|
|
93
96
|
* Resumes a persisted journey from raw sessionStorage data.
|
|
94
97
|
* @param raw Serialized JSON string from storage.
|
|
95
|
-
* @returns True if
|
|
98
|
+
* @returns True if the engine restored the journey.
|
|
96
99
|
*/
|
|
97
100
|
private restore;
|
|
98
101
|
/**
|
|
99
|
-
* Decodes a base64url token into a validated Journey object.
|
|
100
|
-
*
|
|
101
|
-
*
|
|
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.
|
|
102
105
|
* @param token Encoded token string.
|
|
103
106
|
* @returns Decoded Journey instance or null on decode error.
|
|
104
107
|
*/
|
|
@@ -118,9 +121,9 @@ export declare class JourneyEngine {
|
|
|
118
121
|
*/
|
|
119
122
|
private readUrlToken;
|
|
120
123
|
/**
|
|
121
|
-
* Reads the journey token from OpenFin window
|
|
122
|
-
* OPENFIN_OPTIONS_TIMEOUT_MS
|
|
123
|
-
* 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.
|
|
124
127
|
* @returns Promise resolving to token string or null.
|
|
125
128
|
*/
|
|
126
129
|
private readOpenFinToken;
|
package/dist/core/logger.d.ts
CHANGED
|
@@ -49,23 +49,23 @@ export declare class OneLogger {
|
|
|
49
49
|
*/
|
|
50
50
|
warn: (message: string, payload?: Record<string, unknown>) => void;
|
|
51
51
|
/**
|
|
52
|
-
* Logs an error record with
|
|
53
|
-
*
|
|
52
|
+
* Logs an error record with the breadcrumb history. If payload is absent, a plain
|
|
53
|
+
* object in the error slot becomes the payload.
|
|
54
54
|
* @param message Error description.
|
|
55
55
|
* @param error Caught error instance, reason, or payload.
|
|
56
56
|
* @param payload Optional contextual attributes.
|
|
57
57
|
*/
|
|
58
58
|
error: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
|
|
59
59
|
/**
|
|
60
|
-
* Logs a fatal
|
|
61
|
-
*
|
|
60
|
+
* Logs a fatal error record. If payload is absent, a plain object in the error slot
|
|
61
|
+
* becomes the payload.
|
|
62
62
|
* @param message Error description.
|
|
63
63
|
* @param error Caught error instance, reason, or payload.
|
|
64
64
|
* @param payload Optional contextual attributes.
|
|
65
65
|
*/
|
|
66
66
|
fatal: (message: string, error?: unknown, payload?: Record<string, unknown>) => void;
|
|
67
67
|
/**
|
|
68
|
-
* Logs
|
|
68
|
+
* Logs one user action.
|
|
69
69
|
* @param name Action identifier.
|
|
70
70
|
* @param payload Optional action attributes.
|
|
71
71
|
*/
|
|
@@ -102,7 +102,7 @@ export declare class OneLogger {
|
|
|
102
102
|
*/
|
|
103
103
|
timeAsync: <T>(label: string, fn: () => Promise<T>, attributes?: Record<string, unknown>) => Promise<T>;
|
|
104
104
|
/**
|
|
105
|
-
* Builds
|
|
105
|
+
* Builds and emits a standard log record. It also prints the record to the console.
|
|
106
106
|
* @param level Severity level.
|
|
107
107
|
* @param type Record classification.
|
|
108
108
|
* @param body Primary message.
|
|
@@ -110,7 +110,7 @@ export declare class OneLogger {
|
|
|
110
110
|
*/
|
|
111
111
|
private write;
|
|
112
112
|
/**
|
|
113
|
-
* Builds
|
|
113
|
+
* Builds and emits an error record with breadcrumbs. It also prints the record to the console.
|
|
114
114
|
* @param level Severity level ("ERROR" or "FATAL").
|
|
115
115
|
* @param message Error description.
|
|
116
116
|
* @param error Caught error instance, reason, or payload.
|