@utk09/ui-observability 0.8.0 → 0.9.1
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 +95 -0
- package/README.md +75 -48
- package/dist/batch-DEK4bv9N.js +31 -0
- package/dist/batch-DEK4bv9N.js.map +1 -0
- package/dist/batch-DEVFs28i.cjs +2 -0
- package/dist/batch-DEVFs28i.cjs.map +1 -0
- package/dist/bus/bus.d.ts +46 -12
- package/dist/bus/links.d.ts +6 -3
- package/dist/bus-DNFvTkif.cjs +2 -0
- package/dist/bus-DNFvTkif.cjs.map +1 -0
- package/dist/{bus-DPDrlUBY.js → bus-HVQ8E72V.js} +128 -71
- package/dist/bus-HVQ8E72V.js.map +1 -0
- package/dist/capture/interactions.d.ts +7 -6
- package/dist/capture/network.d.ts +23 -9
- package/dist/capture/types.d.ts +3 -3
- package/dist/console-C9Y639mn.js +82 -0
- package/dist/console-C9Y639mn.js.map +1 -0
- package/dist/console-DssDxq1B.cjs +2 -0
- package/dist/console-DssDxq1B.cjs.map +1 -0
- package/dist/constants-N99w84xy.js +117 -0
- package/dist/constants-N99w84xy.js.map +1 -0
- package/dist/constants-X86IDwkC.cjs +2 -0
- package/dist/constants-X86IDwkC.cjs.map +1 -0
- package/dist/constants.d.ts +36 -18
- package/dist/core/diagnostics.d.ts +2 -2
- package/dist/core/drops.d.ts +29 -0
- package/dist/core/hold-buffer.d.ts +27 -0
- package/dist/core/journey.d.ts +16 -4
- package/dist/core/logger.d.ts +6 -2
- package/dist/core/pipeline.d.ts +20 -16
- package/dist/core/record.d.ts +11 -6
- package/dist/core/remote-sampling.d.ts +1 -1
- package/dist/core/runtime.d.ts +87 -23
- package/dist/core/sender.d.ts +19 -11
- 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/error-like-Ywo5uRHo.js +19 -0
- package/dist/error-like-Ywo5uRHo.js.map +1 -0
- package/dist/error-like-gGRx2s36.cjs +2 -0
- package/dist/error-like-gGRx2s36.cjs.map +1 -0
- package/dist/errors-BTWuVnHZ.cjs +3 -0
- package/dist/errors-BTWuVnHZ.cjs.map +1 -0
- package/dist/{errors-Dnc-X4Ec.js → errors-CQusIGWJ.js} +39 -20
- package/dist/errors-CQusIGWJ.js.map +1 -0
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/global-scope-dp2jADRl.js.map +1 -1
- package/dist/identity-B1GDS1Tb.cjs +2 -0
- package/dist/identity-B1GDS1Tb.cjs.map +1 -0
- package/dist/identity-D4DPjTM9.js +88 -0
- package/dist/identity-D4DPjTM9.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +720 -446
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-uD4oaRMc.js → indexeddb-storage-B8SGUzSV.js} +88 -59
- package/dist/indexeddb-storage-B8SGUzSV.js.map +1 -0
- package/dist/indexeddb-storage-ukzC82dm.cjs +2 -0
- package/dist/indexeddb-storage-ukzC82dm.cjs.map +1 -0
- package/dist/interactions-CcxrVzpg.cjs +2 -0
- package/dist/interactions-CcxrVzpg.cjs.map +1 -0
- package/dist/{interactions-igKTAJvj.js → interactions-CnjfQgw3.js} +22 -19
- package/dist/interactions-CnjfQgw3.js.map +1 -0
- package/dist/journey-DjvDzHyp.js +163 -0
- package/dist/journey-DjvDzHyp.js.map +1 -0
- package/dist/journey-DxlfdFJV.cjs +2 -0
- package/dist/journey-DxlfdFJV.cjs.map +1 -0
- package/dist/{library-request-Br_T09Bn.cjs → library-request-BZ1ekVtl.cjs} +2 -2
- package/dist/{library-request-Br_T09Bn.cjs.map → library-request-BZ1ekVtl.cjs.map} +1 -1
- package/dist/{library-request-Dt0fXhcn.js → library-request-C8kc5YWv.js} +2 -2
- package/dist/{library-request-Dt0fXhcn.js.map → library-request-C8kc5YWv.js.map} +1 -1
- package/dist/{long-frames-DahhqM6u.cjs → long-frames-BGik_Yhy.cjs} +2 -2
- package/dist/{long-frames-DahhqM6u.cjs.map → long-frames-BGik_Yhy.cjs.map} +1 -1
- package/dist/{long-frames-6pnjWSSR.js → long-frames-CZk3XOkH.js} +3 -3
- package/dist/{long-frames-6pnjWSSR.js.map → long-frames-CZk3XOkH.js.map} +1 -1
- package/dist/models/batch.d.ts +15 -1
- package/dist/models/bus.d.ts +7 -4
- package/dist/models/config.d.ts +189 -12
- package/dist/models/drop.d.ts +39 -0
- package/dist/models/log-record.d.ts +12 -6
- package/dist/models/storage.d.ts +15 -3
- package/dist/network-51iicpLl.js +174 -0
- package/dist/network-51iicpLl.js.map +1 -0
- package/dist/network-jBbjyAJP.cjs +2 -0
- package/dist/network-jBbjyAJP.cjs.map +1 -0
- package/dist/patch-BX8KrPCT.cjs +2 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -0
- package/dist/patch-CCWfuEY7.js +9 -0
- package/dist/patch-CCWfuEY7.js.map +1 -0
- package/dist/platform-Cjts-8k8.js +48 -0
- package/dist/platform-Cjts-8k8.js.map +1 -0
- package/dist/{platform-D_XkVIF6.cjs → platform-DW3GFIUE.cjs} +2 -2
- package/dist/platform-DW3GFIUE.cjs.map +1 -0
- package/dist/{remote-rules-rJJZKVG8.cjs → remote-rules-ByS34k4e.cjs} +2 -2
- package/dist/remote-rules-ByS34k4e.cjs.map +1 -0
- package/dist/{remote-rules-5UA23alm.js → remote-rules-M-XZ1xbe.js} +14 -14
- package/dist/remote-rules-M-XZ1xbe.js.map +1 -0
- package/dist/sampling-BN3Oi6SV.js +63 -0
- package/dist/sampling-BN3Oi6SV.js.map +1 -0
- package/dist/sampling-b2ck5X98.cjs +2 -0
- package/dist/sampling-b2ck5X98.cjs.map +1 -0
- package/dist/sanitize-DKp5MRsa.cjs +2 -0
- package/dist/sanitize-DKp5MRsa.cjs.map +1 -0
- package/dist/sanitize-Dwj9JCkI.js +123 -0
- package/dist/sanitize-Dwj9JCkI.js.map +1 -0
- package/dist/{sender-G6v4Uqi4.js → sender-BBY0IcUo.js} +439 -322
- package/dist/sender-BBY0IcUo.js.map +1 -0
- package/dist/sender-BXoAZKum.cjs +3 -0
- package/dist/sender-BXoAZKum.cjs.map +1 -0
- package/dist/storage/emergency-queue.d.ts +5 -2
- package/dist/storage/eviction.d.ts +40 -0
- package/dist/storage/factory.d.ts +1 -1
- package/dist/storage/idb-driver.d.ts +7 -1
- package/dist/storage/indexeddb-storage.d.ts +13 -5
- package/dist/storage/local-storage.d.ts +27 -4
- package/dist/storage/memory-storage.d.ts +10 -3
- package/dist/{storm-BtzgLOCX.cjs → storm-CKuaBp7i.cjs} +2 -2
- package/dist/{storm-BtzgLOCX.cjs.map → storm-CKuaBp7i.cjs.map} +1 -1
- package/dist/{storm-DJkEZP_8.js → storm-DhtL2eVr.js} +2 -2
- package/dist/{storm-DJkEZP_8.js.map → storm-DhtL2eVr.js.map} +1 -1
- package/dist/transport/compression.d.ts +1 -1
- package/dist/transport/exit-flush.d.ts +27 -17
- package/dist/transport/http-transport.d.ts +61 -7
- package/dist/transport/retry-engine.d.ts +12 -8
- package/dist/transport/status-transport.d.ts +8 -3
- package/dist/utils/console.d.ts +5 -2
- package/dist/utils/error-like.d.ts +25 -0
- package/dist/utils/global-scope.d.ts +1 -1
- package/dist/utils/identity.d.ts +1 -1
- package/dist/utils/library-console.d.ts +1 -1
- package/dist/utils/library-request.d.ts +1 -1
- package/dist/utils/patch.d.ts +9 -0
- package/dist/utils/platform.d.ts +3 -3
- package/dist/utils/sequence.d.ts +0 -5
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/tracing.d.ts +3 -3
- package/dist/utils/unref.d.ts +2 -2
- package/dist/{web-vitals-DHZ0yA_H.js → web-vitals-Bflr5jSA.js} +4 -2
- package/dist/web-vitals-Bflr5jSA.js.map +1 -0
- package/dist/web-vitals-DFuoTQbZ.cjs +2 -0
- package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -0
- package/package.json +2 -2
- package/dist/bus-CUXRY0JR.cjs +0 -2
- package/dist/bus-CUXRY0JR.cjs.map +0 -1
- package/dist/bus-DPDrlUBY.js.map +0 -1
- package/dist/console-CNljJict.js +0 -81
- package/dist/console-CNljJict.js.map +0 -1
- package/dist/console-PKzc-FmR.cjs +0 -2
- package/dist/console-PKzc-FmR.cjs.map +0 -1
- package/dist/constants-B28fDv2F.cjs +0 -2
- package/dist/constants-B28fDv2F.cjs.map +0 -1
- package/dist/constants-Bu49bm39.js +0 -93
- package/dist/constants-Bu49bm39.js.map +0 -1
- package/dist/errors-C78ZTjet.cjs +0 -3
- package/dist/errors-C78ZTjet.cjs.map +0 -1
- package/dist/errors-Dnc-X4Ec.js.map +0 -1
- package/dist/indexeddb-storage-D0p3iMD0.cjs +0 -2
- package/dist/indexeddb-storage-D0p3iMD0.cjs.map +0 -1
- package/dist/indexeddb-storage-uD4oaRMc.js.map +0 -1
- package/dist/interactions-CsE2y_fQ.cjs +0 -2
- package/dist/interactions-CsE2y_fQ.cjs.map +0 -1
- package/dist/interactions-igKTAJvj.js.map +0 -1
- package/dist/network-CZ0aFUsy.cjs +0 -2
- package/dist/network-CZ0aFUsy.cjs.map +0 -1
- package/dist/network-aSNbwpue.js +0 -112
- package/dist/network-aSNbwpue.js.map +0 -1
- package/dist/platform-BwbMRwHm.js +0 -48
- package/dist/platform-BwbMRwHm.js.map +0 -1
- package/dist/platform-D_XkVIF6.cjs.map +0 -1
- package/dist/remote-rules-5UA23alm.js.map +0 -1
- package/dist/remote-rules-rJJZKVG8.cjs.map +0 -1
- package/dist/sampling-E4x92Nn2.cjs +0 -2
- package/dist/sampling-E4x92Nn2.cjs.map +0 -1
- package/dist/sampling-J1eahbfT.js +0 -160
- package/dist/sampling-J1eahbfT.js.map +0 -1
- package/dist/sanitize-BMhh8ghJ.cjs +0 -2
- package/dist/sanitize-BMhh8ghJ.cjs.map +0 -1
- package/dist/sanitize-UJ-4Lb0n.js +0 -114
- package/dist/sanitize-UJ-4Lb0n.js.map +0 -1
- package/dist/sender-B6ufz26f.cjs +0 -3
- package/dist/sender-B6ufz26f.cjs.map +0 -1
- package/dist/sender-G6v4Uqi4.js.map +0 -1
- package/dist/unref-16maCyKA.js +0 -8
- package/dist/unref-16maCyKA.js.map +0 -1
- package/dist/unref-CU9Nyz_9.cjs +0 -2
- package/dist/unref-CU9Nyz_9.cjs.map +0 -1
- package/dist/web-vitals-B2FYsEAU.cjs +0 -2
- package/dist/web-vitals-B2FYsEAU.cjs.map +0 -1
- package/dist/web-vitals-DHZ0yA_H.js.map +0 -1
package/dist/models/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DiagnosticHandler } from "../core/diagnostics";
|
|
2
|
+
import type { DropSummary } from "./drop";
|
|
2
3
|
import type { LogLevel, LogRecord } from "./log-record";
|
|
3
4
|
import type { LogSerializer } from "./serializer";
|
|
4
5
|
/** Backing store for undelivered records. "auto" picks the best one the host supports. */
|
|
@@ -25,7 +26,7 @@ export interface WebVitalsMetric {
|
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Callback `web-vitals` invokes with a measurement.
|
|
28
|
-
* @param metric The measurement
|
|
29
|
+
* @param metric The measurement that `web-vitals` reports.
|
|
29
30
|
*/
|
|
30
31
|
export type WebVitalsReporter = (metric: WebVitalsMetric) => void;
|
|
31
32
|
/** The five `web-vitals` entry points this library subscribes to. */
|
|
@@ -106,7 +107,7 @@ export interface OtelApi {
|
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
108
109
|
* Supplies the `@opentelemetry/api` module without a hard dependency on it.
|
|
109
|
-
* @returns A promise
|
|
110
|
+
* @returns A promise that resolves to the module.
|
|
110
111
|
*/
|
|
111
112
|
export type OtelLoader = () => Promise<OtelApi>;
|
|
112
113
|
/** Sampling policy. It controls which records the library keeps. */
|
|
@@ -148,6 +149,7 @@ export interface BusOptions {
|
|
|
148
149
|
/**
|
|
149
150
|
* Origins that can send postMessage records to this document.
|
|
150
151
|
* A document that gets records from a cross-origin iframe must list the iframe origin.
|
|
152
|
+
* The library does not accept "null". A sandboxed frame must set `mode: "sender"`.
|
|
151
153
|
* @default []
|
|
152
154
|
*/
|
|
153
155
|
trustedOrigins: string[];
|
|
@@ -159,6 +161,128 @@ export interface BusOptions {
|
|
|
159
161
|
*/
|
|
160
162
|
openFinRole: "auto" | "provider" | "client";
|
|
161
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Where a journey id applies.
|
|
166
|
+
* - "context": each document, frame or worker keeps its own journey.
|
|
167
|
+
* - "tab": a frame or a worker adopts the journey of the context that owns it. A journey
|
|
168
|
+
* does not go to another tab.
|
|
169
|
+
* - "origin": each context of the origin adopts each journey. The broadcast link also reaches
|
|
170
|
+
* other tabs.
|
|
171
|
+
* - "auto": "origin" in OpenFin and "tab" in a browser.
|
|
172
|
+
*/
|
|
173
|
+
export type JourneyScope = "auto" | "context" | "tab" | "origin";
|
|
174
|
+
/** Journey settings. */
|
|
175
|
+
export interface JourneyOptions {
|
|
176
|
+
/**
|
|
177
|
+
* Which contexts adopt a journey that one context starts.
|
|
178
|
+
* @default "auto"
|
|
179
|
+
*/
|
|
180
|
+
scope: JourneyScope;
|
|
181
|
+
/**
|
|
182
|
+
* Maximum open time of a journey, in milliseconds. Then the library ends it. The range is
|
|
183
|
+
* 1 minute to 24 hours. You cannot change this value after startup.
|
|
184
|
+
* @default 1800000
|
|
185
|
+
*/
|
|
186
|
+
maxAgeMs: number;
|
|
187
|
+
}
|
|
188
|
+
/** Batch size and flush interval of each record stream. You cannot change them after startup. */
|
|
189
|
+
export interface BatchingOptions {
|
|
190
|
+
/**
|
|
191
|
+
* Maximum wait of a partial log batch, in milliseconds. The range is 100 to 60000.
|
|
192
|
+
* @default 2000
|
|
193
|
+
*/
|
|
194
|
+
logFlushIntervalMs: number;
|
|
195
|
+
/**
|
|
196
|
+
* Maximum records in one log batch. The range is 1 to 1000.
|
|
197
|
+
* @default 100
|
|
198
|
+
*/
|
|
199
|
+
logBatchSize: number;
|
|
200
|
+
/**
|
|
201
|
+
* Maximum wait of a partial metric batch, in milliseconds. The range is 100 to 60000.
|
|
202
|
+
* @default 10000
|
|
203
|
+
*/
|
|
204
|
+
metricFlushIntervalMs: number;
|
|
205
|
+
/**
|
|
206
|
+
* Maximum records in one metric batch. The range is 1 to 1000.
|
|
207
|
+
* @default 500
|
|
208
|
+
*/
|
|
209
|
+
metricBatchSize: number;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* How long the library keeps an undelivered batch.
|
|
213
|
+
* - "limited": the batch stays until `maxAgeMs` or `maxAttempts`.
|
|
214
|
+
* - "until-delivered": the batch has no age limit and no attempt limit. `maxBatches` still
|
|
215
|
+
* applies. A permanent error still drops the batch.
|
|
216
|
+
*/
|
|
217
|
+
export type RetentionMode = "limited" | "until-delivered";
|
|
218
|
+
/** Retention of undelivered batches. You cannot change it after startup. */
|
|
219
|
+
export interface RetentionOptions {
|
|
220
|
+
/**
|
|
221
|
+
* Retention rule.
|
|
222
|
+
* @default "limited"
|
|
223
|
+
*/
|
|
224
|
+
mode: RetentionMode;
|
|
225
|
+
/**
|
|
226
|
+
* Maximum stored batches. A new batch evicts the oldest batch without an action first. The
|
|
227
|
+
* range is 1 to 5000.
|
|
228
|
+
* @default 500
|
|
229
|
+
*/
|
|
230
|
+
maxBatches: number;
|
|
231
|
+
/**
|
|
232
|
+
* Maximum age of a stored batch, in milliseconds. The range is 1 minute to 7 days.
|
|
233
|
+
* @default 86400000
|
|
234
|
+
*/
|
|
235
|
+
maxAgeMs: number;
|
|
236
|
+
/**
|
|
237
|
+
* Maximum send attempts of a stored batch. The range is 1 to 20.
|
|
238
|
+
* @default 5
|
|
239
|
+
*/
|
|
240
|
+
maxAttempts: number;
|
|
241
|
+
}
|
|
242
|
+
/** Size limits for each record. You cannot change them after startup. */
|
|
243
|
+
export interface LimitOptions {
|
|
244
|
+
/**
|
|
245
|
+
* Maximum body length, in characters. The range is 256 to 65536.
|
|
246
|
+
* @default 4096
|
|
247
|
+
*/
|
|
248
|
+
maxBodyChars: number;
|
|
249
|
+
/**
|
|
250
|
+
* Maximum length of a string attribute, in characters. The range is 256 to 65536.
|
|
251
|
+
* @default 8192
|
|
252
|
+
*/
|
|
253
|
+
maxAttributeChars: number;
|
|
254
|
+
/**
|
|
255
|
+
* Maximum keys in one object. The range is 1 to 1024.
|
|
256
|
+
* @default 128
|
|
257
|
+
*/
|
|
258
|
+
maxAttributeCount: number;
|
|
259
|
+
/**
|
|
260
|
+
* Maximum length of an error stack, in characters. The range is 256 to 65536.
|
|
261
|
+
* @default 8192
|
|
262
|
+
*/
|
|
263
|
+
maxStackChars: number;
|
|
264
|
+
/**
|
|
265
|
+
* Maximum depth of a nested value. The range is 1 to 16.
|
|
266
|
+
* @default 6
|
|
267
|
+
*/
|
|
268
|
+
maxDepth: number;
|
|
269
|
+
/**
|
|
270
|
+
* Maximum items in one array, set or map. The range is 1 to 10000.
|
|
271
|
+
* @default 100
|
|
272
|
+
*/
|
|
273
|
+
maxArrayLength: number;
|
|
274
|
+
/**
|
|
275
|
+
* Maximum values in one sanitize pass. The range is 100 to 100000.
|
|
276
|
+
* @default 10000
|
|
277
|
+
*/
|
|
278
|
+
maxNodes: number;
|
|
279
|
+
/**
|
|
280
|
+
* Maximum attribute bytes of one record. Above it, the library drops the caller attributes.
|
|
281
|
+
* The range is 1024 to 60000.
|
|
282
|
+
* @default 32768
|
|
283
|
+
*/
|
|
284
|
+
maxRecordBytes: number;
|
|
285
|
+
}
|
|
162
286
|
/** Console method that the console capture can wrap. */
|
|
163
287
|
export type CapturedConsoleMethod = "error" | "warn" | "info" | "log";
|
|
164
288
|
/**
|
|
@@ -236,14 +360,15 @@ export interface CaptureOptions {
|
|
|
236
360
|
*/
|
|
237
361
|
ignoreUrls: (string | RegExp)[];
|
|
238
362
|
/**
|
|
239
|
-
* Targets that receive a `traceparent` header. A
|
|
240
|
-
*
|
|
363
|
+
* Targets that receive a `traceparent` header. A string is an origin and matches a request
|
|
364
|
+
* to that origin only. A RegExp tests the full URL. Start each RegExp with `^`. A pattern that
|
|
365
|
+
* matches all URLs breaks CORS on third-party endpoints.
|
|
241
366
|
* @default []
|
|
242
367
|
*/
|
|
243
368
|
propagateTraceHeaderTo: (string | RegExp)[];
|
|
244
369
|
/**
|
|
245
370
|
* Supplies the `web-vitals` module without a hard dependency on the package.
|
|
246
|
-
* @returns A promise
|
|
371
|
+
* @returns A promise that resolves to the `web-vitals` module.
|
|
247
372
|
*/
|
|
248
373
|
webVitalsLoader?: () => Promise<WebVitalsModule>;
|
|
249
374
|
}
|
|
@@ -312,7 +437,7 @@ export interface TransportResponse {
|
|
|
312
437
|
* Sends one batch through a channel of the app, such as an API client, a WebSocket or IPC.
|
|
313
438
|
* A rejected promise counts as a network error. The library then sends the batch again.
|
|
314
439
|
* @param request Batch to send.
|
|
315
|
-
* @returns Promise
|
|
440
|
+
* @returns Promise that resolves to the answer of the server.
|
|
316
441
|
*/
|
|
317
442
|
export type Transport = (request: TransportRequest) => Promise<TransportResponse>;
|
|
318
443
|
/**
|
|
@@ -346,7 +471,7 @@ export interface ObservabilityConfig {
|
|
|
346
471
|
*/
|
|
347
472
|
environment?: string;
|
|
348
473
|
/**
|
|
349
|
-
* Master switch.
|
|
474
|
+
* Master switch. With false, each log call does nothing.
|
|
350
475
|
* @default true
|
|
351
476
|
*/
|
|
352
477
|
enabled?: boolean;
|
|
@@ -356,7 +481,7 @@ export interface ObservabilityConfig {
|
|
|
356
481
|
*/
|
|
357
482
|
minLevel?: LogLevel;
|
|
358
483
|
/**
|
|
359
|
-
*
|
|
484
|
+
* Set "gzip" to compress a payload that is larger than the compression threshold.
|
|
360
485
|
* Set "none" for an ingest endpoint that rejects gzip.
|
|
361
486
|
* @default "gzip"
|
|
362
487
|
*/
|
|
@@ -372,7 +497,7 @@ export interface ObservabilityConfig {
|
|
|
372
497
|
* @default "omit"
|
|
373
498
|
*/
|
|
374
499
|
credentials?: RequestCredentials;
|
|
375
|
-
/** Extra request headers, or a function returning them. */
|
|
500
|
+
/** Extra request headers, or a function returning them. `undefined` removes the headers. */
|
|
376
501
|
headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
377
502
|
/**
|
|
378
503
|
* Backing store for undelivered records.
|
|
@@ -397,6 +522,26 @@ export interface ObservabilityConfig {
|
|
|
397
522
|
* @see {@link BusOptions}
|
|
398
523
|
*/
|
|
399
524
|
bus?: Partial<BusOptions>;
|
|
525
|
+
/**
|
|
526
|
+
* Journey settings.
|
|
527
|
+
* @see {@link JourneyOptions}
|
|
528
|
+
*/
|
|
529
|
+
journey?: Partial<JourneyOptions>;
|
|
530
|
+
/**
|
|
531
|
+
* Batch size and flush interval of each record stream.
|
|
532
|
+
* @see {@link BatchingOptions}
|
|
533
|
+
*/
|
|
534
|
+
batching?: Partial<BatchingOptions>;
|
|
535
|
+
/**
|
|
536
|
+
* Retention of undelivered batches.
|
|
537
|
+
* @see {@link RetentionOptions}
|
|
538
|
+
*/
|
|
539
|
+
retention?: Partial<RetentionOptions>;
|
|
540
|
+
/**
|
|
541
|
+
* Size limits for each record.
|
|
542
|
+
* @see {@link LimitOptions}
|
|
543
|
+
*/
|
|
544
|
+
limits?: Partial<LimitOptions>;
|
|
400
545
|
/**
|
|
401
546
|
* Automatic instrumentation.
|
|
402
547
|
* @see {@link CaptureOptions}
|
|
@@ -426,7 +571,8 @@ export interface ObservabilityConfig {
|
|
|
426
571
|
*/
|
|
427
572
|
otelLoader?: OtelLoader;
|
|
428
573
|
/**
|
|
429
|
-
* Rewrites or drops a record before the library sends it.
|
|
574
|
+
* Rewrites or drops a record before the library sends it. If the hook throws or returns a
|
|
575
|
+
* value that is not a record, the library drops the record.
|
|
430
576
|
* @param record The record that the library is about to send.
|
|
431
577
|
* @returns The record to send, or `null` to drop it.
|
|
432
578
|
*/
|
|
@@ -436,6 +582,15 @@ export interface ObservabilityConfig {
|
|
|
436
582
|
* @see {@link DiagnosticHandler}
|
|
437
583
|
*/
|
|
438
584
|
onDiagnostic?: DiagnosticHandler;
|
|
585
|
+
/**
|
|
586
|
+
* Receives a summary when the library loses records that it built. Sampling, `minLevel` and
|
|
587
|
+
* `redact` do not cause a loss. The library joins the losses of one reason in one task.
|
|
588
|
+
* Do not log through the library in the hook. A record from the hook can evict a stored batch.
|
|
589
|
+
* A batch that storage evicts during its send can still reach the server.
|
|
590
|
+
* @param summary Reason, record count, batch ids, journey ids and action names of the loss.
|
|
591
|
+
* @see {@link DropSummary}
|
|
592
|
+
*/
|
|
593
|
+
onDrop?: (summary: DropSummary) => void;
|
|
439
594
|
}
|
|
440
595
|
/** Fully resolved configuration that the runtime holds. */
|
|
441
596
|
export interface ResolvedConfig {
|
|
@@ -447,11 +602,11 @@ export interface ResolvedConfig {
|
|
|
447
602
|
serviceVersion: string;
|
|
448
603
|
/** The library reports this value as `deployment.environment`. */
|
|
449
604
|
environment: string;
|
|
450
|
-
/** Master switch.
|
|
605
|
+
/** Master switch. With false, each log call does nothing. */
|
|
451
606
|
enabled: boolean;
|
|
452
607
|
/** Minimum level that the library logs. */
|
|
453
608
|
minLevel: LogLevel;
|
|
454
|
-
/**
|
|
609
|
+
/** "gzip" compresses a payload that is larger than the compression threshold. */
|
|
455
610
|
compression: "gzip" | "none";
|
|
456
611
|
/** The library passes this value to `fetch`. */
|
|
457
612
|
credentials: RequestCredentials;
|
|
@@ -469,6 +624,26 @@ export interface ResolvedConfig {
|
|
|
469
624
|
* @see {@link BusOptions}
|
|
470
625
|
*/
|
|
471
626
|
bus: BusOptions;
|
|
627
|
+
/**
|
|
628
|
+
* Journey settings.
|
|
629
|
+
* @see {@link JourneyOptions}
|
|
630
|
+
*/
|
|
631
|
+
journey: JourneyOptions;
|
|
632
|
+
/**
|
|
633
|
+
* Batch size and flush interval of each record stream.
|
|
634
|
+
* @see {@link BatchingOptions}
|
|
635
|
+
*/
|
|
636
|
+
batching: BatchingOptions;
|
|
637
|
+
/**
|
|
638
|
+
* Retention of undelivered batches.
|
|
639
|
+
* @see {@link RetentionOptions}
|
|
640
|
+
*/
|
|
641
|
+
retention: RetentionOptions;
|
|
642
|
+
/**
|
|
643
|
+
* Size limits for each record.
|
|
644
|
+
* @see {@link LimitOptions}
|
|
645
|
+
*/
|
|
646
|
+
limits: LimitOptions;
|
|
472
647
|
/**
|
|
473
648
|
* Automatic instrumentation.
|
|
474
649
|
* @see {@link CaptureOptions}
|
|
@@ -497,4 +672,6 @@ export interface ResolvedConfig {
|
|
|
497
672
|
* @see {@link DiagnosticHandler}
|
|
498
673
|
*/
|
|
499
674
|
onDiagnostic?: DiagnosticHandler;
|
|
675
|
+
/** Receives a summary when the library loses records that it built. */
|
|
676
|
+
onDrop?: ObservabilityConfig["onDrop"];
|
|
500
677
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { LogRecord } from "./log-record";
|
|
2
|
+
/**
|
|
3
|
+
* Cause of a loss.
|
|
4
|
+
* - "buffer_full": a hold buffer before startup or before the sender loads is full.
|
|
5
|
+
* - "expired", "over_capacity", "quota": storage removed stored batches. The reasons are
|
|
6
|
+
* `retention.maxAgeMs`, `retention.maxBatches` and the storage quota of the browser.
|
|
7
|
+
* - "max_attempts": a stored batch reached `retention.maxAttempts`.
|
|
8
|
+
* - "rejected": the server refused the batch permanently, or one record is too large for it.
|
|
9
|
+
* - "unserializable": the serializer threw on the batch.
|
|
10
|
+
* - "exit_queue_full": the exit queue in localStorage is full. It drops its oldest batch.
|
|
11
|
+
* - "load_failed": the delivery code did not load, or shutdown() came first. The held records are
|
|
12
|
+
* lost.
|
|
13
|
+
* - "not_stored": storage did not keep a batch after a failed send. The cause is a write error or
|
|
14
|
+
* `storage: "none"`.
|
|
15
|
+
*/
|
|
16
|
+
export type LossReason = "buffer_full" | "expired" | "over_capacity" | "quota" | "max_attempts" | "rejected" | "unserializable" | "exit_queue_full" | "load_failed" | "not_stored";
|
|
17
|
+
/**
|
|
18
|
+
* One report of lost records. The library joins the losses of one reason in one task.
|
|
19
|
+
* Each list holds at most 20 different values.
|
|
20
|
+
*/
|
|
21
|
+
export interface DropSummary {
|
|
22
|
+
/** Cause of the loss. */
|
|
23
|
+
reason: LossReason;
|
|
24
|
+
/** Number of lost records. */
|
|
25
|
+
records: number;
|
|
26
|
+
/** Ids of the lost batches. A hold buffer loses records, not batches. Its list is empty. */
|
|
27
|
+
batchIds: string[];
|
|
28
|
+
/** Journey ids of the lost records. */
|
|
29
|
+
journeyIds: string[];
|
|
30
|
+
/** Names of the lost action records. An action is an audit fact. */
|
|
31
|
+
actions: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Receives lost records. The runtime adds them to the onDrop report.
|
|
35
|
+
* @param reason Cause of the loss.
|
|
36
|
+
* @param records Lost records.
|
|
37
|
+
* @param batchIds Ids of the lost batches.
|
|
38
|
+
*/
|
|
39
|
+
export type LossReporter = (reason: LossReason, records: readonly LogRecord[], batchIds?: readonly string[]) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** OpenTelemetry severity levels, in ascending order. */
|
|
2
2
|
export type LogLevel = "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL";
|
|
3
3
|
/**
|
|
4
|
-
* Kind of thing a record
|
|
5
|
-
* `event`
|
|
6
|
-
* `system`
|
|
4
|
+
* Kind of thing that a record tells about. `action` is something that a person did.
|
|
5
|
+
* `event` is something that the application did. `metric` is a measurement.
|
|
6
|
+
* `log` is a log call of the application. `system` is the output of this library.
|
|
7
7
|
*/
|
|
8
|
-
export type LogType = "action" | "event" | "metric" | "system";
|
|
8
|
+
export type LogType = "action" | "event" | "metric" | "log" | "system";
|
|
9
9
|
/** Metric value type: level, running total, or distribution. */
|
|
10
10
|
export type MetricType = "gauge" | "counter" | "histogram";
|
|
11
11
|
/** Internal record shape. A serializer converts it to the payload format. */
|
|
@@ -46,11 +46,17 @@ export interface LogRecord {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function nowUnixNano(): string;
|
|
48
48
|
/**
|
|
49
|
-
* Checks
|
|
49
|
+
* Checks if a value is a known log level. An own-key check rejects "toString".
|
|
50
|
+
* @param value The value to check.
|
|
51
|
+
* @returns True if `value` is a key of the severity table.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isLogLevel(value: unknown): value is LogLevel;
|
|
54
|
+
/**
|
|
55
|
+
* Checks if a value has the shape `LogRecord` requires.
|
|
50
56
|
* Use it to validate records from another realm. A malformed record throws
|
|
51
57
|
* during serialization. The check accepts any string as `severityText`, not only
|
|
52
58
|
* a known level. Thus an unknown level from a newer version passes.
|
|
53
59
|
* @param value The value to check.
|
|
54
|
-
* @returns
|
|
60
|
+
* @returns True if `value` has the shape `LogRecord` requires.
|
|
55
61
|
*/
|
|
56
62
|
export declare function isLogRecord(value: unknown): value is LogRecord;
|
package/dist/models/storage.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LogBatch } from "./batch";
|
|
2
|
+
import type { RetentionOptions } from "./config";
|
|
2
3
|
/** Persistent batch storage interface. All methods must resolve and never throw. */
|
|
3
4
|
export interface StorageAdapter {
|
|
4
5
|
/** Adapter identifier name. */
|
|
@@ -46,17 +47,28 @@ export interface StorageLimits {
|
|
|
46
47
|
/** Maximum delivery attempts before dead-letter drop. */
|
|
47
48
|
maxAttempts: number;
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Gives the storage limits of a retention setting. "until-delivered" has no age limit and no
|
|
52
|
+
* attempt limit. The batch cap still applies.
|
|
53
|
+
* @param retention Retention setting from the config.
|
|
54
|
+
* @returns The limits for the storage adapters and the retry engine.
|
|
55
|
+
*/
|
|
56
|
+
export declare function storageLimits(retention: RetentionOptions): StorageLimits;
|
|
49
57
|
/** Metrics for batches and records dropped during storage pruning. */
|
|
50
58
|
export interface PruneResult {
|
|
51
59
|
/** Total batches dropped. */
|
|
52
60
|
batches: number;
|
|
53
61
|
/** Total records dropped within evicted batches. */
|
|
54
62
|
records: number;
|
|
55
|
-
/**
|
|
56
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Cause of the drop. If more than one rule applies, this is the last rule. "not_stored" means
|
|
65
|
+
* that storage did not keep a batch after a failed send.
|
|
66
|
+
*/
|
|
67
|
+
reason: "expired" | "over_capacity" | "quota" | "not_stored";
|
|
57
68
|
}
|
|
58
69
|
/**
|
|
59
70
|
* Callback invoked when dropped records create a telemetry gap.
|
|
60
71
|
* @param result Summary of evicted data.
|
|
72
|
+
* @param dropped The dropped batches. A corrupt entry has no batch. The list then has none for it.
|
|
61
73
|
*/
|
|
62
|
-
export type GapReporter = (result: PruneResult) => void;
|
|
74
|
+
export type GapReporter = (result: PruneResult, dropped: readonly LogBatch[]) => void;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { r as e } from "./platform-Cjts-8k8.js";
|
|
2
|
+
import { t } from "./library-request-C8kc5YWv.js";
|
|
3
|
+
import { t as n } from "./patch-CCWfuEY7.js";
|
|
4
|
+
//#region src/capture/types.ts
|
|
5
|
+
function r(e, t) {
|
|
6
|
+
return typeof e == "string" && t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/capture/network.ts
|
|
10
|
+
function i() {
|
|
11
|
+
return XMLHttpRequest.prototype;
|
|
12
|
+
}
|
|
13
|
+
function a(e) {
|
|
14
|
+
if (typeof e == "string") return e;
|
|
15
|
+
if (e instanceof URL) return e.href;
|
|
16
|
+
if (typeof e == "object" && e) {
|
|
17
|
+
let { url: t } = e;
|
|
18
|
+
if (typeof t == "string") return t;
|
|
19
|
+
}
|
|
20
|
+
return String(e);
|
|
21
|
+
}
|
|
22
|
+
function o(e, t) {
|
|
23
|
+
let n = t?.method;
|
|
24
|
+
return n === void 0 && typeof e == "object" && e && (n = e.method), c(n ?? "GET");
|
|
25
|
+
}
|
|
26
|
+
function s(e) {
|
|
27
|
+
return typeof e == "object" && !(e instanceof URL) && !(e instanceof Request);
|
|
28
|
+
}
|
|
29
|
+
function c(e) {
|
|
30
|
+
return typeof e == "string" ? e.toUpperCase() : String(e);
|
|
31
|
+
}
|
|
32
|
+
var l = class {
|
|
33
|
+
ctx;
|
|
34
|
+
name = "network";
|
|
35
|
+
installed = !1;
|
|
36
|
+
restores = [];
|
|
37
|
+
constructor(e) {
|
|
38
|
+
this.ctx = e;
|
|
39
|
+
}
|
|
40
|
+
install() {
|
|
41
|
+
this.installed || (this.installed = !0, this.ctx.config.capture.fetch && this.installFetch(), this.ctx.config.capture.xhr && this.installXhr());
|
|
42
|
+
}
|
|
43
|
+
uninstall() {
|
|
44
|
+
if (this.installed) {
|
|
45
|
+
this.installed = !1;
|
|
46
|
+
for (let e of this.restores.splice(0)) e();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
ignored(e) {
|
|
50
|
+
return t() || r(e, this.ctx.config.capture.ignoreUrls);
|
|
51
|
+
}
|
|
52
|
+
propagates(e) {
|
|
53
|
+
let t = this.ctx.config.capture.propagateTraceHeaderTo;
|
|
54
|
+
if (t.length === 0) return !1;
|
|
55
|
+
let n = this.ctx.diagnostics.guard("capture.header_failed", "The library could not read the origin of a request URL. Only a RegExp target can match it.", () => new URL(e, location.href).origin);
|
|
56
|
+
return t.some((t) => typeof t == "string" ? t === n : t.test(e));
|
|
57
|
+
}
|
|
58
|
+
installFetch() {
|
|
59
|
+
if (typeof globalThis.fetch != "function") return;
|
|
60
|
+
let e = !0, t = (e, t) => this.prepareFetch(e, t), r = (e, t, n, r, i) => {
|
|
61
|
+
this.record(e, t, n, r, i);
|
|
62
|
+
}, i = n(globalThis, "fetch", (n) => {
|
|
63
|
+
let i = n.bind(globalThis);
|
|
64
|
+
return async function(n, a) {
|
|
65
|
+
let o = e ? t(n, a) : void 0;
|
|
66
|
+
if (!o) return i(n, a);
|
|
67
|
+
let s = performance.now();
|
|
68
|
+
try {
|
|
69
|
+
let e = await i(o.input, o.init);
|
|
70
|
+
return r(o.method, o.url, e.status, performance.now() - s, void 0), e;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
throw r(o.method, o.url, 0, performance.now() - s, e), e;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
this.restores.push(() => {
|
|
77
|
+
e = !1, i();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
prepareFetch(e, t) {
|
|
81
|
+
let n = this.ctx.diagnostics.guard("capture.record_failed", "The library could not read a fetch request. It sends the request unchanged.", () => {
|
|
82
|
+
let n = a(e);
|
|
83
|
+
if (!this.ignored(n)) return {
|
|
84
|
+
method: o(e, t),
|
|
85
|
+
url: n,
|
|
86
|
+
propagate: this.propagates(n)
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
if (!n) return;
|
|
90
|
+
let { method: r, url: i } = n, c = {
|
|
91
|
+
method: r,
|
|
92
|
+
url: i,
|
|
93
|
+
input: e,
|
|
94
|
+
init: t
|
|
95
|
+
};
|
|
96
|
+
if (!n.propagate || s(e)) return c;
|
|
97
|
+
try {
|
|
98
|
+
let n = Object.entries(this.ctx.tracing.headers());
|
|
99
|
+
if (e instanceof Request) {
|
|
100
|
+
let t = new Headers(e.headers);
|
|
101
|
+
for (let [e, r] of n) t.set(e, r);
|
|
102
|
+
c.input = new Request(e, { headers: t });
|
|
103
|
+
} else {
|
|
104
|
+
let e = new Headers(t?.headers);
|
|
105
|
+
for (let [t, r] of n) e.set(t, r);
|
|
106
|
+
c.init = {
|
|
107
|
+
...t,
|
|
108
|
+
headers: e
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
} catch (n) {
|
|
112
|
+
c.input = e, c.init = t, this.ctx.diagnostics.report("capture.header_failed", "The library could not add the traceparent header. It sends the request unchanged.", { url: i }, n);
|
|
113
|
+
}
|
|
114
|
+
return c;
|
|
115
|
+
}
|
|
116
|
+
installXhr() {
|
|
117
|
+
if (typeof XMLHttpRequest > "u") return;
|
|
118
|
+
let e = !0, t = this.ctx, r = (e) => this.ignored(e), o = (e) => this.propagates(e), s = (e, t, n, r) => {
|
|
119
|
+
this.record(e, t, n, r, void 0);
|
|
120
|
+
}, l = i(), d = n(l, "open", (n) => function(r, i, ...o) {
|
|
121
|
+
e && t.diagnostics.guard("capture.record_failed", "The library could not read an XMLHttpRequest. It does not record the request.", () => {
|
|
122
|
+
this.__uiobs = {
|
|
123
|
+
method: c(r),
|
|
124
|
+
url: a(i),
|
|
125
|
+
startedAt: 0
|
|
126
|
+
};
|
|
127
|
+
}), n.apply(this, [
|
|
128
|
+
r,
|
|
129
|
+
i,
|
|
130
|
+
...o
|
|
131
|
+
]);
|
|
132
|
+
}), f = n(l, "send", (n) => function(...i) {
|
|
133
|
+
let a = e ? this.__uiobs : void 0;
|
|
134
|
+
a && t.diagnostics.guard("capture.record_failed", `The library could not record ${a.method} ${a.url}.`, () => {
|
|
135
|
+
r(a.url) || (a.startedAt = performance.now(), this.addEventListener("loadend", () => {
|
|
136
|
+
s(a.method, a.url, this.status, performance.now() - a.startedAt);
|
|
137
|
+
}), o(a.url) && u(this, a.url, t));
|
|
138
|
+
}), n.apply(this, i);
|
|
139
|
+
});
|
|
140
|
+
this.restores.push(() => {
|
|
141
|
+
e = !1, d(), f();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
record(t, n, r, i, a) {
|
|
145
|
+
let o = this.ctx.config.capture.fullUrls ? n : e(n);
|
|
146
|
+
this.ctx.diagnostics.guard("capture.record_failed", `The library could not record ${t} ${o}.`, () => {
|
|
147
|
+
let e = Math.round(i);
|
|
148
|
+
this.ctx.breadcrumbs.push({
|
|
149
|
+
t: Date.now(),
|
|
150
|
+
category: "http",
|
|
151
|
+
message: `${t} ${o} ${r === 0 ? "failed" : String(r)}`,
|
|
152
|
+
data: { durationMs: e }
|
|
153
|
+
});
|
|
154
|
+
let n = {
|
|
155
|
+
"http.request.method": t,
|
|
156
|
+
"url.full": o,
|
|
157
|
+
"http.response.status_code": r,
|
|
158
|
+
"http.duration_ms": e
|
|
159
|
+
};
|
|
160
|
+
r === 0 ? this.ctx.logger.error(`${t} ${o} failed`, a, n) : r >= 400 ? this.ctx.logger.warn(`${t} ${o} returned ${String(r)}`, n) : this.ctx.logger.debug(`${t} ${o}`, n);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
function u(e, t, n) {
|
|
165
|
+
try {
|
|
166
|
+
for (let [t, r] of Object.entries(n.tracing.headers())) e.setRequestHeader(t, r);
|
|
167
|
+
} catch (e) {
|
|
168
|
+
n.diagnostics.report("capture.header_failed", "The library could not add the traceparent header. It sends the request unchanged.", { url: t }, e);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
export { l as NetworkCapture };
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=network-51iicpLl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-51iicpLl.js","names":["stripUrlQuery","patch","matchesAny","url","patterns","pattern","xhrMethods","readUrl","input","readFetchMethod","requested","init","toMethod","isForeignInput","method","NetworkCapture","ctx","restore","isLibraryRequest","targets","origin","target","active","prepare","record","status","durationMs","error","call","original","plan","startedAt","response","read","injected","headers","key","value","ignored","propagates","proto","restoreOpen","rest","originalOpen","restoreSend","args","meta","addTraceHeaders","originalSend","rounded","attributes"],"sources":["../src/capture/types.ts","../src/capture/network.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n","// src/capture/network.ts\n//\n// Instruments fetch and XMLHttpRequest to record network request outcomes and timing.\n\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { patch } from \"../utils/patch\";\nimport { stripUrlQuery } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Signature of the global fetch function. */\ntype FetchFn = typeof fetch;\n\n/** Request data that the XHR wrapper keeps from open to send. */\ninterface XhrMeta {\n /** Uppercase HTTP method. */\n method: string;\n /** Request target URL. */\n url: string;\n /** Performance timestamp at send. */\n startedAt: number;\n}\n\n/** XMLHttpRequest extended with internal telemetry tracking metadata. */\ntype Tracked = XMLHttpRequest & {\n __uiobs?: XhrMeta;\n};\n\n/** Unbound prototype methods intercepted on XMLHttpRequest. */\ninterface XhrMethods {\n open: (this: XMLHttpRequest, ...args: never[]) => void;\n send: (this: XMLHttpRequest, ...args: never[]) => void;\n}\n\n/** Returns the XMLHttpRequest prototype. */\nfunction xhrMethods(): XhrMethods {\n return XMLHttpRequest.prototype;\n}\n\n/** The fetch call to make, and the method and URL to record. */\ninterface FetchPlan {\n /** Uppercase HTTP method. */\n method: string;\n /** Request target URL. */\n url: string;\n /** Input to pass to the original fetch. */\n input: RequestInfo | URL;\n /** Init to pass to the original fetch. */\n init: RequestInit | undefined;\n}\n\n/**\n * Reads the URL of a fetch input or an XHR URL argument.\n * A Request from another realm fails `instanceof Request`. Its `url` property still works.\n * @param input String, URL, Request, or an object with a text form.\n * @returns The URL.\n * @throws TypeError when the input has no text form. Call it inside a diagnostics guard.\n */\nfunction readUrl(input: unknown): string {\n if (typeof input === \"string\") {\n return input;\n }\n\n if (input instanceof URL) {\n return input.href;\n }\n\n if (typeof input === \"object\" && input !== null) {\n const { url } = input as { url?: unknown };\n if (typeof url === \"string\") {\n return url;\n }\n }\n\n // fetch accepts each value with a text form.\n return String(input);\n}\n\n/**\n * Reads the method of a fetch call. The init method wins over the Request method.\n * @param input Fetch input.\n * @param init Fetch init.\n * @returns Uppercase method. The default is GET.\n */\nfunction readFetchMethod(input: unknown, init: RequestInit | undefined): string {\n let requested: unknown = init?.method;\n\n if (requested === undefined && typeof input === \"object\" && input !== null) {\n requested = (input as { method?: unknown }).method;\n }\n\n return toMethod(requested ?? \"GET\");\n}\n\n/**\n * Tests if a fetch input is an object that is not a Request or a URL of this realm.\n * An example is a Request from an iframe.\n * @param input Fetch input.\n * @returns True for a foreign object.\n */\nfunction isForeignInput(input: unknown): boolean {\n return typeof input === \"object\" && !(input instanceof URL) && !(input instanceof Request);\n}\n\n/**\n * Converts a method argument to text. A method that is not a string does not throw.\n * @param method Method argument of the caller.\n * @returns Uppercase method for a string, or the text form of another value.\n */\nfunction toMethod(method: unknown): string {\n return typeof method === \"string\" ? method.toUpperCase() : String(method);\n}\n\n/** Instruments global fetch and XMLHttpRequest to capture request durations and outcomes. */\nexport class NetworkCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"network\";\n\n /** Prevents a second wrap on a wrapped function. */\n private installed = false;\n\n /** Restore functions of the installed wrappers. */\n private readonly restores: (() => void)[] = [];\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, breadcrumbs, and tracing.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Instruments configured network transport APIs. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n\n if (this.ctx.config.capture.fetch) {\n this.installFetch();\n }\n if (this.ctx.config.capture.xhr) {\n this.installXhr();\n }\n }\n\n /**\n * Restores each host function that still holds the wrapper of this capture.\n * A wrapper that another script wrapped again stays in place and records nothing.\n */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const restore of this.restores.splice(0)) {\n restore();\n }\n }\n\n /**\n * Tests if a URL matches ignore patterns.\n * @param url Request target URL.\n * @returns True if telemetry must exclude the URL.\n */\n private ignored(url: string): boolean {\n // resolveConfig always adds the endpoint to ignoreUrls. Without it, a failed POST\n // makes a log record. That record causes a new POST, and the loop does not stop.\n // A custom transport has no known URL. Its request starts inside the library scope.\n return isLibraryRequest() || matchesAny(url, this.ctx.config.capture.ignoreUrls);\n }\n\n /**\n * Tests if a request gets the trace headers.\n * @param url Request target URL.\n * @returns True if the URL is in propagateTraceHeaderTo.\n */\n private propagates(url: string): boolean {\n // Add headers only to allowlisted URLs. A traceparent on a third-party request causes\n // a CORS preflight. The third party does not answer it, and its API stops working.\n const targets = this.ctx.config.capture.propagateTraceHeaderTo;\n if (targets.length === 0) {\n return false;\n }\n\n // A string target is an origin. A relative URL resolves against the page.\n const origin = this.ctx.diagnostics.guard(\n \"capture.header_failed\",\n \"The library could not read the origin of a request URL. Only a RegExp target can match it.\",\n () => new URL(url, location.href).origin,\n );\n\n return targets.some((target) =>\n typeof target === \"string\" ? target === origin : target.test(url),\n );\n }\n\n /** Instruments globalThis.fetch with tracing injection and outcome logging. */\n private installFetch(): void {\n if (typeof globalThis.fetch !== \"function\") {\n return;\n }\n\n // Uninstall clears the flag. A wrapper that stays in place then only calls the original.\n let active = true;\n const prepare = (input: RequestInfo | URL, init: RequestInit | undefined) =>\n this.prepareFetch(input, init);\n const record = (\n method: string,\n url: string,\n status: number,\n durationMs: number,\n error: unknown,\n ): void => {\n this.record(method, url, status, durationMs, error);\n };\n\n const restore = patch(globalThis, \"fetch\", (original: FetchFn) => {\n const call = original.bind(globalThis);\n\n return async function instrumentedFetch(input, init) {\n const plan = active ? prepare(input, init) : undefined;\n if (!plan) {\n return call(input, init);\n }\n\n const startedAt = performance.now();\n try {\n const response = await call(plan.input, plan.init);\n record(plan.method, plan.url, response.status, performance.now() - startedAt, undefined);\n return response;\n } catch (error) {\n record(plan.method, plan.url, 0, performance.now() - startedAt, error);\n throw error;\n }\n };\n });\n\n this.restores.push(() => {\n active = false;\n restore();\n });\n }\n\n /**\n * Reads a fetch call and adds the trace headers to an allowlisted request.\n * @param input Fetch input of the caller.\n * @param init Fetch init of the caller.\n * @returns The plan, or undefined to send the request unchanged and record nothing.\n */\n private prepareFetch(\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n ): FetchPlan | undefined {\n // A read here runs inside the fetch call of the caller. A throw must not fail the request.\n const read = this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read a fetch request. It sends the request unchanged.\",\n (): { method: string; url: string; propagate: boolean } | undefined => {\n const url = readUrl(input);\n if (this.ignored(url)) {\n return undefined;\n }\n\n return { method: readFetchMethod(input, init), url, propagate: this.propagates(url) };\n },\n );\n\n if (!read) {\n return undefined;\n }\n\n const { method, url } = read;\n const plan: FetchPlan = { method, url, input, init };\n // An init with headers replaces all headers of a foreign Request, for example\n // Authorization. Send a foreign input without the trace headers.\n if (!read.propagate || isForeignInput(input)) {\n return plan;\n }\n\n try {\n const injected = Object.entries(this.ctx.tracing.headers());\n\n if (input instanceof Request) {\n // Do not spread a non-empty init with a Request input. That runs the Request\n // constructor on `input` again and reads its body. A second read of a body\n // causes a TypeError.\n const headers = new Headers(input.headers);\n for (const [key, value] of injected) {\n headers.set(key, value);\n }\n plan.input = new Request(input, { headers });\n } else {\n const headers = new Headers(init?.headers);\n for (const [key, value] of injected) {\n headers.set(key, value);\n }\n plan.init = { ...init, headers };\n }\n } catch (error) {\n // Send the request that the caller gave, without changes. A missing header is\n // better than a failed request.\n plan.input = input;\n plan.init = init;\n this.ctx.diagnostics.report(\n \"capture.header_failed\",\n \"The library could not add the traceparent header. It sends the request unchanged.\",\n { url },\n error,\n );\n }\n\n return plan;\n }\n\n /** Instruments XMLHttpRequest open and send prototype methods. */\n private installXhr(): void {\n if (typeof XMLHttpRequest === \"undefined\") {\n return;\n }\n\n // Uninstall clears the flag. A wrapper that stays in place then only calls the original.\n let active = true;\n const ctx = this.ctx;\n const ignored = (url: string): boolean => this.ignored(url);\n const propagates = (url: string): boolean => this.propagates(url);\n const record = (method: string, url: string, status: number, durationMs: number): void => {\n this.record(method, url, status, durationMs, undefined);\n };\n\n const proto = xhrMethods();\n\n const restoreOpen = patch(\n proto,\n \"open\",\n (originalOpen) =>\n function (this: Tracked, method: unknown, url: unknown, ...rest: never[]) {\n if (active) {\n // A read here runs inside the open call of the caller. A throw must not fail it.\n ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read an XMLHttpRequest. It does not record the request.\",\n () => {\n this.__uiobs = { method: toMethod(method), url: readUrl(url), startedAt: 0 };\n },\n );\n }\n originalOpen.apply(this, [method, url, ...rest] as never[]);\n },\n );\n\n const restoreSend = patch(\n proto,\n \"send\",\n (originalSend) =>\n function (this: Tracked, ...args: never[]) {\n const meta = active ? this.__uiobs : undefined;\n if (meta) {\n ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record ${meta.method} ${meta.url}.`,\n () => {\n if (ignored(meta.url)) {\n return;\n }\n\n meta.startedAt = performance.now();\n this.addEventListener(\"loadend\", () => {\n record(meta.method, meta.url, this.status, performance.now() - meta.startedAt);\n });\n\n // setRequestHeader works only between open and send.\n if (propagates(meta.url)) {\n addTraceHeaders(this, meta.url, ctx);\n }\n },\n );\n }\n originalSend.apply(this, args);\n },\n );\n\n this.restores.push(() => {\n active = false;\n restoreOpen();\n restoreSend();\n });\n }\n\n /**\n * Records request outcome attributes and breadcrumb entry.\n * @param method Uppercase HTTP method.\n * @param target Request target URL. The method removes the query unless you set fullUrls.\n * @param status HTTP response status code, or 0 on failure.\n * @param durationMs Request duration in milliseconds.\n * @param error Caught error instance on failed requests.\n */\n private record(\n method: string,\n target: string,\n status: number,\n durationMs: number,\n error: unknown,\n ): void {\n // Remove the query here, not at the call sites. ignoreUrls and propagateTraceHeaderTo\n // match on the full URL. Only the recorded URL loses the query string.\n const url = this.ctx.config.capture.fullUrls ? target : stripUrlQuery(target);\n\n // This code runs inside the fetch call of the caller. An error here must not cause\n // the request of the caller to fail.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record ${method} ${url}.`,\n () => {\n const rounded = Math.round(durationMs);\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `${method} ${url} ${status === 0 ? \"failed\" : String(status)}`,\n data: { durationMs: rounded },\n });\n\n const attributes = {\n \"http.request.method\": method,\n \"url.full\": url,\n \"http.response.status_code\": status,\n \"http.duration_ms\": rounded,\n };\n\n if (status === 0) {\n this.ctx.logger.error(`${method} ${url} failed`, error, attributes);\n return;\n }\n if (status >= 400) {\n this.ctx.logger.warn(`${method} ${url} returned ${String(status)}`, attributes);\n return;\n }\n\n // Log a success at DEBUG. The default minLevel of INFO drops it.\n // Only failures use bandwidth.\n this.ctx.logger.debug(`${method} ${url}`, attributes);\n },\n );\n }\n}\n\n/**\n * Adds the trace headers to an open XHR. A failure sends the request without them.\n * @param xhr Request between open and send.\n * @param url Request target URL, for the diagnostic.\n * @param ctx Capture context with tracing and diagnostics.\n */\nfunction addTraceHeaders(xhr: XMLHttpRequest, url: string, ctx: CaptureContext): void {\n try {\n for (const [key, value] of Object.entries(ctx.tracing.headers())) {\n xhr.setRequestHeader(key, value);\n }\n } catch (error) {\n ctx.diagnostics.report(\n \"capture.header_failed\",\n \"The library could not add the traceparent header. It sends the request unchanged.\",\n { url },\n error,\n );\n }\n}\n"],"mappings":";;;;AAgHA,SAAgBE,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,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