@utk09/ui-observability 0.9.3 → 0.9.5
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 +90 -0
- package/README.md +199 -96
- package/dist/batch-BQFtb3i5.cjs +2 -0
- package/dist/batch-BQFtb3i5.cjs.map +1 -0
- package/dist/{batch-DDgxg16_.js → batch-BUJh-1jZ.js} +6 -4
- package/dist/batch-BUJh-1jZ.js.map +1 -0
- package/dist/bus/bus.d.ts +76 -2
- package/dist/bus/links.d.ts +9 -2
- package/dist/bus/validation.d.ts +7 -0
- package/dist/bus-BW6N-pY8.cjs +2 -0
- package/dist/bus-BW6N-pY8.cjs.map +1 -0
- package/dist/bus-DeOPHWaD.js +647 -0
- package/dist/bus-DeOPHWaD.js.map +1 -0
- package/dist/capture/network.d.ts +1 -0
- package/dist/capture/storm.d.ts +2 -1
- package/dist/capture/types.d.ts +5 -0
- package/dist/capture/web-socket.d.ts +40 -0
- package/dist/{console-BSusX_M-.cjs → console-Ce6heqZZ.cjs} +2 -2
- package/dist/console-Ce6heqZZ.cjs.map +1 -0
- package/dist/{console-Dv5GfaNn.js → console-DbAZYJuy.js} +4 -4
- package/dist/console-DbAZYJuy.js.map +1 -0
- package/dist/constants-CN7GE1Lt.js +246 -0
- package/dist/constants-CN7GE1Lt.js.map +1 -0
- package/dist/constants-CW-MlHdY.cjs +2 -0
- package/dist/constants-CW-MlHdY.cjs.map +1 -0
- package/dist/constants.d.ts +63 -11
- package/dist/context-storage-BjzeBSxH.cjs +2 -0
- package/dist/context-storage-BjzeBSxH.cjs.map +1 -0
- package/dist/context-storage-DxZf4Gfh.js +52 -0
- package/dist/context-storage-DxZf4Gfh.js.map +1 -0
- package/dist/core/breadcrumbs.d.ts +10 -3
- package/dist/core/context.d.ts +2 -0
- package/dist/core/diagnostics.d.ts +11 -3
- package/dist/core/journey.d.ts +7 -0
- package/dist/core/meter.d.ts +25 -2
- package/dist/core/pipeline.d.ts +41 -6
- package/dist/core/record.d.ts +42 -9
- package/dist/core/remote-sampling.d.ts +7 -3
- package/dist/core/runtime.d.ts +153 -6
- package/dist/core/sampling.d.ts +35 -2
- package/dist/core/sender.d.ts +43 -1
- package/dist/core/spans.d.ts +34 -0
- package/dist/deadline-5_PecIl5.js +26 -0
- package/dist/deadline-5_PecIl5.js.map +1 -0
- package/dist/deadline-XSnm95pg.cjs +2 -0
- package/dist/deadline-XSnm95pg.cjs.map +1 -0
- package/dist/emergency-queue-BYUyDHGD.js +69 -0
- package/dist/emergency-queue-BYUyDHGD.js.map +1 -0
- package/dist/emergency-queue-Cs1hrjsC.cjs +2 -0
- package/dist/emergency-queue-Cs1hrjsC.cjs.map +1 -0
- package/dist/{errors-DCZWcHkd.js → errors-BhC7HTSt.js} +8 -9
- package/dist/errors-BhC7HTSt.js.map +1 -0
- package/dist/errors-CgY633cG.cjs +3 -0
- package/dist/errors-CgY633cG.cjs.map +1 -0
- package/dist/factory-C5TujXlU.js +280 -0
- package/dist/factory-C5TujXlU.js.map +1 -0
- package/dist/factory-CNj4DH3n.cjs +2 -0
- package/dist/factory-CNj4DH3n.cjs.map +1 -0
- package/dist/fixed-window-CtaFHanJ.js +12 -0
- package/dist/fixed-window-CtaFHanJ.js.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs +2 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -0
- package/dist/identity-8vKkyAWm.js +103 -0
- package/dist/identity-8vKkyAWm.js.map +1 -0
- package/dist/identity-Da9TkuKd.cjs +2 -0
- package/dist/identity-Da9TkuKd.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +66 -6
- package/dist/index.js +1253 -595
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-BTfIFRHF.cjs +2 -0
- package/dist/indexeddb-storage-BTfIFRHF.cjs.map +1 -0
- package/dist/{indexeddb-storage-T9YIYVYC.js → indexeddb-storage-CCA1LvtO.js} +45 -30
- package/dist/indexeddb-storage-CCA1LvtO.js.map +1 -0
- package/dist/{interactions-BLH_tX87.js → interactions-BUDLxbv1.js} +16 -12
- package/dist/interactions-BUDLxbv1.js.map +1 -0
- package/dist/interactions-NHbLKrqe.cjs +2 -0
- package/dist/interactions-NHbLKrqe.cjs.map +1 -0
- package/dist/{journey-yALMEWF7.js → journey-BUJ4WJxP.js} +37 -34
- package/dist/journey-BUJ4WJxP.js.map +1 -0
- package/dist/journey-B_tTnvac.cjs +2 -0
- package/dist/journey-B_tTnvac.cjs.map +1 -0
- package/dist/keys-BHhw_0Wh.cjs +2 -0
- package/dist/keys-BHhw_0Wh.cjs.map +1 -0
- package/dist/keys-D5r_GH9q.js +17 -0
- package/dist/keys-D5r_GH9q.js.map +1 -0
- package/dist/{library-request-CQD4HUiP.js → library-request-BKOcaKtQ.js} +3 -3
- package/dist/{library-request-CQD4HUiP.js.map → library-request-BKOcaKtQ.js.map} +1 -1
- package/dist/{library-request-BcAxuwsf.cjs → library-request-BaZOi4eg.cjs} +2 -2
- package/dist/{library-request-BcAxuwsf.cjs.map → library-request-BaZOi4eg.cjs.map} +1 -1
- package/dist/{long-frames-D4Bm3Zkz.cjs → long-frames-CF3qiSAX.cjs} +2 -2
- package/dist/long-frames-CF3qiSAX.cjs.map +1 -0
- package/dist/{long-frames-DD_Um9_4.js → long-frames-DI5ypfAF.js} +5 -5
- package/dist/long-frames-DI5ypfAF.js.map +1 -0
- package/dist/models/batch.d.ts +4 -0
- package/dist/models/bus.d.ts +32 -9
- package/dist/models/config.d.ts +401 -12
- package/dist/models/drop.d.ts +1 -1
- package/dist/models/health.d.ts +27 -0
- package/dist/models/log-record.d.ts +1 -1
- package/dist/models/plugin.d.ts +47 -0
- package/dist/models/stats.d.ts +11 -0
- package/dist/models/storage.d.ts +13 -0
- package/dist/network-CF8UO5PK.cjs +2 -0
- package/dist/network-CF8UO5PK.cjs.map +1 -0
- package/dist/{network--GoE7_Or.js → network-DdzXDI3J.js} +47 -31
- package/dist/network-DdzXDI3J.js.map +1 -0
- package/dist/openfin-BwEN0uj4.js.map +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/{platform-GaM6h7XM.js → platform-Bw1btWCT.js} +21 -10
- package/dist/platform-Bw1btWCT.js.map +1 -0
- package/dist/platform-DBSKTvFn.cjs +2 -0
- package/dist/platform-DBSKTvFn.cjs.map +1 -0
- package/dist/remote-rules-DIcC5vVC.js +91 -0
- package/dist/remote-rules-DIcC5vVC.js.map +1 -0
- package/dist/remote-rules-DpFmOef2.cjs +2 -0
- package/dist/remote-rules-DpFmOef2.cjs.map +1 -0
- package/dist/sampling-BVjspJWu.cjs +2 -0
- package/dist/sampling-BVjspJWu.cjs.map +1 -0
- package/dist/sampling-Cm3WhI0a.js +76 -0
- package/dist/sampling-Cm3WhI0a.js.map +1 -0
- package/dist/{sanitize-DP0xDPrt.js → sanitize-C-ahCFsG.js} +2 -2
- package/dist/{sanitize-DP0xDPrt.js.map → sanitize-C-ahCFsG.js.map} +1 -1
- package/dist/{sanitize--_e4oOPX.cjs → sanitize-DHucKGdi.cjs} +2 -2
- package/dist/{sanitize--_e4oOPX.cjs.map → sanitize-DHucKGdi.cjs.map} +1 -1
- package/dist/sender-D3fRCR8d.cjs +3 -0
- package/dist/sender-D3fRCR8d.cjs.map +1 -0
- package/dist/sender-DUUmSglb.js +1163 -0
- package/dist/sender-DUUmSglb.js.map +1 -0
- package/dist/storage/context-storage.d.ts +89 -0
- package/dist/storage/emergency-queue.d.ts +9 -1
- package/dist/storage/factory.d.ts +7 -1
- package/dist/storage/idb-driver.d.ts +13 -0
- package/dist/storage/indexeddb-storage.d.ts +13 -0
- package/dist/storage/local-storage.d.ts +21 -1
- package/dist/storage/memory-storage.d.ts +13 -0
- package/dist/storage-BA9RqRO-.cjs +2 -0
- package/dist/storage-BA9RqRO-.cjs.map +1 -0
- package/dist/storage-w7Tslvlq.js +17 -0
- package/dist/storage-w7Tslvlq.js.map +1 -0
- package/dist/storm-CNZjsw4T.cjs +2 -0
- package/dist/storm-CNZjsw4T.cjs.map +1 -0
- package/dist/storm-Daq2jGHU.js +10 -0
- package/dist/storm-Daq2jGHU.js.map +1 -0
- package/dist/transport/exit-flush.d.ts +6 -0
- package/dist/transport/http-transport.d.ts +2 -1
- package/dist/transport/retry-engine.d.ts +7 -2
- package/dist/transport/serializers/otlp-traces.d.ts +3 -0
- package/dist/transport/serializers/select.d.ts +8 -5
- package/dist/transport/status-transport.d.ts +24 -0
- package/dist/types-BR9t_w28.js +8 -0
- package/dist/types-BR9t_w28.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs +2 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -0
- package/dist/utils/fixed-window.d.ts +9 -0
- package/dist/utils/identity.d.ts +20 -2
- package/dist/utils/lock.d.ts +8 -0
- package/dist/utils/openfin.d.ts +1 -1
- package/dist/utils/platform.d.ts +10 -0
- package/dist/utils/tracing.d.ts +82 -4
- package/dist/web-socket-BacvKOvD.cjs +2 -0
- package/dist/web-socket-BacvKOvD.cjs.map +1 -0
- package/dist/web-socket-CpsD8WAa.js +105 -0
- package/dist/web-socket-CpsD8WAa.js.map +1 -0
- package/package.json +1 -1
- package/dist/batch-D5qvsMQ_.cjs +0 -2
- package/dist/batch-D5qvsMQ_.cjs.map +0 -1
- package/dist/batch-DDgxg16_.js.map +0 -1
- package/dist/bus-C6RwKzPW.js +0 -478
- package/dist/bus-C6RwKzPW.js.map +0 -1
- package/dist/bus-WPVDFw2y.cjs +0 -2
- package/dist/bus-WPVDFw2y.cjs.map +0 -1
- package/dist/console-BSusX_M-.cjs.map +0 -1
- package/dist/console-Dv5GfaNn.js.map +0 -1
- package/dist/constants-Cb92egPS.cjs +0 -2
- package/dist/constants-Cb92egPS.cjs.map +0 -1
- package/dist/constants-DhH6VI5a.js +0 -144
- package/dist/constants-DhH6VI5a.js.map +0 -1
- package/dist/deadline-CUrH0Hd8.cjs +0 -2
- package/dist/deadline-CUrH0Hd8.cjs.map +0 -1
- package/dist/deadline-DeqXEliN.js +0 -31
- package/dist/deadline-DeqXEliN.js.map +0 -1
- package/dist/errors-DCZWcHkd.js.map +0 -1
- package/dist/errors-ERu-su8m.cjs +0 -3
- package/dist/errors-ERu-su8m.cjs.map +0 -1
- package/dist/fixed-window-BR0bu32Y.cjs +0 -2
- package/dist/fixed-window-BR0bu32Y.cjs.map +0 -1
- package/dist/fixed-window-Re7jIRJH.js +0 -9
- package/dist/fixed-window-Re7jIRJH.js.map +0 -1
- package/dist/identity-C1WLItSl.cjs +0 -2
- package/dist/identity-C1WLItSl.cjs.map +0 -1
- package/dist/identity-Di-QXGCC.js +0 -88
- package/dist/identity-Di-QXGCC.js.map +0 -1
- package/dist/indexeddb-storage-DX18p39D.cjs +0 -2
- package/dist/indexeddb-storage-DX18p39D.cjs.map +0 -1
- package/dist/indexeddb-storage-T9YIYVYC.js.map +0 -1
- package/dist/interactions-BLH_tX87.js.map +0 -1
- package/dist/interactions-_hfOerfC.cjs +0 -2
- package/dist/interactions-_hfOerfC.cjs.map +0 -1
- package/dist/journey-BRUj0hqD.cjs +0 -2
- package/dist/journey-BRUj0hqD.cjs.map +0 -1
- package/dist/journey-yALMEWF7.js.map +0 -1
- package/dist/long-frames-D4Bm3Zkz.cjs.map +0 -1
- package/dist/long-frames-DD_Um9_4.js.map +0 -1
- package/dist/network--GoE7_Or.js.map +0 -1
- package/dist/network-DcuS2H1P.cjs +0 -2
- package/dist/network-DcuS2H1P.cjs.map +0 -1
- package/dist/platform-GaM6h7XM.js.map +0 -1
- package/dist/platform-kIL5AZB7.cjs +0 -2
- package/dist/platform-kIL5AZB7.cjs.map +0 -1
- package/dist/remote-rules-6ePq8CrI.js +0 -84
- package/dist/remote-rules-6ePq8CrI.js.map +0 -1
- package/dist/remote-rules-CI3gbRCL.cjs +0 -2
- package/dist/remote-rules-CI3gbRCL.cjs.map +0 -1
- package/dist/sampling-C-M8p3FK.cjs +0 -2
- package/dist/sampling-C-M8p3FK.cjs.map +0 -1
- package/dist/sampling-Ud_WiuU9.js +0 -65
- package/dist/sampling-Ud_WiuU9.js.map +0 -1
- package/dist/sender-BESHz6my.cjs +0 -3
- package/dist/sender-BESHz6my.cjs.map +0 -1
- package/dist/sender-BUBWLn5i.js +0 -1244
- package/dist/sender-BUBWLn5i.js.map +0 -1
- package/dist/storm-DhHGHhOc.cjs +0 -2
- package/dist/storm-DhHGHhOc.cjs.map +0 -1
- package/dist/storm-OD5J6Ylm.js +0 -10
- package/dist/storm-OD5J6Ylm.js.map +0 -1
package/dist/constants.d.ts
CHANGED
|
@@ -162,6 +162,8 @@ export declare const SERIALIZER_NAME_ECS = "ecs";
|
|
|
162
162
|
* @see {@link SERIALIZER_NAME_ECS}
|
|
163
163
|
*/
|
|
164
164
|
export declare const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>>;
|
|
165
|
+
/** ECS version of the documents. The Elastic ECS logging libraries write this version. */
|
|
166
|
+
export declare const ECS_VERSION = "8.10.0";
|
|
165
167
|
/** Content type for an OTLP/JSON body. */
|
|
166
168
|
export declare const CONTENT_TYPE_JSON = "application/json";
|
|
167
169
|
/** Content type for newline-delimited JSON. */
|
|
@@ -240,12 +242,11 @@ export declare const QUOTA_EVICTION_DIVISOR = 4;
|
|
|
240
242
|
/** DOMException name for a full store. */
|
|
241
243
|
export declare const QUOTA_EXCEEDED_ERROR = "QuotaExceededError";
|
|
242
244
|
/**
|
|
243
|
-
* Native IndexedDB version.
|
|
244
|
-
*
|
|
245
|
-
* fail with VersionError for an existing installation. Then no code can read
|
|
246
|
-
* batches in that database.
|
|
245
|
+
* Native IndexedDB version. Version 11 replaced Dexie. Version 12 adds the context index.
|
|
246
|
+
* Dexie opened this database at ten times its declared version. A version below 11 makes
|
|
247
|
+
* open() fail with VersionError for an existing installation. Then no code can read its batches.
|
|
247
248
|
*/
|
|
248
|
-
export declare const INDEXEDDB_SCHEMA_VERSION =
|
|
249
|
+
export declare const INDEXEDDB_SCHEMA_VERSION = 12;
|
|
249
250
|
/** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */
|
|
250
251
|
export declare const INDEXEDDB_STORE_NAME = "batches";
|
|
251
252
|
/** Index on the batch store that orders reads by creation time. */
|
|
@@ -277,6 +278,22 @@ export declare const JOURNEY_STORAGE_KEY = "ui-observability.journey";
|
|
|
277
278
|
* @see {@link JOURNEY_TOKEN_MAX_CHARS}
|
|
278
279
|
*/
|
|
279
280
|
export declare const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;
|
|
281
|
+
/**
|
|
282
|
+
* Max length of a journey id from startJourney(), in characters. The token of a journey with this
|
|
283
|
+
* id and a full name stays below the token limit.
|
|
284
|
+
* @see {@link JOURNEY_TOKEN_MAX_CHARS}
|
|
285
|
+
*/
|
|
286
|
+
export declare const JOURNEY_ID_MAX_CHARS = 64;
|
|
287
|
+
/**
|
|
288
|
+
* Accepted journey id from startJourney(): letters, digits, "_", ".", ":" and "-". Each character
|
|
289
|
+
* is one byte in UTF-8. A multibyte id makes the token larger than its limit.
|
|
290
|
+
*/
|
|
291
|
+
export declare const JOURNEY_ID_PATTERN: RegExp;
|
|
292
|
+
/**
|
|
293
|
+
* Time that the start of a journey token can be ahead of this clock, in milliseconds. Two machines
|
|
294
|
+
* can disagree on the time. A token further ahead never expires.
|
|
295
|
+
*/
|
|
296
|
+
export declare const JOURNEY_CLOCK_SKEW_MS: number;
|
|
280
297
|
/**
|
|
281
298
|
* Max whole-token length, in characters. It rejects an oversized token. It does not
|
|
282
299
|
* validate the token content.
|
|
@@ -329,7 +346,7 @@ export declare const FNV_PRIME = 16777619;
|
|
|
329
346
|
/** Largest 32-bit unsigned value. */
|
|
330
347
|
export declare const UINT32_MAX = 4294967295;
|
|
331
348
|
/**
|
|
332
|
-
* Types that minLevel does not drop. An action is an audit fact and a
|
|
349
|
+
* Types that minLevel does not drop. An action is an audit fact. A metric and a span are measurements.
|
|
333
350
|
* The remote rate cap for records below minLevel does not apply to them.
|
|
334
351
|
*/
|
|
335
352
|
export declare const LEVEL_BYPASS_TYPES: readonly LogType[];
|
|
@@ -337,8 +354,26 @@ export declare const LEVEL_BYPASS_TYPES: readonly LogType[];
|
|
|
337
354
|
export declare const LOG_TYPE_METRIC: LogType;
|
|
338
355
|
/** Record kind of an audit fact. Storage and the hold buffers drop it last. */
|
|
339
356
|
export declare const LOG_TYPE_ACTION: LogType;
|
|
357
|
+
/** Record kind routed to the trace stream. */
|
|
358
|
+
export declare const LOG_TYPE_SPAN: LogType;
|
|
340
359
|
/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */
|
|
341
|
-
export declare const BUS_PROTOCOL = "ui-observability/
|
|
360
|
+
export declare const BUS_PROTOCOL = "ui-observability/2";
|
|
361
|
+
/**
|
|
362
|
+
* Type tag of each bus message. Every frame must use the same values. The prefix makes a message
|
|
363
|
+
* easy to identify in a postMessage log. The envelope tag BUS_PROTOCOL still separates the bus
|
|
364
|
+
* from other traffic.
|
|
365
|
+
*/
|
|
366
|
+
export declare const BUS_TYPE: {
|
|
367
|
+
readonly hello: "ui-observability.message.hello";
|
|
368
|
+
readonly welcome: "ui-observability.message.welcome";
|
|
369
|
+
readonly records: "ui-observability.message.records";
|
|
370
|
+
readonly securityContext: "ui-observability.message.security-context";
|
|
371
|
+
readonly journey: "ui-observability.message.journey";
|
|
372
|
+
readonly journeyRequest: "ui-observability.message.journey-request";
|
|
373
|
+
readonly sampling: "ui-observability.message.sampling";
|
|
374
|
+
readonly samplingRequest: "ui-observability.message.sampling-request";
|
|
375
|
+
readonly tab: "ui-observability.message.tab";
|
|
376
|
+
};
|
|
342
377
|
/** Global window property key used to locate a same-origin runtime instance. */
|
|
343
378
|
export declare const RUNTIME_GLOBAL_KEY = "ui-observability.runtime";
|
|
344
379
|
/** Global key of the runtime that shutdown() stopped. Calls go to it until the next configure(). */
|
|
@@ -363,12 +398,16 @@ export declare const ERROR_CEILING_MAX_PER_WINDOW = 500;
|
|
|
363
398
|
export declare const LONG_FRAME_THRESHOLD_MS = 100;
|
|
364
399
|
/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */
|
|
365
400
|
export declare const LONG_FRAME_MAX_PER_WINDOW = 20;
|
|
401
|
+
/** Maximum WebSocket events recorded in each storm window. A reconnect loop cannot flood the pipeline. */
|
|
402
|
+
export declare const WEBSOCKET_MAX_PER_WINDOW = 20;
|
|
366
403
|
/** Maximum character length of a console breadcrumb message. */
|
|
367
404
|
export declare const CONSOLE_BREADCRUMB_MAX_CHARS = 200;
|
|
368
405
|
/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */
|
|
369
406
|
export declare const MAX_TRACKED_ERROR_SIGNATURES = 200;
|
|
370
407
|
/** Maximum character length retained from clicked element text in breadcrumbs. */
|
|
371
408
|
export declare const CLICK_TEXT_MAX_CHARS = 50;
|
|
409
|
+
/** Attribute that names a click action when the app sets no other attribute. */
|
|
410
|
+
export declare const ACTION_ATTRIBUTE_DEFAULT = "data-observability-action";
|
|
372
411
|
/** Maximum character length retained from an aria-label attribute in generated selectors. */
|
|
373
412
|
export declare const ARIA_LABEL_MAX_CHARS = 40;
|
|
374
413
|
/** Maximum class names included per element in generated CSS selectors. */
|
|
@@ -409,6 +448,16 @@ export declare const METRIC_KEYS: {
|
|
|
409
448
|
readonly bounds: "metric.bounds";
|
|
410
449
|
readonly buckets: "metric.bucket_counts";
|
|
411
450
|
};
|
|
451
|
+
/** Namespace of the span records. */
|
|
452
|
+
export declare const TRACE_NAMESPACE = "uiobs.traces";
|
|
453
|
+
/** Attribute keys of the span fields of a span record. The traces serializer reads them. */
|
|
454
|
+
export declare const SPAN_KEYS: {
|
|
455
|
+
readonly kind: "span.kind";
|
|
456
|
+
readonly parentId: "span.parent_id";
|
|
457
|
+
readonly start: "span.start_time_unix_nano";
|
|
458
|
+
readonly end: "span.end_time_unix_nano";
|
|
459
|
+
readonly status: "span.status";
|
|
460
|
+
};
|
|
412
461
|
/** Default `service.name` when a consumer sets none. */
|
|
413
462
|
export declare const UNKNOWN_SERVICE_NAME = "unknown-service";
|
|
414
463
|
/** Lowest sampling rate (drop everything). */
|
|
@@ -434,12 +483,12 @@ export declare const REMOTE_SAMPLING_POLL_MS = 30000;
|
|
|
434
483
|
* Config keys with no default, excluded from `DEFAULT_CONFIG`.
|
|
435
484
|
* @see {@link DEFAULT_CONFIG}
|
|
436
485
|
*/
|
|
437
|
-
export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["redact", "onDiagnostic", "onDrop", "headers", "serializer", "otelLoader", "transport", "transportOnExit"];
|
|
486
|
+
export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["contextProvider", "redact", "onDiagnostic", "onDrop", "headers", "serializer", "otelLoader", "transport", "transportOnExit"];
|
|
438
487
|
/**
|
|
439
488
|
* Nested config section keys.
|
|
440
489
|
* @see {@link ResolvedConfig}
|
|
441
490
|
*/
|
|
442
|
-
export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "journey", "batching", "retention", "limits", "capture"];
|
|
491
|
+
export declare const CONFIG_SECTIONS: readonly ["capturePolicy", "metadata", "persistence", "diagnostics", "correlation", "metrics", "buffering", "delivery", "loggerCache", "securityContext", "sampling", "bus", "journey", "batching", "retention", "limits", "capture"];
|
|
443
492
|
/**
|
|
444
493
|
* Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.
|
|
445
494
|
* @see {@link UNDEFAULTED_CONFIG_KEYS}
|
|
@@ -498,8 +547,11 @@ export declare const BUS_MAX_BOOT_BUFFER_RECORDS = 500;
|
|
|
498
547
|
export declare const BUS_MAX_BOOT_BUFFER_ACTIONS = 2000;
|
|
499
548
|
/** Max different values in each list of an onDrop summary. */
|
|
500
549
|
export declare const DROP_SUMMARY_MAX_ITEMS = 20;
|
|
501
|
-
/**
|
|
502
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Max characters of an untrusted message type in a diagnostic detail. The sender sets the text.
|
|
552
|
+
* The longest BUS_TYPE value has 41 characters. Each valid type then fits.
|
|
553
|
+
*/
|
|
554
|
+
export declare const BUS_TYPE_DETAIL_MAX_CHARS = 48;
|
|
503
555
|
/** Breadcrumbs kept as context for the next error. */
|
|
504
556
|
export declare const MAX_BREADCRUMBS = 50;
|
|
505
557
|
/**
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=class{store;policy;namespace;name;active=!0;discard=!1;constructor(e,t,n=``){this.store=e,this.policy=t,this.namespace=n,this.name=e.name}accepts(e){return(e.persistenceNamespace??``)===this.namespace&&(!this.policy.isolation||!this.policy.id||e.routingContextId===this.policy.id)}async save(e){this.active&&this.accepts(e)&&(await this.store.save(e),this.discard&&await this.store.remove(e.id))}async take(e){return this.isolated()?this.store.takeContext?this.store.takeContext(this.policy.id,e):(await this.store.take(4294967295)).filter(e=>this.accepts(e)).slice(0,e):(await this.store.take(e)).filter(e=>this.accepts(e))}isolated(){return this.policy.isolation&&this.policy.id!==``}remove(e){return this.store.remove(e)}bumpAttempts(e,t){return this.store.bumpAttempts(e,t)}prune(){return this.store.prune()}async count(){return this.isolated()?this.store.countContext?this.store.countContext(this.policy.id):(await this.take(2**53-1)).length:this.store.count()}async clear(){for(let e of await this.take(2**53-1))await this.store.remove(e.id)}async retire(e){this.active=!1,this.discard=e,e&&await this.clear(),this.name!==`memory`&&await this.close()}clearNamespace(){return this.store.clear()}close(){return this.store.close()}};exports.ContextStorage=e;
|
|
2
|
+
//# sourceMappingURL=context-storage-BjzeBSxH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-storage-BjzeBSxH.cjs","names":["ContextStorage","store","policy","namespace","batch","limit","id","attempts","discard"],"sources":["../src/storage/context-storage.ts"],"sourcesContent":["// src/storage/context-storage.ts\n//\n// Gives access to stored batches of one delivery context and one application namespace.\n\nimport type { SecurityContextOptions } from \"../models/config\";\nimport type { LogBatch } from \"../models/batch\";\nimport type { StorageAdapter } from \"../models/storage\";\n\n/** Gives access to one part of the shared store. Records of other contexts stay stored. */\nexport class ContextStorage implements StorageAdapter {\n /** Adapter name of the underlying store. */\n readonly name: string;\n /** False after this context store stops accepting writes. */\n private active = true;\n /** True if a late save must remove its batch after it completes. */\n private discard = false;\n\n /**\n * Builds access to one application namespace and delivery context.\n * @param store Underlying batch store.\n * @param policy Active context id and isolation rule.\n * @param namespace Application storage namespace.\n */\n constructor(\n private readonly store: StorageAdapter,\n private readonly policy: SecurityContextOptions,\n readonly namespace = \"\",\n ) {\n this.name = store.name;\n }\n\n /**\n * Checks if a batch belongs to the permitted namespace and context.\n * @param batch Batch to check.\n * @returns True if this adapter can accept the batch.\n */\n accepts(batch: LogBatch): boolean {\n return (\n (batch.persistenceNamespace ?? \"\") === this.namespace &&\n (!this.policy.isolation || !this.policy.id || batch.routingContextId === this.policy.id)\n );\n }\n\n /**\n * Stores a batch of this context. A late save removes its batch after a discard.\n * @param batch Batch to store.\n * @returns Promise that resolves when the save and any removal complete.\n */\n async save(batch: LogBatch): Promise<void> {\n if (!this.active || !this.accepts(batch)) return;\n await this.store.save(batch);\n // A slow save can complete after the context change cleared these records.\n if (this.discard) await this.store.remove(batch.id);\n }\n\n /**\n * Reads stored batches of this context, oldest first.\n * @param limit Maximum batches to return.\n * @returns Batches in creation order. The method does not remove them.\n */\n async take(limit: number): Promise<LogBatch[]> {\n // Read only this part of the store. A full read on each retry pass parses all contexts.\n if (!this.isolated()) {\n return (await this.store.take(limit)).filter((batch) => this.accepts(batch));\n }\n\n if (this.store.takeContext) {\n return this.store.takeContext(this.policy.id, limit);\n }\n\n const all = await this.store.take(0xffffffff);\n return all.filter((batch) => this.accepts(batch)).slice(0, limit);\n }\n\n /**\n * Checks if reads are limited to the active context.\n * @returns True if isolation is on and the context has an id.\n */\n private isolated(): boolean {\n return this.policy.isolation && this.policy.id !== \"\";\n }\n\n /**\n * Removes one stored batch.\n * @param id Batch id.\n * @returns Promise that resolves when removal completes.\n */\n remove(id: string): Promise<void> {\n return this.store.remove(id);\n }\n\n /**\n * Changes the attempt count of a stored batch.\n * @param id Batch id.\n * @param attempts Total attempt count to store.\n * @returns Promise that resolves when the change completes.\n */\n bumpAttempts(id: string, attempts: number): Promise<void> {\n return this.store.bumpAttempts(id, attempts);\n }\n\n /**\n * Applies the retention and capacity limits of the underlying store.\n * @returns Summary of the batches and records removed.\n */\n prune(): ReturnType<StorageAdapter[\"prune\"]> {\n return this.store.prune();\n }\n\n /**\n * Counts stored batches of this context.\n * @returns Number of batches in this context.\n */\n async count(): Promise<number> {\n if (!this.isolated()) {\n return this.store.count();\n }\n\n if (this.store.countContext) {\n return this.store.countContext(this.policy.id);\n }\n\n return (await this.take(Number.MAX_SAFE_INTEGER)).length;\n }\n\n /**\n * Removes stored batches of this context.\n * @returns Promise that resolves when removal completes.\n */\n async clear(): Promise<void> {\n for (const batch of await this.take(Number.MAX_SAFE_INTEGER)) await this.store.remove(batch.id);\n }\n\n /**\n * Stops new writes and clears this context if required. Other contexts can keep the memory store.\n * @param discard True to remove this context before closing the store.\n * @returns Promise that resolves when removal and closure complete.\n */\n async retire(discard: boolean): Promise<void> {\n this.active = false;\n this.discard = discard;\n if (discard) await this.clear();\n // Keep the memory store for later context changes. It can hold records of other contexts.\n if (this.name !== \"memory\") await this.close();\n }\n\n /**\n * Removes all batches in the application namespace.\n * @returns Promise that resolves when removal completes.\n */\n clearNamespace(): Promise<void> {\n return this.store.clear();\n }\n\n /**\n * Closes the underlying store.\n * @returns Promise that resolves when closure completes.\n */\n close(): Promise<void> {\n return this.store.close();\n }\n}\n"],"mappings":"AASA,IAAaA,EAAb,KAAsD,CAejC,MACA,OACR,UAfX,KAEA,OAAiB,GAEjB,QAAkB,GAQlB,YACE,EACA,EACA,EAAqB,GACrB,CAHiB,KAAA,MAAAC,EACA,KAAA,OAAAC,EACR,KAAA,UAAAC,EAET,KAAK,KAAOF,EAAM,IACpB,CAOA,QAAQ,EAA0B,CAChC,OACGG,EAAM,sBAAwB,MAAQ,KAAK,YAC3C,CAAC,KAAK,OAAO,WAAa,CAAC,KAAK,OAAO,IAAMA,EAAM,mBAAqB,KAAK,OAAO,GAEzF,CAOA,MAAM,KAAK,EAAgC,CACpC,KAAK,QAAW,KAAK,QAAQA,CAAK,IACvC,MAAM,KAAK,MAAM,KAAKA,CAAK,EAEvB,KAAK,SAAS,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE,EACpD,CAOA,MAAM,KAAK,EAAoC,CAW7C,OATK,KAAK,SAAS,EAIf,KAAK,MAAM,YACN,KAAK,MAAM,YAAY,KAAK,OAAO,GAAIC,CAAK,GAI9C,MADW,KAAK,MAAM,KAAK,UAAU,EAAA,CACjC,OAAQ,GAAU,KAAK,QAAQD,CAAK,CAAC,CAAC,CAAC,MAAM,EAAGC,CAAK,GARtD,MAAM,KAAK,MAAM,KAAKA,CAAK,EAAA,CAAG,OAAQ,GAAU,KAAK,QAAQD,CAAK,CAAC,CAS/E,CAMA,UAA4B,CAC1B,OAAO,KAAK,OAAO,WAAa,KAAK,OAAO,KAAO,EACrD,CAOA,OAAO,EAA2B,CAChC,OAAO,KAAK,MAAM,OAAOE,CAAE,CAC7B,CAQA,aAAa,EAAY,EAAiC,CACxD,OAAO,KAAK,MAAM,aAAaA,EAAIC,CAAQ,CAC7C,CAMA,OAA6C,CAC3C,OAAO,KAAK,MAAM,MAAM,CAC1B,CAMA,MAAM,OAAyB,CAS7B,OARK,KAAK,SAAS,EAIf,KAAK,MAAM,aACN,KAAK,MAAM,aAAa,KAAK,OAAO,EAAE,GAGvC,MAAM,KAAK,YAA4B,EAAA,CAAG,OAPzC,KAAK,MAAM,MAAM,CAQ5B,CAMA,MAAM,OAAuB,CAC3B,IAAK,IAAMH,KAAS,MAAM,KAAK,YAA4B,EAAG,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE,CAChG,CAOA,MAAM,OAAO,EAAiC,CAC5C,KAAK,OAAS,GACd,KAAK,QAAUI,EACXA,GAAS,MAAM,KAAK,MAAM,EAE1B,KAAK,OAAS,UAAU,MAAM,KAAK,MAAM,CAC/C,CAMA,gBAAgC,CAC9B,OAAO,KAAK,MAAM,MAAM,CAC1B,CAMA,OAAuB,CACrB,OAAO,KAAK,MAAM,MAAM,CAC1B,CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/storage/context-storage.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
store;
|
|
4
|
+
policy;
|
|
5
|
+
namespace;
|
|
6
|
+
name;
|
|
7
|
+
active = !0;
|
|
8
|
+
discard = !1;
|
|
9
|
+
constructor(e, t, n = "") {
|
|
10
|
+
this.store = e, this.policy = t, this.namespace = n, this.name = e.name;
|
|
11
|
+
}
|
|
12
|
+
accepts(e) {
|
|
13
|
+
return (e.persistenceNamespace ?? "") === this.namespace && (!this.policy.isolation || !this.policy.id || e.routingContextId === this.policy.id);
|
|
14
|
+
}
|
|
15
|
+
async save(e) {
|
|
16
|
+
this.active && this.accepts(e) && (await this.store.save(e), this.discard && await this.store.remove(e.id));
|
|
17
|
+
}
|
|
18
|
+
async take(e) {
|
|
19
|
+
return this.isolated() ? this.store.takeContext ? this.store.takeContext(this.policy.id, e) : (await this.store.take(4294967295)).filter((e) => this.accepts(e)).slice(0, e) : (await this.store.take(e)).filter((e) => this.accepts(e));
|
|
20
|
+
}
|
|
21
|
+
isolated() {
|
|
22
|
+
return this.policy.isolation && this.policy.id !== "";
|
|
23
|
+
}
|
|
24
|
+
remove(e) {
|
|
25
|
+
return this.store.remove(e);
|
|
26
|
+
}
|
|
27
|
+
bumpAttempts(e, t) {
|
|
28
|
+
return this.store.bumpAttempts(e, t);
|
|
29
|
+
}
|
|
30
|
+
prune() {
|
|
31
|
+
return this.store.prune();
|
|
32
|
+
}
|
|
33
|
+
async count() {
|
|
34
|
+
return this.isolated() ? this.store.countContext ? this.store.countContext(this.policy.id) : (await this.take(2 ** 53 - 1)).length : this.store.count();
|
|
35
|
+
}
|
|
36
|
+
async clear() {
|
|
37
|
+
for (let e of await this.take(2 ** 53 - 1)) await this.store.remove(e.id);
|
|
38
|
+
}
|
|
39
|
+
async retire(e) {
|
|
40
|
+
this.active = !1, this.discard = e, e && await this.clear(), this.name !== "memory" && await this.close();
|
|
41
|
+
}
|
|
42
|
+
clearNamespace() {
|
|
43
|
+
return this.store.clear();
|
|
44
|
+
}
|
|
45
|
+
close() {
|
|
46
|
+
return this.store.close();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { e as ContextStorage };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=context-storage-DxZf4Gfh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-storage-DxZf4Gfh.js","names":["ContextStorage","store","policy","namespace","batch","limit","id","attempts","discard"],"sources":["../src/storage/context-storage.ts"],"sourcesContent":["// src/storage/context-storage.ts\n//\n// Gives access to stored batches of one delivery context and one application namespace.\n\nimport type { SecurityContextOptions } from \"../models/config\";\nimport type { LogBatch } from \"../models/batch\";\nimport type { StorageAdapter } from \"../models/storage\";\n\n/** Gives access to one part of the shared store. Records of other contexts stay stored. */\nexport class ContextStorage implements StorageAdapter {\n /** Adapter name of the underlying store. */\n readonly name: string;\n /** False after this context store stops accepting writes. */\n private active = true;\n /** True if a late save must remove its batch after it completes. */\n private discard = false;\n\n /**\n * Builds access to one application namespace and delivery context.\n * @param store Underlying batch store.\n * @param policy Active context id and isolation rule.\n * @param namespace Application storage namespace.\n */\n constructor(\n private readonly store: StorageAdapter,\n private readonly policy: SecurityContextOptions,\n readonly namespace = \"\",\n ) {\n this.name = store.name;\n }\n\n /**\n * Checks if a batch belongs to the permitted namespace and context.\n * @param batch Batch to check.\n * @returns True if this adapter can accept the batch.\n */\n accepts(batch: LogBatch): boolean {\n return (\n (batch.persistenceNamespace ?? \"\") === this.namespace &&\n (!this.policy.isolation || !this.policy.id || batch.routingContextId === this.policy.id)\n );\n }\n\n /**\n * Stores a batch of this context. A late save removes its batch after a discard.\n * @param batch Batch to store.\n * @returns Promise that resolves when the save and any removal complete.\n */\n async save(batch: LogBatch): Promise<void> {\n if (!this.active || !this.accepts(batch)) return;\n await this.store.save(batch);\n // A slow save can complete after the context change cleared these records.\n if (this.discard) await this.store.remove(batch.id);\n }\n\n /**\n * Reads stored batches of this context, oldest first.\n * @param limit Maximum batches to return.\n * @returns Batches in creation order. The method does not remove them.\n */\n async take(limit: number): Promise<LogBatch[]> {\n // Read only this part of the store. A full read on each retry pass parses all contexts.\n if (!this.isolated()) {\n return (await this.store.take(limit)).filter((batch) => this.accepts(batch));\n }\n\n if (this.store.takeContext) {\n return this.store.takeContext(this.policy.id, limit);\n }\n\n const all = await this.store.take(0xffffffff);\n return all.filter((batch) => this.accepts(batch)).slice(0, limit);\n }\n\n /**\n * Checks if reads are limited to the active context.\n * @returns True if isolation is on and the context has an id.\n */\n private isolated(): boolean {\n return this.policy.isolation && this.policy.id !== \"\";\n }\n\n /**\n * Removes one stored batch.\n * @param id Batch id.\n * @returns Promise that resolves when removal completes.\n */\n remove(id: string): Promise<void> {\n return this.store.remove(id);\n }\n\n /**\n * Changes the attempt count of a stored batch.\n * @param id Batch id.\n * @param attempts Total attempt count to store.\n * @returns Promise that resolves when the change completes.\n */\n bumpAttempts(id: string, attempts: number): Promise<void> {\n return this.store.bumpAttempts(id, attempts);\n }\n\n /**\n * Applies the retention and capacity limits of the underlying store.\n * @returns Summary of the batches and records removed.\n */\n prune(): ReturnType<StorageAdapter[\"prune\"]> {\n return this.store.prune();\n }\n\n /**\n * Counts stored batches of this context.\n * @returns Number of batches in this context.\n */\n async count(): Promise<number> {\n if (!this.isolated()) {\n return this.store.count();\n }\n\n if (this.store.countContext) {\n return this.store.countContext(this.policy.id);\n }\n\n return (await this.take(Number.MAX_SAFE_INTEGER)).length;\n }\n\n /**\n * Removes stored batches of this context.\n * @returns Promise that resolves when removal completes.\n */\n async clear(): Promise<void> {\n for (const batch of await this.take(Number.MAX_SAFE_INTEGER)) await this.store.remove(batch.id);\n }\n\n /**\n * Stops new writes and clears this context if required. Other contexts can keep the memory store.\n * @param discard True to remove this context before closing the store.\n * @returns Promise that resolves when removal and closure complete.\n */\n async retire(discard: boolean): Promise<void> {\n this.active = false;\n this.discard = discard;\n if (discard) await this.clear();\n // Keep the memory store for later context changes. It can hold records of other contexts.\n if (this.name !== \"memory\") await this.close();\n }\n\n /**\n * Removes all batches in the application namespace.\n * @returns Promise that resolves when removal completes.\n */\n clearNamespace(): Promise<void> {\n return this.store.clear();\n }\n\n /**\n * Closes the underlying store.\n * @returns Promise that resolves when closure completes.\n */\n close(): Promise<void> {\n return this.store.close();\n }\n}\n"],"mappings":";AASA,IAAaA,IAAb,MAAsD;CAejC;CACA;CACR;CAfX;CAEA,SAAiB;CAEjB,UAAkB;CAQlB,YACE,GACA,GACA,IAAqB,IACrB;EACA,AAJiB,KAAA,QAAAC,GACA,KAAA,SAAAC,GACR,KAAA,YAAAC,GAET,KAAK,OAAOF,EAAM;CACpB;CAOA,QAAQ,GAA0B;EAChC,QACGG,EAAM,wBAAwB,QAAQ,KAAK,cAC3C,CAAC,KAAK,OAAO,aAAa,CAAC,KAAK,OAAO,MAAMA,EAAM,qBAAqB,KAAK,OAAO;CAEzF;CAOA,MAAM,KAAK,GAAgC;EACzC,AAAK,KAAK,UAAW,KAAK,QAAQA,CAAK,MACvC,MAAM,KAAK,MAAM,KAAKA,CAAK,GAEvB,KAAK,WAAS,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE;CACpD;CAOA,MAAM,KAAK,GAAoC;EAW7C,OATK,KAAK,SAAS,IAIf,KAAK,MAAM,cACN,KAAK,MAAM,YAAY,KAAK,OAAO,IAAIC,CAAK,KAI9C,MADW,KAAK,MAAM,KAAK,UAAU,EAAA,CACjC,QAAQ,MAAU,KAAK,QAAQD,CAAK,CAAC,CAAC,CAAC,MAAM,GAAGC,CAAK,KARtD,MAAM,KAAK,MAAM,KAAKA,CAAK,EAAA,CAAG,QAAQ,MAAU,KAAK,QAAQD,CAAK,CAAC;CAS/E;CAMA,WAA4B;EAC1B,OAAO,KAAK,OAAO,aAAa,KAAK,OAAO,OAAO;CACrD;CAOA,OAAO,GAA2B;EAChC,OAAO,KAAK,MAAM,OAAOE,CAAE;CAC7B;CAQA,aAAa,GAAY,GAAiC;EACxD,OAAO,KAAK,MAAM,aAAaA,GAAIC,CAAQ;CAC7C;CAMA,QAA6C;EAC3C,OAAO,KAAK,MAAM,MAAM;CAC1B;CAMA,MAAM,QAAyB;EAS7B,OARK,KAAK,SAAS,IAIf,KAAK,MAAM,eACN,KAAK,MAAM,aAAa,KAAK,OAAO,EAAE,KAGvC,MAAM,KAAK,gBAA4B,EAAA,CAAG,SAPzC,KAAK,MAAM,MAAM;CAQ5B;CAMA,MAAM,QAAuB;EAC3B,KAAK,IAAMH,KAAS,MAAM,KAAK,gBAA4B,GAAG,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE;CAChG;CAOA,MAAM,OAAO,GAAiC;EAK5C,AAJA,KAAK,SAAS,IACd,KAAK,UAAUI,GACXA,KAAS,MAAM,KAAK,MAAM,GAE1B,KAAK,SAAS,YAAU,MAAM,KAAK,MAAM;CAC/C;CAMA,iBAAgC;EAC9B,OAAO,KAAK,MAAM,MAAM;CAC1B;CAMA,QAAuB;EACrB,OAAO,KAAK,MAAM,MAAM;CAC1B;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Category of a breadcrumb event. */
|
|
2
|
-
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console" | "frame";
|
|
2
|
+
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console" | "frame" | "custom";
|
|
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. */
|
|
@@ -14,7 +14,7 @@ export interface Breadcrumb {
|
|
|
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
|
-
private
|
|
17
|
+
private buffer;
|
|
18
18
|
/** Next write index in the circular buffer. */
|
|
19
19
|
private pointer;
|
|
20
20
|
/**
|
|
@@ -23,16 +23,23 @@ export declare class BreadcrumbBuffer {
|
|
|
23
23
|
*/
|
|
24
24
|
private filled;
|
|
25
25
|
/** Maximum number of breadcrumbs that the buffer keeps. */
|
|
26
|
-
private
|
|
26
|
+
private capacity;
|
|
27
27
|
/**
|
|
28
28
|
* @param capacity Maximum number of breadcrumbs. A smaller value changes to the minimum size.
|
|
29
29
|
*/
|
|
30
30
|
constructor(capacity: number);
|
|
31
|
+
/**
|
|
32
|
+
* Changes the capacity and keeps the most recent breadcrumbs that fit.
|
|
33
|
+
* @param capacity New capacity. Set 0 to remove and disable stored breadcrumbs.
|
|
34
|
+
*/
|
|
35
|
+
resize(capacity: number): void;
|
|
31
36
|
/**
|
|
32
37
|
* Adds a breadcrumb. When the buffer is full, the new breadcrumb replaces the oldest one.
|
|
33
38
|
* @param crumb Breadcrumb to add.
|
|
34
39
|
*/
|
|
35
40
|
push(crumb: Breadcrumb): void;
|
|
41
|
+
/** Removes all breadcrumbs. A new session must not carry the trail of the previous user. */
|
|
42
|
+
clear(): void;
|
|
36
43
|
/**
|
|
37
44
|
* Returns all stored breadcrumbs ordered from oldest to newest.
|
|
38
45
|
* @returns List of breadcrumbs in time order.
|
package/dist/core/context.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export declare class ContextStore {
|
|
|
18
18
|
* @param key Attribute key to remove.
|
|
19
19
|
*/
|
|
20
20
|
remove(key: string): void;
|
|
21
|
+
/** Removes all ambient context attributes. */
|
|
22
|
+
clear(): void;
|
|
21
23
|
/**
|
|
22
24
|
* Returns a copy of all ambient context attributes. The copy prevents a merge
|
|
23
25
|
* target or a sanitizer from changing the store.
|
|
@@ -1,5 +1,5 @@
|
|
|
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" | "record.dropped_no_destination" | "runtime.version_mismatch" | "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" | "capture.transport_request" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
|
|
2
|
+
export type DiagnosticCode = "config.locked" | "security.rotated" | "security.context_mismatch" | "record.dropped_during_rotation" | "bus.rejected_message" | "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_processor" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "record.dropped_no_destination" | "runtime.version_mismatch" | "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" | "capture.transport_request" | "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. */
|
|
@@ -20,7 +20,8 @@ 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
|
-
private
|
|
23
|
+
private throttleMs;
|
|
24
|
+
private consoleFallback;
|
|
24
25
|
/** Running occurrence counts per diagnostic code. */
|
|
25
26
|
private readonly counters;
|
|
26
27
|
/** Timestamp of last emitted event per code in epoch milliseconds. */
|
|
@@ -28,8 +29,15 @@ export declare class Diagnostics {
|
|
|
28
29
|
/**
|
|
29
30
|
* @param handler Optional diagnostic event listener callback.
|
|
30
31
|
* @param throttleMs Minimum duration in milliseconds between emitted events for a single code.
|
|
32
|
+
* @param consoleFallback True to print a fixed warning if the diagnostic handler throws.
|
|
31
33
|
*/
|
|
32
|
-
constructor(handler?: DiagnosticHandler | undefined, throttleMs?: number);
|
|
34
|
+
constructor(handler?: DiagnosticHandler | undefined, throttleMs?: number, consoleFallback?: boolean);
|
|
35
|
+
/**
|
|
36
|
+
* Changes the report interval and the console fallback rule.
|
|
37
|
+
* @param throttleMs Minimum wait between reports of one code, in milliseconds.
|
|
38
|
+
* @param consoleFallback True to print a fixed warning if the handler throws.
|
|
39
|
+
*/
|
|
40
|
+
setPolicy(throttleMs: number, consoleFallback: boolean): void;
|
|
33
41
|
/**
|
|
34
42
|
* Updates or removes the active diagnostic event handler.
|
|
35
43
|
* @param handler New diagnostic event handler.
|
package/dist/core/journey.d.ts
CHANGED
|
@@ -68,6 +68,13 @@ export declare class JourneyEngine {
|
|
|
68
68
|
parent?: boolean;
|
|
69
69
|
id?: string;
|
|
70
70
|
}): Journey;
|
|
71
|
+
/**
|
|
72
|
+
* Gives the id of a new journey. A longer id, or an id with multibyte characters, makes the
|
|
73
|
+
* journey token too long for adoptJourney().
|
|
74
|
+
* @param requested Id from the app, or undefined.
|
|
75
|
+
* @returns The requested id when it matches JOURNEY_ID_PATTERN, else a new id.
|
|
76
|
+
*/
|
|
77
|
+
private journeyId;
|
|
71
78
|
/** Ends the active journey and broadcasts the change. */
|
|
72
79
|
end(): void;
|
|
73
80
|
/**
|
package/dist/core/meter.d.ts
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
import type { InstrumentDef, MetricAttributes } from "../models/metric";
|
|
1
|
+
import type { Counter, Histogram, HistogramOptions, InstrumentDef, InstrumentOptions, MetricAttributes } from "../models/metric";
|
|
2
2
|
import type { Diagnostics } from "./diagnostics";
|
|
3
|
+
/** Adds a value to an instrument of the runtime. */
|
|
4
|
+
export type RecordMetric = (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Makes a counter handle.
|
|
7
|
+
* @param name Metric name.
|
|
8
|
+
* @param options Unit of the values.
|
|
9
|
+
* @param record Adds a value to the instrument.
|
|
10
|
+
* @returns The counter.
|
|
11
|
+
*/
|
|
12
|
+
export declare function makeCounter(name: string, options: InstrumentOptions, record: RecordMetric): Counter;
|
|
13
|
+
/**
|
|
14
|
+
* Makes a histogram handle.
|
|
15
|
+
* @param name Metric name.
|
|
16
|
+
* @param options Unit of the values and the bucket boundaries.
|
|
17
|
+
* @param record Adds a value to the instrument.
|
|
18
|
+
* @returns The histogram.
|
|
19
|
+
*/
|
|
20
|
+
export declare function makeHistogram(name: string, options: HistogramOptions, record: RecordMetric): Histogram;
|
|
3
21
|
/** Sums the values of the counter and histogram instruments for one interval. */
|
|
4
22
|
export declare class Meter {
|
|
5
23
|
private readonly intervalMs;
|
|
6
24
|
private readonly emit;
|
|
7
25
|
private readonly diagnostics;
|
|
26
|
+
private readonly policy;
|
|
8
27
|
/** Instruments with a value in the current interval. */
|
|
9
28
|
private readonly instruments;
|
|
10
29
|
/** Timer of the current interval. It runs only while a value waits. */
|
|
@@ -17,7 +36,11 @@ export declare class Meter {
|
|
|
17
36
|
* metric fields.
|
|
18
37
|
* @param diagnostics Diagnostics reporter.
|
|
19
38
|
*/
|
|
20
|
-
constructor(intervalMs: () => number, emit: (name: string, attributes: MetricAttributes, fields: Record<string, unknown>) => void, diagnostics: Diagnostics
|
|
39
|
+
constructor(intervalMs: () => number, emit: (name: string, attributes: MetricAttributes, fields: Record<string, unknown>) => void, diagnostics: Diagnostics, policy?: {
|
|
40
|
+
maxSeries: number;
|
|
41
|
+
maxInstruments: number;
|
|
42
|
+
maxHistogramBoundaries: number;
|
|
43
|
+
});
|
|
21
44
|
/**
|
|
22
45
|
* Adds a value to the series of its attribute set. It never throws into the call of the app.
|
|
23
46
|
* @param def Definition of the instrument.
|
package/dist/core/pipeline.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ResolvedConfig } from "../models/config";
|
|
2
|
+
import type { LossReporter } from "../models/drop";
|
|
1
3
|
import type { LogBatch } from "../models/batch";
|
|
2
4
|
import { type LogRecord } from "../models/log-record";
|
|
3
5
|
import type { StorageAdapter } from "../models/storage";
|
|
@@ -5,7 +7,7 @@ import type { BatchTransport } from "../transport/status-transport";
|
|
|
5
7
|
import type { RetryEngine } from "../transport/retry-engine";
|
|
6
8
|
import type { Diagnostics } from "./diagnostics";
|
|
7
9
|
/** Name of a pipeline stream. */
|
|
8
|
-
export type StreamName = "logs" | "metrics";
|
|
10
|
+
export type StreamName = "logs" | "metrics" | "traces";
|
|
9
11
|
/** Batching policy for one record stream. */
|
|
10
12
|
export interface StreamOptions {
|
|
11
13
|
/** Maximum time in milliseconds that a partial batch waits before the pipeline sends it. */
|
|
@@ -19,6 +21,9 @@ export declare class LogPipeline {
|
|
|
19
21
|
private readonly storage;
|
|
20
22
|
private readonly retry;
|
|
21
23
|
private readonly diagnostics;
|
|
24
|
+
private readonly routingContextId?;
|
|
25
|
+
private readonly policy?;
|
|
26
|
+
private readonly onLoss;
|
|
22
27
|
/** Buffer instances for logs and metrics streams. */
|
|
23
28
|
private readonly streams;
|
|
24
29
|
/** In-flight batches without delivery confirmation. The exit flush sends them again. */
|
|
@@ -29,12 +34,34 @@ export declare class LogPipeline {
|
|
|
29
34
|
private readonly open;
|
|
30
35
|
/** Ceiling on the ERROR and FATAL records that bypass sampling. */
|
|
31
36
|
private readonly ceiling;
|
|
32
|
-
/**
|
|
37
|
+
/** Requests that have not completed. delivery.maxConcurrentRequests sets their limit. */
|
|
33
38
|
private inFlight;
|
|
34
39
|
/** It is true when a pump is in the queue. One microtask then drains a burst. */
|
|
35
40
|
private pumpScheduled;
|
|
36
41
|
/** True after destroy() stops the pipeline. */
|
|
37
42
|
private stopped;
|
|
43
|
+
/** Encoded byte count of each record in the buffers or requests. */
|
|
44
|
+
private readonly held;
|
|
45
|
+
/** Total encoded bytes of the held records. */
|
|
46
|
+
private heldBytes;
|
|
47
|
+
/** True while the overflow storage operation has not completed. */
|
|
48
|
+
private persisting;
|
|
49
|
+
/**
|
|
50
|
+
* Removes completed or dropped records from the buffer counts.
|
|
51
|
+
* @param records Records to remove from the counts.
|
|
52
|
+
*/
|
|
53
|
+
private release;
|
|
54
|
+
/**
|
|
55
|
+
* Removes records that have not reached the transport. A request already sent cannot be removed.
|
|
56
|
+
* @returns True if the method removed a batch or a buffered group.
|
|
57
|
+
*/
|
|
58
|
+
private evict;
|
|
59
|
+
/**
|
|
60
|
+
* Checks the buffer limits and applies the overflow rule.
|
|
61
|
+
* @param record New record to add.
|
|
62
|
+
* @returns True if the record can enter the live buffer.
|
|
63
|
+
*/
|
|
64
|
+
private admit;
|
|
38
65
|
/**
|
|
39
66
|
* @param transport HTTP transport for live batch delivery.
|
|
40
67
|
* @param storage Storage adapter for offline batch persistence.
|
|
@@ -42,7 +69,7 @@ export declare class LogPipeline {
|
|
|
42
69
|
* @param diagnostics Diagnostics reporter.
|
|
43
70
|
* @param streamOptions Batching policy per stream, from the batching config.
|
|
44
71
|
*/
|
|
45
|
-
constructor(transport: BatchTransport, storage: StorageAdapter, retry: RetryEngine, diagnostics: Diagnostics, streamOptions: Record<StreamName, StreamOptions
|
|
72
|
+
constructor(transport: BatchTransport, storage: StorageAdapter, retry: RetryEngine, diagnostics: Diagnostics, streamOptions: Record<StreamName, StreamOptions>, routingContextId?: (() => string | undefined) | undefined, policy?: ResolvedConfig | undefined, onLoss?: LossReporter);
|
|
46
73
|
/**
|
|
47
74
|
* Sets the observed timestamp and adds a record to the pipeline.
|
|
48
75
|
* @param record Record to push.
|
|
@@ -53,8 +80,8 @@ export declare class LogPipeline {
|
|
|
53
80
|
* Records already given to fetch go again under a new batch ID. The server cannot
|
|
54
81
|
* deduplicate them. Thus the exit flush can deliver duplicates. This is intentional.
|
|
55
82
|
* A closing document cannot confirm delivery.
|
|
56
|
-
* @returns One batch
|
|
57
|
-
*
|
|
83
|
+
* @returns One batch for each stream, metrics first. A stream with no records has no batch.
|
|
84
|
+
* A mixed batch sends a metric to the endpoint of the logs.
|
|
58
85
|
*/
|
|
59
86
|
drainForExit(): LogBatch[];
|
|
60
87
|
/**
|
|
@@ -64,6 +91,14 @@ export declare class LogPipeline {
|
|
|
64
91
|
* @returns Promise that resolves when the pipeline sends or stores each batch, or on destroy.
|
|
65
92
|
*/
|
|
66
93
|
flushPending(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Counts the records that wait and the records in requests.
|
|
96
|
+
* @returns Records in the buffers and the queue, and records in dispatch.
|
|
97
|
+
*/
|
|
98
|
+
counts(): {
|
|
99
|
+
pending: number;
|
|
100
|
+
inFlight: number;
|
|
101
|
+
};
|
|
67
102
|
/** Stops the flush timers and refuses further records. */
|
|
68
103
|
destroy(): void;
|
|
69
104
|
/**
|
|
@@ -75,7 +110,7 @@ export declare class LogPipeline {
|
|
|
75
110
|
/**
|
|
76
111
|
* Sorts a record into its stream. Sampling already ran. RecordBuilder samples a local
|
|
77
112
|
* record. The runtime samples a forwarded record. This method catches each fault.
|
|
78
|
-
* A record without `attributes` makes
|
|
113
|
+
* A record without `attributes` makes streamOf throw. An uncaught throw goes into the
|
|
79
114
|
* log call of the caller.
|
|
80
115
|
* @param record Record to sort.
|
|
81
116
|
*/
|
package/dist/core/record.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Identity } from "../utils/identity";
|
|
|
4
4
|
import { type PlatformMetadata } from "../utils/platform";
|
|
5
5
|
import { type SanitizeLimits } from "../utils/sanitize";
|
|
6
6
|
import type { Sequence } from "../utils/sequence";
|
|
7
|
-
import type { TraceEngine } from "../utils/tracing";
|
|
7
|
+
import type { TraceContext, TraceEngine } from "../utils/tracing";
|
|
8
8
|
import type { ContextStore } from "./context";
|
|
9
9
|
import type { Diagnostics } from "./diagnostics";
|
|
10
10
|
import type { JourneyEngine } from "./journey";
|
|
@@ -40,10 +40,10 @@ export interface RecordLimits extends SanitizeLimits {
|
|
|
40
40
|
maxRecordBytes: number;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Reason a record was not built. "malformed" means the redact hook broke the
|
|
44
|
-
* or set an unknown severityText.
|
|
43
|
+
* Reason a record was not built. "malformed" means a processor or the redact hook broke the
|
|
44
|
+
* record shape or set an unknown severityText.
|
|
45
45
|
*/
|
|
46
|
-
export type DropReason = "level" | "sampling" | "redact" | "malformed";
|
|
46
|
+
export type DropReason = "level" | "sampling" | "processor" | "redact" | "malformed";
|
|
47
47
|
/** Outcome of one build call. */
|
|
48
48
|
export interface BuildResult {
|
|
49
49
|
/** Completed record, or null when the builder drops it. */
|
|
@@ -72,6 +72,8 @@ export interface BuildInput {
|
|
|
72
72
|
fixed?: Record<string, unknown>;
|
|
73
73
|
/** True for a point of a counter or histogram. Sampling keeps it. */
|
|
74
74
|
aggregated?: boolean;
|
|
75
|
+
/** Trace IDs of a span. Without them, the builder reads the active trace. */
|
|
76
|
+
trace?: TraceContext;
|
|
75
77
|
}
|
|
76
78
|
/** Builds validated and sanitized LogRecord instances from logger inputs. */
|
|
77
79
|
export declare class RecordBuilder {
|
|
@@ -85,19 +87,50 @@ export declare class RecordBuilder {
|
|
|
85
87
|
/** Clears the cached resource attributes. The next build computes them again. */
|
|
86
88
|
invalidateResource(): void;
|
|
87
89
|
/**
|
|
88
|
-
* Checks if logging is on and the level is at or above
|
|
89
|
-
*
|
|
90
|
+
* Checks if logging is on and the level is at or above the minimum level of the namespace.
|
|
91
|
+
* The minimum level does not apply to an action or a metric.
|
|
90
92
|
* @param level Target log severity level.
|
|
91
|
-
* @param
|
|
93
|
+
* @param namespace Logger namespace. `minLevels` can set its level.
|
|
94
|
+
* @param type Record type. Without it, the check applies the minimum level.
|
|
92
95
|
* @returns True if the library builds a record of this level and type.
|
|
93
96
|
*/
|
|
94
|
-
isEnabled(level: LogLevel, type?: LogType): boolean;
|
|
97
|
+
isEnabled(level: LogLevel, namespace: string, type?: LogType): boolean;
|
|
95
98
|
/**
|
|
96
99
|
* Builds a structured LogRecord from the input. It sanitizes attributes and applies size limits.
|
|
97
100
|
* @param input Logger call input parameters.
|
|
101
|
+
* @param forConsole True to skip delivery sampling and level checks. Privacy hooks still run.
|
|
98
102
|
* @returns The record, or null with the reason of the drop.
|
|
99
103
|
*/
|
|
100
|
-
build(input: BuildInput): BuildResult;
|
|
104
|
+
build(input: BuildInput, forConsole?: boolean): BuildResult;
|
|
105
|
+
/**
|
|
106
|
+
* Runs the redact hook on a record from another context. A child context without redact
|
|
107
|
+
* forwards raw records. The sender is the last privacy gate.
|
|
108
|
+
* @param record Forwarded record.
|
|
109
|
+
* @returns The record to deliver, or null when the hook drops it.
|
|
110
|
+
*/
|
|
111
|
+
redactForwarded(record: LogRecord): LogRecord | null;
|
|
112
|
+
/**
|
|
113
|
+
* Runs the hooks in order. Then it sanitizes and measures the attributes again.
|
|
114
|
+
* @param record Built record.
|
|
115
|
+
* @param stages Hooks and their stages.
|
|
116
|
+
* @param fixed Fields that the library builds. The hooks cannot change them.
|
|
117
|
+
* @returns The record and the size of its attributes, or the reason of the drop.
|
|
118
|
+
*/
|
|
119
|
+
private applyHooks;
|
|
120
|
+
/**
|
|
121
|
+
* Runs one consumer hook on a record. A processor and the redact hook have the same contract.
|
|
122
|
+
* @param hook Processor or redact hook.
|
|
123
|
+
* @param stage Stage of the hook.
|
|
124
|
+
* @param record Record before the hook.
|
|
125
|
+
* @returns The record after the hook, or the reason of the drop.
|
|
126
|
+
*/
|
|
127
|
+
private runHook;
|
|
128
|
+
/**
|
|
129
|
+
* Calls the contextProvider of the config. A provider that throws or gives a value that is not
|
|
130
|
+
* an object adds nothing. The record is still built. undefined means no attributes.
|
|
131
|
+
* @returns The attributes from the provider, or an empty object.
|
|
132
|
+
*/
|
|
133
|
+
private provided;
|
|
101
134
|
/**
|
|
102
135
|
* Computes or returns cached resource metadata for this runtime context.
|
|
103
136
|
* @returns Resource attributes record.
|
|
@@ -9,6 +9,8 @@ export interface RemoteRules {
|
|
|
9
9
|
rates: Record<string, number>;
|
|
10
10
|
/** Lowest level that the library sends. It can only lower `minLevel`. */
|
|
11
11
|
minLevel?: LogLevel;
|
|
12
|
+
/** Lowest level for each namespace prefix. It can only lower the level of the config. */
|
|
13
|
+
minLevels?: Record<string, LogLevel>;
|
|
12
14
|
}
|
|
13
15
|
/** Rules and their TTL, after validation. */
|
|
14
16
|
export interface RemoteUpdate {
|
|
@@ -53,10 +55,12 @@ export declare class RemoteSampling {
|
|
|
53
55
|
*/
|
|
54
56
|
current(): RemoteRules | null;
|
|
55
57
|
/**
|
|
56
|
-
* Returns the lowest level that the library sends.
|
|
57
|
-
*
|
|
58
|
+
* Returns the lowest level that the library sends for a namespace. A remote prefix level wins
|
|
59
|
+
* over the remote `minLevel`. A remote level applies only when it is lower than the config level.
|
|
60
|
+
* @param namespace Target application namespace.
|
|
61
|
+
* @returns The lower of the remote level and the config level of the namespace.
|
|
58
62
|
*/
|
|
59
|
-
|
|
63
|
+
minLevelFor(namespace: string): LogLevel;
|
|
60
64
|
/**
|
|
61
65
|
* Returns the rules in force in the shape of the header, with the remaining TTL.
|
|
62
66
|
* @returns The rules, or null if no rules are in force.
|