@blueking/open-telemetry 0.0.9 → 0.0.11
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/dist/bk-rum.global.js +2 -2
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/config.d.ts +17 -0
- package/dist/core/telemetry-attributes.d.ts +3 -0
- package/dist/core/url.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +376 -339
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -9,10 +9,10 @@ import { registerInstrumentations as p } from "@opentelemetry/instrumentation";
|
|
|
9
9
|
import { resourceFromAttributes as m } from "@opentelemetry/resources";
|
|
10
10
|
import { BatchLogRecordProcessor as h, LoggerProvider as g } from "@opentelemetry/sdk-logs";
|
|
11
11
|
import { MeterProvider as _, PeriodicExportingMetricReader as v } from "@opentelemetry/sdk-metrics";
|
|
12
|
-
import { BatchSpanProcessor as y, ParentBasedSampler as
|
|
13
|
-
import { WebTracerProvider as
|
|
12
|
+
import { BatchSpanProcessor as y, ParentBasedSampler as b, SimpleSpanProcessor as ee, TraceIdRatioBasedSampler as te } from "@opentelemetry/sdk-trace-base";
|
|
13
|
+
import { WebTracerProvider as ne } from "@opentelemetry/sdk-trace-web";
|
|
14
14
|
//#region src/schema/attributes.ts
|
|
15
|
-
var
|
|
15
|
+
var x = {
|
|
16
16
|
actionType: "action.type",
|
|
17
17
|
deploymentEnvironmentName: "deployment.environment.name",
|
|
18
18
|
browserName: "browser_name",
|
|
@@ -58,22 +58,22 @@ var b = {
|
|
|
58
58
|
};
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
|
|
61
|
-
function
|
|
61
|
+
function S(e) {
|
|
62
62
|
"@babel/helpers - typeof";
|
|
63
|
-
return
|
|
63
|
+
return S = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
64
64
|
return typeof e;
|
|
65
65
|
} : function(e) {
|
|
66
66
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
67
|
-
},
|
|
67
|
+
}, S(e);
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
|
|
71
|
-
function
|
|
72
|
-
if (
|
|
71
|
+
function re(e, t) {
|
|
72
|
+
if (S(e) != "object" || !e) return e;
|
|
73
73
|
var n = e[Symbol.toPrimitive];
|
|
74
74
|
if (n !== void 0) {
|
|
75
75
|
var r = n.call(e, t || "default");
|
|
76
|
-
if (
|
|
76
|
+
if (S(r) != "object") return r;
|
|
77
77
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
78
78
|
}
|
|
79
79
|
return (t === "string" ? String : Number)(e);
|
|
@@ -81,8 +81,8 @@ function S(e, t) {
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
|
|
83
83
|
function C(e) {
|
|
84
|
-
var t =
|
|
85
|
-
return
|
|
84
|
+
var t = re(e, "string");
|
|
85
|
+
return S(t) == "symbol" ? t : t + "";
|
|
86
86
|
}
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
|
|
@@ -145,10 +145,10 @@ var D = "http://localhost:4318", ie = 60 * 1e3, ae = "unknown_service", O = (e)
|
|
|
145
145
|
version: e == null ? void 0 : e.version
|
|
146
146
|
};
|
|
147
147
|
}, fe = (e) => E(E({
|
|
148
|
-
[
|
|
148
|
+
[x.deploymentEnvironmentName]: e.environment,
|
|
149
149
|
"rum.provider": "blueking",
|
|
150
|
-
[
|
|
151
|
-
}, e.version ? { [
|
|
150
|
+
[x.serviceName]: e.name
|
|
151
|
+
}, e.version ? { [x.serviceVersion]: e.version } : {}), {}, { "telemetry.sdk.language": "webjs" }), pe = (e) => ({
|
|
152
152
|
endpoint: O((e == null ? void 0 : e.endpoint) || D),
|
|
153
153
|
traces: k(e, "traces"),
|
|
154
154
|
metrics: k(e, "metrics"),
|
|
@@ -277,13 +277,17 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
277
277
|
e.transport.metrics.endpoint,
|
|
278
278
|
e.transport.logs.endpoint
|
|
279
279
|
].some((e) => Ce(n, xe(e)));
|
|
280
|
-
}, M = (e, t) => Te(e, t), Ee = (e, t) =>
|
|
281
|
-
|
|
280
|
+
}, M = (e, t) => Te(e, t), Ee = (e, t) => e === "all" ? !0 : typeof e == "function" ? e(t) : (Array.isArray(e) ? e : [e]).some((e) => typeof e == "string" ? t.includes(e) : e.test(t)), De = (e, t) => {
|
|
281
|
+
if (we(t)) return !0;
|
|
282
|
+
let n = e.instrumentations.propagateTraceHeaderUrls;
|
|
283
|
+
return n ? Ee(n, xe(t)) : !1;
|
|
284
|
+
}, Oe = ["http.url", "url.full"], ke = (e) => {
|
|
285
|
+
for (let n of Oe) {
|
|
282
286
|
var t;
|
|
283
287
|
let r = (t = e.attributes) == null ? void 0 : t[n];
|
|
284
288
|
if (typeof r == "string") return r;
|
|
285
289
|
}
|
|
286
|
-
},
|
|
290
|
+
}, Ae = class {
|
|
287
291
|
constructor(e, t) {
|
|
288
292
|
this.inner = e, this.config = t;
|
|
289
293
|
}
|
|
@@ -291,7 +295,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
291
295
|
return this.inner.forceFlush();
|
|
292
296
|
}
|
|
293
297
|
onEnd(e) {
|
|
294
|
-
let t =
|
|
298
|
+
let t = ke(e);
|
|
295
299
|
t && Te(this.config, t) || this.inner.onEnd(e);
|
|
296
300
|
}
|
|
297
301
|
onStart(e, t) {
|
|
@@ -300,7 +304,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
300
304
|
shutdown() {
|
|
301
305
|
return this.inner.shutdown();
|
|
302
306
|
}
|
|
303
|
-
},
|
|
307
|
+
}, je = class {
|
|
304
308
|
constructor(e = {}, t) {
|
|
305
309
|
w(this, "attributes", {}), w(this, "setOptionalAttribute", (e, t) => {
|
|
306
310
|
if (t === void 0) {
|
|
@@ -319,13 +323,13 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
319
323
|
}), w(this, "setUser", (e) => {
|
|
320
324
|
if (this.user = E(E({}, this.user), e), "id" in e) {
|
|
321
325
|
if (e.id === void 0) {
|
|
322
|
-
delete this.attributes[
|
|
326
|
+
delete this.attributes[x.userId];
|
|
323
327
|
return;
|
|
324
328
|
}
|
|
325
|
-
this.attributes[
|
|
329
|
+
this.attributes[x.userId] = e.id;
|
|
326
330
|
}
|
|
327
331
|
}), w(this, "setView", (e) => {
|
|
328
|
-
this.view = E(E({}, this.view), e), this.setOptionalAttribute(
|
|
332
|
+
this.view = E(E({}, this.view), e), this.setOptionalAttribute(x.viewId, e.id), this.setOptionalAttribute(x.viewUrl, e.url), this.setOptionalAttribute(x.viewUrlPathGroup, e.urlPathGroup), this.setOptionalAttribute(x.viewLoadingType, e.loadingType);
|
|
329
333
|
}), this.setAttributes(e), t && this.setUser(t);
|
|
330
334
|
}
|
|
331
335
|
}, N = {
|
|
@@ -344,7 +348,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
344
348
|
resource: "resource",
|
|
345
349
|
route: "route",
|
|
346
350
|
vital: "vital"
|
|
347
|
-
},
|
|
351
|
+
}, Me = (e) => e < 100 ? "<100ms" : e < 500 ? "100~500ms" : e < 2e3 ? "500ms~2s" : ">2s", Ne = (e) => `${Math.trunc(e / 100)}xx`, Pe = (e) => e === 408 || e === 504 ? N.timeout : typeof e == "number" && e >= 400 ? N.error : N.success, Fe = (e) => e === 408 || e === 504 ? "network_timeout" : typeof e != "number" || e < 400 ? "none" : e >= 500 ? "http_5xx" : "http_4xx", Ie = (e) => e === "good" ? N.success : N.warning, Le = (e, t) => {
|
|
348
352
|
if (!e) return {};
|
|
349
353
|
try {
|
|
350
354
|
let n = new URL(e, typeof location > "u" ? "http://localhost" : location.href), r = t == null ? n.pathname : t;
|
|
@@ -360,53 +364,53 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
360
364
|
};
|
|
361
365
|
}
|
|
362
366
|
}, F = ({ duration: e, errorType: t = "none", eventLabel: n, result: r = N.success, spanSubtype: i, spanType: a, targetLabel: o, targetValue: s, traceScene: c }) => E(E(E(E(E({
|
|
363
|
-
[
|
|
364
|
-
[
|
|
365
|
-
[
|
|
366
|
-
[
|
|
367
|
-
}, e === void 0 ? {} : { [
|
|
368
|
-
let o =
|
|
367
|
+
[x.spanType]: a,
|
|
368
|
+
[x.spanSubtype]: i,
|
|
369
|
+
[x.result]: r,
|
|
370
|
+
[x.errorType]: t
|
|
371
|
+
}, e === void 0 ? {} : { [x.durationBucket]: Me(e) }), n === void 0 ? {} : { [x.eventLabel]: n }), o === void 0 ? {} : { [x.targetLabel]: o }), s === void 0 ? {} : { [x.targetValue]: s }), c === void 0 ? {} : { [x.traceScene]: c }), Re = ({ duration: e, method: t, statusCode: n, subtype: r, url: i, urlPathTemplate: a }) => {
|
|
372
|
+
let o = Le(i, a);
|
|
369
373
|
return E(E(E(E(E({}, F({
|
|
370
374
|
duration: e,
|
|
371
|
-
errorType:
|
|
375
|
+
errorType: Fe(n),
|
|
372
376
|
eventLabel: "API 调用",
|
|
373
|
-
result:
|
|
377
|
+
result: Pe(n),
|
|
374
378
|
spanSubtype: r,
|
|
375
379
|
spanType: P.http,
|
|
376
380
|
targetLabel: o.label,
|
|
377
381
|
targetValue: n
|
|
378
|
-
})), t ? { "http.request.method": t.toUpperCase() } : {}), o.domain ? { [
|
|
382
|
+
})), t ? { "http.request.method": t.toUpperCase() } : {}), o.domain ? { [x.targetDomain]: o.domain } : {}), o.pathTemplate ? { [x.targetPathTemplate]: o.pathTemplate } : {}), typeof n == "number" ? {
|
|
379
383
|
"http.response.status_code": n,
|
|
380
|
-
[
|
|
384
|
+
[x.statusClass]: Ne(n)
|
|
381
385
|
} : {});
|
|
382
|
-
},
|
|
386
|
+
}, ze = ({ duration: e, initiatorType: t = "other", responseStatus: n, transferSize: r, url: i, urlPathTemplate: a }) => {
|
|
383
387
|
var o;
|
|
384
|
-
let s =
|
|
388
|
+
let s = Le(i, a), c = typeof n == "number" ? Pe(n) : N.success;
|
|
385
389
|
return E(E(E(E({}, F({
|
|
386
390
|
duration: e,
|
|
387
|
-
errorType: typeof n == "number" ?
|
|
391
|
+
errorType: typeof n == "number" ? Fe(n) : "none",
|
|
388
392
|
eventLabel: "静态资源",
|
|
389
393
|
result: c,
|
|
390
394
|
spanSubtype: t,
|
|
391
395
|
spanType: P.resource,
|
|
392
396
|
targetLabel: (o = s.label) == null ? i : o,
|
|
393
397
|
targetValue: r
|
|
394
|
-
})), s.domain ? { [
|
|
398
|
+
})), s.domain ? { [x.targetDomain]: s.domain } : {}), s.pathTemplate ? { [x.targetPathTemplate]: s.pathTemplate } : {}), typeof n == "number" ? {
|
|
395
399
|
"http.response.status_code": n,
|
|
396
|
-
[
|
|
400
|
+
[x.statusClass]: Ne(n)
|
|
397
401
|
} : {});
|
|
398
|
-
},
|
|
402
|
+
}, Be = [
|
|
399
403
|
"click",
|
|
400
404
|
"submit",
|
|
401
405
|
"keydown"
|
|
402
|
-
],
|
|
406
|
+
], Ve = (e) => e instanceof Element ? e : void 0, He = (e) => {
|
|
403
407
|
var t;
|
|
404
408
|
if (!e) return;
|
|
405
409
|
let n = ((t = e.textContent) == null ? void 0 : t.trim()) || e.getAttribute("aria-label") || e.getAttribute("title") || "";
|
|
406
410
|
return n ? n.slice(0, 32) : void 0;
|
|
407
|
-
},
|
|
411
|
+
}, Ue = (e = {}) => {
|
|
408
412
|
var t;
|
|
409
|
-
let n = [], r = (t = e.eventNames) == null ?
|
|
413
|
+
let n = [], r = (t = e.eventNames) == null ? Be : t;
|
|
410
414
|
return {
|
|
411
415
|
name: "action",
|
|
412
416
|
init(e) {
|
|
@@ -416,14 +420,14 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
416
420
|
passive: !0
|
|
417
421
|
}, i = (t) => {
|
|
418
422
|
var n;
|
|
419
|
-
let r =
|
|
423
|
+
let r = Ve(t.target), i = He(r), a = r == null ? void 0 : r.tagName.toLowerCase();
|
|
420
424
|
e.startSpan(`action.${t.type}`, E(E(E(E({}, e.config.hooks.getPageAttributes()), F({
|
|
421
425
|
errorType: "none",
|
|
422
426
|
eventLabel: "用户操作",
|
|
423
427
|
spanSubtype: t.type,
|
|
424
428
|
spanType: P.action,
|
|
425
429
|
targetLabel: (n = i == null ? a : i) == null ? t.type : n
|
|
426
|
-
})), {}, { [
|
|
430
|
+
})), {}, { [x.actionType]: t.type }, i ? { [x.targetTextShort]: i } : {}), a ? { [x.targetTag]: a } : {})).end();
|
|
427
431
|
};
|
|
428
432
|
for (let e of r) window.addEventListener(e, i, t), n.push(() => window.removeEventListener(e, i, t));
|
|
429
433
|
},
|
|
@@ -434,7 +438,39 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
434
438
|
}
|
|
435
439
|
}
|
|
436
440
|
};
|
|
437
|
-
}
|
|
441
|
+
};
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
444
|
+
function We(e, t) {
|
|
445
|
+
if (e == null) return {};
|
|
446
|
+
var n = {};
|
|
447
|
+
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
448
|
+
if (t.includes(r)) continue;
|
|
449
|
+
n[r] = e[r];
|
|
450
|
+
}
|
|
451
|
+
return n;
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
455
|
+
function Ge(e, t) {
|
|
456
|
+
if (e == null) return {};
|
|
457
|
+
var n, r, i = We(e, t);
|
|
458
|
+
if (Object.getOwnPropertySymbols) {
|
|
459
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
460
|
+
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
461
|
+
}
|
|
462
|
+
return i;
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/core/telemetry-attributes.ts
|
|
466
|
+
var Ke = (e) => typeof e == "string" && e.length > 0 ? e : void 0, qe = (e) => {
|
|
467
|
+
let t = Ke(e);
|
|
468
|
+
return t ? { [x.viewUrlPathGroup]: t } : {};
|
|
469
|
+
}, I = (e) => qe(e[x.viewUrlPathGroup]), L = (e, t) => {
|
|
470
|
+
var n;
|
|
471
|
+
let r = x.viewUrlPathGroup, { [r]: i } = e;
|
|
472
|
+
return E(E({}, Ge(e, [r].map(C))), qe((n = Ke(i)) == null ? t : n));
|
|
473
|
+
}, Je = "body", Ye = 3e3, Xe = .8, Ze = [
|
|
438
474
|
"[data-loading=\"true\"]",
|
|
439
475
|
"[aria-busy=\"true\"]",
|
|
440
476
|
".loading",
|
|
@@ -442,56 +478,56 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
442
478
|
".spinner",
|
|
443
479
|
".skeleton",
|
|
444
480
|
".bk-loading"
|
|
445
|
-
],
|
|
481
|
+
], R = [
|
|
446
482
|
[.5, .5],
|
|
447
483
|
[.25, .25],
|
|
448
484
|
[.75, .25],
|
|
449
485
|
[.25, .75],
|
|
450
486
|
[.75, .75]
|
|
451
|
-
],
|
|
487
|
+
], Qe = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, $e = (e, t) => typeof e != "number" || !Number.isFinite(e) ? t : Math.max(0, Math.min(1, e)), et = (e) => {
|
|
452
488
|
if (!e) return "";
|
|
453
489
|
let t = e.tagName.toLowerCase();
|
|
454
490
|
return e.id ? `${t}#${e.id}` : t;
|
|
455
|
-
},
|
|
491
|
+
}, tt = (e, t) => e ? t.some((t) => {
|
|
456
492
|
try {
|
|
457
493
|
return e.matches(t) || !!e.closest(t);
|
|
458
494
|
} catch (e) {
|
|
459
495
|
return !1;
|
|
460
496
|
}
|
|
461
|
-
}) : !1,
|
|
497
|
+
}) : !1, nt = (e) => {
|
|
462
498
|
if (typeof document > "u") return () => {};
|
|
463
499
|
if (document.readyState === "complete" || document.readyState === "interactive") return e(), () => {};
|
|
464
500
|
let t = () => {
|
|
465
501
|
document.removeEventListener("DOMContentLoaded", t), e();
|
|
466
502
|
};
|
|
467
503
|
return document.addEventListener("DOMContentLoaded", t), () => document.removeEventListener("DOMContentLoaded", t);
|
|
468
|
-
},
|
|
504
|
+
}, rt = (e = {}) => {
|
|
469
505
|
var t, n;
|
|
470
506
|
let r, i, a = !1, o = {
|
|
471
|
-
checkDelay:
|
|
507
|
+
checkDelay: Qe(e.checkDelay, Ye),
|
|
472
508
|
ignoreSelectors: (t = e.ignoreSelectors) == null ? [] : t,
|
|
473
|
-
rootSelector: (n = e.rootSelector) == null ?
|
|
474
|
-
threshold:
|
|
509
|
+
rootSelector: (n = e.rootSelector) == null ? Je : n,
|
|
510
|
+
threshold: $e(e.threshold, Xe)
|
|
475
511
|
};
|
|
476
512
|
return {
|
|
477
513
|
name: "blank-screen",
|
|
478
514
|
init(e) {
|
|
479
515
|
if (typeof window > "u" || typeof document > "u") return;
|
|
480
|
-
let { checkDelay: t, rootSelector: n, threshold: s } = o, c = [...
|
|
516
|
+
let { checkDelay: t, rootSelector: n, threshold: s } = o, c = [...Ze, ...o.ignoreSelectors], l = e.meter.createCounter("browser.blank_screen.count", { description: "Number of suspected blank screen detections" }), u = () => {
|
|
481
517
|
try {
|
|
482
518
|
var t, r;
|
|
483
519
|
let i = document.querySelector(n), a = 0, o = 0;
|
|
484
|
-
for (let [e, t] of
|
|
520
|
+
for (let [e, t] of R) {
|
|
485
521
|
let n = document.elementFromPoint(window.innerWidth * e, window.innerHeight * t);
|
|
486
|
-
if (
|
|
522
|
+
if (tt(n, c)) {
|
|
487
523
|
o += 1;
|
|
488
524
|
continue;
|
|
489
525
|
}
|
|
490
526
|
(n === i || n === document.body || n === document.documentElement) && (a += 1);
|
|
491
527
|
}
|
|
492
|
-
let u =
|
|
528
|
+
let u = R.length - o;
|
|
493
529
|
if (u === 0) return;
|
|
494
|
-
let d = a / u, f = d >= s, p =
|
|
530
|
+
let d = a / u, f = d >= s, p = et(document.elementFromPoint(window.innerWidth / 2, window.innerHeight / 2)), m = E(E({}, F({
|
|
495
531
|
errorType: f ? "blank_screen" : "none",
|
|
496
532
|
eventLabel: "白屏",
|
|
497
533
|
result: f ? N.error : N.success,
|
|
@@ -504,13 +540,13 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
504
540
|
"blank_screen.threshold": s,
|
|
505
541
|
"blank_screen.root": n,
|
|
506
542
|
"blank_screen.detected": f,
|
|
507
|
-
"blank_screen.sample_total":
|
|
543
|
+
"blank_screen.sample_total": R.length,
|
|
508
544
|
"blank_screen.sample_valid": u,
|
|
509
545
|
"blank_screen.sample_loading": o,
|
|
510
546
|
"blank_screen.center_element": p,
|
|
511
547
|
"blank_screen.dom_node_count": (t = (r = document.body) == null ? void 0 : r.getElementsByTagName("*").length) == null ? 0 : t
|
|
512
548
|
});
|
|
513
|
-
f && (l.add(1, e.applyRedact({ "blank_screen.root": n })), e.startSpan("browser.blank_screen", m).end());
|
|
549
|
+
f && (l.add(1, e.applyRedact(E(E(E({}, e.config.hooks.getMetricAttributes()), I(e.getRuntimeAttributes())), {}, { "blank_screen.root": n }))), e.startSpan("browser.blank_screen", m).end());
|
|
514
550
|
} catch (t) {
|
|
515
551
|
if (e.config.debug) {
|
|
516
552
|
var i;
|
|
@@ -518,7 +554,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
518
554
|
}
|
|
519
555
|
}
|
|
520
556
|
};
|
|
521
|
-
i =
|
|
557
|
+
i = nt(() => {
|
|
522
558
|
a || (r = window.setTimeout(u, t));
|
|
523
559
|
});
|
|
524
560
|
},
|
|
@@ -526,11 +562,11 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
526
562
|
a = !0, i == null || i(), i = void 0, r !== void 0 && typeof window < "u" && (window.clearTimeout(r), r = void 0);
|
|
527
563
|
}
|
|
528
564
|
};
|
|
529
|
-
},
|
|
565
|
+
}, it = ["http.url", "url.full"], at = ["http.status_code", "http.response.status_code"], ot = ["http.method", "http.request.method"], st = (e) => ({ test: e }), z = (e) => typeof location > "u" ? void 0 : e.config.hooks.getViewPathGroup(location.href), ct = (e, t, n) => {
|
|
530
566
|
var r;
|
|
531
|
-
t.setAttributes(e.applyRedact(e.config.hooks.getPageAttributes()));
|
|
567
|
+
t.setAttributes(e.applyRedact(E(E({}, L(e.getRuntimeAttributes(), z(e))), e.config.hooks.getPageAttributes())));
|
|
532
568
|
let i;
|
|
533
|
-
for (let n of
|
|
569
|
+
for (let n of it) {
|
|
534
570
|
var a;
|
|
535
571
|
let r = (a = t.attributes) == null ? void 0 : a[n];
|
|
536
572
|
if (typeof r == "string") {
|
|
@@ -538,35 +574,36 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
538
574
|
typeof a == "string" && (i = a, t.setAttribute(n, a));
|
|
539
575
|
}
|
|
540
576
|
}
|
|
541
|
-
let o =
|
|
577
|
+
let o = at.map((e) => {
|
|
542
578
|
var n;
|
|
543
579
|
return (n = t.attributes) == null ? void 0 : n[e];
|
|
544
|
-
}).find((e) => typeof e == "number"), s =
|
|
580
|
+
}).find((e) => typeof e == "number"), s = ot.map((e) => {
|
|
545
581
|
var n;
|
|
546
582
|
return (n = t.attributes) == null ? void 0 : n[e];
|
|
547
|
-
}).find((e) => typeof e == "string"), c = (r = i) == null ?
|
|
583
|
+
}).find((e) => typeof e == "string"), c = (r = i) == null ? it.map((e) => {
|
|
548
584
|
var n;
|
|
549
585
|
return (n = t.attributes) == null ? void 0 : n[e];
|
|
550
586
|
}).find((e) => typeof e == "string") : r;
|
|
551
|
-
t.setAttributes(e.applyRedact(
|
|
587
|
+
t.setAttributes(e.applyRedact(Re({
|
|
552
588
|
method: s,
|
|
553
589
|
statusCode: o,
|
|
554
590
|
subtype: n,
|
|
555
591
|
url: c,
|
|
556
592
|
urlPathTemplate: c ? e.config.hooks.getViewPathGroup(c) : void 0
|
|
557
593
|
})));
|
|
558
|
-
},
|
|
559
|
-
|
|
594
|
+
}, lt = (e, t, n) => {
|
|
595
|
+
let r = z(e);
|
|
596
|
+
t.setAttributes(e.applyRedact(E(E(E({}, L(e.getRuntimeAttributes(), r)), e.config.hooks.getPageAttributes()), F({
|
|
560
597
|
errorType: "none",
|
|
561
598
|
eventLabel: "文档加载",
|
|
562
599
|
spanSubtype: n,
|
|
563
600
|
spanType: P.document,
|
|
564
|
-
targetLabel:
|
|
601
|
+
targetLabel: r,
|
|
565
602
|
traceScene: "page_load"
|
|
566
603
|
}))));
|
|
567
|
-
},
|
|
604
|
+
}, ut = (e, t, n) => {
|
|
568
605
|
let r = e.config.hooks.redactUrl(n.name);
|
|
569
|
-
t.setAttributes(e.applyRedact(E(E(E({}, e.config.hooks.getPageAttributes()),
|
|
606
|
+
t.setAttributes(e.applyRedact(E(E(E(E({}, L(e.getRuntimeAttributes(), z(e))), e.config.hooks.getPageAttributes()), ze({
|
|
570
607
|
duration: n.duration,
|
|
571
608
|
initiatorType: n.initiatorType || "other",
|
|
572
609
|
responseStatus: n.responseStatus,
|
|
@@ -574,7 +611,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
574
611
|
url: r,
|
|
575
612
|
urlPathTemplate: e.config.hooks.getViewPathGroup(n.name)
|
|
576
613
|
})), {}, { "url.full": r })));
|
|
577
|
-
},
|
|
614
|
+
}, dt = (e = {}) => {
|
|
578
615
|
var t, n, r, i;
|
|
579
616
|
let a = [], o = {
|
|
580
617
|
documentLoad: (t = e.documentLoad) == null ? !0 : t,
|
|
@@ -587,7 +624,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
587
624
|
enabled: !!(o.documentLoad || o.fetch || o.xhr || o.userInteraction),
|
|
588
625
|
init(e) {
|
|
589
626
|
return A(function* () {
|
|
590
|
-
let t = [
|
|
627
|
+
let t = [st((t) => M(e.config, t))], n = [st((t) => De(e.config, t))], [r, i, s, c] = yield Promise.all([
|
|
591
628
|
o.documentLoad ? import("@opentelemetry/instrumentation-document-load") : Promise.resolve(null),
|
|
592
629
|
o.fetch ? import("@opentelemetry/instrumentation-fetch") : Promise.resolve(null),
|
|
593
630
|
o.xhr ? import("@opentelemetry/instrumentation-xml-http-request") : Promise.resolve(null),
|
|
@@ -596,18 +633,18 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
596
633
|
if (r && a.push(new r.DocumentLoadInstrumentation({
|
|
597
634
|
semconvStabilityOptIn: "http",
|
|
598
635
|
applyCustomAttributesOnSpan: {
|
|
599
|
-
documentLoad: (t) =>
|
|
600
|
-
documentFetch: (t) =>
|
|
601
|
-
resourceFetch: (t, n) =>
|
|
636
|
+
documentLoad: (t) => lt(e, t, "navigate"),
|
|
637
|
+
documentFetch: (t) => lt(e, t, "document_fetch"),
|
|
638
|
+
resourceFetch: (t, n) => ut(e, t, n)
|
|
602
639
|
}
|
|
603
640
|
})), i && a.push(new i.FetchInstrumentation({
|
|
604
|
-
applyCustomAttributesOnSpan: (t) =>
|
|
641
|
+
applyCustomAttributesOnSpan: (t) => ct(e, t, "fetch"),
|
|
605
642
|
ignoreUrls: t,
|
|
606
643
|
propagateTraceHeaderCorsUrls: n,
|
|
607
644
|
semconvStabilityOptIn: "http",
|
|
608
645
|
ignoreNetworkEvents: !1
|
|
609
646
|
})), s && a.push(new s.XMLHttpRequestInstrumentation({
|
|
610
|
-
applyCustomAttributesOnSpan: (t) =>
|
|
647
|
+
applyCustomAttributesOnSpan: (t) => ct(e, t, "xhr"),
|
|
611
648
|
ignoreUrls: t,
|
|
612
649
|
propagateTraceHeaderCorsUrls: n,
|
|
613
650
|
semconvStabilityOptIn: "http",
|
|
@@ -626,11 +663,11 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
626
663
|
}
|
|
627
664
|
}
|
|
628
665
|
};
|
|
629
|
-
},
|
|
666
|
+
}, B = (e) => {
|
|
630
667
|
let t = 5381;
|
|
631
668
|
for (let n = 0; n < e.length; n++) t = t * 33 ^ e.charCodeAt(n);
|
|
632
669
|
return (t >>> 0).toString(36);
|
|
633
|
-
},
|
|
670
|
+
}, ft = (e, t) => {
|
|
634
671
|
let n = /* @__PURE__ */ new Map(), r = 0, i = (t) => {
|
|
635
672
|
if (!(t - r < e)) {
|
|
636
673
|
r = t;
|
|
@@ -652,18 +689,18 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
652
689
|
count: o.count
|
|
653
690
|
});
|
|
654
691
|
} };
|
|
655
|
-
},
|
|
656
|
-
if (t) return
|
|
657
|
-
},
|
|
692
|
+
}, pt = 6e4, mt = 5, ht = /^https?:|^\/\//i, gt = (e, t) => {
|
|
693
|
+
if (t) return ht.test(t) ? e(t) : t;
|
|
694
|
+
}, _t = () => {
|
|
658
695
|
let e;
|
|
659
696
|
return {
|
|
660
697
|
name: "csp-violation",
|
|
661
698
|
init(t) {
|
|
662
699
|
if (typeof window > "u" || typeof document > "u") return;
|
|
663
|
-
let n =
|
|
664
|
-
let r =
|
|
700
|
+
let n = ft(pt, mt), r = (e) => {
|
|
701
|
+
let r = B(`${e.violatedDirective}|${e.blockedURI}|${e.sourceFile}|${e.lineNumber}`), i = n.allow(r);
|
|
665
702
|
if (!i.allowed) return;
|
|
666
|
-
let a =
|
|
703
|
+
let a = gt(t.config.hooks.redactUrl, e.blockedURI), o = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0, s = i.count === 1;
|
|
667
704
|
t.startSpan("csp.violation", E(E(E({}, t.config.hooks.getPageAttributes()), F({
|
|
668
705
|
errorType: "csp",
|
|
669
706
|
eventLabel: "CSP 错误",
|
|
@@ -683,7 +720,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
683
720
|
"csp.status_code": e.statusCode,
|
|
684
721
|
"csp.fingerprint": r,
|
|
685
722
|
"csp.window_count": i.count,
|
|
686
|
-
[
|
|
723
|
+
[x.exceptionFingerprint]: r,
|
|
687
724
|
"error.source": "csp"
|
|
688
725
|
}, s ? { "csp.original_policy": e.originalPolicy } : {})).end();
|
|
689
726
|
};
|
|
@@ -693,7 +730,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
693
730
|
e == null || e(), e = void 0;
|
|
694
731
|
}
|
|
695
732
|
};
|
|
696
|
-
},
|
|
733
|
+
}, V = (e) => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`, vt = "BK_RUM_DEVICE_ID", yt = 250, bt = () => navigator.connection, xt = () => navigator.userAgentData, St = (e) => {
|
|
697
734
|
for (let [t, n] of [
|
|
698
735
|
["Edge", /Edg\/([\d.]+)/],
|
|
699
736
|
["Chrome", /Chrome\/([\d.]+)/],
|
|
@@ -710,21 +747,21 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
710
747
|
name: "Other",
|
|
711
748
|
version: void 0
|
|
712
749
|
};
|
|
713
|
-
},
|
|
750
|
+
}, Ct = (e, t) => {
|
|
714
751
|
let n = `${t == null ? "" : t} ${e}`;
|
|
715
752
|
return /iphone|ipad|ipod/i.test(n) ? "iOS" : /android/i.test(n) ? "Android" : /mac/i.test(n) ? "macOS" : /win/i.test(n) ? "Windows" : /linux/i.test(n) ? "Linux" : "Other";
|
|
716
|
-
},
|
|
753
|
+
}, wt = (e) => {
|
|
717
754
|
let t = null;
|
|
718
755
|
try {
|
|
719
756
|
t = window.localStorage.getItem(e);
|
|
720
757
|
} catch (e) {}
|
|
721
758
|
if (t) return t;
|
|
722
|
-
let n =
|
|
759
|
+
let n = V("device");
|
|
723
760
|
try {
|
|
724
761
|
window.localStorage.setItem(e, n);
|
|
725
762
|
} catch (e) {}
|
|
726
763
|
return n;
|
|
727
|
-
},
|
|
764
|
+
}, Tt = () => {
|
|
728
765
|
var e, t;
|
|
729
766
|
return typeof window > "u" ? {} : {
|
|
730
767
|
"browser.viewport.width": window.innerWidth,
|
|
@@ -732,8 +769,8 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
732
769
|
"browser.screen.width": (e = window.screen) == null ? void 0 : e.width,
|
|
733
770
|
"browser.screen.height": (t = window.screen) == null ? void 0 : t.height
|
|
734
771
|
};
|
|
735
|
-
},
|
|
736
|
-
let e =
|
|
772
|
+
}, Et = () => {
|
|
773
|
+
let e = bt();
|
|
737
774
|
return e ? {
|
|
738
775
|
"network.effective_type": e.effectiveType,
|
|
739
776
|
"network.connection_type": e.type,
|
|
@@ -741,45 +778,45 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
741
778
|
"network.rtt": e.rtt,
|
|
742
779
|
"network.save_data": e.saveData
|
|
743
780
|
} : {};
|
|
744
|
-
},
|
|
781
|
+
}, Dt = () => {
|
|
745
782
|
if (typeof navigator > "u") return {};
|
|
746
|
-
let e =
|
|
783
|
+
let e = xt(), t = navigator.userAgent, n = St(t), r = Ct(t, e == null ? void 0 : e.platform), i = e != null && e.mobile || /mobi|android|iphone|ipad|ipod/i.test(t) ? "mobile" : "desktop";
|
|
747
784
|
return {
|
|
748
785
|
"device.memory": navigator.deviceMemory,
|
|
749
786
|
"device.cpu_cores": navigator.hardwareConcurrency,
|
|
750
787
|
"device.platform": e == null ? void 0 : e.platform,
|
|
751
788
|
"device.mobile": e == null ? void 0 : e.mobile,
|
|
752
|
-
[
|
|
753
|
-
[
|
|
754
|
-
[
|
|
755
|
-
[
|
|
789
|
+
[x.browserName]: n.name,
|
|
790
|
+
[x.browserVersion]: n.version,
|
|
791
|
+
[x.deviceType]: i,
|
|
792
|
+
[x.osName]: r,
|
|
756
793
|
"user_agent.name": n.name,
|
|
757
794
|
"user_agent.version": n.version,
|
|
758
795
|
"user_agent.os.name": r
|
|
759
796
|
};
|
|
760
|
-
},
|
|
797
|
+
}, Ot = (e, t) => {
|
|
761
798
|
let n;
|
|
762
799
|
return () => {
|
|
763
800
|
n !== void 0 && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
764
801
|
n = void 0, e();
|
|
765
802
|
}, t);
|
|
766
803
|
};
|
|
767
|
-
},
|
|
804
|
+
}, kt = (e = {}) => {
|
|
768
805
|
var t;
|
|
769
|
-
let n = [], r = (t = e.storageKey) == null ?
|
|
806
|
+
let n = [], r = (t = e.storageKey) == null ? vt : t;
|
|
770
807
|
return {
|
|
771
808
|
name: "device",
|
|
772
809
|
init(e) {
|
|
773
|
-
let t = typeof window > "u" ?
|
|
774
|
-
if (e.setRuntimeAttributes(E(E(E({ "device.id": t },
|
|
775
|
-
let i =
|
|
776
|
-
e.setRuntimeAttributes(
|
|
777
|
-
},
|
|
810
|
+
let t = typeof window > "u" ? V("device") : wt(r);
|
|
811
|
+
if (e.setRuntimeAttributes(E(E(E({ "device.id": t }, Dt()), Tt()), Et())), typeof window > "u") return;
|
|
812
|
+
let i = Ot(() => {
|
|
813
|
+
e.setRuntimeAttributes(Tt());
|
|
814
|
+
}, yt);
|
|
778
815
|
window.addEventListener("resize", i), window.addEventListener("orientationchange", i), n.push(() => window.removeEventListener("resize", i), () => window.removeEventListener("orientationchange", i));
|
|
779
|
-
let a =
|
|
816
|
+
let a = bt();
|
|
780
817
|
if (a && typeof a.addEventListener == "function") {
|
|
781
818
|
let t = () => {
|
|
782
|
-
e.setRuntimeAttributes(
|
|
819
|
+
e.setRuntimeAttributes(Et());
|
|
783
820
|
};
|
|
784
821
|
a.addEventListener("change", t), n.push(() => {
|
|
785
822
|
var e;
|
|
@@ -794,7 +831,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
794
831
|
}
|
|
795
832
|
}
|
|
796
833
|
};
|
|
797
|
-
},
|
|
834
|
+
}, At = 6e4, jt = 5, Mt = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, Nt = (e) => {
|
|
798
835
|
if (e instanceof Error) return e.message;
|
|
799
836
|
if (typeof e == "string") return e;
|
|
800
837
|
try {
|
|
@@ -802,32 +839,32 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
802
839
|
} catch (t) {
|
|
803
840
|
return String(e);
|
|
804
841
|
}
|
|
805
|
-
},
|
|
842
|
+
}, Pt = (e) => {
|
|
806
843
|
var t;
|
|
807
844
|
return e instanceof Error ? (t = e.stack) == null ? "" : t : "";
|
|
808
|
-
},
|
|
845
|
+
}, Ft = (e) => e.slice(0, 80), It = (e) => {
|
|
809
846
|
var t, n;
|
|
810
847
|
return (t = (n = e.split("\n").find((e) => e.trim().startsWith("at "))) == null ? void 0 : n.trim()) == null ? "" : t;
|
|
811
|
-
},
|
|
812
|
-
let c =
|
|
848
|
+
}, Lt = (e) => e === "unhandledrejection" ? "promise" : e === "resource" ? "resource_load" : "js", Rt = ({ context: e, error: n, exceptionType: r, extra: i = {}, source: a, spanName: o, throttle: s }) => {
|
|
849
|
+
let c = Nt(n), l = Pt(n), u = B(`${a}|${c}|${l.slice(0, 256)}`), d = s.allow(u);
|
|
813
850
|
if (!d.allowed) return;
|
|
814
851
|
let f = n instanceof Error ? n : {
|
|
815
852
|
message: c,
|
|
816
853
|
name: r == null ? a : r
|
|
817
854
|
}, p = E(E(E(E({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), F({
|
|
818
|
-
errorType:
|
|
855
|
+
errorType: Lt(a),
|
|
819
856
|
eventLabel: "错误",
|
|
820
857
|
result: N.error,
|
|
821
|
-
spanSubtype:
|
|
858
|
+
spanSubtype: Lt(a),
|
|
822
859
|
spanType: P.error,
|
|
823
860
|
targetLabel: n instanceof Error ? n.name : r == null ? a : r
|
|
824
861
|
})), {}, {
|
|
825
862
|
"exception.message": c,
|
|
826
|
-
[
|
|
863
|
+
[x.exceptionMessageShort]: Ft(c),
|
|
827
864
|
"exception.stacktrace": l,
|
|
828
|
-
[
|
|
865
|
+
[x.exceptionStackTopFrame]: It(l),
|
|
829
866
|
"exception.type": n instanceof Error ? n.name : r == null ? a : r,
|
|
830
|
-
[
|
|
867
|
+
[x.exceptionFingerprint]: u,
|
|
831
868
|
"error.handled": !1,
|
|
832
869
|
"error.source": a,
|
|
833
870
|
"error.window_count": d.count
|
|
@@ -836,16 +873,16 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
836
873
|
code: t.ERROR,
|
|
837
874
|
message: c
|
|
838
875
|
}), m.end();
|
|
839
|
-
},
|
|
840
|
-
let t = [], n =
|
|
876
|
+
}, zt = (e = {}) => {
|
|
877
|
+
let t = [], n = Mt(e.windowMs, At), r = Mt(e.maxPerWindow, jt);
|
|
841
878
|
return {
|
|
842
879
|
name: "error",
|
|
843
880
|
init(e) {
|
|
844
881
|
if (typeof window > "u") return;
|
|
845
|
-
let i =
|
|
882
|
+
let i = ft(n, r), a = (t) => {
|
|
846
883
|
var n;
|
|
847
884
|
let r = !t.error && !t.filename && t.message === "Script error.";
|
|
848
|
-
|
|
885
|
+
Rt({
|
|
849
886
|
context: e,
|
|
850
887
|
throttle: i,
|
|
851
888
|
spanName: "browser.error",
|
|
@@ -858,7 +895,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
858
895
|
}, r ? { "error.cross_origin": !0 } : {})
|
|
859
896
|
});
|
|
860
897
|
}, o = (t) => {
|
|
861
|
-
|
|
898
|
+
Rt({
|
|
862
899
|
context: e,
|
|
863
900
|
throttle: i,
|
|
864
901
|
spanName: "browser.unhandledrejection",
|
|
@@ -871,7 +908,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
871
908
|
let n = t.target;
|
|
872
909
|
if (!(n instanceof Element)) return;
|
|
873
910
|
let r = n, a = r.src || r.href || n.currentSrc || "";
|
|
874
|
-
|
|
911
|
+
Rt({
|
|
875
912
|
context: e,
|
|
876
913
|
throttle: i,
|
|
877
914
|
spanName: "browser.resource_error",
|
|
@@ -893,13 +930,13 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
893
930
|
}
|
|
894
931
|
}
|
|
895
932
|
};
|
|
896
|
-
},
|
|
933
|
+
}, Bt = 10 * 1024, Vt = 10, Ht = (e) => e.body, Ut = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, H = /* @__PURE__ */ new WeakMap(), Wt = (e, t) => e.length <= t ? {
|
|
897
934
|
body: e,
|
|
898
935
|
truncated: !1
|
|
899
936
|
} : {
|
|
900
937
|
body: e.slice(0, t),
|
|
901
938
|
truncated: !0
|
|
902
|
-
},
|
|
939
|
+
}, Gt = (e, t) => {
|
|
903
940
|
if (!e) return;
|
|
904
941
|
if (e instanceof Headers) return e.get(t) || void 0;
|
|
905
942
|
let n = t.toLowerCase();
|
|
@@ -909,30 +946,30 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
909
946
|
}
|
|
910
947
|
let i = Object.keys(e).find((e) => e.toLowerCase() === n);
|
|
911
948
|
return i ? e[i] : void 0;
|
|
912
|
-
},
|
|
949
|
+
}, Kt = (e) => {
|
|
913
950
|
let t = {};
|
|
914
951
|
return e.forEach((e, n) => {
|
|
915
952
|
t[n] = e instanceof File ? `[File name=${e.name} type=${e.type || "unknown"} size=${e.size}]` : e;
|
|
916
953
|
}), JSON.stringify(t);
|
|
917
|
-
},
|
|
954
|
+
}, qt = function() {
|
|
918
955
|
var e = A(function* (e) {
|
|
919
|
-
return e == null ? "" : typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : e instanceof FormData ?
|
|
956
|
+
return e == null ? "" : typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : e instanceof FormData ? Kt(e) : e instanceof Blob ? e.text() : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? new TextDecoder().decode(e) : e instanceof Document ? new XMLSerializer().serializeToString(e) : String(e);
|
|
920
957
|
});
|
|
921
958
|
return function(t) {
|
|
922
959
|
return e.apply(this, arguments);
|
|
923
960
|
};
|
|
924
|
-
}(),
|
|
961
|
+
}(), Jt = function() {
|
|
925
962
|
var e = A(function* (e, t, n) {
|
|
926
|
-
let r = yield
|
|
927
|
-
if (r) return E(E({},
|
|
963
|
+
let r = yield qt(e);
|
|
964
|
+
if (r) return E(E({}, Wt(r, t)), {}, { contentType: n });
|
|
928
965
|
});
|
|
929
966
|
return function(t, n, r) {
|
|
930
967
|
return e.apply(this, arguments);
|
|
931
968
|
};
|
|
932
|
-
}(),
|
|
969
|
+
}(), Yt = function() {
|
|
933
970
|
var e = A(function* (e, t, n) {
|
|
934
971
|
try {
|
|
935
|
-
return yield
|
|
972
|
+
return yield Jt(e, t, n);
|
|
936
973
|
} catch (e) {
|
|
937
974
|
return;
|
|
938
975
|
}
|
|
@@ -940,20 +977,20 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
940
977
|
return function(t, n, r) {
|
|
941
978
|
return e.apply(this, arguments);
|
|
942
979
|
};
|
|
943
|
-
}(),
|
|
980
|
+
}(), Xt = (e) => e instanceof Request ? e.url : String(e), Zt = (e, t) => t != null && t.method ? t.method : e instanceof Request ? e.method : "GET", Qt = (e, t, n) => t != null && t.body ? () => Yt(t.body, n, Gt(t.headers, "content-type")) : (e instanceof Request, () => Promise.resolve(void 0)), $t = function() {
|
|
944
981
|
var e = A(function* (e, t) {
|
|
945
982
|
try {
|
|
946
983
|
let n = e.headers.get("content-type") || void 0, r = e.headers.get("content-length");
|
|
947
984
|
if (r) {
|
|
948
985
|
let e = Number(r);
|
|
949
|
-
if (Number.isFinite(e) && e > t *
|
|
986
|
+
if (Number.isFinite(e) && e > t * Vt) return {
|
|
950
987
|
body: "",
|
|
951
988
|
contentType: n,
|
|
952
989
|
truncated: !0
|
|
953
990
|
};
|
|
954
991
|
}
|
|
955
992
|
let i = e.clone();
|
|
956
|
-
return
|
|
993
|
+
return Yt(i.body ? yield i.text() : "", t, n);
|
|
957
994
|
} catch (e) {
|
|
958
995
|
return;
|
|
959
996
|
}
|
|
@@ -961,28 +998,28 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
961
998
|
return function(t, n) {
|
|
962
999
|
return e.apply(this, arguments);
|
|
963
1000
|
};
|
|
964
|
-
}(),
|
|
965
|
-
if (e.responseType === "" || e.responseType === "text") return E(E({},
|
|
966
|
-
if (e.responseType === "json") return E(E({},
|
|
967
|
-
},
|
|
1001
|
+
}(), en = (e, t) => {
|
|
1002
|
+
if (e.responseType === "" || e.responseType === "text") return E(E({}, Wt(e.responseText || "", t)), {}, { contentType: e.getResponseHeader("content-type") || void 0 });
|
|
1003
|
+
if (e.responseType === "json") return E(E({}, Wt(JSON.stringify(e.response), t)), {}, { contentType: e.getResponseHeader("content-type") || void 0 });
|
|
1004
|
+
}, tn = (e, t, n) => {
|
|
968
1005
|
if (n) return e.redact(E(E({}, t), {}, {
|
|
969
1006
|
body: n.body,
|
|
970
1007
|
truncated: n.truncated
|
|
971
1008
|
}));
|
|
972
|
-
},
|
|
973
|
-
let d = !!r || typeof c == "number" && c >= 400, f = i.toUpperCase(), p = d ?
|
|
1009
|
+
}, U = ({ config: e, context: t, duration: n, error: r, method: i, request: a, response: s, status: c, subtype: l, url: u }) => {
|
|
1010
|
+
let d = !!r || typeof c == "number" && c >= 400, f = i.toUpperCase(), p = d ? tn(e, {
|
|
974
1011
|
contentType: a == null ? void 0 : a.contentType,
|
|
975
1012
|
method: f,
|
|
976
1013
|
status: c,
|
|
977
1014
|
type: "request",
|
|
978
1015
|
url: u
|
|
979
|
-
}, a) : void 0, m = d ?
|
|
1016
|
+
}, a) : void 0, m = d ? tn(e, {
|
|
980
1017
|
contentType: s == null ? void 0 : s.contentType,
|
|
981
1018
|
method: f,
|
|
982
1019
|
status: c,
|
|
983
1020
|
type: "response",
|
|
984
1021
|
url: u
|
|
985
|
-
}, s) : void 0, h = E(E(E({}, t.config.hooks.getPageAttributes()),
|
|
1022
|
+
}, s) : void 0, h = E(E(E({}, t.config.hooks.getPageAttributes()), Re({
|
|
986
1023
|
duration: n,
|
|
987
1024
|
method: f,
|
|
988
1025
|
statusCode: c,
|
|
@@ -1008,11 +1045,11 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1008
1045
|
body: d ? "HTTP request completed with error" : "HTTP request completed",
|
|
1009
1046
|
attributes: h
|
|
1010
1047
|
});
|
|
1011
|
-
},
|
|
1048
|
+
}, nn = (e = {}) => {
|
|
1012
1049
|
var t;
|
|
1013
1050
|
let n = [], r = {
|
|
1014
|
-
maxBodySize:
|
|
1015
|
-
redact: (t = e.redact) == null ?
|
|
1051
|
+
maxBodySize: Ut(e.maxBodySize, Bt),
|
|
1052
|
+
redact: (t = e.redact) == null ? Ht : t
|
|
1016
1053
|
};
|
|
1017
1054
|
return {
|
|
1018
1055
|
name: "http-body",
|
|
@@ -1022,25 +1059,25 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1022
1059
|
if (typeof i == "function") {
|
|
1023
1060
|
let a = function() {
|
|
1024
1061
|
var n = A(function* (n, a) {
|
|
1025
|
-
let o =
|
|
1062
|
+
let o = Xt(n);
|
|
1026
1063
|
if (M(e.config, o)) return i(n, a);
|
|
1027
|
-
let s =
|
|
1064
|
+
let s = Zt(n, a), c = Qt(n, a, t), l = performance.now();
|
|
1028
1065
|
try {
|
|
1029
1066
|
let u = yield i(n, a), d = performance.now() - l, f = u.status >= 400;
|
|
1030
|
-
return
|
|
1067
|
+
return U({
|
|
1031
1068
|
config: r,
|
|
1032
1069
|
context: e,
|
|
1033
1070
|
duration: d,
|
|
1034
1071
|
method: s,
|
|
1035
1072
|
request: f ? yield c() : void 0,
|
|
1036
|
-
response: f ? yield
|
|
1073
|
+
response: f ? yield $t(u, t) : void 0,
|
|
1037
1074
|
status: u.status,
|
|
1038
1075
|
subtype: "fetch",
|
|
1039
1076
|
url: o
|
|
1040
1077
|
}), u;
|
|
1041
1078
|
} catch (t) {
|
|
1042
1079
|
let n = yield c();
|
|
1043
|
-
throw
|
|
1080
|
+
throw U({
|
|
1044
1081
|
config: r,
|
|
1045
1082
|
context: e,
|
|
1046
1083
|
duration: performance.now() - l,
|
|
@@ -1062,13 +1099,13 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1062
1099
|
}
|
|
1063
1100
|
let a = XMLHttpRequest.prototype.open, o = XMLHttpRequest.prototype.send, s = XMLHttpRequest.prototype.setRequestHeader, c = function(e, t, ...n) {
|
|
1064
1101
|
var r;
|
|
1065
|
-
return
|
|
1102
|
+
return H.set(this, {
|
|
1066
1103
|
method: e,
|
|
1067
1104
|
startTime: performance.now(),
|
|
1068
1105
|
url: String(t)
|
|
1069
1106
|
}), a.call(this, e, t, (r = n[0]) == null ? !0 : r, n[1], n[2]);
|
|
1070
1107
|
}, l = function(e, t) {
|
|
1071
|
-
let n =
|
|
1108
|
+
let n = H.get(this);
|
|
1072
1109
|
if (n) {
|
|
1073
1110
|
var r;
|
|
1074
1111
|
let i = e.toLowerCase(), a = (r = n.requestHeaders) == null ? {} : r, o = a[i];
|
|
@@ -1077,23 +1114,23 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1077
1114
|
return s.call(this, e, t);
|
|
1078
1115
|
}, u = function(n) {
|
|
1079
1116
|
var i = this;
|
|
1080
|
-
let a =
|
|
1117
|
+
let a = H.get(this);
|
|
1081
1118
|
if (a) {
|
|
1082
1119
|
var s;
|
|
1083
1120
|
a.requestBody = n, a.requestContentType = (s = a.requestHeaders) == null ? void 0 : s["content-type"];
|
|
1084
1121
|
}
|
|
1085
1122
|
return this.addEventListener("abort", () => {
|
|
1086
|
-
let e =
|
|
1123
|
+
let e = H.get(this);
|
|
1087
1124
|
e && (e.aborted = !0);
|
|
1088
1125
|
}, { once: !0 }), this.addEventListener("error", () => {
|
|
1089
|
-
let e =
|
|
1126
|
+
let e = H.get(this);
|
|
1090
1127
|
e && (e.networkError = !0);
|
|
1091
1128
|
}, { once: !0 }), this.addEventListener("loadend", () => {
|
|
1092
1129
|
A(function* () {
|
|
1093
|
-
let n =
|
|
1130
|
+
let n = H.get(i);
|
|
1094
1131
|
if (!n || M(e.config, n.url) || n.aborted) return;
|
|
1095
|
-
let a = n.networkError || i.status >= 400, o = a ?
|
|
1096
|
-
|
|
1132
|
+
let a = n.networkError || i.status >= 400, o = a ? en(i, t) : void 0, s = a ? yield Yt(n.requestBody, t, n.requestContentType) : void 0;
|
|
1133
|
+
U({
|
|
1097
1134
|
config: r,
|
|
1098
1135
|
context: e,
|
|
1099
1136
|
duration: performance.now() - n.startTime,
|
|
@@ -1119,8 +1156,8 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1119
1156
|
}
|
|
1120
1157
|
}
|
|
1121
1158
|
};
|
|
1122
|
-
},
|
|
1123
|
-
let t, n =
|
|
1159
|
+
}, rn = 50, an = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, on = (e = {}) => {
|
|
1160
|
+
let t, n = an(e.threshold, rn);
|
|
1124
1161
|
return {
|
|
1125
1162
|
name: "long-task",
|
|
1126
1163
|
init(e) {
|
|
@@ -1132,11 +1169,11 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1132
1169
|
});
|
|
1133
1170
|
try {
|
|
1134
1171
|
t = new PerformanceObserver((t) => {
|
|
1135
|
-
let r = e.applyRedact(E(E({}, e.config.hooks.getPageAttributes()), e.config.hooks.getMetricAttributes()));
|
|
1172
|
+
let r = e.applyRedact(E(E(E({}, e.config.hooks.getPageAttributes()), e.config.hooks.getMetricAttributes()), I(e.getRuntimeAttributes())));
|
|
1136
1173
|
for (let h of t.getEntries()) {
|
|
1137
1174
|
var o, s, c, l, u, d, f, p, m;
|
|
1138
1175
|
if (h.duration < n) continue;
|
|
1139
|
-
let t = (o = h.attribution) == null ? void 0 : o[0], g = E(E({}, r), {}, { [
|
|
1176
|
+
let t = (o = h.attribution) == null ? void 0 : o[0], g = E(E({}, r), {}, { [x.longtaskAttributionScript]: (s = (c = t == null ? void 0 : t.containerSrc) == null ? t == null ? void 0 : t.name : c) == null ? "unknown" : s }), _ = h.duration > 100 ? N.warning : N.success;
|
|
1140
1177
|
e.startSpan("browser.long_task", E(E(E({}, r), F({
|
|
1141
1178
|
duration: h.duration,
|
|
1142
1179
|
errorType: _ === N.warning ? "longtask_blocking" : "none",
|
|
@@ -1147,8 +1184,8 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1147
1184
|
targetLabel: (u = (d = (f = t == null ? void 0 : t.containerSrc) == null ? t == null ? void 0 : t.containerName : f) == null ? t == null ? void 0 : t.name : d) == null ? "unknown" : u,
|
|
1148
1185
|
targetValue: h.duration
|
|
1149
1186
|
})), {}, {
|
|
1150
|
-
[
|
|
1151
|
-
[
|
|
1187
|
+
[x.longtaskBlockingDuration]: h.duration,
|
|
1188
|
+
[x.longtaskAttributionScript]: (p = (m = t == null ? void 0 : t.containerSrc) == null ? t == null ? void 0 : t.name : m) == null ? "unknown" : p
|
|
1152
1189
|
}), { startTime: performance.timeOrigin + h.startTime }).end(performance.timeOrigin + h.startTime + h.duration), i.add(1, g), a.record(h.duration, g);
|
|
1153
1190
|
}
|
|
1154
1191
|
}), t.observe({
|
|
@@ -1163,50 +1200,50 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1163
1200
|
t == null || t.disconnect(), t = void 0;
|
|
1164
1201
|
}
|
|
1165
1202
|
};
|
|
1166
|
-
},
|
|
1167
|
-
let n =
|
|
1168
|
-
|
|
1203
|
+
}, W = /* @__PURE__ */ new Set(), G = "", K, q, J = !1, Y = () => typeof location > "u" ? "" : location.href, X = (e, t) => {
|
|
1204
|
+
let n = Y();
|
|
1205
|
+
G = n;
|
|
1169
1206
|
let r = {
|
|
1170
1207
|
fromUrl: t,
|
|
1171
1208
|
source: e,
|
|
1172
1209
|
toUrl: n
|
|
1173
1210
|
};
|
|
1174
|
-
for (let e of Array.from(
|
|
1175
|
-
},
|
|
1176
|
-
|
|
1177
|
-
},
|
|
1178
|
-
|
|
1179
|
-
},
|
|
1180
|
-
|
|
1181
|
-
let r =
|
|
1211
|
+
for (let e of Array.from(W)) e(r);
|
|
1212
|
+
}, sn = () => {
|
|
1213
|
+
X("popstate", G || Y());
|
|
1214
|
+
}, cn = () => {
|
|
1215
|
+
X("hashchange", G || Y());
|
|
1216
|
+
}, ln = () => {
|
|
1217
|
+
J || typeof window > "u" || typeof history > "u" || (J = !0, G = Y(), K = history.pushState, q = history.replaceState, history.pushState = function(e, t, n) {
|
|
1218
|
+
let r = G || Y(), i = K == null ? void 0 : K.apply(this, [
|
|
1182
1219
|
e,
|
|
1183
1220
|
t,
|
|
1184
1221
|
n
|
|
1185
1222
|
]);
|
|
1186
|
-
return
|
|
1223
|
+
return X("pushState", r), i;
|
|
1187
1224
|
}, history.replaceState = function(e, t, n) {
|
|
1188
|
-
let r =
|
|
1225
|
+
let r = G || Y(), i = q == null ? void 0 : q.apply(this, [
|
|
1189
1226
|
e,
|
|
1190
1227
|
t,
|
|
1191
1228
|
n
|
|
1192
1229
|
]);
|
|
1193
|
-
return
|
|
1194
|
-
}, window.addEventListener("popstate",
|
|
1195
|
-
},
|
|
1196
|
-
!
|
|
1197
|
-
},
|
|
1198
|
-
|
|
1199
|
-
}),
|
|
1230
|
+
return X("replaceState", r), i;
|
|
1231
|
+
}, window.addEventListener("popstate", sn), window.addEventListener("hashchange", cn));
|
|
1232
|
+
}, un = () => {
|
|
1233
|
+
!J || typeof window > "u" || typeof history > "u" || (K && (history.pushState = K), q && (history.replaceState = q), window.removeEventListener("popstate", sn), window.removeEventListener("hashchange", cn), K = void 0, q = void 0, J = !1, G = "");
|
|
1234
|
+
}, dn = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (ln(), W.add(e), () => {
|
|
1235
|
+
W.delete(e), W.size === 0 && un();
|
|
1236
|
+
}), fn = () => typeof location > "u" ? "" : location.href, pn = () => {
|
|
1200
1237
|
let e = [];
|
|
1201
1238
|
return {
|
|
1202
1239
|
name: "page-view",
|
|
1203
1240
|
init(t) {
|
|
1204
1241
|
if (typeof window > "u") return;
|
|
1205
1242
|
let n = "", r, i = (e, i = n) => {
|
|
1206
|
-
let a =
|
|
1243
|
+
let a = fn();
|
|
1207
1244
|
if (a === n) return;
|
|
1208
1245
|
r == null || r.setAttribute("view.end_reason", e), r == null || r.end(), n = a;
|
|
1209
|
-
let o =
|
|
1246
|
+
let o = V("view"), s = t.config.hooks.getViewPathGroup(a), c = e === "load" ? "initial_load" : "route_change", l = t.config.hooks.redactUrl(a), u = t.config.hooks.redactUrl(i);
|
|
1210
1247
|
t.setView({
|
|
1211
1248
|
id: o,
|
|
1212
1249
|
loadingType: c,
|
|
@@ -1221,15 +1258,15 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1221
1258
|
targetLabel: s,
|
|
1222
1259
|
traceScene: d ? "page_load" : "route_change"
|
|
1223
1260
|
})), {}, {
|
|
1224
|
-
[
|
|
1225
|
-
[
|
|
1226
|
-
[
|
|
1227
|
-
[
|
|
1261
|
+
[x.viewId]: o,
|
|
1262
|
+
[x.viewUrl]: l,
|
|
1263
|
+
[x.viewUrlPathGroup]: s,
|
|
1264
|
+
[x.viewLoadingType]: c,
|
|
1228
1265
|
"url.previous": u,
|
|
1229
1266
|
"event.source": e
|
|
1230
1267
|
}, d ? { "document.referrer": t.config.hooks.redactUrl(document.referrer || "") } : {});
|
|
1231
1268
|
r = t.startSpan("browser.view", f), t.startSpan("browser.page_view", E({}, f)).end();
|
|
1232
|
-
}, a =
|
|
1269
|
+
}, a = dn((e) => {
|
|
1233
1270
|
i(e.source, e.fromUrl);
|
|
1234
1271
|
});
|
|
1235
1272
|
i("load");
|
|
@@ -1245,7 +1282,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1245
1282
|
}
|
|
1246
1283
|
}
|
|
1247
1284
|
};
|
|
1248
|
-
},
|
|
1285
|
+
}, mn = (e) => e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, hn = () => {
|
|
1249
1286
|
let e, t = /* @__PURE__ */ new Set();
|
|
1250
1287
|
return {
|
|
1251
1288
|
name: "resource",
|
|
@@ -1258,7 +1295,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1258
1295
|
if (t.has(r)) return;
|
|
1259
1296
|
t.add(r);
|
|
1260
1297
|
let i = n.config.hooks.redactUrl(e.name), a = e.duration;
|
|
1261
|
-
n.startSpan("browser.resource", E(E(E({}, n.config.hooks.getPageAttributes()),
|
|
1298
|
+
n.startSpan("browser.resource", E(E(E({}, n.config.hooks.getPageAttributes()), ze({
|
|
1262
1299
|
duration: a,
|
|
1263
1300
|
initiatorType: e.initiatorType || "other",
|
|
1264
1301
|
responseStatus: e.responseStatus,
|
|
@@ -1267,9 +1304,9 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1267
1304
|
urlPathTemplate: n.config.hooks.getViewPathGroup(e.name)
|
|
1268
1305
|
})), {}, {
|
|
1269
1306
|
"url.full": i,
|
|
1270
|
-
[
|
|
1271
|
-
[
|
|
1272
|
-
[
|
|
1307
|
+
[x.transferSize]: e.transferSize,
|
|
1308
|
+
[x.cacheHit]: mn(e),
|
|
1309
|
+
[x.nextHopProtocol]: e.nextHopProtocol,
|
|
1273
1310
|
initiator_type: e.initiatorType || "other",
|
|
1274
1311
|
"resource.encoded_body_size": e.encodedBodySize,
|
|
1275
1312
|
"resource.decoded_body_size": e.decodedBodySize
|
|
@@ -1290,7 +1327,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1290
1327
|
e == null || e.disconnect(), e = void 0, t.clear();
|
|
1291
1328
|
}
|
|
1292
1329
|
};
|
|
1293
|
-
},
|
|
1330
|
+
}, gn = () => {
|
|
1294
1331
|
let e = [], t = !1;
|
|
1295
1332
|
return {
|
|
1296
1333
|
name: "route-timing",
|
|
@@ -1303,7 +1340,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1303
1340
|
if (t) return;
|
|
1304
1341
|
let o = performance.now(), s = performance.timeOrigin + o, c = () => {
|
|
1305
1342
|
if (t || typeof document < "u" && document.visibilityState === "hidden") return;
|
|
1306
|
-
let c = performance.now() - o, l = c > 500 ? N.warning : N.success, u = n.applyRedact(E(E(E({}, n.config.hooks.getPageAttributes()), n.config.hooks.getMetricAttributes()), {}, { "route.change.source": e }));
|
|
1343
|
+
let c = performance.now() - o, l = c > 500 ? N.warning : N.success, u = n.applyRedact(E(E(E(E({}, n.config.hooks.getPageAttributes()), n.config.hooks.getMetricAttributes()), I(n.getRuntimeAttributes())), {}, { "route.change.source": e }));
|
|
1307
1344
|
r.record(c, u), n.startSpan("browser.route_change", E(E(E({}, u), F({
|
|
1308
1345
|
duration: c,
|
|
1309
1346
|
errorType: l === N.warning ? "slow" : "none",
|
|
@@ -1320,7 +1357,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1320
1357
|
}), { startTime: s }).end();
|
|
1321
1358
|
};
|
|
1322
1359
|
requestAnimationFrame(() => requestAnimationFrame(() => setTimeout(c, 0)));
|
|
1323
|
-
}, a =
|
|
1360
|
+
}, a = dn((e) => {
|
|
1324
1361
|
e.fromUrl !== e.toUrl && i(e.source, e.fromUrl, e.toUrl);
|
|
1325
1362
|
});
|
|
1326
1363
|
e.push(a);
|
|
@@ -1332,32 +1369,32 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1332
1369
|
}
|
|
1333
1370
|
}
|
|
1334
1371
|
};
|
|
1335
|
-
},
|
|
1372
|
+
}, _n = 1800 * 1e3, vn = 1440 * 60 * 1e3, yn = 6e4, bn = 5e3, xn = [
|
|
1336
1373
|
"click",
|
|
1337
1374
|
"keydown",
|
|
1338
1375
|
"scroll",
|
|
1339
1376
|
"mousemove",
|
|
1340
1377
|
"touchstart"
|
|
1341
|
-
],
|
|
1378
|
+
], Sn = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, Cn = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= t + bn, wn = (e, t) => {
|
|
1342
1379
|
if (!e) return null;
|
|
1343
1380
|
try {
|
|
1344
1381
|
let n = JSON.parse(e);
|
|
1345
|
-
if (typeof (n == null ? void 0 : n.id) == "string" &&
|
|
1382
|
+
if (typeof (n == null ? void 0 : n.id) == "string" && Cn(n.ts, t) && Cn(n.startedAt, t)) return n;
|
|
1346
1383
|
} catch (e) {}
|
|
1347
1384
|
return null;
|
|
1348
|
-
},
|
|
1385
|
+
}, Tn = (e, t) => {
|
|
1349
1386
|
if (typeof window > "u") return null;
|
|
1350
1387
|
let n = null;
|
|
1351
1388
|
try {
|
|
1352
1389
|
n = window.localStorage.getItem(e);
|
|
1353
1390
|
} catch (e) {}
|
|
1354
|
-
let r =
|
|
1391
|
+
let r = wn(n, t);
|
|
1355
1392
|
if (r) return r;
|
|
1356
1393
|
try {
|
|
1357
1394
|
n = window.sessionStorage.getItem(e);
|
|
1358
1395
|
} catch (e) {}
|
|
1359
|
-
return r =
|
|
1360
|
-
},
|
|
1396
|
+
return r = wn(n, t), r;
|
|
1397
|
+
}, En = (e, t) => {
|
|
1361
1398
|
if (typeof window > "u") return;
|
|
1362
1399
|
let n = JSON.stringify(t);
|
|
1363
1400
|
try {
|
|
@@ -1366,23 +1403,23 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1366
1403
|
try {
|
|
1367
1404
|
window.localStorage.setItem(e, n);
|
|
1368
1405
|
} catch (e) {}
|
|
1369
|
-
},
|
|
1370
|
-
let r = Date.now(), i =
|
|
1406
|
+
}, Dn = (e, t, n) => {
|
|
1407
|
+
let r = Date.now(), i = Tn(e, r);
|
|
1371
1408
|
if (i) {
|
|
1372
1409
|
let a = r - i.ts >= t, o = r - i.startedAt >= n;
|
|
1373
1410
|
if (!a && !o) {
|
|
1374
1411
|
let t = E(E({}, i), {}, { ts: r });
|
|
1375
|
-
return
|
|
1412
|
+
return En(e, t), {
|
|
1376
1413
|
id: t.id,
|
|
1377
1414
|
rotated: !1
|
|
1378
1415
|
};
|
|
1379
1416
|
}
|
|
1380
1417
|
let s = a ? "inactivity" : "maxLifetime", c = {
|
|
1381
|
-
id:
|
|
1418
|
+
id: V("session"),
|
|
1382
1419
|
startedAt: r,
|
|
1383
1420
|
ts: r
|
|
1384
1421
|
};
|
|
1385
|
-
return
|
|
1422
|
+
return En(e, c), {
|
|
1386
1423
|
id: c.id,
|
|
1387
1424
|
prevId: i.id,
|
|
1388
1425
|
reason: s,
|
|
@@ -1390,24 +1427,24 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1390
1427
|
};
|
|
1391
1428
|
}
|
|
1392
1429
|
let a = {
|
|
1393
|
-
id:
|
|
1430
|
+
id: V("session"),
|
|
1394
1431
|
startedAt: r,
|
|
1395
1432
|
ts: r
|
|
1396
1433
|
};
|
|
1397
|
-
return
|
|
1434
|
+
return En(e, a), {
|
|
1398
1435
|
id: a.id,
|
|
1399
1436
|
reason: "init",
|
|
1400
1437
|
rotated: !0
|
|
1401
1438
|
};
|
|
1402
|
-
},
|
|
1439
|
+
}, On = (e) => {
|
|
1403
1440
|
let t = "";
|
|
1404
1441
|
try {
|
|
1405
1442
|
t = new URL(e).host;
|
|
1406
1443
|
} catch (n) {
|
|
1407
1444
|
t = e;
|
|
1408
1445
|
}
|
|
1409
|
-
return `bk_ot_session__${
|
|
1410
|
-
},
|
|
1446
|
+
return `bk_ot_session__${B(t || "default")}`;
|
|
1447
|
+
}, kn = (e, t) => {
|
|
1411
1448
|
if (!t.rotated || !t.reason) return;
|
|
1412
1449
|
let n = Date.now();
|
|
1413
1450
|
e.emitLog({
|
|
@@ -1415,44 +1452,44 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1415
1452
|
severityText: "INFO",
|
|
1416
1453
|
body: t.reason === "init" ? "session.start" : "session.rotate",
|
|
1417
1454
|
attributes: E(E({}, e.config.hooks.getPageAttributes()), {}, {
|
|
1418
|
-
[
|
|
1419
|
-
[
|
|
1420
|
-
[
|
|
1455
|
+
[x.sessionHasReplay]: !1,
|
|
1456
|
+
[x.sessionId]: t.id,
|
|
1457
|
+
[x.sessionStartTime]: n,
|
|
1421
1458
|
"session.rotate.reason": t.reason
|
|
1422
1459
|
}, t.prevId ? { "session.previous_id": t.prevId } : {})
|
|
1423
1460
|
});
|
|
1424
|
-
},
|
|
1425
|
-
let t = [], n =
|
|
1461
|
+
}, An = (e = {}) => {
|
|
1462
|
+
let t = [], n = Sn(e.inactivityMs, _n), r = Sn(e.maxLifetimeMs, vn);
|
|
1426
1463
|
return {
|
|
1427
1464
|
name: "session",
|
|
1428
1465
|
init(i) {
|
|
1429
1466
|
var a;
|
|
1430
|
-
let o = (a = e.storageKey) == null ?
|
|
1467
|
+
let o = (a = e.storageKey) == null ? On(i.config.transport.endpoint) : a, s = "", c = () => {
|
|
1431
1468
|
if (typeof window > "u") {
|
|
1432
|
-
s || (s =
|
|
1433
|
-
[
|
|
1434
|
-
[
|
|
1469
|
+
s || (s = V("session"), i.setRuntimeAttributes({
|
|
1470
|
+
[x.sessionHasReplay]: !1,
|
|
1471
|
+
[x.sessionId]: s
|
|
1435
1472
|
}));
|
|
1436
1473
|
return;
|
|
1437
1474
|
}
|
|
1438
|
-
let e =
|
|
1475
|
+
let e = Dn(o, n, r);
|
|
1439
1476
|
i.setRuntimeAttributes({
|
|
1440
|
-
[
|
|
1441
|
-
[
|
|
1442
|
-
}), e.id !== s && (s = e.id,
|
|
1477
|
+
[x.sessionHasReplay]: !1,
|
|
1478
|
+
[x.sessionId]: e.id
|
|
1479
|
+
}), e.id !== s && (s = e.id, kn(i, e));
|
|
1443
1480
|
};
|
|
1444
1481
|
if (c(), typeof window > "u" || typeof document > "u") return;
|
|
1445
1482
|
let l = Date.now(), u = () => {
|
|
1446
1483
|
let e = Date.now();
|
|
1447
|
-
e - l <
|
|
1484
|
+
e - l < yn || (l = e, c());
|
|
1448
1485
|
}, d = {
|
|
1449
1486
|
capture: !0,
|
|
1450
1487
|
passive: !0
|
|
1451
1488
|
};
|
|
1452
|
-
|
|
1489
|
+
xn.forEach((e) => {
|
|
1453
1490
|
window.addEventListener(e, u, d);
|
|
1454
1491
|
}), t.push(() => {
|
|
1455
|
-
|
|
1492
|
+
xn.forEach((e) => {
|
|
1456
1493
|
window.removeEventListener(e, u, d);
|
|
1457
1494
|
});
|
|
1458
1495
|
});
|
|
@@ -1462,13 +1499,13 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1462
1499
|
document.addEventListener("visibilitychange", f), t.push(() => document.removeEventListener("visibilitychange", f));
|
|
1463
1500
|
let p = (e) => {
|
|
1464
1501
|
if (e.storageArea !== window.localStorage || e.key !== o || !e.newValue) return;
|
|
1465
|
-
let t = Date.now(), n =
|
|
1502
|
+
let t = Date.now(), n = wn(e.newValue, t);
|
|
1466
1503
|
if (!(!n || n.id === s)) {
|
|
1467
1504
|
s = n.id;
|
|
1468
1505
|
try {
|
|
1469
1506
|
window.sessionStorage.setItem(o, e.newValue);
|
|
1470
1507
|
} catch (e) {}
|
|
1471
|
-
i.setRuntimeAttributes({ [
|
|
1508
|
+
i.setRuntimeAttributes({ [x.sessionId]: n.id });
|
|
1472
1509
|
}
|
|
1473
1510
|
};
|
|
1474
1511
|
window.addEventListener("storage", p), t.push(() => window.removeEventListener("storage", p));
|
|
@@ -1480,18 +1517,18 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1480
1517
|
}
|
|
1481
1518
|
}
|
|
1482
1519
|
};
|
|
1483
|
-
},
|
|
1484
|
-
if (typeof performance > "u") return
|
|
1520
|
+
}, jn = "unknown", Mn = (e) => e ? e.replace(/_/g, "-") : jn, Nn = () => {
|
|
1521
|
+
if (typeof performance > "u") return jn;
|
|
1485
1522
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1486
|
-
return
|
|
1487
|
-
},
|
|
1523
|
+
return Mn(e == null ? void 0 : e.type);
|
|
1524
|
+
}, Pn = (e, t) => {
|
|
1488
1525
|
var n;
|
|
1489
1526
|
return {
|
|
1490
1527
|
"rum.navigation.type": (n = e.navigationType) == null ? t : n,
|
|
1491
|
-
[
|
|
1492
|
-
[
|
|
1528
|
+
[x.vitalMetric]: e.name.toLowerCase(),
|
|
1529
|
+
[x.vitalRating]: e.rating
|
|
1493
1530
|
};
|
|
1494
|
-
},
|
|
1531
|
+
}, Fn = (e, t) => {
|
|
1495
1532
|
var n;
|
|
1496
1533
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
1497
1534
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -1515,7 +1552,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1515
1552
|
default: break;
|
|
1516
1553
|
}
|
|
1517
1554
|
return i;
|
|
1518
|
-
},
|
|
1555
|
+
}, In = () => {
|
|
1519
1556
|
let e = !1;
|
|
1520
1557
|
return {
|
|
1521
1558
|
name: "web-vitals",
|
|
@@ -1533,7 +1570,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1533
1570
|
return;
|
|
1534
1571
|
}
|
|
1535
1572
|
if (e) return;
|
|
1536
|
-
let { onCLS: i, onFCP: a, onINP: o, onLCP: s, onTTFB: c } = n, l =
|
|
1573
|
+
let { onCLS: i, onFCP: a, onINP: o, onLCP: s, onTTFB: c } = n, l = Nn(), u = t.meter.createHistogram("browser.web_vital.cls", {
|
|
1537
1574
|
unit: "1",
|
|
1538
1575
|
description: "Cumulative Layout Shift"
|
|
1539
1576
|
}), d = t.meter.createHistogram("browser.web_vital.duration", {
|
|
@@ -1541,26 +1578,26 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1541
1578
|
description: "Web Vitals duration metrics, including FCP, INP, LCP and TTFB"
|
|
1542
1579
|
}), f = (e) => {
|
|
1543
1580
|
let n = e.name.toLowerCase();
|
|
1544
|
-
t.startSpan("browser.web_vital", E(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()),
|
|
1581
|
+
t.startSpan("browser.web_vital", E(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()), Pn(e, l)), F({
|
|
1545
1582
|
duration: e.name === "CLS" ? void 0 : e.value,
|
|
1546
1583
|
errorType: e.rating === "good" ? "none" : "slow",
|
|
1547
1584
|
eventLabel: "Web 指标",
|
|
1548
|
-
result:
|
|
1585
|
+
result: Ie(e.rating),
|
|
1549
1586
|
spanSubtype: n,
|
|
1550
1587
|
spanType: P.vital,
|
|
1551
1588
|
targetLabel: n,
|
|
1552
1589
|
targetValue: e.value
|
|
1553
1590
|
})), {}, {
|
|
1554
|
-
[
|
|
1555
|
-
[
|
|
1556
|
-
[
|
|
1591
|
+
[x.vitalMetric]: n,
|
|
1592
|
+
[x.vitalValue]: e.value,
|
|
1593
|
+
[x.vitalRating]: e.rating,
|
|
1557
1594
|
"vital.id": e.id
|
|
1558
|
-
},
|
|
1595
|
+
}, Fn(e, t.config.hooks.redactUrl))).end();
|
|
1559
1596
|
}, p = (n) => {
|
|
1560
|
-
e || !Number.isFinite(n.value) || (d.record(n.value, t.applyRedact(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()),
|
|
1597
|
+
e || !Number.isFinite(n.value) || (d.record(n.value, t.applyRedact(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()), I(t.getRuntimeAttributes())), Pn(n, l)))), f(n));
|
|
1561
1598
|
};
|
|
1562
1599
|
i((n) => {
|
|
1563
|
-
e || !Number.isFinite(n.value) || (u.record(n.value, t.applyRedact(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()),
|
|
1600
|
+
e || !Number.isFinite(n.value) || (u.record(n.value, t.applyRedact(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()), I(t.getRuntimeAttributes())), Pn(n, l)))), f(n));
|
|
1564
1601
|
}), a(p), o(p), s(p), c(p);
|
|
1565
1602
|
})();
|
|
1566
1603
|
},
|
|
@@ -1568,7 +1605,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1568
1605
|
e = !0;
|
|
1569
1606
|
}
|
|
1570
1607
|
};
|
|
1571
|
-
},
|
|
1608
|
+
}, Ln = 64 * 1024, Rn = 6e4, zn = 5, Bn = (e) => e == null ? 0 : typeof e == "string" ? e.length > Ln || typeof TextEncoder > "u" ? e.length : new TextEncoder().encode(e).byteLength : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e.byteLength : typeof Blob < "u" && e instanceof Blob ? e.size : 0, Vn = (e, t) => {
|
|
1572
1609
|
let n = {
|
|
1573
1610
|
"network.protocol.name": "websocket",
|
|
1574
1611
|
"url.full": t(e)
|
|
@@ -1581,42 +1618,42 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1581
1618
|
metricAttributes: r,
|
|
1582
1619
|
spanAttributes: n
|
|
1583
1620
|
};
|
|
1584
|
-
},
|
|
1621
|
+
}, Hn = (e, n) => {
|
|
1585
1622
|
var r;
|
|
1586
|
-
let { bytesCounter: i, connectDurationHistogram: a, context: s, errorCounter: c, errorThrottle: l, isDisposed: u, messageCounter: d, url: f } = n, { metricAttributes: p, spanAttributes: m } =
|
|
1623
|
+
let { bytesCounter: i, connectDurationHistogram: a, context: s, errorCounter: c, errorThrottle: l, isDisposed: u, messageCounter: d, url: f } = n, { metricAttributes: p, spanAttributes: m } = Vn(f, s.config.hooks.redactUrl), h = s.applyRedact(E(E({}, s.config.hooks.getMetricAttributes()), p)), g = (r = m["server.address"]) == null ? m["url.full"] : r, _ = s.startSpan("websocket.connect", E(E(E({}, m), F({
|
|
1587
1624
|
errorType: "none",
|
|
1588
1625
|
eventLabel: "WebSocket",
|
|
1589
1626
|
spanSubtype: "websocket",
|
|
1590
1627
|
spanType: P.custom,
|
|
1591
|
-
targetLabel:
|
|
1592
|
-
})), m["server.address"] ? { [
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
let n = performance.now() -
|
|
1596
|
-
e === "error" &&
|
|
1628
|
+
targetLabel: g
|
|
1629
|
+
})), m["server.address"] ? { [x.targetDomain]: m["server.address"] } : {})), v = performance.now(), y = !1, b = (e) => {
|
|
1630
|
+
if (y) return;
|
|
1631
|
+
y = !0;
|
|
1632
|
+
let n = performance.now() - v;
|
|
1633
|
+
e === "error" && _.setStatus({
|
|
1597
1634
|
code: t.ERROR,
|
|
1598
1635
|
message: "websocket connect failed"
|
|
1599
|
-
}),
|
|
1636
|
+
}), _.setAttributes(F({
|
|
1600
1637
|
duration: n,
|
|
1601
1638
|
errorType: e === "error" ? "network" : "none",
|
|
1602
1639
|
eventLabel: "WebSocket",
|
|
1603
1640
|
result: e === "error" ? N.error : N.success,
|
|
1604
1641
|
spanSubtype: "websocket",
|
|
1605
1642
|
spanType: P.custom,
|
|
1606
|
-
targetLabel:
|
|
1643
|
+
targetLabel: g,
|
|
1607
1644
|
targetValue: n
|
|
1608
|
-
})),
|
|
1645
|
+
})), _.end(), e === "opened" && !u() && a.record(n, h);
|
|
1609
1646
|
};
|
|
1610
1647
|
e.addEventListener("open", () => {
|
|
1611
|
-
u() ||
|
|
1648
|
+
u() || b("opened");
|
|
1612
1649
|
}), e.addEventListener("message", (e) => {
|
|
1613
1650
|
if (u()) return;
|
|
1614
|
-
let t = E(E({},
|
|
1615
|
-
d.add(1, t), i.add(
|
|
1651
|
+
let t = E(E({}, h), {}, { "websocket.direction": "in" });
|
|
1652
|
+
d.add(1, t), i.add(Bn(e.data), t);
|
|
1616
1653
|
}), e.addEventListener("error", () => {
|
|
1617
1654
|
if (u()) return;
|
|
1618
|
-
let e =
|
|
1619
|
-
c.add(1, E(E({},
|
|
1655
|
+
let e = y ? "runtime" : "connect";
|
|
1656
|
+
c.add(1, E(E({}, h), {}, { "websocket.error.phase": e })), b("error");
|
|
1620
1657
|
let t = l.allow(`ws:error:${f}`);
|
|
1621
1658
|
t.allowed && s.emitLog({
|
|
1622
1659
|
severityNumber: o.ERROR,
|
|
@@ -1628,14 +1665,14 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1628
1665
|
result: N.error,
|
|
1629
1666
|
spanSubtype: "websocket",
|
|
1630
1667
|
spanType: P.custom,
|
|
1631
|
-
targetLabel:
|
|
1668
|
+
targetLabel: g
|
|
1632
1669
|
})), {}, {
|
|
1633
1670
|
"websocket.error.phase": e,
|
|
1634
1671
|
"websocket.error.window_count": t.count
|
|
1635
1672
|
})
|
|
1636
1673
|
});
|
|
1637
1674
|
}), e.addEventListener("close", (e) => {
|
|
1638
|
-
u() || (
|
|
1675
|
+
u() || (y || b("error"), s.emitLog({
|
|
1639
1676
|
severityNumber: o.INFO,
|
|
1640
1677
|
severityText: "INFO",
|
|
1641
1678
|
body: "websocket.close",
|
|
@@ -1645,7 +1682,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1645
1682
|
result: e.wasClean ? N.success : N.warning,
|
|
1646
1683
|
spanSubtype: "websocket",
|
|
1647
1684
|
spanType: P.custom,
|
|
1648
|
-
targetLabel:
|
|
1685
|
+
targetLabel: g,
|
|
1649
1686
|
targetValue: e.code
|
|
1650
1687
|
})), {}, {
|
|
1651
1688
|
"websocket.close.code": e.code,
|
|
@@ -1657,12 +1694,12 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1657
1694
|
let ee = e.send.bind(e);
|
|
1658
1695
|
e.send = (e) => {
|
|
1659
1696
|
if (!u()) {
|
|
1660
|
-
let t = E(E({},
|
|
1661
|
-
d.add(1, t), i.add(
|
|
1697
|
+
let t = E(E({}, h), {}, { "websocket.direction": "out" });
|
|
1698
|
+
d.add(1, t), i.add(Bn(e), t);
|
|
1662
1699
|
}
|
|
1663
1700
|
return ee(e);
|
|
1664
1701
|
};
|
|
1665
|
-
},
|
|
1702
|
+
}, Un = () => {
|
|
1666
1703
|
let e, t, n = !1;
|
|
1667
1704
|
return {
|
|
1668
1705
|
name: "websocket",
|
|
@@ -1676,12 +1713,12 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1676
1713
|
}), s = r.meter.createCounter("browser.websocket.error.count", { description: "Total number of WebSocket error events" }), c = r.meter.createHistogram("browser.websocket.connect.duration", {
|
|
1677
1714
|
unit: "ms",
|
|
1678
1715
|
description: "WebSocket connection establishment duration (only successful connects)"
|
|
1679
|
-
}), l =
|
|
1716
|
+
}), l = ft(Rn, zn), u = () => n;
|
|
1680
1717
|
t = new Proxy(i, { construct(e, t, i) {
|
|
1681
1718
|
let d = Reflect.construct(e, t, i);
|
|
1682
1719
|
if (n) return d;
|
|
1683
1720
|
let f = t[0] == null ? "" : String(t[0]);
|
|
1684
|
-
return !f || M(r.config, f) ||
|
|
1721
|
+
return !f || M(r.config, f) || Hn(d, {
|
|
1685
1722
|
bytesCounter: o,
|
|
1686
1723
|
connectDurationHistogram: c,
|
|
1687
1724
|
context: r,
|
|
@@ -1697,56 +1734,56 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1697
1734
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
1698
1735
|
}
|
|
1699
1736
|
};
|
|
1700
|
-
},
|
|
1737
|
+
}, Z = "BK_RUM_SAMPLING", Wn = /* @__PURE__ */ new Map(), Gn = (e) => Wn.get(e), Kn = (e, t) => (Wn.set(e, t), t), qn = ({ sampling: e }) => {
|
|
1701
1738
|
if (e.rate <= 0) return !1;
|
|
1702
1739
|
if (e.rate >= 1) return !0;
|
|
1703
1740
|
try {
|
|
1704
|
-
let t = sessionStorage.getItem(
|
|
1741
|
+
let t = sessionStorage.getItem(Z);
|
|
1705
1742
|
if (t) return t === "1";
|
|
1706
1743
|
let n = Math.random() < e.rate;
|
|
1707
|
-
return sessionStorage.setItem(
|
|
1744
|
+
return sessionStorage.setItem(Z, n ? "1" : "0"), Kn(Z, n), n;
|
|
1708
1745
|
} catch (t) {
|
|
1709
|
-
let n =
|
|
1710
|
-
return typeof n == "boolean" ? n :
|
|
1746
|
+
let n = Gn(Z);
|
|
1747
|
+
return typeof n == "boolean" ? n : Kn(Z, Math.random() < e.rate);
|
|
1711
1748
|
}
|
|
1712
|
-
},
|
|
1749
|
+
}, Jn = (e) => ({
|
|
1713
1750
|
url: e.endpoint,
|
|
1714
1751
|
headers: e.headers,
|
|
1715
1752
|
concurrencyLimit: e.concurrencyLimit,
|
|
1716
1753
|
timeoutMillis: e.timeoutMillis
|
|
1717
|
-
}),
|
|
1754
|
+
}), Yn = "bk-rum", Q = (e, t, n) => n ? new Proxy(e, { get(e, n, r) {
|
|
1718
1755
|
if (n === "export") return (n, r) => {
|
|
1719
1756
|
var i;
|
|
1720
1757
|
return (i = globalThis.console) == null || i.log(`[bk-ot][${t}]`, n), e.export(n, r);
|
|
1721
1758
|
};
|
|
1722
1759
|
let i = Reflect.get(e, n, r);
|
|
1723
1760
|
return typeof i == "function" ? i.bind(e) : i;
|
|
1724
|
-
} }) : e,
|
|
1725
|
-
...$(e.device, !0,
|
|
1726
|
-
...$(e.session, !0,
|
|
1727
|
-
...$(e.pageView, !0,
|
|
1728
|
-
...$(e.httpBody, !1,
|
|
1729
|
-
...$(e.error, !0,
|
|
1730
|
-
...$(e.webVitals, !0,
|
|
1731
|
-
...$(e.resource, !0,
|
|
1732
|
-
...$(e.blankScreen, !0,
|
|
1733
|
-
...$(e.action, !1,
|
|
1734
|
-
...$(e.websocket, !1,
|
|
1735
|
-
...$(e.longTask, !1,
|
|
1736
|
-
...$(e.cspViolation, !1,
|
|
1737
|
-
...$(e.routeTiming, !1,
|
|
1738
|
-
],
|
|
1761
|
+
} }) : e, Xn = (e) => [dt(e.instrumentations)], Zn = (e, t) => e === void 0 ? t : e !== !1, Qn = (e) => typeof e == "object" && e ? e : void 0, $ = (e, t, n) => Zn(e, t) ? [n(Qn(e))] : [], $n = (e) => [
|
|
1762
|
+
...$(e.device, !0, kt),
|
|
1763
|
+
...$(e.session, !0, An),
|
|
1764
|
+
...$(e.pageView, !0, pn),
|
|
1765
|
+
...$(e.httpBody, !1, nn),
|
|
1766
|
+
...$(e.error, !0, zt),
|
|
1767
|
+
...$(e.webVitals, !0, In),
|
|
1768
|
+
...$(e.resource, !0, hn),
|
|
1769
|
+
...$(e.blankScreen, !0, rt),
|
|
1770
|
+
...$(e.action, !1, Ue),
|
|
1771
|
+
...$(e.websocket, !1, Un),
|
|
1772
|
+
...$(e.longTask, !1, on),
|
|
1773
|
+
...$(e.cspViolation, !1, _t),
|
|
1774
|
+
...$(e.routeTiming, !1, gn)
|
|
1775
|
+
], er = class {
|
|
1739
1776
|
assertBeforeStart(e) {
|
|
1740
1777
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
1741
1778
|
}
|
|
1742
1779
|
constructor(o) {
|
|
1743
|
-
var
|
|
1780
|
+
var S = this, re, C;
|
|
1744
1781
|
w(this, "loggerProvider", void 0), w(this, "meterProvider", void 0), w(this, "phase", "idle"), w(this, "pluginManager", void 0), w(this, "plugins", void 0), w(this, "registeredInstrumentations", void 0), w(this, "runtimeContext", void 0), w(this, "sampled", void 0), w(this, "teardownCallbacks", []), w(this, "tracerProvider", void 0), w(this, "applyRedact", (e) => this.config.hooks.redactAttributes(e)), w(this, "config", void 0), w(this, "emitLog", (e) => {
|
|
1745
1782
|
var t;
|
|
1746
1783
|
let n = E(E({}, e), {}, { attributes: this.applyRedact(E(E({}, this.getRuntimeAttributes()), (t = e.attributes) == null ? {} : t)) });
|
|
1747
1784
|
this.logger.emit(n);
|
|
1748
1785
|
}), w(this, "flush", A(function* () {
|
|
1749
|
-
yield
|
|
1786
|
+
yield S.pluginManager.flush(), yield S.tracerProvider.forceFlush(), yield S.meterProvider.forceFlush(), yield S.loggerProvider.forceFlush();
|
|
1750
1787
|
})), w(this, "getRuntimeAttributes", () => this.runtimeContext.getAttributes()), w(this, "logger", void 0), w(this, "meter", void 0), w(this, "reportAction", ({ attributes: e = {}, targetTag: t, targetText: n, type: r }) => {
|
|
1751
1788
|
var i;
|
|
1752
1789
|
if (!this.sampled) return;
|
|
@@ -1757,7 +1794,7 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1757
1794
|
spanSubtype: r,
|
|
1758
1795
|
spanType: P.action,
|
|
1759
1796
|
targetLabel: (i = a == null ? t : a) == null ? r : i
|
|
1760
|
-
})), {}, { [
|
|
1797
|
+
})), {}, { [x.actionType]: r }, a ? { [x.targetTextShort]: a } : {}), t ? { [x.targetTag]: t } : {}), e)).end();
|
|
1761
1798
|
}), w(this, "reportCustomEvent", ({ attributes: e = {}, error: n, name: r }) => {
|
|
1762
1799
|
if (!this.sampled) {
|
|
1763
1800
|
if (this.config.debug) {
|
|
@@ -1785,64 +1822,64 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1785
1822
|
}), w(this, "setView", (e) => {
|
|
1786
1823
|
this.runtimeContext.setView(e);
|
|
1787
1824
|
}), w(this, "shutdown", A(function* () {
|
|
1788
|
-
if (
|
|
1789
|
-
for (yield
|
|
1825
|
+
if (S.phase !== "stopped") {
|
|
1826
|
+
for (yield S.flush(); S.teardownCallbacks.length;) {
|
|
1790
1827
|
var e;
|
|
1791
|
-
(e =
|
|
1828
|
+
(e = S.teardownCallbacks.pop()) == null || e();
|
|
1792
1829
|
}
|
|
1793
|
-
for (yield
|
|
1830
|
+
for (yield S.pluginManager.shutdown(); S.registeredInstrumentations.length;) {
|
|
1794
1831
|
var t, i;
|
|
1795
|
-
(t =
|
|
1832
|
+
(t = S.registeredInstrumentations.pop()) == null || (i = t.disable) == null || i.call(t);
|
|
1796
1833
|
}
|
|
1797
|
-
yield
|
|
1834
|
+
yield S.tracerProvider.shutdown(), yield S.meterProvider.shutdown(), yield S.loggerProvider.shutdown(), a.disable(), r.disable(), n.disable(), S.phase = "stopped";
|
|
1798
1835
|
}
|
|
1799
1836
|
})), w(this, "start", A(function* () {
|
|
1800
|
-
if (!(
|
|
1801
|
-
if (
|
|
1802
|
-
if (!
|
|
1803
|
-
|
|
1837
|
+
if (!(S.phase === "started" || S.phase === "starting")) {
|
|
1838
|
+
if (S.phase === "stopped") throw Error("[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.");
|
|
1839
|
+
if (!S.config.enabled) {
|
|
1840
|
+
S.phase = "started";
|
|
1804
1841
|
return;
|
|
1805
1842
|
}
|
|
1806
|
-
|
|
1843
|
+
S.phase = "starting", i.setGlobalPropagator(new l()), S.tracerProvider.register({ contextManager: new c() }), r.setGlobalMeterProvider(S.meterProvider), s.setGlobalLoggerProvider(S.loggerProvider);
|
|
1807
1844
|
try {
|
|
1808
|
-
if (
|
|
1809
|
-
instrumentations:
|
|
1810
|
-
meterProvider:
|
|
1811
|
-
tracerProvider:
|
|
1812
|
-
}), yield
|
|
1845
|
+
if (S.registeredInstrumentations.length && p({
|
|
1846
|
+
instrumentations: S.registeredInstrumentations,
|
|
1847
|
+
meterProvider: S.meterProvider,
|
|
1848
|
+
tracerProvider: S.tracerProvider
|
|
1849
|
+
}), yield S.pluginManager.start(S), typeof window < "u" && typeof document < "u") {
|
|
1813
1850
|
let e = () => {
|
|
1814
|
-
|
|
1851
|
+
S.flush();
|
|
1815
1852
|
}, t = () => {
|
|
1816
|
-
document.visibilityState === "hidden" &&
|
|
1853
|
+
document.visibilityState === "hidden" && S.flush();
|
|
1817
1854
|
};
|
|
1818
|
-
window.addEventListener("pagehide", e), document.addEventListener("visibilitychange", t),
|
|
1855
|
+
window.addEventListener("pagehide", e), document.addEventListener("visibilitychange", t), S.teardownCallbacks.push(() => window.removeEventListener("pagehide", e), () => document.removeEventListener("visibilitychange", t));
|
|
1819
1856
|
}
|
|
1820
1857
|
} catch (i) {
|
|
1821
|
-
for (;
|
|
1858
|
+
for (; S.teardownCallbacks.length;) {
|
|
1822
1859
|
var e;
|
|
1823
|
-
(e =
|
|
1860
|
+
(e = S.teardownCallbacks.pop()) == null || e();
|
|
1824
1861
|
}
|
|
1825
|
-
yield
|
|
1826
|
-
for (let e of
|
|
1862
|
+
yield S.pluginManager.shutdown();
|
|
1863
|
+
for (let e of S.registeredInstrumentations) {
|
|
1827
1864
|
var t;
|
|
1828
1865
|
(t = e.disable) == null || t.call(e);
|
|
1829
1866
|
}
|
|
1830
|
-
throw a.disable(), r.disable(), n.disable(),
|
|
1867
|
+
throw a.disable(), r.disable(), n.disable(), S.phase = "idle", i;
|
|
1831
1868
|
}
|
|
1832
|
-
|
|
1869
|
+
S.phase = "started";
|
|
1833
1870
|
}
|
|
1834
1871
|
})), w(this, "startSpan", (t, n = {}, r) => this.tracer.startSpan(t, {
|
|
1835
1872
|
kind: e.INTERNAL,
|
|
1836
1873
|
startTime: r == null ? void 0 : r.startTime,
|
|
1837
1874
|
attributes: this.applyRedact(E(E({}, this.getRuntimeAttributes()), n))
|
|
1838
|
-
})), w(this, "tracer", void 0), w(this, "use", (e) => (this.assertBeforeStart("use"), this.sampled && this.plugins.push(e), this)), w(this, "useInstrumentation", (e) => (this.assertBeforeStart("useInstrumentation"), this.config.enabled && this.registeredInstrumentations.push(e), this)), this.config = ge(o), this.sampled = this.config.enabled &&
|
|
1839
|
-
let T = m(this.config.resourceAttributes), D =
|
|
1875
|
+
})), w(this, "tracer", void 0), w(this, "use", (e) => (this.assertBeforeStart("use"), this.sampled && this.plugins.push(e), this)), w(this, "useInstrumentation", (e) => (this.assertBeforeStart("useInstrumentation"), this.config.enabled && this.registeredInstrumentations.push(e), this)), this.config = ge(o), this.sampled = this.config.enabled && qn(this.config);
|
|
1876
|
+
let T = m(this.config.resourceAttributes), D = Q(new f(Jn(this.config.transport.traces)), "traces", this.config.debug), ie = Q(new d(Jn(this.config.transport.metrics)), "metrics", this.config.debug), ae = Q(new u(Jn(this.config.transport.logs)), "logs", this.config.debug), O = new Ae(this.config.spanProcessor === "simple" ? new ee(D) : new y(D, this.config.spanBatch), this.config), oe = new v({
|
|
1840
1877
|
exporter: ie,
|
|
1841
1878
|
exportIntervalMillis: this.config.metricIntervalMillis
|
|
1842
1879
|
}), k = new h(ae);
|
|
1843
|
-
this.tracerProvider = new
|
|
1880
|
+
this.tracerProvider = new ne({
|
|
1844
1881
|
resource: T,
|
|
1845
|
-
sampler: new
|
|
1882
|
+
sampler: new b({ root: new te(+!!this.sampled) }),
|
|
1846
1883
|
spanProcessors: [O]
|
|
1847
1884
|
}), this.meterProvider = new _({
|
|
1848
1885
|
resource: T,
|
|
@@ -1850,11 +1887,11 @@ var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1850
1887
|
}), this.loggerProvider = new g({
|
|
1851
1888
|
resource: T,
|
|
1852
1889
|
processors: [k]
|
|
1853
|
-
}), this.tracer = this.tracerProvider.getTracer(
|
|
1890
|
+
}), this.tracer = this.tracerProvider.getTracer(Yn), this.meter = this.meterProvider.getMeter(Yn), this.logger = this.loggerProvider.getLogger(Yn), this.runtimeContext = new je({ "rum.sampled": this.sampled }, this.config.user), this.registeredInstrumentations = this.config.enabled ? [...(re = this.config.instrumentations.custom) == null ? [] : re] : [], this.plugins = [...this.config.enabled ? Xn(this.config) : [], ...this.sampled ? [...$n(this.config.plugins), ...(C = this.config.plugins.custom) == null ? [] : C] : []], this.pluginManager = new be(this.plugins), this.config.autoStart && this.start().catch((e) => {
|
|
1854
1891
|
var t;
|
|
1855
1892
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
1856
1893
|
});
|
|
1857
1894
|
}
|
|
1858
1895
|
};
|
|
1859
1896
|
//#endregion
|
|
1860
|
-
export {
|
|
1897
|
+
export { er as BkOpenTelemetry, Ae as FilteringSpanProcessor, x as RUM_ATTRIBUTES, N as RUM_SPAN_RESULT, P as RUM_SPAN_TYPE, je as RumRuntimeContext, F as buildRumSpanAttributes, Ue as createActionPlugin, rt as createBlankScreenPlugin, dt as createCommonInstrumentationsPlugin, _t as createCspViolationPlugin, kt as createDevicePlugin, zt as createErrorPlugin, nn as createHttpBodyPlugin, on as createLongTaskPlugin, pn as createPageViewPlugin, ye as createPlugin, hn as createResourcePlugin, gn as createRouteTimingPlugin, An as createSessionPlugin, Un as createWebSocketPlugin, In as createWebVitalsPlugin, Me as getDurationBucket, ge as resolveConfig };
|