@utk09/ui-observability 0.9.4 → 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 +45 -0
- package/README.md +122 -94
- package/dist/batch-BQFtb3i5.cjs +2 -0
- package/dist/batch-BQFtb3i5.cjs.map +1 -0
- package/dist/{batch-D-4xl7op.js → batch-BUJh-1jZ.js} +7 -5
- 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/storm.d.ts +2 -1
- package/dist/capture/types.d.ts +2 -0
- package/dist/{console-Boqa7new.cjs → console-Ce6heqZZ.cjs} +2 -2
- package/dist/console-Ce6heqZZ.cjs.map +1 -0
- package/dist/{console-BT7mcgU6.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 +29 -9
- 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 +7 -2
- package/dist/core/context.d.ts +2 -0
- package/dist/core/diagnostics.d.ts +11 -3
- package/dist/core/meter.d.ts +6 -1
- package/dist/core/pipeline.d.ts +29 -2
- package/dist/core/record.d.ts +2 -1
- package/dist/core/runtime.d.ts +91 -3
- package/dist/core/sampling.d.ts +3 -1
- package/dist/core/sender.d.ts +35 -1
- 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-BDI96zKc.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 +45 -7
- package/dist/index.js +908 -529
- 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-HgkQUTyS.js → indexeddb-storage-CCA1LvtO.js} +33 -18
- package/dist/indexeddb-storage-CCA1LvtO.js.map +1 -0
- package/dist/{interactions-Ck01cEij.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-DRK0A8u_.js → journey-BUJ4WJxP.js} +12 -12
- package/dist/{journey-DRK0A8u_.js.map → journey-BUJ4WJxP.js.map} +1 -1
- package/dist/{journey-Co9OlzrW.cjs → journey-B_tTnvac.cjs} +2 -2
- package/dist/{journey-Co9OlzrW.cjs.map → journey-B_tTnvac.cjs.map} +1 -1
- 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-ChCar5F8.js → library-request-BKOcaKtQ.js} +2 -2
- package/dist/{library-request-ChCar5F8.js.map → library-request-BKOcaKtQ.js.map} +1 -1
- package/dist/{library-request-gMFOCNcn.cjs → library-request-BaZOi4eg.cjs} +2 -2
- package/dist/{library-request-gMFOCNcn.cjs.map → library-request-BaZOi4eg.cjs.map} +1 -1
- package/dist/{long-frames-Bky6nZDF.cjs → long-frames-CF3qiSAX.cjs} +2 -2
- package/dist/long-frames-CF3qiSAX.cjs.map +1 -0
- package/dist/{long-frames-DDumopji.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 +347 -9
- package/dist/models/drop.d.ts +1 -1
- package/dist/models/health.d.ts +27 -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-BsBZ6_-Q.js → network-DdzXDI3J.js} +18 -16
- 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-4yYjMD-B.js → platform-Bw1btWCT.js} +16 -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-1KqfVBIu.js → remote-rules-DIcC5vVC.js} +3 -3
- package/dist/{remote-rules-1KqfVBIu.js.map → remote-rules-DIcC5vVC.js.map} +1 -1
- package/dist/{remote-rules-BHgEGlYi.cjs → remote-rules-DpFmOef2.cjs} +2 -2
- package/dist/{remote-rules-BHgEGlYi.cjs.map → remote-rules-DpFmOef2.cjs.map} +1 -1
- package/dist/sampling-BVjspJWu.cjs +2 -0
- package/dist/sampling-BVjspJWu.cjs.map +1 -0
- package/dist/{sampling-nYIWP_vP.js → sampling-Cm3WhI0a.js} +26 -36
- package/dist/sampling-Cm3WhI0a.js.map +1 -0
- package/dist/{sanitize-BiUKCUG6.js → sanitize-C-ahCFsG.js} +2 -2
- package/dist/{sanitize-BiUKCUG6.js.map → sanitize-C-ahCFsG.js.map} +1 -1
- package/dist/{sanitize-BxuPSXOk.cjs → sanitize-DHucKGdi.cjs} +2 -2
- package/dist/{sanitize-BxuPSXOk.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/retry-engine.d.ts +7 -2
- package/dist/transport/status-transport.d.ts +17 -0
- package/dist/types-BR9t_w28.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/utils/fixed-window.d.ts +9 -0
- package/dist/utils/identity.d.ts +9 -2
- package/dist/utils/lock.d.ts +8 -0
- package/dist/utils/openfin.d.ts +1 -1
- package/dist/utils/platform.d.ts +3 -1
- 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-C4oF6XZT.cjs +0 -2
- package/dist/batch-C4oF6XZT.cjs.map +0 -1
- package/dist/batch-D-4xl7op.js.map +0 -1
- package/dist/bus-Cyvq-Ngx.js +0 -478
- package/dist/bus-Cyvq-Ngx.js.map +0 -1
- package/dist/bus-rOhVuRee.cjs +0 -2
- package/dist/bus-rOhVuRee.cjs.map +0 -1
- package/dist/console-BT7mcgU6.js.map +0 -1
- package/dist/console-Boqa7new.cjs.map +0 -1
- package/dist/constants-BgRS6MB0.cjs +0 -2
- package/dist/constants-BgRS6MB0.cjs.map +0 -1
- package/dist/constants-L_d5YvvQ.js +0 -160
- package/dist/constants-L_d5YvvQ.js.map +0 -1
- package/dist/errors-BDI96zKc.js.map +0 -1
- package/dist/errors-_xEsCVXn.cjs +0 -3
- package/dist/errors-_xEsCVXn.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-Bwku7zzN.cjs +0 -2
- package/dist/identity-Bwku7zzN.cjs.map +0 -1
- package/dist/identity-Dtv917nz.js +0 -98
- package/dist/identity-Dtv917nz.js.map +0 -1
- package/dist/indexeddb-storage-Cvavrf-y.cjs +0 -2
- package/dist/indexeddb-storage-Cvavrf-y.cjs.map +0 -1
- package/dist/indexeddb-storage-HgkQUTyS.js.map +0 -1
- package/dist/interactions-Bhe1ft8P.cjs +0 -2
- package/dist/interactions-Bhe1ft8P.cjs.map +0 -1
- package/dist/interactions-Ck01cEij.js.map +0 -1
- package/dist/log-record-cwFiLyPY.js +0 -17
- package/dist/log-record-cwFiLyPY.js.map +0 -1
- package/dist/log-record-jX9eWUP8.cjs +0 -2
- package/dist/log-record-jX9eWUP8.cjs.map +0 -1
- package/dist/long-frames-Bky6nZDF.cjs.map +0 -1
- package/dist/long-frames-DDumopji.js.map +0 -1
- package/dist/network-BsBZ6_-Q.js.map +0 -1
- package/dist/network-_4csBGBM.cjs +0 -2
- package/dist/network-_4csBGBM.cjs.map +0 -1
- package/dist/platform-4yYjMD-B.js.map +0 -1
- package/dist/platform-o7r1ocOu.cjs +0 -2
- package/dist/platform-o7r1ocOu.cjs.map +0 -1
- package/dist/sampling-C4my-ma0.cjs +0 -2
- package/dist/sampling-C4my-ma0.cjs.map +0 -1
- package/dist/sampling-nYIWP_vP.js.map +0 -1
- package/dist/sender-6vrT9fFL.cjs +0 -3
- package/dist/sender-6vrT9fFL.cjs.map +0 -1
- package/dist/sender-DFQMF39P.js +0 -1351
- package/dist/sender-DFQMF39P.js.map +0 -1
- package/dist/storm-6YYbXzT_.cjs +0 -2
- package/dist/storm-6YYbXzT_.cjs.map +0 -1
- package/dist/storm-CfO0Sam2.js +0 -10
- package/dist/storm-CfO0Sam2.js.map +0 -1
- package/dist/web-socket-Ar4cZxmd.js +0 -102
- package/dist/web-socket-Ar4cZxmd.js.map +0 -1
- package/dist/web-socket-BwJdwSHl.cjs +0 -2
- package/dist/web-socket-BwJdwSHl.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [0.9.5] - 2026-11-01
|
|
6
|
+
|
|
7
|
+
### Added - v0.9.5
|
|
8
|
+
|
|
9
|
+
- `rotateSecurityContext(update, options?)` changes the delivery identity and settings together. The `pending` rule is `"discard"`, `"flush"`, `"retain"` or `"carry"`. The default is `"discard"`. `"carry"` moves each stored batch to the new id with no attempts. The retry engine sends it. Logger calls during this step go to the new context. Without a new destination, the stored batches stay parked under the old id. `newSession()` stays a correlation change. Use awaited rotation for logout or tenant changes.
|
|
10
|
+
- `lockConfiguration` refuses changes through `configure()`. Identical repeated settings are accepted. `setConfigurationLocked(false)` permits changes again. Explicit context rotation stays available while configuration is locked.
|
|
11
|
+
- `getHealth()` reports SDK versions, runtime state, delivery role and counts, configuration lock state, cache usage and security/bus policies. Version conflicts and context conflicts have machine-readable issue codes. A configured console-only runtime can report `"ready"`.
|
|
12
|
+
- `registerFrame(frame, options)` binds a child window to an exact origin and source permissions. It accepts an iframe element or a `Window`, also a cross-origin one. `registerWorker(worker, options?)` now accepts permissions. Both functions return a function that removes the registration. The default permission is `"records"`. Journey and sampling access need separate permissions.
|
|
13
|
+
- `bus.sourcePolicy`, `bus.validation` and bus budgets control source checks, message checks, message bytes, record counts, message rates and named source tracking. A registration binds its exact origin under each source policy. Limits can be disabled where documented.
|
|
14
|
+
- `loggerCache.maxEntries` sets the LRU logger cache limit. The default is 256. Set 0 for no cache or null for no limit. A logger that the app holds stays valid after removal from the cache.
|
|
15
|
+
- `delivery` sets request timeouts, request concurrency, retry delays and the number of batches in one stored delivery pass.
|
|
16
|
+
- `buffering` sets live record and encoded-byte limits. Its overflow rule removes old records, drops new records or tries storage. A record larger than the byte limit is dropped alone. The storage rule permits only one overflow write at a time.
|
|
17
|
+
- `metrics` sets limits for instrument names, attribute sets and histogram boundaries. `correlation` sets session and trace timing. Correlation settings take effect at startup.
|
|
18
|
+
- `capturePolicy` sets breadcrumb capacity, error duplicate checks, capture rate limits and the pipeline error ceiling. `diagnostics` sets the report interval and the console fallback rule.
|
|
19
|
+
- `persistence.namespace` separates application batch stores, emergency queues and retry lock names. It takes effect at startup. `clearPersistedLogs()` removes the stored records of the active context. `clearPersistedLogs("namespace")` removes the stored records of all contexts in that namespace. Pending requests can store records again after removal.
|
|
20
|
+
- `metadata` controls page URL, user agent and OpenFin resource fields. `capture.urlTransform` replaces the default URL formatting rule. It receives the original URL. Null, an invalid result or an exception gives an empty URL. An exception reports `capture.record_failed`.
|
|
21
|
+
- Custom transport requests include `signal` and `routingContextId`. A custom transport must check the signal to cancel its own work when the old context stops.
|
|
22
|
+
|
|
23
|
+
### Changed - v0.9.5
|
|
24
|
+
|
|
25
|
+
- Enabled click capture records a stable `data-observability-action` value, or `"unknown-click"`, by default. `capture.interactions.actionAttribute` selects another attribute, for example `data-testid`. It does not record text or selectors. The object form of `capture.interactions` can enable those details. Selectors are in `breadcrumb.data.selector`. `ignoreSelector: null` permits capture in all regions.
|
|
26
|
+
- Delivery is isolated by context by default. Replay after a page reload requires an explicit stable `securityContext.id`. Batches from other contexts and old batches without an id stay stored. Storage retention and capacity limits still apply to them. Set `securityContext.isolation: false` to permit cross-context replay and ordinary delivery reconfiguration.
|
|
27
|
+
- With isolation enabled, changes to delivery settings or identity use `rotateSecurityContext()` instead of `configure()`. `configure()` keeps the delivery settings in force, reports `config.invalid` and applies its other settings. Delivery fields not supplied during rotation reset to their defaults. Old credentials and signal endpoints are not retained. Calls logged during rotation are dropped and counted.
|
|
28
|
+
- Child-frame forwarding requires registration by default, including the same-origin direct path. Select `bus.sourcePolicy: "trusted-origin"` to permit automatic source discovery by origin. Message validation defaults to `"strict"`.
|
|
29
|
+
- Bus messages use the envelope tag `ui-observability/2` and longer type names, for example `ui-observability.message.hello`. A frame on an earlier version ignores them. Load the same library version in each frame.
|
|
30
|
+
- The owner sends a new delivery identity to registered frames, workers and OpenFin views. A forwarder that knows its owner welcomes its own children. It relays their records. It sends them the identity of its owner. The first identity that a forwarder takes keeps its startup records. When the owner identity later changes, a forwarder clears its buffered records, also before startup completes. `onDrop` reports them with `security_context`.
|
|
31
|
+
- Live delivery buffers default to 10,000 records and 16 MiB of encoded JSON, with `"drop-oldest"` overflow. Metric instrument names default to a limit of 1,000 per collection interval. Extra instrument names are dropped and counted. Set the corresponding limit to 0 for no limit.
|
|
32
|
+
- `capturePolicy.breadcrumbs: 0` disables breadcrumb storage. Before, a zero capacity kept one breadcrumb.
|
|
33
|
+
- Diagnostic console fallback is off by default. When enabled, it prints a fixed warning if `onDiagnostic` throws. It does not print the exception, message or stack.
|
|
34
|
+
- `capture.urlTransform` also applies to WebSocket URLs. Without it, a socket URL still has no query or fragment, also with `capture.fullUrls`.
|
|
35
|
+
- IndexedDB schema version 12 adds a context/time index. Context reads and counts no longer load batches of other contexts.
|
|
36
|
+
- The size budget of the main graph is 36,000 B to include the operational controls.
|
|
37
|
+
- See [runtime policies and migration](docs/runtime-policies.md) for defaults, overrides, update timing and upgrade steps.
|
|
38
|
+
|
|
39
|
+
### Fixed - v0.9.5
|
|
40
|
+
|
|
41
|
+
- Console output below the delivery level or outside the sample now passes through configured processors and redaction. Sampled-out breadcrumbs use the processed message too. Hooks can run without a telemetry send. A local record is not processed twice for console output.
|
|
42
|
+
- Old queued records cannot use a new delivery context when isolation is enabled. Context ids stay with batches through storage, retries and splitting. Old HTTP requests are cancelled where possible. A request that the server already accepted cannot be recalled.
|
|
43
|
+
- HTTP capture ignores completions from an old security context. WebSocket capture also checks the context that opened each socket before it records lifecycle events or message counts.
|
|
44
|
+
- Retained memory queues survive context rotation. A slow save that completes after a discard removes its old batch. A rejected rotation no longer causes a later shutdown to reject.
|
|
45
|
+
- Incoming and outgoing bus controls check source permissions. Changing a self-reported context id does not reset the physical source's rate budget.
|
|
46
|
+
- The owner answers a hello, a journey question or a sampling question only to the child that asked. Before, each known child frame received each answer.
|
|
47
|
+
- The cross-origin playground server sets the library version value. Before, its child frame stopped with a `ReferenceError` at load.
|
|
48
|
+
- Lint rejects empty named imports and continues to permit imports that run a module for its side effects.
|
|
49
|
+
|
|
5
50
|
## [0.9.4] - 2026-10-31
|
|
6
51
|
|
|
7
52
|
### Added - v0.9.4
|
package/README.md
CHANGED
|
@@ -64,11 +64,11 @@ log.logAction("ORDER_SUBMIT", { orderId: "ORD-1001", qty: 100 });
|
|
|
64
64
|
log.error("pricing call failed", caughtError);
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
- `configure()` is idempotent. A later call updates
|
|
67
|
+
- `configure()` is idempotent. A later call updates an unlocked runtime singleton in place. Delivery/identity changes require `rotateSecurityContext()` by default. You cannot change `storage`, `identity`, `batching`, `retention`, `limits` or `journey.maxAgeMs` after startup. The library reports that change and ignores it.
|
|
68
68
|
- Call `configure()` from one context in each document. A second call changes `service.name` on the records of every other context. In a composed page, the shell calls `configure()`. Each microfrontend uses its own namespace.
|
|
69
69
|
- You can call `getLogger()` at module top level, before `configure()`. The logger finds the runtime on its first write.
|
|
70
|
-
- A write before the first `configure()` starts a runtime with default settings. It does not throw. The first `configure()` then sets `limits` and `
|
|
71
|
-
- After `shutdown()`,
|
|
70
|
+
- A write before the first `configure()` starts a runtime with default settings. It does not throw. The first `configure()` then sets `limits`, `journey.maxAgeMs`, `persistence.namespace` and an explicit `securityContext.id` of that runtime.
|
|
71
|
+
- After `shutdown()`, logging does nothing until the next `configure()`; health/stats remain inspectable.
|
|
72
72
|
|
|
73
73
|
### Console Only (No Network)
|
|
74
74
|
|
|
@@ -89,7 +89,7 @@ configure({
|
|
|
89
89
|
- `identity: "memory"` writes no key to `localStorage` or `sessionStorage`.
|
|
90
90
|
- `console` and `minLevel` are independent. `console` sets what the library prints. `minLevel` sets what the library sends.
|
|
91
91
|
- The console output does not depend on the bus or the endpoint.
|
|
92
|
-
- With a `redact` hook, the console shows only what `redact` returns. A record that a processor or `redact` drops prints no line.
|
|
92
|
+
- With a `redact` hook, the console shows only what `redact` returns. A record that a processor or `redact` drops prints no line. With `redact` or `processors`, a record below `minLevel` or outside the sample also goes through them before the console prints it. Without hooks, such a record shows its message, payload and error as given.
|
|
93
93
|
|
|
94
94
|
### Console Output
|
|
95
95
|
|
|
@@ -232,16 +232,19 @@ X-UiObs-Sampling: {"v":1,"ttlMs":600000,"defaultRate":0.1,"rates":{"blotter.grid
|
|
|
232
232
|
- The library keeps the rules in memory only. A reload uses the `configure()` rules until the next accepted batch.
|
|
233
233
|
- A child frame, a worker or an OpenFin view asks its owner for the rules at start and each 30 seconds. Set `sampling.remote: true` in each context.
|
|
234
234
|
- A frame accepts rules from a parent only if the parent origin is the page origin or is in `bus.trustedOrigins`. A page that embeds your app cannot lower `minLevel`.
|
|
235
|
+
- Under the default `bus.sourcePolicy: "registered"`, a parent sends rules only to a frame or a worker that it registered with the `sampling:read` permission.
|
|
235
236
|
- Each OpenFin view of one app can read the bus messages of the others. Load only trusted content into a view that has the `fin` API.
|
|
236
237
|
|
|
237
238
|
## API Reference
|
|
238
239
|
|
|
239
240
|
### Lifecycle & Setup
|
|
240
241
|
|
|
241
|
-
| Function
|
|
242
|
-
|
|
|
243
|
-
| `configure(config)`
|
|
244
|
-
| `shutdown()`
|
|
242
|
+
| Function | Description |
|
|
243
|
+
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
244
|
+
| `configure(config)` | Starts the runtime singleton, or updates it. |
|
|
245
|
+
| `shutdown()` | Sends pending records and stops every subsystem. Later calls do nothing until the next `configure()`. |
|
|
246
|
+
| `rotateSecurityContext(update, options?)` | Changes the delivery identity and the delivery settings together. Use it at logout or a tenant change. See [runtime policies](docs/runtime-policies.md#security-context-rotation). |
|
|
247
|
+
| `setConfigurationLocked(locked)` | Locks or unlocks changes through `configure()`. |
|
|
245
248
|
|
|
246
249
|
### Logging Methods
|
|
247
250
|
|
|
@@ -268,90 +271,110 @@ The level methods give records with `log.type: "log"`. Records of the library it
|
|
|
268
271
|
|
|
269
272
|
### Context & Correlation
|
|
270
273
|
|
|
271
|
-
| Function
|
|
272
|
-
|
|
|
273
|
-
| `setContext(key, value)`
|
|
274
|
-
| `setContextMap(values)`
|
|
275
|
-
| `removeContext(key)`
|
|
276
|
-
| `addBreadcrumb(message, data?)`
|
|
277
|
-
| `startJourney(name, options?)`
|
|
278
|
-
| `endJourney()`
|
|
279
|
-
| `currentJourney()`
|
|
280
|
-
| `getJourneyToken()`
|
|
281
|
-
| `adoptJourney(token)`
|
|
282
|
-
| `startTrace()`
|
|
283
|
-
| `getTraceHeaders()`
|
|
284
|
-
| `registerWorker(worker)`
|
|
285
|
-
| `
|
|
274
|
+
| Function | Description |
|
|
275
|
+
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
276
|
+
| `setContext(key, value)` | Sets one ambient attribute on every later record. |
|
|
277
|
+
| `setContextMap(values)` | Merges an attribute map into the ambient context. |
|
|
278
|
+
| `removeContext(key)` | Removes one attribute from the ambient context. |
|
|
279
|
+
| `addBreadcrumb(message, data?)` | Adds a breadcrumb with the category `custom`. The next error record carries the trail. The library copies `data` at the call. |
|
|
280
|
+
| `startJourney(name, options?)` | Starts a journey across windows. `options.parent: true` links the active journey as the parent. `options.id` sets the id, 1 to 64 letters, digits, `_`, `.`, `:` or `-`. Another value gives a new id and a `config.invalid` report. |
|
|
281
|
+
| `endJourney()` | Ends the active journey. |
|
|
282
|
+
| `currentJourney()` | Returns the active `Journey`, or null. |
|
|
283
|
+
| `getJourneyToken()` | Serializes the active journey into a URL token. |
|
|
284
|
+
| `adoptJourney(token)` | Adopts a journey token into this context. |
|
|
285
|
+
| `startTrace()` | Rotates the ambient trace context. |
|
|
286
|
+
| `getTraceHeaders()` | Returns the W3C `traceparent` header for an outgoing request. |
|
|
287
|
+
| `registerWorker(worker, options?)` | Attaches a Web Worker or MessagePort to the bus, with its permissions. Returns a function that removes the registration. |
|
|
288
|
+
| `registerFrame(frame, options)` | Registers a child iframe element or window at its exact origin, with its permissions. Returns a function that removes the registration. A child frame forwards only after its registration, unless `bus.sourcePolicy` is `trusted-origin`. |
|
|
289
|
+
| `newSession()` | Rotates correlation in this tab. Use `rotateSecurityContext()` for logout or tenant changes. It sends the open metric points, ends the active trace and journey, and clears the breadcrumbs. Other tabs read the new id at their next startup. |
|
|
290
|
+
|
|
291
|
+
See [runtime policies, operational budgets and migration](docs/runtime-policies.md) for `rotateSecurityContext()`, `registerFrame()`, source permissions, `setConfigurationLocked()`, `getHealth()` and configurable cache/bus budgets. Defaults favor privacy and isolation; applications can explicitly choose broader capture and delivery policies.
|
|
286
292
|
|
|
287
293
|
### Delivery & Diagnostics
|
|
288
294
|
|
|
289
|
-
| Function
|
|
290
|
-
|
|
|
291
|
-
| `flush()`
|
|
292
|
-
| `getQueueDepth()`
|
|
293
|
-
| `getStats()`
|
|
294
|
-
| `getDiagnosticCounters()`
|
|
295
|
+
| Function | Description |
|
|
296
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
297
|
+
| `flush()` | Sends the records held in the pipeline or the forward buffer, and waits for the batches in flight. |
|
|
298
|
+
| `getQueueDepth()` | Returns the number of batches in storage. |
|
|
299
|
+
| `getStats()` | Returns `{ pending, inFlight, stored, lastSendAt }`. `pending` counts the records in the buffers. `inFlight` counts the records in requests. `stored` counts the batches in storage. `lastSendAt` is the epoch time in ms of the last batch that the server accepted, or null. A forwarder reports only its own buffers. |
|
|
300
|
+
| `getDiagnosticCounters()` | Returns the count of each diagnostic code. |
|
|
301
|
+
| `getHealth()` | Returns the state of this SDK copy. It has the SDK version, the status, the delivery role and counts, the lock and cache state, the issue codes and the policies. |
|
|
302
|
+
| `clearPersistedLogs(scope?)` | Removes the stored records of the active context. With `"namespace"`, it removes the stored records of each context in the persistence namespace. |
|
|
295
303
|
|
|
296
304
|
---
|
|
297
305
|
|
|
298
306
|
## Configuration Options
|
|
299
307
|
|
|
300
|
-
No key is required. Set `endpoint` to send records. A value of the wrong type or outside its range reports `config.invalid`. The value in force stays. Level names can have any case. You cannot change `batching` and `retention` after the delivery stack loads. You cannot change `limits` and `journey.maxAgeMs` after the first `configure()`.
|
|
301
|
-
|
|
302
|
-
| Key
|
|
303
|
-
|
|
|
304
|
-
| `endpoint`
|
|
305
|
-
| `metricsEndpoint`
|
|
306
|
-
| `tracesEndpoint`
|
|
307
|
-
| `serviceName`
|
|
308
|
-
| `serviceVersion`
|
|
309
|
-
| `environment`
|
|
310
|
-
| `enabled`
|
|
311
|
-
| `minLevel`
|
|
312
|
-
| `minLevels`
|
|
313
|
-
| `compression`
|
|
314
|
-
| `serializer`
|
|
315
|
-
| `credentials`
|
|
316
|
-
| `headers`
|
|
317
|
-
| `storage`
|
|
318
|
-
| `identity`
|
|
319
|
-
| `sampling.defaultRate`
|
|
320
|
-
| `sampling.rates`
|
|
321
|
-
| `sampling.alwaysSampleTypes`
|
|
322
|
-
| `sampling.remote`
|
|
323
|
-
| `sampling.remoteMaxRate`
|
|
324
|
-
| `bus.mode`
|
|
325
|
-
| `bus.trustedOrigins`
|
|
326
|
-
| `bus.
|
|
327
|
-
| `
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `batching.
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
| `retention.
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `limits.
|
|
341
|
-
| `limits.
|
|
342
|
-
| `limits.
|
|
343
|
-
| `limits.
|
|
344
|
-
| `limits.
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
347
|
-
| `
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
| `
|
|
351
|
-
| `
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
354
|
-
| `
|
|
308
|
+
No key is required. Set `endpoint` to send records. A value of the wrong type or outside its range reports `config.invalid`. The value in force stays. Level names can have any case. You cannot change `batching` and `retention` after the delivery stack loads. You cannot change `limits` and `journey.maxAgeMs` after the first `configure()`. [Runtime policies](docs/runtime-policies.md) gives each default and range of the policy sections.
|
|
309
|
+
|
|
310
|
+
| Key | Default | Description |
|
|
311
|
+
| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
312
|
+
| `endpoint` | `""` | HTTP endpoint that receives the batches. `null` selects console-only mode. `""` reports `config.invalid`. |
|
|
313
|
+
| `metricsEndpoint` | `""` | OTLP metrics endpoint, for example `https://ingest.example/v1/metrics`. With it, each batch of metric records goes there as an OTLP `ExportMetricsServiceRequest`. Without it, metric records are log records on `endpoint`. It needs `serializer: "otlp"`, and `endpoint` or `transport`. |
|
|
314
|
+
| `tracesEndpoint` | `""` | OTLP traces endpoint, for example `https://ingest.example/v1/traces`. With it, the library records spans and sends them there as an OTLP `ExportTraceServiceRequest`. Without it, the library sends no span. It needs `serializer: "otlp"`, and `endpoint` or `transport`. See [Spans](#spans). |
|
|
315
|
+
| `serviceName` | `""` | `service.name` on every record. |
|
|
316
|
+
| `serviceVersion` | `""` | `service.version` on every record. |
|
|
317
|
+
| `environment` | `""` | `deployment.environment` on every record. |
|
|
318
|
+
| `enabled` | `true` | Set `false` to stop all logging. Every log call then does nothing. |
|
|
319
|
+
| `minLevel` | `"INFO"` | Lowest level that the library sends (`TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`). It does not drop actions and metrics. |
|
|
320
|
+
| `minLevels` | `{}` | Lowest level for each namespace prefix, for example `{ "trading.ticks": "DEBUG" }`. The longest matching prefix wins. A prefix matches its own namespace and the namespaces below it after a dot. A namespace with no match uses `minLevel`. A new map replaces the map in force. |
|
|
321
|
+
| `compression` | `"gzip"` | `gzip` or `none`. The library compresses a payload above 1 KB only. |
|
|
322
|
+
| `serializer` | `"otlp"` | `otlp`, `ecs`, or a custom `LogSerializer`. `ecs` writes ECS 8.10 NDJSON. It maps `app.namespace` to `log.logger`, `error.type`, `error.message` and `error.stack_trace` to `error.*`, and `log.type` to `event.kind`. The other attributes go to `labels`. |
|
|
323
|
+
| `credentials` | `"omit"` | Fetch credentials mode. Set `"include"` for cookie auth. |
|
|
324
|
+
| `headers` | `{}` | Static headers, or a function that returns them. After a 401 or 403, a function gets one more call and the batch one more send. The exit flush sends the last headers. Before a function gives its first result, the exit flush puts the batch in the emergency queue. `headers: undefined` removes the headers. |
|
|
325
|
+
| `storage` | `"auto"` | Store for undelivered batches: `auto`, `indexeddb`, `localstorage`, `memory` or `none`. Fixed at startup. |
|
|
326
|
+
| `identity` | `"storage"` | Store for session, tab and journey ids. `memory` writes no key. Fixed at startup. |
|
|
327
|
+
| `sampling.defaultRate` | `1` | Keep rate for a namespace with no rule. |
|
|
328
|
+
| `sampling.rates` | `{}` | Keep rate per namespace. The longest matching prefix wins. |
|
|
329
|
+
| `sampling.alwaysSampleTypes` | `["action"]` | Record types that ignore the rate. |
|
|
330
|
+
| `sampling.remote` | `false` | Reads sampling rules from the `X-UiObs-Sampling` header of each accepted batch (see Remote Sampling). |
|
|
331
|
+
| `sampling.remoteMaxRate` | `1` | Highest rate that a remote rule can set. It applies to the remote `defaultRate` and to each remote namespace rate. |
|
|
332
|
+
| `bus.mode` | `"auto"` | `auto`, `sender`, `forwarder` or `off`. With `off`, this context sends its own records and opens no link. A same-origin child frame that the page registers can still forward to it. |
|
|
333
|
+
| `bus.trustedOrigins` | `[]` | Origins of other documents that this document trusts. A cross-origin child frame forwards its records only to a parent on these origins. With `bus.sourcePolicy: "trusted-origin"`, a parent also accepts records from a child frame on these origins. With the default policy, use `registerFrame()`. The library keeps the origin of each URL. For a sandboxed frame, set `bus.mode: "sender"` in the frame. A trusted origin is also trusted for metric points. Its points bypass the sampling and the limit of 100 attribute sets of this document. |
|
|
334
|
+
| `bus.sourcePolicy` | `"registered"` | `registered` accepts only the frames and workers that the page registers. `trusted-origin` also accepts each frame on the page origin or in `bus.trustedOrigins`. |
|
|
335
|
+
| `bus.validation` | `"strict"` | `strict` checks the fields of each bus message. `envelope` checks the envelope only. |
|
|
336
|
+
| `bus.maxMessageBytes`, `bus.maxRecordsPerMessage`, `bus.maxMessagesPerSecond`, `bus.maxTrackedSources` | `262144`, `100`, `100`, `256` | Bus budgets for each message and each source. `0` turns a limit off. |
|
|
337
|
+
| `bus.openFinRole` | `"auto"` | `auto`, `provider` or `client`. |
|
|
338
|
+
| `journey.scope` | `"auto"` | Which contexts adopt a journey. `context`: each context keeps its own. `tab`: a frame or a worker adopts the journey of its owner. `origin`: each context of the origin, also in other tabs. `auto` is `origin` in OpenFin and `tab` in a browser. |
|
|
339
|
+
| `journey.maxAgeMs` | `1800000` | Maximum open time of a journey, in milliseconds. Then the library ends it. The range is 60000 to 86400000. |
|
|
340
|
+
| `batching.logFlushIntervalMs` | `2000` | Maximum wait of a partial log batch, in milliseconds. The range is 100 to 60000. |
|
|
341
|
+
| `batching.logBatchSize` | `100` | Maximum records in one log batch. The range is 1 to 1000. |
|
|
342
|
+
| `batching.metricFlushIntervalMs` | `10000` | Maximum wait of a partial metric batch, in milliseconds. The range is 100 to 60000. |
|
|
343
|
+
| `batching.metricBatchSize` | `500` | Maximum records in one metric batch. The range is 1 to 1000. |
|
|
344
|
+
| `retention.mode` | `"limited"` | `limited` or `until-delivered`. With `until-delivered`, a stored batch has no age limit and no attempt limit. `retention.maxBatches` still applies. A permanent error still drops the batch. A batch that always gets a temporary error stays first. The batches of the same endpoint behind it wait. |
|
|
345
|
+
| `retention.maxBatches` | `500` | Maximum stored batches. A new batch evicts the oldest batch without an action first. The range is 1 to 5000. |
|
|
346
|
+
| `retention.maxAgeMs` | `86400000` | Maximum age of a stored batch, in milliseconds. The range is 60000 to 604800000. |
|
|
347
|
+
| `retention.maxAttempts` | `5` | Maximum send attempts of a stored batch. The range is 1 to 20. |
|
|
348
|
+
| `limits.maxBodyChars` | `4096` | Maximum body length, in characters. The range is 256 to 65536. |
|
|
349
|
+
| `limits.maxAttributeChars` | `8192` | Maximum length of a string attribute, in characters. The range is 256 to 65536. |
|
|
350
|
+
| `limits.maxAttributeCount` | `128` | Maximum keys in one object. The range is 1 to 1024. |
|
|
351
|
+
| `limits.maxStackChars` | `8192` | Maximum length of an error stack, in characters. The range is 256 to 65536. |
|
|
352
|
+
| `limits.maxDepth` | `6` | Maximum depth of a nested value. The range is 1 to 16. |
|
|
353
|
+
| `limits.maxArrayLength` | `100` | Maximum items in one array, set or map. The range is 1 to 10000. |
|
|
354
|
+
| `limits.maxNodes` | `10000` | Maximum values in one sanitize pass. The range is 100 to 100000. |
|
|
355
|
+
| `limits.maxRecordBytes` | `32768` | Maximum attribute bytes of one record. Above it, the library drops the caller attributes. The range is 1024 to 60000. |
|
|
356
|
+
| `securityContext.id` | Generated | Delivery identity of this runtime. Supply a stable opaque id to send stored batches after a reload. Do not put secrets or personal data in it. |
|
|
357
|
+
| `securityContext.isolation` | `true` | Keeps the stored batches of each identity apart. Delivery changes then need `rotateSecurityContext()`. |
|
|
358
|
+
| `lockConfiguration` | `false` | Refuses changes through `configure()`. Identical repeated settings are accepted. `setConfigurationLocked(false)` unlocks. |
|
|
359
|
+
| `loggerCache.maxEntries` | `256` | LRU limit of cached loggers. `0` turns the cache off. `null` sets no limit. |
|
|
360
|
+
| `delivery` | See policies | Request timeout, request concurrency, retry delays and batches in one retry pass. |
|
|
361
|
+
| `buffering` | 10,000 records, 16 MiB, `"drop-oldest"` | Limits of the live buffers, and the overflow rule. |
|
|
362
|
+
| `metrics` | See policies | Limits of instrument names, attribute sets and histogram boundaries. |
|
|
363
|
+
| `correlation` | See policies | Session idle time, session write interval and trace age. Fixed at startup. |
|
|
364
|
+
| `capturePolicy` | See policies | Breadcrumb capacity, error duplicate check, capture rate limits and the error ceiling. |
|
|
365
|
+
| `diagnostics` | `{ throttleMs: 1000, consoleFallback: false }` | Report interval of each diagnostic code, and the console fallback when `onDiagnostic` throws. |
|
|
366
|
+
| `persistence.namespace` | `""` | Separates the batch stores, the emergency queue and the retry locks of one application. Fixed at startup. |
|
|
367
|
+
| `metadata` | All `true` | `pageUrl`, `userAgent` and `openfin` include `page.url`, `browser.user_agent` and the OpenFin fields. |
|
|
368
|
+
| `capture` | See below | Auto-capture settings. |
|
|
369
|
+
| `console` | `false` | Prints records to devtools. `true` prints from `DEBUG` up. A level name prints from that level up. An object sets `level` and `styles` (see Console Output). It does not depend on `minLevel`. |
|
|
370
|
+
| `transport(request)` | `undefined` | Sends batches through a channel of your app in place of HTTP (see Custom Transport). |
|
|
371
|
+
| `transportOnExit(request)` | `undefined` | Sends the last batch while the page closes. It must return a boolean and must not wait. |
|
|
372
|
+
| `otelLoader()` | `undefined` | Loads `@opentelemetry/api`. Without it, OTel is off. |
|
|
373
|
+
| `contextProvider()` | `undefined` | Returns attributes for each built record, including console/breadcrumb-only candidates, for example the current route. Its values override `setContext()` values. The logger scope and the call payload override its values. Keep it fast and synchronous. A provider that throws reports `handler.threw`. A value that is not an object reports `config.invalid`. The record is still built. |
|
|
374
|
+
| `processors` | `[]` | Functions that change or drop a record. They run in list order, before `redact`. A processor has the contract of `redact`. Return the record or a new record to keep it, or `null` to drop it. If a processor throws or returns a value that is not a record, the library drops the record. It counts `record.dropped_by_processor`. A new list replaces the list in force. |
|
|
375
|
+
| `redact(record)` | `undefined` | Changes a record before the library sends or prints it, including console-only candidates. Return `null` to drop the record. If the hook throws or returns a value that is not a record, the library drops the record. It counts `record.dropped_by_redact`. The sender also runs its `redact` on each record from a frame or a worker. A record that the child already redacted then runs through `redact` again. Write `redact` so that a second run gives the same result. |
|
|
376
|
+
| `onDiagnostic(event)` | `undefined` | Receives the faults of the library itself. |
|
|
377
|
+
| `onDrop(summary)` | `undefined` | Receives a summary when the library loses records that it built. The summary has `reason`, `records`, `batchIds`, `journeyIds` and `actions`. Sampling, `minLevel`, `processors` and `redact` do not cause a loss. Do not log through the library in the hook. A record from the hook can evict a stored batch. A batch that storage evicts during its send can still reach the server. |
|
|
355
378
|
|
|
356
379
|
### Auto-Capture Options
|
|
357
380
|
|
|
@@ -364,13 +387,14 @@ capture: {
|
|
|
364
387
|
xhr: false, // XMLHttpRequest duration and status codes
|
|
365
388
|
httpMetrics: true, // http.client.request.duration histogram of fetch and xhr requests, in seconds.
|
|
366
389
|
// Attributes: http.request.method, http.response.status_code, server.address, error.type
|
|
367
|
-
interactions: false, //
|
|
390
|
+
interactions: false, // Click action names. The object form sets actionAttribute, text and selector
|
|
368
391
|
navigation: false, // Single-page navigation URL changes
|
|
369
392
|
webVitals: false, // Core Web Vitals (LCP, CLS, INP, FCP, TTFB)
|
|
370
393
|
longFrames: false, // Frames that freeze the page, as ui.long_frame.duration
|
|
371
394
|
longFrameThresholdMs: 100, // Minimum frame duration that longFrames records
|
|
372
395
|
console: false, // App console calls: true, or a list such as ["error", "warn", "info"]
|
|
373
396
|
fullUrls: false, // Keep query strings and fragments on recorded URLs
|
|
397
|
+
urlTransform: undefined, // Function that replaces the default URL rule
|
|
374
398
|
ignoreUrls: [], // URL patterns excluded from network capture
|
|
375
399
|
propagateTraceHeaderTo: [], // Origins, or RegExp patterns, that receive traceparent
|
|
376
400
|
webSocket: false, // WebSocket open, close and error, and ui.websocket.messages
|
|
@@ -401,7 +425,7 @@ capture: {
|
|
|
401
425
|
|
|
402
426
|
- `websocket.open` and `websocket.close` are events. `websocket.error` is a WARN record. Each has `url.full` and `server.address`.
|
|
403
427
|
- `websocket.close` adds `websocket.close.code` and `websocket.close.clean`.
|
|
404
|
-
- `url.full` has no user info, no query and no fragment, also with `fullUrls`. A socket URL often holds a token.
|
|
428
|
+
- `url.full` has no user info, no query and no fragment, also with `fullUrls`. A socket URL often holds a token. Only `urlTransform` can record more of the URL.
|
|
405
429
|
- The counter `ui.websocket.messages` counts the messages, with `network.io.direction` (`transmit` or `receive`) and `server.address`.
|
|
406
430
|
- The library never reads the content of a message.
|
|
407
431
|
- The library records at most 20 lifecycle records in each 10-second window. The counter counts each message.
|
|
@@ -437,7 +461,7 @@ const visibility: CapturePlugin = {
|
|
|
437
461
|
configure({ endpoint: "https://ingest.example/v1/logs", capture: { plugins: [visibility] } });
|
|
438
462
|
```
|
|
439
463
|
|
|
440
|
-
`fullUrls` is off by default. The library then cuts each recorded URL at the first `?` or `#`. This applies to the page URL, the request target and the URL of a failed resource. `ignoreUrls` and a RegExp in `propagateTraceHeaderTo` match the full URL.
|
|
464
|
+
`fullUrls` is off by default. The library then cuts each recorded URL at the first `?` or `#`. This applies to the page URL, the request target and the URL of a failed resource. `ignoreUrls` and a RegExp in `propagateTraceHeaderTo` match the full URL. `urlTransform` replaces this rule. It receives the original URL. If it throws, the library records an empty URL and reports `capture.record_failed`.
|
|
441
465
|
|
|
442
466
|
A string in `propagateTraceHeaderTo` is an origin, for example `"https://api.example"`. It matches a request to that origin only. A URL with a path gives its origin. A relative request URL resolves against the page. To match a path, use a RegExp. A RegExp tests the request URL in the form that the caller gives. Start each RegExp with `^`. Without it, `/\/api\//` also matches `https://vendor.example/api/`. For example, `/^https:\/\/api\.example\/v2\//` matches one path on one origin. `/^\/api\//` matches a relative request URL only.
|
|
443
467
|
|
|
@@ -464,7 +488,9 @@ With `tracesEndpoint`, the library sends spans. The backend then has a root span
|
|
|
464
488
|
| `ui-observability.emergency.*` | `localStorage` | When the exit flush cannot send a batch | `endpoint: null`, `storage: "memory"` or `"none"` |
|
|
465
489
|
| `ui-observability.probe` | `localStorage` | One write and one remove, when the library tests `localStorage` | `storage` other than `auto` or `localstorage` |
|
|
466
490
|
|
|
467
|
-
IndexedDB holds undelivered batches with `storage: "auto"` or `"indexeddb"`.
|
|
491
|
+
IndexedDB holds undelivered batches with `storage: "auto"` or `"indexeddb"`, in the database `UiObservability`.
|
|
492
|
+
|
|
493
|
+
With `persistence.namespace`, the batch keys start with `ui-observability:namespaced:<namespace>:batch:`, the emergency keys start with `ui-observability:namespaced:<namespace>:emergency:`, and the database is `UiObservability:<namespace>`.
|
|
468
494
|
|
|
469
495
|
---
|
|
470
496
|
|
|
@@ -473,6 +499,7 @@ IndexedDB holds undelivered batches with `storage: "auto"` or `"indexeddb"`.
|
|
|
473
499
|
- [Attribute reference](docs/attributes.md): each attribute that the library writes, and its type.
|
|
474
500
|
- [Browser support](docs/browser-support.md): the browser APIs that the library uses, and the fallback for each.
|
|
475
501
|
- [Threat model](docs/threat-model.md): the trust boundaries, the threats and the controls.
|
|
502
|
+
- [Runtime policies and migration](docs/runtime-policies.md): the defaults, the overrides, security-context rotation, registered bus sources, health and the upgrade steps for 0.9.5.
|
|
476
503
|
|
|
477
504
|
---
|
|
478
505
|
|
|
@@ -480,19 +507,19 @@ IndexedDB holds undelivered batches with `storage: "auto"` or `"indexeddb"`.
|
|
|
480
507
|
|
|
481
508
|
- **Code splitting:** The main chunk holds the logger, the record builder and the console sink. The delivery stack loads only when you set an endpoint. The bus loads only when the context needs it. Each capture module loads only when you enable it.
|
|
482
509
|
- **Document singleton:** The library keeps the runtime at `globalThis[Symbol.for("ui-observability.runtime")]`. Federated microfrontends and separate bundles share one buffer, one sequence and one transport.
|
|
483
|
-
- **One sender:** Iframes, workers and OpenFin views find the nearest long-lived context. They forward their records to it over the bus. That context batches, stores and sends for all of them.
|
|
484
|
-
- **One sender for each tab:** Each top-level tab or window has its own sender. Two tabs of one origin send their records separately. They have the same `session.id` and a different `tab.id`. A retry of stored batches runs in one tab at a time, under a Web Lock.
|
|
510
|
+
- **One sender:** Iframes, workers and OpenFin views find the nearest long-lived context. They forward their records to it over the bus. That context batches, stores and sends for all of them. By default, a parent accepts only the frames and workers that it registers with `registerFrame()` and `registerWorker()`. A frame that knows its owner relays the records of its own children.
|
|
511
|
+
- **One sender for each tab:** Each top-level tab or window has its own sender. Two tabs of one origin send their records separately. They have the same `session.id` and a different `tab.id`. A retry of stored batches runs in one tab at a time, under a Web Lock for each persistence namespace.
|
|
485
512
|
- **Five correlation ids:** Each record carries `session.id`, `tab.id`, `context.id`, `journey.id` and `trace_id`.
|
|
486
513
|
- **Durability and exit flush:** The library stores a batch that fails to send, in IndexedDB or localStorage. It sends the batch again with exponential backoff and jitter. When the document becomes hidden, the library runs a normal flush with the headers, gzip and retry. While the document is hidden, a send of 60 KB or less uses `keepalive`. A mobile OS can stop a hidden page with no `pagehide`. On `pagehide`, `freeze` or OpenFin close, it sends pending records with `navigator.sendBeacon` if they are below 60 KB. With `headers`, it uses a keepalive fetch with the last headers, because a beacon cannot set a header. A larger payload goes to the emergency queue. `shutdown()` runs a normal flush before the exit flush. An action is an audit fact. When storage is over `retention.maxBatches` or over the quota of the browser, it removes the batches without an action first. Before startup, the hold buffers keep up to 2000 actions. The 500-record limit applies only to other records. `onDrop` tells the app about each loss.
|
|
487
514
|
- **Server (Node):** On Node, for example during server-side rendering, the library runs console-only. It installs no capture, keeps the ids in memory, uses no storage and has no exit flush. If you set `endpoint`, `metricsEndpoint`, `tracesEndpoint` or `transport`, it reports `config.invalid` one time.
|
|
488
515
|
- **One library version on a page:** If a copy of another version owns the page runtime, this copy runs console-only. It installs no capture and reports `runtime.version_mismatch`. Load one version of the library on the page.
|
|
489
516
|
- **Emergency queue:** The emergency queue is best effort. With `storage: "memory"` or `"none"`, the exit flush does not use it. A batch that it cannot send is then lost, and `onDrop` reports `not_stored`. It writes to `localStorage` synchronously, because no other storage works while the page unloads. If the browser refuses the write, the library reports `storage.quota_exceeded`. The library then loses the batch.
|
|
490
|
-
- **Configuration after startup:** A second `configure()` call merges
|
|
517
|
+
- **Configuration after startup:** A second `configure()` call merges accepted options into an unlocked live runtime. Isolation is on by default. Then `configure()` refuses changes to delivery settings and to the context ID. It keeps the values in force, reports `config.invalid` and applies the other settings. Use `rotateSecurityContext()` for these changes. `securityContext.isolation: false` restores ordinary mutable routing. The runtime also refuses these 5 changes and reports `config.invalid` for each:
|
|
491
518
|
- A change to `storage`. The stored batches stay in the adapter that the runtime built at startup.
|
|
492
519
|
- A change to `identity`. The ids exist from startup.
|
|
493
520
|
- A change to `batching` or `retention` after the delivery stack loads. The stack reads them one time.
|
|
494
521
|
- A change to `limits` or `journey.maxAgeMs` after the first `configure()`. The record builder and the journey engine read them one time.
|
|
495
|
-
- An `endpoint` change to `null` or `""` after the delivery stack loads. Without an endpoint, the stored batches would be lost.
|
|
522
|
+
- An `endpoint` change to `null` or `""` after the delivery stack loads. Without an endpoint, the stored batches would be lost. With isolation off, a change to another endpoint URL is accepted.
|
|
496
523
|
- **Deterministic sampling:** FNV-1a hashing applies one keep rate to a whole journey. An error and an explicit action are always kept.
|
|
497
524
|
|
|
498
525
|
---
|
|
@@ -529,11 +556,12 @@ The ingest server must meet these requirements:
|
|
|
529
556
|
```bash
|
|
530
557
|
npm install
|
|
531
558
|
npm run dev # Playground, mock ingest server and iframe host
|
|
532
|
-
npm run verify # Format check,
|
|
559
|
+
npm run verify # Format check, typecheck, build, lint, peer, size and dev-server checks, tests
|
|
533
560
|
```
|
|
534
561
|
|
|
535
562
|
- Vanilla playground: `http://localhost:5173/playground/vanilla/index.html`
|
|
536
|
-
- Mock ingest server: `http://localhost:8787`. It accepts `/v1/logs` and `/v1/
|
|
563
|
+
- Mock ingest server: `http://localhost:8787`. It accepts `/v1/logs`, `/v1/metrics` and `/v1/traces`. It prints one line for each record and for each metric point.
|
|
564
|
+
- Cross-origin child frame: `http://localhost:5174`. The vanilla playground registers it and its same-origin child frame before they load.
|
|
537
565
|
- The React example sends its counter, histogram and HTTP duration points to `/v1/metrics`.
|
|
538
566
|
|
|
539
567
|
### Example Applications
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-CW-MlHdY.cjs"),t=require("./identity-Da9TkuKd.cjs");function n(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`id`),n=Reflect.get(e,`createdAt`),r=Reflect.get(e,`attempts`),i=Reflect.get(e,`records`);return typeof t==`string`&&typeof n==`number`&&typeof r==`number`&&Array.isArray(i)}function r(e,n){if(e.records.length<2)return null;let r=Math.floor(e.records.length/2),i=r=>({id:t.i(n),records:r,createdAt:e.createdAt,attempts:e.attempts,routingContextId:e.routingContextId,persistenceNamespace:e.persistenceNamespace});return[i(e.records.slice(0,r)),i(e.records.slice(r))]}function i(e,t){let n=e;if(typeof n!=`object`||!n)return;let r=Reflect.get(n,`attributes`);if(typeof r==`object`&&r)return Reflect.get(r,t)}function a(t){return i(t,e.f)===e.vt}function o(e){return e.reduce((e,t)=>e+t.records.length,0)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
|
2
|
+
//# sourceMappingURL=batch-BQFtb3i5.cjs.map
|