@blueking/open-telemetry 0.0.31 → 0.0.33
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/README.md +71 -33
- package/dist/bk-rum.global.js +2 -2
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/plugin.d.ts +3 -0
- package/dist/index.js +461 -354
- package/dist/index.js.map +1 -1
- package/dist/plugins/web-vitals.d.ts +1 -1
- package/dist/schema/attributes.d.ts +1 -0
- package/dist/schema/span.d.ts +10 -0
- package/package.json +1 -1
- package/skills/bk-rum-otele/SKILL.md +1 -1
- package/skills/bk-rum-otele/evals/evals.json +1 -1
- package/skills/bk-rum-otele/references/actions.md +16 -10
- package/skills/bk-rum-otele/references/api.md +6 -3
- package/skills/bk-rum-otele/references/architecture.md +4 -4
- package/skills/bk-rum-otele/references/blank-screen.md +10 -19
- package/skills/bk-rum-otele/references/capabilities.md +18 -18
- package/skills/bk-rum-otele/references/configuration.md +5 -5
- package/skills/bk-rum-otele/references/data-model.md +14 -16
- package/skills/bk-rum-otele/references/errors-security.md +9 -8
- package/skills/bk-rum-otele/references/extensions.md +8 -0
- package/skills/bk-rum-otele/references/framework-integration.md +1 -1
- package/skills/bk-rum-otele/references/getting-started.md +21 -2
- package/skills/bk-rum-otele/references/network.md +21 -22
- package/skills/bk-rum-otele/references/performance.md +14 -25
- package/skills/bk-rum-otele/references/privacy.md +1 -1
- package/skills/bk-rum-otele/references/session-context.md +16 -12
- package/skills/bk-rum-otele/references/span-protocol.md +192 -282
- package/skills/bk-rum-otele/references/telemetry-reference.md +97 -99
- package/skills/bk-rum-otele/references/transport-sampling.md +19 -14
- package/skills/bk-rum-otele/references/troubleshooting.md +4 -4
- package/skills/bk-rum-otele/references/views-routing.md +5 -4
package/dist/index.js
CHANGED
|
@@ -6,13 +6,14 @@ import { resourceFromAttributes as c } from "@opentelemetry/resources";
|
|
|
6
6
|
import { BatchSpanProcessor as l, SamplingDecision as u, SimpleSpanProcessor as d } from "@opentelemetry/sdk-trace-base";
|
|
7
7
|
import { WebTracerProvider as f } from "@opentelemetry/sdk-trace-web";
|
|
8
8
|
//#region package.json
|
|
9
|
-
var p = "0.0.
|
|
9
|
+
var p = "0.0.33", m = (e) => {
|
|
10
10
|
let t = 5381;
|
|
11
11
|
for (let n = 0; n < e.length; n++) t = t * 33 ^ e.charCodeAt(n);
|
|
12
12
|
return (t >>> 0).toString(36);
|
|
13
13
|
}, h = (e) => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`, g = {
|
|
14
14
|
actionFrustrationType: "action.frustration.type",
|
|
15
15
|
actionId: "action.id",
|
|
16
|
+
actionName: "action.name",
|
|
16
17
|
actionTargetName: "action.target.name",
|
|
17
18
|
actionTargetTag: "action.target.tag",
|
|
18
19
|
actionType: "action.type",
|
|
@@ -385,21 +386,99 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
385
386
|
}
|
|
386
387
|
})();
|
|
387
388
|
}
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
}, A = {
|
|
390
|
+
abort: "abort",
|
|
391
|
+
error: "error",
|
|
392
|
+
success: "success",
|
|
393
|
+
timeout: "timeout",
|
|
394
|
+
warning: "warning"
|
|
395
|
+
}, j = {
|
|
396
|
+
action: "action",
|
|
397
|
+
custom: "custom",
|
|
398
|
+
error: "error",
|
|
399
|
+
longTask: "long_task",
|
|
400
|
+
resource: "resource",
|
|
401
|
+
session: "session",
|
|
402
|
+
vital: "vital",
|
|
403
|
+
view: "view",
|
|
404
|
+
websocket: "websocket"
|
|
405
|
+
}, M = (e, t) => {
|
|
406
|
+
let n = e[t];
|
|
407
|
+
return typeof n == "string" && n.trim() ? n.trim() : void 0;
|
|
408
|
+
}, N = ({ attributes: e, nameHint: t, spanType: n }) => {
|
|
409
|
+
if (n === j.session) {
|
|
410
|
+
let t = M(e, g.sessionPhase);
|
|
411
|
+
return t ? `session.${t}` : "session";
|
|
412
|
+
}
|
|
413
|
+
if (n === j.view) {
|
|
414
|
+
var r, i;
|
|
415
|
+
return (r = (i = M(e, g.viewName)) == null ? M(e, g.viewUrlTemplate) : i) == null ? "view" : r;
|
|
416
|
+
}
|
|
417
|
+
if (n === j.resource) {
|
|
418
|
+
var a;
|
|
419
|
+
let t = (a = M(e, "http.request.method")) == null ? void 0 : a.toUpperCase(), n = M(e, "url.template");
|
|
420
|
+
if (t && n) return `${t} ${n}`;
|
|
421
|
+
let r = M(e, "resource.type");
|
|
422
|
+
return r ? `resource.${r}` : "resource";
|
|
423
|
+
}
|
|
424
|
+
if (n === j.action) {
|
|
425
|
+
var o, s;
|
|
426
|
+
return (o = (s = M(e, g.actionName)) == null ? M(e, g.actionType) : s) == null ? "action" : o;
|
|
427
|
+
}
|
|
428
|
+
if (n === j.error) {
|
|
429
|
+
let n = M(e, "blank_screen.reason");
|
|
430
|
+
if (n) return `blank_screen.${n}`;
|
|
431
|
+
let r = M(e, "csp.effective_directive");
|
|
432
|
+
return r ? `csp.${r}` : (t == null ? void 0 : t.trim()) || M(e, "error.source") || "error";
|
|
433
|
+
}
|
|
434
|
+
if (n === j.vital) {
|
|
435
|
+
var c, l;
|
|
436
|
+
return (c = (l = M(e, g.vitalMetric)) == null ? void 0 : l.toUpperCase()) == null ? "vital" : c;
|
|
437
|
+
}
|
|
438
|
+
if (n === j.longTask) {
|
|
439
|
+
var u;
|
|
440
|
+
return (u = M(e, g.longTaskEntryType)) == null ? "long-task" : u;
|
|
441
|
+
}
|
|
442
|
+
if (n === j.websocket) {
|
|
443
|
+
let t = M(e, g.websocketPhase);
|
|
444
|
+
return t ? `websocket.${t}` : "websocket";
|
|
445
|
+
}
|
|
446
|
+
return n === j.custom ? t === void 0 ? "custom" : `custom.${t}` : n;
|
|
447
|
+
}, Ie = (e) => e === 408 || e === 504 ? A.timeout : typeof e == "number" && e >= 400 ? A.error : A.success, Le = (e) => e === "good" ? A.success : A.warning, Re = (e) => {
|
|
448
|
+
if (!e) return {};
|
|
449
|
+
try {
|
|
450
|
+
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
451
|
+
return {
|
|
452
|
+
serverAddress: t.hostname,
|
|
453
|
+
serverPort: t.port ? Number(t.port) : void 0
|
|
454
|
+
};
|
|
455
|
+
} catch (e) {
|
|
456
|
+
return {};
|
|
457
|
+
}
|
|
458
|
+
}, P = ({ outcome: e = A.success, spanType: t }) => ({
|
|
459
|
+
[g.spanType]: t,
|
|
460
|
+
[g.outcomeType]: e
|
|
461
|
+
}), ze = ({ initiatorType: e = "other", method: t, outcome: n, url: r }) => {
|
|
462
|
+
let i = Re(r), a = (n == null ? void 0 : n.type) === "response" && typeof n.statusCode == "number" && n.statusCode > 0 ? n.statusCode : void 0, o = (n == null ? void 0 : n.type) === "abort" ? A.abort : (n == null ? void 0 : n.type) === "timeout" ? A.timeout : (n == null ? void 0 : n.type) === "network_error" ? A.error : typeof a == "number" ? Ie(a) : A.success, s = t == null ? void 0 : t.toUpperCase();
|
|
463
|
+
return S(S(S(S(S({}, P({
|
|
464
|
+
outcome: o,
|
|
465
|
+
spanType: j.resource
|
|
466
|
+
})), i.serverAddress ? { "server.address": i.serverAddress } : {}), i.serverPort === void 0 ? {} : { "server.port": i.serverPort }), {}, { "resource.type": e }, s ? { "http.request.method": s } : {}), typeof a == "number" ? { "http.response.status_code": a } : {});
|
|
467
|
+
}, Be = ["http.url", "url.full"], Ve = /* @__PURE__ */ new WeakSet(), He = (e) => {
|
|
468
|
+
Ve.add(e);
|
|
469
|
+
}, Ue = (e) => {
|
|
470
|
+
for (let n of Be) {
|
|
392
471
|
var t;
|
|
393
472
|
let r = (t = e.attributes) == null ? void 0 : t[n];
|
|
394
473
|
if (typeof r == "string") return r;
|
|
395
474
|
}
|
|
396
|
-
},
|
|
475
|
+
}, We = (e) => {
|
|
397
476
|
let t = e == null ? void 0 : e[g.sessionId];
|
|
398
477
|
return typeof t == "string" && t.length > 0;
|
|
399
|
-
},
|
|
478
|
+
}, Ge = (e) => {
|
|
400
479
|
let t = e == null ? void 0 : e[g.viewId];
|
|
401
480
|
return typeof t == "string" && t.length > 0;
|
|
402
|
-
},
|
|
481
|
+
}, Ke = (e) => We(e) && Ge(e), qe = (e) => (e == null ? void 0 : e[g.spanType]) === j.session, Je = class {
|
|
403
482
|
constructor(e, t, n) {
|
|
404
483
|
this.inner = e, this.config = t, this.getRuntimeAttributes = n;
|
|
405
484
|
}
|
|
@@ -407,8 +486,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
407
486
|
return this.inner.forceFlush();
|
|
408
487
|
}
|
|
409
488
|
onEnd(e) {
|
|
410
|
-
let t =
|
|
411
|
-
if (!(
|
|
489
|
+
let t = Ue(e);
|
|
490
|
+
if (!(Ve.delete(e) || t && me(this.config, t) || !Ke(e.attributes) && !(qe(e.attributes) && We(e.attributes)))) {
|
|
412
491
|
try {
|
|
413
492
|
var n, r;
|
|
414
493
|
if (((n = this.config.hooks) == null || (r = n.beforeSend) == null ? void 0 : r.call(n, {
|
|
@@ -432,13 +511,13 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
432
511
|
shutdown() {
|
|
433
512
|
return this.inner.shutdown();
|
|
434
513
|
}
|
|
435
|
-
},
|
|
514
|
+
}, Ye = new Set(Object.values(g)), Xe = (e) => {
|
|
436
515
|
if (typeof e == "string" && e.length > 0) return e;
|
|
437
516
|
if (Array.isArray(e)) for (let t = e.length - 1; t >= 0; --t) {
|
|
438
517
|
let n = e[t];
|
|
439
518
|
if (typeof n == "string" && n.length > 0) return n;
|
|
440
519
|
}
|
|
441
|
-
},
|
|
520
|
+
}, Ze = class {
|
|
442
521
|
constructor(e = {}, t) {
|
|
443
522
|
b(this, "actionHistory", []), b(this, "attributes", {}), b(this, "queuedViewCommands", []), b(this, "recordAssociation", (e, t, n, r) => {
|
|
444
523
|
let i = e.at(-1);
|
|
@@ -491,7 +570,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
491
570
|
this.attributes[t] = n;
|
|
492
571
|
}
|
|
493
572
|
if (g.sessionId in e && this.recordAssociation(this.sessionHistory, [g.sessionId, g.sessionHasReplay], t, typeof this.attributes[g.sessionId] == "string"), g.actionId in e) {
|
|
494
|
-
let e =
|
|
573
|
+
let e = Xe(this.attributes[g.actionId]);
|
|
495
574
|
e === void 0 ? delete this.attributes[g.actionId] : this.attributes[g.actionId] = e, this.recordAssociation(this.actionHistory, [g.actionId], t, typeof this.attributes[g.actionId] == "string");
|
|
496
575
|
}
|
|
497
576
|
}), b(this, "setUser", (e) => {
|
|
@@ -513,7 +592,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
513
592
|
var n;
|
|
514
593
|
this.viewAttributeKeys.forEach((e) => delete this.attributes[e]), this.viewAttributeKeys.clear();
|
|
515
594
|
let r = {};
|
|
516
|
-
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 ||
|
|
595
|
+
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 || Ye.has(t) || (r[t] = i, this.attributes[t] = i, this.viewAttributeKeys.add(t), this.viewScopedAttributeKeys.add(t));
|
|
517
596
|
this.view = S(S({}, e), {}, { attributes: r }), this.setOptionalAttribute(g.viewId, e.id), this.setOptionalAttribute(g.viewUrl, e.url), this.setOptionalAttribute(g.viewUrlTemplate, e.urlTemplate), this.setOptionalAttribute(g.viewLoadingType, e.loadingType), this.setOptionalAttribute(g.viewName, e.name), [
|
|
518
597
|
g.viewId,
|
|
519
598
|
g.viewUrl,
|
|
@@ -523,43 +602,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
523
602
|
].forEach((e) => this.viewScopedAttributeKeys.add(e)), this.recordAssociation(this.viewHistory, this.viewScopedAttributeKeys, t, typeof e.id == "string" && e.id.length > 0), this.viewChangeListeners.forEach((e) => e(this.getView()));
|
|
524
603
|
}), this.setAttributes(e), t && this.setUser(t);
|
|
525
604
|
}
|
|
526
|
-
},
|
|
527
|
-
abort: "abort",
|
|
528
|
-
error: "error",
|
|
529
|
-
success: "success",
|
|
530
|
-
timeout: "timeout",
|
|
531
|
-
warning: "warning"
|
|
532
|
-
}, j = {
|
|
533
|
-
action: "action",
|
|
534
|
-
custom: "custom",
|
|
535
|
-
error: "error",
|
|
536
|
-
longTask: "long_task",
|
|
537
|
-
resource: "resource",
|
|
538
|
-
session: "session",
|
|
539
|
-
vital: "vital",
|
|
540
|
-
view: "view",
|
|
541
|
-
websocket: "websocket"
|
|
542
|
-
}, qe = (e) => e === 408 || e === 504 ? A.timeout : typeof e == "number" && e >= 400 ? A.error : A.success, Je = (e) => e === "good" ? A.success : A.warning, Ye = (e) => {
|
|
543
|
-
if (!e) return {};
|
|
544
|
-
try {
|
|
545
|
-
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
546
|
-
return {
|
|
547
|
-
serverAddress: t.hostname,
|
|
548
|
-
serverPort: t.port ? Number(t.port) : void 0
|
|
549
|
-
};
|
|
550
|
-
} catch (e) {
|
|
551
|
-
return {};
|
|
552
|
-
}
|
|
553
|
-
}, M = ({ outcome: e = A.success, spanType: t }) => ({
|
|
554
|
-
[g.spanType]: t,
|
|
555
|
-
[g.outcomeType]: e
|
|
556
|
-
}), Xe = ({ initiatorType: e = "other", method: t, outcome: n, url: r }) => {
|
|
557
|
-
let i = Ye(r), a = (n == null ? void 0 : n.type) === "response" && typeof n.statusCode == "number" && n.statusCode > 0 ? n.statusCode : void 0, o = (n == null ? void 0 : n.type) === "abort" ? A.abort : (n == null ? void 0 : n.type) === "timeout" ? A.timeout : (n == null ? void 0 : n.type) === "network_error" ? A.error : typeof a == "number" ? qe(a) : A.success, s = t == null ? void 0 : t.toUpperCase();
|
|
558
|
-
return S(S(S(S(S({}, M({
|
|
559
|
-
outcome: o,
|
|
560
|
-
spanType: j.resource
|
|
561
|
-
})), i.serverAddress ? { "server.address": i.serverAddress } : {}), i.serverPort === void 0 ? {} : { "server.port": i.serverPort }), {}, { "resource.type": e }, s ? { "http.request.method": s } : {}), typeof a == "number" ? { "http.response.status_code": a } : {});
|
|
562
|
-
}, Ze = 100, Qe = 100, $e = 1e3, et = 100, tt = 1e4, nt = "data-bk-action-name", rt = 100, it = 10, at = (e) => e.replace(/\s+/g, " ").trim().slice(0, rt), N = (e) => {
|
|
605
|
+
}, Qe = 100, $e = 100, et = 1e3, tt = 100, nt = 1e4, rt = "data-bk-action-name", it = 100, at = 10, F = (e) => e.replace(/\s+/g, " ").trim().slice(0, it), I = (e) => {
|
|
563
606
|
var t;
|
|
564
607
|
if (e.parentElement) return e.parentElement;
|
|
565
608
|
let n = (t = e.getRootNode) == null ? void 0 : t.call(e);
|
|
@@ -568,12 +611,12 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
568
611
|
let n = e;
|
|
569
612
|
for (; n;) {
|
|
570
613
|
let e = n.getAttribute(t);
|
|
571
|
-
if (e) return
|
|
572
|
-
n =
|
|
614
|
+
if (e) return F(e);
|
|
615
|
+
n = I(n);
|
|
573
616
|
}
|
|
574
617
|
}, st = (e) => {
|
|
575
618
|
var t;
|
|
576
|
-
return e.isContentEditable ? "" :
|
|
619
|
+
return e.isContentEditable ? "" : F((t = e.textContent) == null ? "" : t);
|
|
577
620
|
}, ct = (e) => {
|
|
578
621
|
var t, n;
|
|
579
622
|
let r = e, i = (t = r.labels) == null ? void 0 : t[0];
|
|
@@ -588,7 +631,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
588
631
|
"submit"
|
|
589
632
|
].includes(o == null ? "" : o)) {
|
|
590
633
|
var s;
|
|
591
|
-
let e =
|
|
634
|
+
let e = F((s = r.value) == null ? "" : s);
|
|
592
635
|
if (e) return e;
|
|
593
636
|
}
|
|
594
637
|
if (a === "button" || a === "label" || e.getAttribute("role") === "button") {
|
|
@@ -603,29 +646,29 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
603
646
|
"placeholder"
|
|
604
647
|
]) {
|
|
605
648
|
var c;
|
|
606
|
-
let n =
|
|
649
|
+
let n = F((c = e.getAttribute(t)) == null ? "" : c);
|
|
607
650
|
if (n) return n;
|
|
608
651
|
}
|
|
609
|
-
}, lt = (e, t =
|
|
652
|
+
}, lt = (e, t = rt, n = !1) => {
|
|
610
653
|
let r = ot(e, t);
|
|
611
654
|
if (r) return r;
|
|
612
655
|
if (!n) return e.tagName.toLowerCase();
|
|
613
656
|
let i = e, a = 0;
|
|
614
|
-
for (; i && a <=
|
|
657
|
+
for (; i && a <= at;) {
|
|
615
658
|
let e = i.tagName.toLowerCase();
|
|
616
659
|
if (e === "body" || e === "html" || e === "head") break;
|
|
617
660
|
let t = ct(i);
|
|
618
661
|
if (t) return t;
|
|
619
662
|
if (e === "form") break;
|
|
620
|
-
i =
|
|
663
|
+
i = I(i), a += 1;
|
|
621
664
|
}
|
|
622
|
-
for (i = e, a = 0; i && a <=
|
|
665
|
+
for (i = e, a = 0; i && a <= at;) {
|
|
623
666
|
let e = i.tagName.toLowerCase();
|
|
624
667
|
if (e === "body" || e === "html" || e === "head") break;
|
|
625
668
|
let t = st(i);
|
|
626
669
|
if (t) return t;
|
|
627
670
|
if (e === "form") break;
|
|
628
|
-
i =
|
|
671
|
+
i = I(i), a += 1;
|
|
629
672
|
}
|
|
630
673
|
return e.tagName.toLowerCase();
|
|
631
674
|
}, ut = (e) => {
|
|
@@ -655,11 +698,11 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
655
698
|
"submit"
|
|
656
699
|
].includes((r = (i = t.getAttribute("type")) == null ? void 0 : i.toLowerCase()) == null ? "text" : r);
|
|
657
700
|
}
|
|
658
|
-
t =
|
|
701
|
+
t = I(t);
|
|
659
702
|
}
|
|
660
703
|
return !1;
|
|
661
704
|
}, mt = (e = {}) => {
|
|
662
|
-
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute ||
|
|
705
|
+
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute || rt, a = ft(e.maxDuration, nt), o = [], s, c = () => {
|
|
663
706
|
s == null || s.setRuntimeAttributes({ [g.actionId]: [...n.keys()].at(-1) });
|
|
664
707
|
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !pt(e.target), u = (e) => {
|
|
665
708
|
if (!r.delete(e) || !s || !e.completed) return;
|
|
@@ -668,29 +711,36 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
668
711
|
"rage_click",
|
|
669
712
|
"dead_click",
|
|
670
713
|
"error_click"
|
|
671
|
-
].filter((t) => e.frustrations.has(t)), { endTime: n, hasLoadingTime: i } = e.completed, a = e.hadError || t.length > 0
|
|
672
|
-
s.startSpan("action.click", S(S(S(S({}, s.config.hooks.getPageAttributes()), M({
|
|
714
|
+
].filter((t) => e.frustrations.has(t)), { endTime: n, hasLoadingTime: i } = e.completed, a = e.hadError || t.length > 0, o = `click ${e.targetName}`, c = S(S(S(S({}, s.config.hooks.getPageAttributes()), P({
|
|
673
715
|
outcome: a ? A.warning : A.success,
|
|
674
716
|
spanType: j.action
|
|
675
717
|
})), e.runtimeAttributes), {}, {
|
|
676
718
|
[g.actionId]: e.id,
|
|
719
|
+
[g.actionName]: o,
|
|
677
720
|
[g.actionType]: "click",
|
|
678
721
|
[g.actionTargetName]: e.targetName,
|
|
679
722
|
[g.actionTargetTag]: e.targetTag
|
|
680
|
-
}, t.length ? { [g.actionFrustrationType]: t } : {})
|
|
723
|
+
}, t.length ? { [g.actionFrustrationType]: t } : {});
|
|
724
|
+
s.startSpan(N({
|
|
725
|
+
attributes: c,
|
|
726
|
+
spanType: j.action
|
|
727
|
+
}), c, {
|
|
728
|
+
rumSpanType: j.action,
|
|
729
|
+
startTime: e.startTime
|
|
730
|
+
}).end(i ? n : e.startTime);
|
|
681
731
|
}, d = (e, t, i) => {
|
|
682
732
|
if (!n.delete(e.id) || !s) return;
|
|
683
733
|
clearTimeout(e.validationTimer), clearTimeout(e.quietTimer), clearTimeout(e.maxDurationTimer), c(), e.completed = {
|
|
684
734
|
endTime: t,
|
|
685
735
|
hasLoadingTime: i
|
|
686
736
|
}, r.add(e);
|
|
687
|
-
let a = Math.max(0, e.startTime +
|
|
737
|
+
let a = Math.max(0, e.startTime + et - Date.now());
|
|
688
738
|
e.reportTimer = setTimeout(() => u(e), a);
|
|
689
739
|
}, f = () => {
|
|
690
740
|
[...r].forEach(u);
|
|
691
741
|
}, p = (e) => {
|
|
692
742
|
if (clearTimeout(e.quietTimer), !e.hadActivity || e.pendingRequests.size) return;
|
|
693
|
-
let t = Math.max(0, e.lastActivityTime +
|
|
743
|
+
let t = Math.max(0, e.lastActivityTime + $e - Date.now());
|
|
694
744
|
e.quietTimer = setTimeout(() => d(e, e.lastActivityTime, !0), t);
|
|
695
745
|
}, m = (e, t) => {
|
|
696
746
|
e.hadActivity = !0, e.lastActivityTime = Math.max(e.lastActivityTime, t), p(e);
|
|
@@ -723,14 +773,14 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
723
773
|
[...n.values()].forEach((t) => d(t, e, t.hadActivity));
|
|
724
774
|
}, b = (e, t) => {
|
|
725
775
|
let n = "clientX" in t && typeof t.clientX == "number" ? t.clientX : 0, r = "clientY" in t && typeof t.clientY == "number" ? t.clientY : 0;
|
|
726
|
-
o = o.filter((t) => e.startTime - t.action.startTime <=
|
|
727
|
-
let i = o.at(-1), a = o.some((e) => e.action.userActivity.scroll || e.action.userActivity.selection), s = (i == null ? void 0 : i.target) === e.target && Math.hypot(i.x - n, i.y - r) <=
|
|
776
|
+
o = o.filter((t) => e.startTime - t.action.startTime <= et);
|
|
777
|
+
let i = o.at(-1), a = o.some((e) => e.action.userActivity.scroll || e.action.userActivity.selection), s = (i == null ? void 0 : i.target) === e.target && Math.hypot(i.x - n, i.y - r) <= tt;
|
|
728
778
|
(a || i && !s) && (o = []), o.push({
|
|
729
779
|
action: e,
|
|
730
780
|
target: e.target,
|
|
731
781
|
x: n,
|
|
732
782
|
y: r
|
|
733
|
-
}), o.length >= 3 && e.startTime - o[o.length - 3].action.startTime <=
|
|
783
|
+
}), o.length >= 3 && e.startTime - o[o.length - 3].action.startTime <= et && (o.slice(-3).map((e) => e.action).forEach((e) => e.frustrations.add("rage_click")), o = []);
|
|
734
784
|
};
|
|
735
785
|
return {
|
|
736
786
|
name: "action",
|
|
@@ -764,7 +814,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
764
814
|
},
|
|
765
815
|
validationTimer: setTimeout(() => {
|
|
766
816
|
u.hadActivity || d(u, u.startTime, !1);
|
|
767
|
-
},
|
|
817
|
+
}, Qe)
|
|
768
818
|
};
|
|
769
819
|
n.set(s, u), b(u, t), c();
|
|
770
820
|
};
|
|
@@ -929,15 +979,18 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
929
979
|
}, p = (t, n) => {
|
|
930
980
|
if (s !== t || c === t || !e.isSampled()) return;
|
|
931
981
|
c = t;
|
|
932
|
-
let r = Date.now()
|
|
933
|
-
e.startSpan("browser.blank_screen", S(S({}, M({
|
|
982
|
+
let r = Date.now(), i = S(S({}, P({
|
|
934
983
|
outcome: A.error,
|
|
935
984
|
spanType: j.error
|
|
936
985
|
})), {}, {
|
|
937
986
|
"blank_screen.empty_ratio": n.score,
|
|
938
987
|
"blank_screen.empty_sample_count": n.emptyCount,
|
|
939
988
|
"blank_screen.reason": n.reason
|
|
940
|
-
})
|
|
989
|
+
});
|
|
990
|
+
e.startSpan(N({
|
|
991
|
+
attributes: i,
|
|
992
|
+
spanType: j.error
|
|
993
|
+
}), i, { startTime: r }).end(r);
|
|
941
994
|
}, m = (t) => {
|
|
942
995
|
if (s !== t || c === t || document.visibilityState === "hidden") return;
|
|
943
996
|
let n;
|
|
@@ -980,44 +1033,44 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
980
1033
|
clearTimeout(u), u = void 0, d(), l == null || l(), l = void 0, f == null || f(), f = void 0, s = void 0, c = void 0;
|
|
981
1034
|
}
|
|
982
1035
|
};
|
|
983
|
-
}, Nt = 100, Pt = 200,
|
|
984
|
-
let t =
|
|
985
|
-
t >= 0 &&
|
|
986
|
-
},
|
|
1036
|
+
}, Nt = 100, Pt = 200, L = [], Ft = (e) => e.replace(/#.*$/, ""), It = (e) => {
|
|
1037
|
+
let t = L.indexOf(e);
|
|
1038
|
+
t >= 0 && L.splice(t, 1), e.timer !== void 0 && clearTimeout(e.timer);
|
|
1039
|
+
}, R = (e, t) => {
|
|
987
1040
|
let n = e.callback;
|
|
988
1041
|
It(e), e.callback = void 0, n == null || n(t);
|
|
989
1042
|
}, Lt = (e) => {
|
|
990
|
-
let t = performance.timeOrigin + e.startTime, n =
|
|
991
|
-
n && (n.entry = e, n.callback &&
|
|
1043
|
+
let t = performance.timeOrigin + e.startTime, n = L.filter((n) => !n.entry && Ft(n.url) === Ft(e.name) && t >= n.startTime - 50).sort((e, n) => Math.abs(e.startTime - t) - Math.abs(n.startTime - t))[0];
|
|
1044
|
+
n && (n.entry = e, n.callback && R(n, e));
|
|
992
1045
|
}, Rt = (e, t = Date.now()) => {
|
|
993
1046
|
let n = {
|
|
994
1047
|
startTime: t,
|
|
995
1048
|
url: e
|
|
996
1049
|
};
|
|
997
|
-
return
|
|
998
|
-
cancel: () =>
|
|
1050
|
+
return L.push(n), L.length > Nt && R(L[0]), {
|
|
1051
|
+
cancel: () => R(n),
|
|
999
1052
|
complete: (e) => {
|
|
1000
1053
|
if (n.callback = e, n.entry) {
|
|
1001
|
-
|
|
1054
|
+
R(n, n.entry);
|
|
1002
1055
|
return;
|
|
1003
1056
|
}
|
|
1004
|
-
n.timer = setTimeout(() =>
|
|
1057
|
+
n.timer = setTimeout(() => R(n), Pt);
|
|
1005
1058
|
}
|
|
1006
1059
|
};
|
|
1007
|
-
},
|
|
1060
|
+
}, z = "traceparent", B = 32, V = 16, zt = "0123456789abcdef", Bt = /^[\da-f]+$/, Vt = /^0+$/, Ht = /^\d+$/, Ut = /^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(?:-.*)?$/, Wt = /^([\da-f]{32})-([\da-f]{16})(?:-([01]))?$/, Gt = /(?:^|,)_dd\.p\.tid=([\da-f]{16})(?:,|$)/, Kt = "0000000000000000", H = (e, t) => e.length === t && Bt.test(e) && !Vt.test(e), qt = (e) => {
|
|
1008
1061
|
let t = e.toLowerCase();
|
|
1009
|
-
return
|
|
1062
|
+
return H(t, B) ? t : H(t, V) ? t.padStart(B, "0") : void 0;
|
|
1010
1063
|
}, Jt = (e) => {
|
|
1011
1064
|
let t = e.toLowerCase();
|
|
1012
|
-
return
|
|
1013
|
-
},
|
|
1065
|
+
return H(t, V) ? t : void 0;
|
|
1066
|
+
}, U = (e) => {
|
|
1014
1067
|
let t = new Uint8Array(e / 2);
|
|
1015
1068
|
if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") crypto.getRandomValues(t);
|
|
1016
1069
|
else for (let e = 0; e < t.length; e += 1) t[e] = Math.floor(Math.random() * 256);
|
|
1017
1070
|
let n = "";
|
|
1018
1071
|
for (let e of t) n += zt[e >> 4] + zt[e & 15];
|
|
1019
1072
|
return Vt.test(n) ? `${n.slice(1)}1` : n;
|
|
1020
|
-
},
|
|
1073
|
+
}, Yt = (e) => {
|
|
1021
1074
|
if (!Ht.test(e)) return;
|
|
1022
1075
|
let t = [];
|
|
1023
1076
|
for (let n = 0; n < e.length; n += 1) {
|
|
@@ -1028,11 +1081,11 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1028
1081
|
}
|
|
1029
1082
|
for (; r > 0;) t.push(r % 16), r = (r - r % 16) / 16;
|
|
1030
1083
|
}
|
|
1031
|
-
if (t.length >
|
|
1084
|
+
if (t.length > V) return;
|
|
1032
1085
|
let n = "";
|
|
1033
1086
|
for (let e = t.length - 1; e >= 0; --e) n += zt[t[e]];
|
|
1034
|
-
return n.padStart(
|
|
1035
|
-
},
|
|
1087
|
+
return n.padStart(V, "0");
|
|
1088
|
+
}, W = (e, t) => {
|
|
1036
1089
|
let n = {};
|
|
1037
1090
|
for (let i of t) {
|
|
1038
1091
|
var r;
|
|
@@ -1040,7 +1093,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1040
1093
|
t && (n[i] = t);
|
|
1041
1094
|
}
|
|
1042
1095
|
return n;
|
|
1043
|
-
},
|
|
1096
|
+
}, Xt = [
|
|
1044
1097
|
(e) => {
|
|
1045
1098
|
var t;
|
|
1046
1099
|
let n = (t = e("traceparent")) == null ? void 0 : t.trim().toLowerCase();
|
|
@@ -1048,9 +1101,9 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1048
1101
|
let r = Ut.exec(n);
|
|
1049
1102
|
if (!r || r[1] === "ff") return;
|
|
1050
1103
|
let [, , i, a, o] = r;
|
|
1051
|
-
if (!(!
|
|
1104
|
+
if (!(!H(i, B) || !H(a, V))) return {
|
|
1052
1105
|
format: "traceparent",
|
|
1053
|
-
headers:
|
|
1106
|
+
headers: W(e, [z]),
|
|
1054
1107
|
sampled: (Number.parseInt(o, 16) & 1) == 1,
|
|
1055
1108
|
spanId: a,
|
|
1056
1109
|
traceId: i
|
|
@@ -1060,7 +1113,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1060
1113
|
var t;
|
|
1061
1114
|
let n = (t = e("sentry-trace")) == null ? void 0 : t.trim().toLowerCase();
|
|
1062
1115
|
if (!n) return;
|
|
1063
|
-
let r =
|
|
1116
|
+
let r = W(e, ["sentry-trace"]), i = Wt.exec(n);
|
|
1064
1117
|
if (!i) return {
|
|
1065
1118
|
format: "sentry-trace",
|
|
1066
1119
|
headers: r
|
|
@@ -1069,7 +1122,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1069
1122
|
return S(S({
|
|
1070
1123
|
format: "sentry-trace",
|
|
1071
1124
|
headers: r
|
|
1072
|
-
}, s === void 0 ? {} : { sampled: s === "1" }),
|
|
1125
|
+
}, s === void 0 ? {} : { sampled: s === "1" }), H(a, B) && H(o, V) ? {
|
|
1073
1126
|
spanId: o,
|
|
1074
1127
|
traceId: a
|
|
1075
1128
|
} : {});
|
|
@@ -1081,7 +1134,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1081
1134
|
let [r, i, a] = n.split("-"), o = r ? qt(r) : void 0, s = i ? Jt(i) : void 0;
|
|
1082
1135
|
return S(S({
|
|
1083
1136
|
format: "b3",
|
|
1084
|
-
headers:
|
|
1137
|
+
headers: W(e, ["b3"])
|
|
1085
1138
|
}, o && s ? {
|
|
1086
1139
|
spanId: s,
|
|
1087
1140
|
traceId: o
|
|
@@ -1094,7 +1147,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1094
1147
|
let s = i ? qt(i) : void 0, c = a ? Jt(a) : void 0;
|
|
1095
1148
|
return S(S({
|
|
1096
1149
|
format: "b3-multi",
|
|
1097
|
-
headers:
|
|
1150
|
+
headers: W(e, [
|
|
1098
1151
|
"x-b3-traceid",
|
|
1099
1152
|
"x-b3-spanid",
|
|
1100
1153
|
"x-b3-parentspanid",
|
|
@@ -1110,10 +1163,10 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1110
1163
|
var t, n, r, i, a, o;
|
|
1111
1164
|
let s = (t = e("x-datadog-trace-id")) == null ? void 0 : t.trim(), c = (n = e("x-datadog-parent-id")) == null ? void 0 : n.trim(), l = (r = e("x-datadog-sampling-priority")) == null ? void 0 : r.trim();
|
|
1112
1165
|
if (!s && !c && !l) return;
|
|
1113
|
-
let u = (i = e("x-datadog-tags")) == null ? void 0 : i.trim().toLowerCase(), d = (a = u ? (o = Gt.exec(u)) == null ? void 0 : o[1] : void 0) == null ? Kt : a, f = s ?
|
|
1166
|
+
let u = (i = e("x-datadog-tags")) == null ? void 0 : i.trim().toLowerCase(), d = (a = u ? (o = Gt.exec(u)) == null ? void 0 : o[1] : void 0) == null ? Kt : a, f = s ? Yt(s) : void 0, p = f ? qt(`${d}${f}`) : void 0, m = c ? Yt(c) : void 0, h = m ? Jt(m) : void 0;
|
|
1114
1167
|
return S(S({
|
|
1115
1168
|
format: "datadog",
|
|
1116
|
-
headers:
|
|
1169
|
+
headers: W(e, [
|
|
1117
1170
|
"x-datadog-trace-id",
|
|
1118
1171
|
"x-datadog-parent-id",
|
|
1119
1172
|
"x-datadog-sampling-priority",
|
|
@@ -1132,42 +1185,42 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1132
1185
|
let r = n.split("-")[0];
|
|
1133
1186
|
return S({
|
|
1134
1187
|
format: "sw8",
|
|
1135
|
-
headers:
|
|
1188
|
+
headers: W(e, ["sw8"])
|
|
1136
1189
|
}, r ? { sampled: r === "1" } : {});
|
|
1137
1190
|
}
|
|
1138
|
-
],
|
|
1139
|
-
for (let t of
|
|
1191
|
+
], Zt = (e) => {
|
|
1192
|
+
for (let t of Xt) {
|
|
1140
1193
|
let n = t(e);
|
|
1141
1194
|
if (n) return n;
|
|
1142
1195
|
}
|
|
1143
|
-
},
|
|
1196
|
+
}, Qt = (e, t, r, i) => ({
|
|
1144
1197
|
attributes: r,
|
|
1145
1198
|
context: {
|
|
1146
1199
|
spanId: t,
|
|
1147
1200
|
traceFlags: i === !1 ? n.NONE : n.SAMPLED,
|
|
1148
1201
|
traceId: e
|
|
1149
1202
|
}
|
|
1150
|
-
}),
|
|
1203
|
+
}), $t = (e) => {
|
|
1151
1204
|
var t, n;
|
|
1152
|
-
let r =
|
|
1205
|
+
let r = Zt(e);
|
|
1153
1206
|
if (!r) {
|
|
1154
|
-
let e =
|
|
1207
|
+
let e = U(B), t = U(V), n = `00-${e}-${t}-01`;
|
|
1155
1208
|
return {
|
|
1156
|
-
links: [
|
|
1209
|
+
links: [Qt(e, t, {
|
|
1157
1210
|
format: "traceparent",
|
|
1158
1211
|
injected: !0,
|
|
1159
|
-
[
|
|
1212
|
+
[z]: n
|
|
1160
1213
|
})],
|
|
1161
1214
|
traceparent: n
|
|
1162
1215
|
};
|
|
1163
1216
|
}
|
|
1164
|
-
return { links: [
|
|
1217
|
+
return { links: [Qt((t = r.traceId) == null ? U(B) : t, (n = r.spanId) == null ? U(V) : n, S({
|
|
1165
1218
|
format: r.format,
|
|
1166
1219
|
injected: !1
|
|
1167
1220
|
}, r.headers), r.sampled)] };
|
|
1168
|
-
},
|
|
1169
|
-
|
|
1170
|
-
},
|
|
1221
|
+
}, en = (e) => e.deliveryType === "cache" || e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, tn = (e) => e.transferSize === 0 && e.encodedBodySize === 0 && e.decodedBodySize === 0 && e.requestStart === 0 && e.responseStart === 0 && !e.nextHopProtocol, nn = (...e) => e.every((t, n) => n === 0 || e[n - 1] <= t), G = (e, t, n, r, i) => {
|
|
1222
|
+
nn(n, r, i) && (e[`resource.${t}.start`] = r - n, e[`resource.${t}.duration`] = i - r);
|
|
1223
|
+
}, rn = (e) => {
|
|
1171
1224
|
let t = {}, n = [
|
|
1172
1225
|
e.startTime,
|
|
1173
1226
|
e.fetchStart,
|
|
@@ -1179,16 +1232,16 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1179
1232
|
e.responseStart,
|
|
1180
1233
|
e.responseEnd
|
|
1181
1234
|
];
|
|
1182
|
-
return !n.every(Number.isFinite) || !
|
|
1183
|
-
},
|
|
1184
|
-
let t =
|
|
1185
|
-
return S(S(S(S(S({ [g.cacheHit]:
|
|
1235
|
+
return !n.every(Number.isFinite) || !nn(...n) ? t : (G(t, "first_byte", e.startTime, e.requestStart, e.responseStart), G(t, "download", e.startTime, e.responseStart, e.responseEnd), e.workerStart > 0 && e.workerStart < e.fetchStart && G(t, "worker", e.startTime, e.workerStart, e.fetchStart), e.fetchStart < e.domainLookupEnd && G(t, "dns", e.startTime, e.domainLookupStart, e.domainLookupEnd), e.fetchStart < e.connectEnd && (G(t, "connect", e.startTime, e.connectStart, e.connectEnd), e.connectStart <= e.secureConnectionStart && e.secureConnectionStart <= e.connectEnd && G(t, "ssl", e.startTime, e.secureConnectionStart, e.connectEnd)), e.redirectEnd > e.startTime && nn(e.startTime, e.redirectStart, e.redirectEnd, e.fetchStart) && G(t, "redirect", e.startTime, e.redirectStart, e.redirectEnd), t);
|
|
1236
|
+
}, an = (e) => e.duration === 0 && e.responseEnd > e.startTime ? e.responseEnd - e.startTime : e.duration, on = (e) => {
|
|
1237
|
+
let t = tn(e), n = typeof e.deliveryType == "string" && e.deliveryType ? e.deliveryType : void 0;
|
|
1238
|
+
return S(S(S(S(S({ [g.cacheHit]: en(e) }, e.nextHopProtocol ? { [g.nextHopProtocol]: e.nextHopProtocol } : {}), rn(e)), n ? { "resource.delivery_type": n } : {}), e.renderBlockingStatus ? { "resource.render_blocking_status": e.renderBlockingStatus } : {}), t ? {} : {
|
|
1186
1239
|
"resource.size": e.decodedBodySize,
|
|
1187
1240
|
"resource.encoded_body_size": e.encodedBodySize,
|
|
1188
1241
|
"resource.decoded_body_size": e.decodedBodySize,
|
|
1189
1242
|
"resource.transfer_size": e.transferSize
|
|
1190
1243
|
});
|
|
1191
|
-
},
|
|
1244
|
+
}, sn = (t = !0) => {
|
|
1192
1245
|
let n;
|
|
1193
1246
|
return {
|
|
1194
1247
|
name: "resource",
|
|
@@ -1202,21 +1255,30 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1202
1255
|
return;
|
|
1203
1256
|
}
|
|
1204
1257
|
if (n.duration < 0) return;
|
|
1205
|
-
let i = r.config.hooks.redactUrl(n.name), a =
|
|
1206
|
-
t && r.isSampled()
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1258
|
+
let i = r.config.hooks.redactUrl(n.name), a = an(n), o = performance.timeOrigin + n.startTime, s = o + a;
|
|
1259
|
+
if (t && r.isSampled()) {
|
|
1260
|
+
let t = S(S(S({}, r.config.hooks.getPageAttributes()), ze({
|
|
1261
|
+
initiatorType: n.initiatorType || "other",
|
|
1262
|
+
method: "GET",
|
|
1263
|
+
outcome: typeof n.responseStatus == "number" ? {
|
|
1264
|
+
statusCode: n.responseStatus,
|
|
1265
|
+
type: "response"
|
|
1266
|
+
} : void 0,
|
|
1267
|
+
url: i
|
|
1268
|
+
})), {}, {
|
|
1269
|
+
"url.full": i,
|
|
1270
|
+
"url.template": r.config.hooks.getRequestUrlTemplate(i)
|
|
1271
|
+
}, on(n));
|
|
1272
|
+
r.startSpan(N({
|
|
1273
|
+
attributes: t,
|
|
1274
|
+
spanType: j.resource
|
|
1275
|
+
}), t, {
|
|
1276
|
+
kind: e.CLIENT,
|
|
1277
|
+
rumSpanType: j.resource,
|
|
1278
|
+
startTime: o
|
|
1279
|
+
}).end(s);
|
|
1280
|
+
}
|
|
1281
|
+
r.notifyActivity({
|
|
1220
1282
|
endTime: s,
|
|
1221
1283
|
startTime: o,
|
|
1222
1284
|
type: "resource",
|
|
@@ -1238,31 +1300,31 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1238
1300
|
n == null || n.disconnect(), n = void 0;
|
|
1239
1301
|
}
|
|
1240
1302
|
};
|
|
1241
|
-
},
|
|
1303
|
+
}, cn = (e) => typeof e.config.tracking.request == "object" ? e.config.tracking.request : void 0, ln = (e) => {
|
|
1242
1304
|
var t;
|
|
1243
|
-
let n = (t =
|
|
1305
|
+
let n = (t = cn(e)) == null ? void 0 : t.allowedTracingUrls;
|
|
1244
1306
|
return Array.isArray(n) ? n.length > 0 : n !== void 0;
|
|
1245
|
-
},
|
|
1307
|
+
}, un = (e) => typeof e == "object" && e && "name" in e && typeof e.name == "string" ? e.name : "", dn = (e, t) => {
|
|
1246
1308
|
let n = e.signal;
|
|
1247
|
-
return
|
|
1309
|
+
return un(n == null ? void 0 : n.reason) === "TimeoutError" || un(t) === "TimeoutError" ? {
|
|
1248
1310
|
error: t,
|
|
1249
1311
|
type: "timeout"
|
|
1250
|
-
} : n != null && n.aborted ||
|
|
1312
|
+
} : n != null && n.aborted || un(t) === "AbortError" ? { type: "abort" } : {
|
|
1251
1313
|
error: t,
|
|
1252
1314
|
type: "network_error"
|
|
1253
1315
|
};
|
|
1254
|
-
},
|
|
1316
|
+
}, fn = (e, t) => e === "abort" ? { type: "abort" } : e === "timeout" ? { type: "timeout" } : e === "error" || t.status === 0 ? { type: "network_error" } : {
|
|
1255
1317
|
statusCode: t.status,
|
|
1256
1318
|
type: "response"
|
|
1257
|
-
},
|
|
1319
|
+
}, pn = (e) => e.type === "network_error" || e.type === "timeout" || e.type === "response" && typeof e.statusCode == "number" && e.statusCode >= 400, mn = (e) => typeof e == "string" || e instanceof URL ? E(String(e)) : E(e.url), hn = (e, t) => {
|
|
1258
1320
|
var n;
|
|
1259
1321
|
return ((n = t == null ? void 0 : t.method) == null ? typeof Request < "u" && e instanceof Request ? e.method : "GET" : n).toUpperCase();
|
|
1260
|
-
},
|
|
1322
|
+
}, gn = (e, t) => typeof Request < "u" && e instanceof Request ? e : t == null ? {} : t, _n = (e, t) => {
|
|
1261
1323
|
var n;
|
|
1262
1324
|
let r = typeof Request < "u" && e instanceof Request ? e.headers : void 0;
|
|
1263
1325
|
return new Headers((n = t == null ? void 0 : t.headers) == null ? r : n);
|
|
1264
|
-
},
|
|
1265
|
-
if (
|
|
1326
|
+
}, vn = (e, t, n) => n.traceparent ? (t.set(z, n.traceparent), S(S({}, e), {}, { headers: t })) : e, yn = (e) => (t) => e == null ? void 0 : e[t.toLowerCase()], bn = (e, t) => D(e.config, t) || O(e.config.view.excludedActivityUrls, t), xn = (e, t) => {
|
|
1327
|
+
if (bn(e, t)) return () => {};
|
|
1266
1328
|
let n = h("request");
|
|
1267
1329
|
e.notifyActivity({
|
|
1268
1330
|
id: n,
|
|
@@ -1278,28 +1340,32 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1278
1340
|
type: "request_end"
|
|
1279
1341
|
}));
|
|
1280
1342
|
};
|
|
1281
|
-
},
|
|
1343
|
+
}, Sn = (e, t) => e.isSampled() ? Rt(t) : {
|
|
1282
1344
|
cancel() {},
|
|
1283
1345
|
complete(e) {
|
|
1284
1346
|
e();
|
|
1285
1347
|
}
|
|
1286
|
-
},
|
|
1348
|
+
}, Cn = (t, n, r, i) => {
|
|
1287
1349
|
var a, o;
|
|
1288
|
-
let s = (a = r.startedAt) == null ? Date.now() : a
|
|
1289
|
-
return t.startSpan("browser.resource", S(S(S({}, t.config.hooks.getPageAttributes()), Xe({
|
|
1350
|
+
let s = (a = r.startedAt) == null ? Date.now() : a, c = S(S(S({}, t.config.hooks.getPageAttributes()), ze({
|
|
1290
1351
|
initiatorType: n,
|
|
1291
1352
|
method: r.method,
|
|
1292
1353
|
url: (o = r.url) == null ? "" : o
|
|
1293
1354
|
})), r.url ? {
|
|
1294
1355
|
"url.full": t.config.hooks.redactUrl(r.url),
|
|
1295
1356
|
"url.template": t.config.hooks.getRequestUrlTemplate(r.url)
|
|
1296
|
-
} : {})
|
|
1357
|
+
} : {});
|
|
1358
|
+
return t.startSpan(N({
|
|
1359
|
+
attributes: c,
|
|
1360
|
+
spanType: j.resource
|
|
1361
|
+
}), c, S({
|
|
1297
1362
|
kind: e.CLIENT,
|
|
1363
|
+
rumSpanType: j.resource,
|
|
1298
1364
|
startTime: s
|
|
1299
1365
|
}, i ? { links: i.links } : {}));
|
|
1300
|
-
},
|
|
1366
|
+
}, wn = (e, n, r, i, a, o = {}) => {
|
|
1301
1367
|
let s = o.url, c = s ? e.config.hooks.redactUrl(s) : void 0, l = o.method, u = {
|
|
1302
|
-
attributes: S(S(S(S({}, e.config.hooks.getPageAttributes()),
|
|
1368
|
+
attributes: S(S(S(S({}, e.config.hooks.getPageAttributes()), ze({
|
|
1303
1369
|
initiatorType: r,
|
|
1304
1370
|
method: l,
|
|
1305
1371
|
outcome: a,
|
|
@@ -1315,17 +1381,21 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1315
1381
|
}, d = !0;
|
|
1316
1382
|
try {
|
|
1317
1383
|
var f, p;
|
|
1318
|
-
d = (f =
|
|
1384
|
+
d = (f = cn(e)) == null || (p = f.beforeSend) == null ? void 0 : p.call(f, u, i);
|
|
1319
1385
|
} catch (t) {
|
|
1320
1386
|
var m;
|
|
1321
1387
|
e.config.debug && ((m = globalThis.console) == null || m.warn("[bk-ot] request.beforeSend failed:", t));
|
|
1322
1388
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1389
|
+
let h = e.applyRedact(u.attributes);
|
|
1390
|
+
if (n.setAttributes(h), n.updateName(N({
|
|
1391
|
+
attributes: h,
|
|
1392
|
+
spanType: j.resource
|
|
1393
|
+
})), d === !1) {
|
|
1394
|
+
He(n);
|
|
1325
1395
|
return;
|
|
1326
1396
|
}
|
|
1327
|
-
|
|
1328
|
-
},
|
|
1397
|
+
pn(a) && n.setStatus({ code: t.ERROR });
|
|
1398
|
+
}, Tn = (e) => {
|
|
1329
1399
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
1330
1400
|
return {
|
|
1331
1401
|
name: "request",
|
|
@@ -1335,19 +1405,19 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1335
1405
|
if (typeof window.fetch == "function") {
|
|
1336
1406
|
let r = window.fetch, i = /* @__PURE__ */ function() {
|
|
1337
1407
|
var t = k(function* (t, i) {
|
|
1338
|
-
let a =
|
|
1408
|
+
let a = mn(t);
|
|
1339
1409
|
if (!e.isSampled() || _e(e.config, a)) return r.call(this, t, i);
|
|
1340
1410
|
let o = {
|
|
1341
|
-
method:
|
|
1411
|
+
method: hn(t, i),
|
|
1342
1412
|
startedAt: Date.now(),
|
|
1343
1413
|
url: a
|
|
1344
|
-
}, s = ve(e.config, a) ?
|
|
1414
|
+
}, s = ve(e.config, a) ? _n(t, i) : void 0, c = s ? $t((e) => {
|
|
1345
1415
|
var t;
|
|
1346
1416
|
return (t = s.get(e)) == null ? void 0 : t;
|
|
1347
|
-
}) : void 0, l =
|
|
1417
|
+
}) : void 0, l = Cn(e, "fetch", o, c), u = Sn(e, a), d = xn(e, a), f = gn(t, i), p = s && c ? vn(i, s, c) : i, m = !1, h = (t, r = Date.now()) => {
|
|
1348
1418
|
if (!m) {
|
|
1349
1419
|
if (m = !0, n.delete(g), t) {
|
|
1350
|
-
l.setAttributes(e.applyRedact(
|
|
1420
|
+
l.setAttributes(e.applyRedact(on(t))), l.end(performance.timeOrigin + t.startTime + an(t));
|
|
1351
1421
|
return;
|
|
1352
1422
|
}
|
|
1353
1423
|
l.end(r);
|
|
@@ -1358,7 +1428,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1358
1428
|
n.add(g);
|
|
1359
1429
|
try {
|
|
1360
1430
|
let n = yield r.call(this, t, p), i = S(S({}, n.status > 0 ? { statusCode: n.status } : {}), {}, { type: "response" });
|
|
1361
|
-
|
|
1431
|
+
wn(e, l, "fetch", {
|
|
1362
1432
|
request: f,
|
|
1363
1433
|
response: n,
|
|
1364
1434
|
type: "fetch"
|
|
@@ -1366,8 +1436,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1366
1436
|
let a = Date.now();
|
|
1367
1437
|
return u.complete((e) => h(e, a)), n;
|
|
1368
1438
|
} catch (t) {
|
|
1369
|
-
let n =
|
|
1370
|
-
|
|
1439
|
+
let n = dn(f, t);
|
|
1440
|
+
wn(e, l, "fetch", {
|
|
1371
1441
|
error: t,
|
|
1372
1442
|
request: f,
|
|
1373
1443
|
type: "fetch"
|
|
@@ -1397,8 +1467,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1397
1467
|
let s = (a = r.get(this)) == null ? {} : a;
|
|
1398
1468
|
if (!e.isSampled() || !s.url || _e(e.config, s.url)) return o.call(this, t);
|
|
1399
1469
|
s.startedAt = Date.now();
|
|
1400
|
-
let c = ve(e.config, s.url) ?
|
|
1401
|
-
c != null && c.traceparent && this.setRequestHeader(
|
|
1470
|
+
let c = ve(e.config, s.url) ? $t(yn(i.get(this))) : void 0, l = Cn(e, "xhr", s, c), u = Sn(e, s.url), d = xn(e, s.url);
|
|
1471
|
+
c != null && c.traceparent && this.setRequestHeader(z, c.traceparent);
|
|
1402
1472
|
let f = !1, p = !1, m = () => {}, h = () => {
|
|
1403
1473
|
m(), u.cancel(), !p && (p = !0, n.delete(h), d(), l.end());
|
|
1404
1474
|
};
|
|
@@ -1406,8 +1476,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1406
1476
|
let g = (t) => {
|
|
1407
1477
|
if (f || p) return;
|
|
1408
1478
|
f = !0, m();
|
|
1409
|
-
let r =
|
|
1410
|
-
|
|
1479
|
+
let r = fn(t, this);
|
|
1480
|
+
wn(e, l, "xhr", {
|
|
1411
1481
|
type: "xhr",
|
|
1412
1482
|
xhr: this
|
|
1413
1483
|
}, r, s), d();
|
|
@@ -1415,7 +1485,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1415
1485
|
u.complete((t) => {
|
|
1416
1486
|
if (!p) {
|
|
1417
1487
|
if (p = !0, n.delete(h), t) {
|
|
1418
|
-
l.setAttributes(e.applyRedact(
|
|
1488
|
+
l.setAttributes(e.applyRedact(on(t))), l.end(performance.timeOrigin + t.startTime + an(t));
|
|
1419
1489
|
return;
|
|
1420
1490
|
}
|
|
1421
1491
|
l.end(i);
|
|
@@ -1433,7 +1503,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1433
1503
|
};
|
|
1434
1504
|
if (XMLHttpRequest.prototype.open = s, XMLHttpRequest.prototype.send = c, t.push(() => {
|
|
1435
1505
|
XMLHttpRequest.prototype.open === s && (XMLHttpRequest.prototype.open = a), XMLHttpRequest.prototype.send === c && (XMLHttpRequest.prototype.send = o);
|
|
1436
|
-
}),
|
|
1506
|
+
}), ln(e) && typeof XMLHttpRequest.prototype.setRequestHeader == "function") {
|
|
1437
1507
|
let e = XMLHttpRequest.prototype.setRequestHeader, n = function(t, n) {
|
|
1438
1508
|
var r;
|
|
1439
1509
|
let a = t.toLowerCase(), o = (r = i.get(this)) == null ? {} : r;
|
|
@@ -1452,9 +1522,9 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1452
1522
|
for (; t.length;) (e = t.pop()) == null || e();
|
|
1453
1523
|
}
|
|
1454
1524
|
};
|
|
1455
|
-
},
|
|
1456
|
-
if (t) return
|
|
1457
|
-
},
|
|
1525
|
+
}, En = /^https?:|^\/\//i, Dn = (e, t) => {
|
|
1526
|
+
if (t) return En.test(t) ? e(t) : t;
|
|
1527
|
+
}, On = () => {
|
|
1458
1528
|
let e;
|
|
1459
1529
|
return {
|
|
1460
1530
|
name: "csp-violation",
|
|
@@ -1462,8 +1532,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1462
1532
|
if (typeof window > "u" || typeof document > "u") return;
|
|
1463
1533
|
let n = (e) => {
|
|
1464
1534
|
if (!t.isSampled()) return;
|
|
1465
|
-
let n = Date.now(), r =
|
|
1466
|
-
t.startSpan("csp.violation", S(S(S({}, t.config.hooks.getPageAttributes()), M({
|
|
1535
|
+
let n = Date.now(), r = Dn(t.config.hooks.redactUrl, e.blockedURI), i = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0, a = S(S(S({}, t.config.hooks.getPageAttributes()), P({
|
|
1467
1536
|
outcome: A.error,
|
|
1468
1537
|
spanType: j.error
|
|
1469
1538
|
})), {}, {
|
|
@@ -1477,7 +1546,11 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1477
1546
|
"csp.status_code": e.statusCode,
|
|
1478
1547
|
"csp.original_policy": e.originalPolicy,
|
|
1479
1548
|
"error.source": "csp"
|
|
1480
|
-
})
|
|
1549
|
+
});
|
|
1550
|
+
t.startSpan(N({
|
|
1551
|
+
attributes: a,
|
|
1552
|
+
spanType: j.error
|
|
1553
|
+
}), a, { startTime: n }).end(n);
|
|
1481
1554
|
};
|
|
1482
1555
|
document.addEventListener("securitypolicyviolation", n), e = () => document.removeEventListener("securitypolicyviolation", n);
|
|
1483
1556
|
},
|
|
@@ -1485,7 +1558,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1485
1558
|
e == null || e(), e = void 0;
|
|
1486
1559
|
}
|
|
1487
1560
|
};
|
|
1488
|
-
},
|
|
1561
|
+
}, kn = (e) => {
|
|
1489
1562
|
if (e instanceof Error) return e.message;
|
|
1490
1563
|
if (typeof e == "string") return e;
|
|
1491
1564
|
try {
|
|
@@ -1493,29 +1566,33 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1493
1566
|
} catch (t) {
|
|
1494
1567
|
return String(e);
|
|
1495
1568
|
}
|
|
1496
|
-
},
|
|
1569
|
+
}, An = ({ context: e, error: n, exceptionType: r, extra: i = {}, source: a }) => {
|
|
1497
1570
|
if (!e.isSampled()) return;
|
|
1498
|
-
let
|
|
1571
|
+
let o = Date.now(), s = kn(n);
|
|
1499
1572
|
e.notifyActivity({
|
|
1500
|
-
time:
|
|
1573
|
+
time: o,
|
|
1501
1574
|
type: "error"
|
|
1502
1575
|
});
|
|
1503
|
-
let l = n instanceof Error ? n : {
|
|
1504
|
-
message:
|
|
1505
|
-
name:
|
|
1506
|
-
}, u = S(S(S(S({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()),
|
|
1576
|
+
let c = r == null ? n instanceof Error ? n.name || "Error" : a : r, l = n instanceof Error ? n : {
|
|
1577
|
+
message: s,
|
|
1578
|
+
name: c
|
|
1579
|
+
}, u = S(S(S(S({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), P({
|
|
1507
1580
|
outcome: A.error,
|
|
1508
1581
|
spanType: j.error
|
|
1509
1582
|
})), {}, {
|
|
1510
|
-
"error.message":
|
|
1583
|
+
"error.message": s,
|
|
1511
1584
|
"error.handled": !1,
|
|
1512
1585
|
"error.source": a
|
|
1513
|
-
}, i), d = e.startSpan(
|
|
1586
|
+
}, i), d = e.startSpan(N({
|
|
1587
|
+
attributes: u,
|
|
1588
|
+
nameHint: c,
|
|
1589
|
+
spanType: j.error
|
|
1590
|
+
}), u, { startTime: o });
|
|
1514
1591
|
d.recordException(l), d.setStatus({
|
|
1515
1592
|
code: t.ERROR,
|
|
1516
|
-
message:
|
|
1593
|
+
message: s
|
|
1517
1594
|
}), d.end();
|
|
1518
|
-
},
|
|
1595
|
+
}, jn = () => {
|
|
1519
1596
|
let e = [];
|
|
1520
1597
|
return {
|
|
1521
1598
|
name: "error",
|
|
@@ -1523,9 +1600,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1523
1600
|
if (typeof window > "u") return;
|
|
1524
1601
|
let n = (e) => {
|
|
1525
1602
|
var n;
|
|
1526
|
-
|
|
1603
|
+
An({
|
|
1527
1604
|
context: t,
|
|
1528
|
-
spanName: "browser.error",
|
|
1529
1605
|
source: "window.error",
|
|
1530
1606
|
error: (n = e.error) == null ? e.message : n,
|
|
1531
1607
|
extra: {
|
|
@@ -1535,9 +1611,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1535
1611
|
}
|
|
1536
1612
|
});
|
|
1537
1613
|
}, r = (e) => {
|
|
1538
|
-
|
|
1614
|
+
An({
|
|
1539
1615
|
context: t,
|
|
1540
|
-
spanName: "browser.unhandledrejection",
|
|
1541
1616
|
source: "unhandledrejection",
|
|
1542
1617
|
error: e.reason,
|
|
1543
1618
|
exceptionType: e.reason instanceof Error ? e.reason.name : "UnhandledRejection"
|
|
@@ -1547,9 +1622,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1547
1622
|
let n = e.target;
|
|
1548
1623
|
if (!(n instanceof Element)) return;
|
|
1549
1624
|
let r = n, i = r.src || r.href || n.currentSrc || "";
|
|
1550
|
-
|
|
1625
|
+
An({
|
|
1551
1626
|
context: t,
|
|
1552
|
-
spanName: "browser.resource_error",
|
|
1553
1627
|
source: "resource",
|
|
1554
1628
|
error: /* @__PURE__ */ Error(`Resource load failed: ${n.tagName.toLowerCase()} ${i}`),
|
|
1555
1629
|
exceptionType: "ResourceError",
|
|
@@ -1565,7 +1639,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1565
1639
|
}
|
|
1566
1640
|
}
|
|
1567
1641
|
};
|
|
1568
|
-
},
|
|
1642
|
+
}, Mn = 50, Nn = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, Pn = (e) => Number.isFinite(e) ? e : void 0, Fn = (e, t) => S(S(S(S(S({}, e.containerId ? { "long_task.attribution.container_id": e.containerId } : {}), e.containerName ? { "long_task.attribution.container_name": e.containerName } : {}), e.containerSrc ? { "long_task.attribution.container_src": t(e.containerSrc) } : {}), e.containerType ? { "long_task.attribution.container_type": e.containerType } : {}), e.name ? { "long_task.attribution.name": e.name } : {}), In = (e, t) => ({
|
|
1569
1643
|
"long_task.script.duration": e.duration,
|
|
1570
1644
|
"long_task.script.execution_start": e.executionStart,
|
|
1571
1645
|
"long_task.script.forced_style_and_layout_duration": e.forcedStyleAndLayoutDuration,
|
|
@@ -1578,7 +1652,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1578
1652
|
"long_task.script.start_time": e.startTime,
|
|
1579
1653
|
"long_task.script.window_attribution": e.windowAttribution
|
|
1580
1654
|
}), Ln = (e = {}) => {
|
|
1581
|
-
let t =
|
|
1655
|
+
let t = Nn(e.threshold, Mn), n, r, i = [];
|
|
1582
1656
|
return {
|
|
1583
1657
|
name: "long-task",
|
|
1584
1658
|
init(e) {
|
|
@@ -1589,16 +1663,19 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1589
1663
|
let c = (n) => {
|
|
1590
1664
|
var r, i;
|
|
1591
1665
|
if (!e.isSampled() || !Number.isFinite(n.duration) || n.duration < t) return;
|
|
1592
|
-
let a = n.entryType === "long-animation-frame", o = a ? n : void 0, s = (r = o == null ? void 0 : o.scripts) == null ? [] : r, c = h("long-task"), l = performance.timeOrigin + n.startTime, u = l + n.duration, d = a ? "long-animation-frame" : "long-task", f = a || (i = n.attribution) == null ? [] : i, p =
|
|
1666
|
+
let a = n.entryType === "long-animation-frame", o = a ? n : void 0, s = (r = o == null ? void 0 : o.scripts) == null ? [] : r, c = h("long-task"), l = performance.timeOrigin + n.startTime, u = l + n.duration, d = a ? "long-animation-frame" : "long-task", f = a || (i = n.attribution) == null ? [] : i, p = S(S(S(S(S(S({}, e.config.hooks.getPageAttributes()), P({ spanType: j.longTask })), Pn(o == null ? void 0 : o.blockingDuration) === void 0 ? {} : { [g.longTaskBlockingDuration]: o.blockingDuration }), {}, {
|
|
1593
1667
|
[g.longTaskEntryType]: d,
|
|
1594
1668
|
[g.longTaskId]: c,
|
|
1595
1669
|
"long_task.name": n.name
|
|
1596
|
-
},
|
|
1670
|
+
}, Pn(o == null ? void 0 : o.firstUIEventTimestamp) === void 0 ? {} : { "long_task.first_ui_event_timestamp": o.firstUIEventTimestamp }), Pn(o == null ? void 0 : o.renderStart) === void 0 ? {} : { "long_task.render_start": o.renderStart }), Pn(o == null ? void 0 : o.styleAndLayoutStart) === void 0 ? {} : { "long_task.style_and_layout_start": o.styleAndLayoutStart }), m = e.startSpan(N({
|
|
1671
|
+
attributes: p,
|
|
1672
|
+
spanType: j.longTask
|
|
1673
|
+
}), p, { startTime: l });
|
|
1597
1674
|
s.forEach((t) => {
|
|
1598
|
-
|
|
1675
|
+
m.addEvent("long_task.script", e.applyRedact(In(t, e.config.hooks.redactUrl)), performance.timeOrigin + t.startTime);
|
|
1599
1676
|
}), f.forEach((t, n) => {
|
|
1600
|
-
|
|
1601
|
-
}),
|
|
1677
|
+
m.addEvent("long_task.attribution", e.applyRedact(S({ "long_task.attribution.index": n }, Fn(t, e.config.hooks.redactUrl))), l);
|
|
1678
|
+
}), m.end(u), e.notifyActivity({
|
|
1602
1679
|
endTime: u,
|
|
1603
1680
|
startTime: l,
|
|
1604
1681
|
type: "long_task"
|
|
@@ -1624,43 +1701,43 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1624
1701
|
n == null || n.disconnect(), n = void 0, clearTimeout(r), r = void 0, i = [];
|
|
1625
1702
|
}
|
|
1626
1703
|
};
|
|
1627
|
-
},
|
|
1628
|
-
let n =
|
|
1629
|
-
|
|
1704
|
+
}, Rn = /* @__PURE__ */ new Set(), K = "", q, J, zn = !1, Y = () => typeof location > "u" ? "" : location.href, Bn = (e, t) => {
|
|
1705
|
+
let n = Y();
|
|
1706
|
+
K = n;
|
|
1630
1707
|
let r = {
|
|
1631
1708
|
fromUrl: t,
|
|
1632
1709
|
source: e,
|
|
1633
1710
|
toUrl: n
|
|
1634
1711
|
};
|
|
1635
|
-
for (let e of Array.from(
|
|
1636
|
-
},
|
|
1637
|
-
|
|
1638
|
-
},
|
|
1639
|
-
|
|
1640
|
-
},
|
|
1641
|
-
|
|
1642
|
-
let r =
|
|
1712
|
+
for (let e of Array.from(Rn)) e(r);
|
|
1713
|
+
}, Vn = () => {
|
|
1714
|
+
Bn("popstate", K || Y());
|
|
1715
|
+
}, Hn = () => {
|
|
1716
|
+
Bn("hashchange", K || Y());
|
|
1717
|
+
}, Un = () => {
|
|
1718
|
+
zn || typeof window > "u" || typeof history > "u" || (zn = !0, K = Y(), q = history.pushState, J = history.replaceState, history.pushState = function(e, t, n) {
|
|
1719
|
+
let r = K || Y(), i = q == null ? void 0 : q.apply(this, [
|
|
1643
1720
|
e,
|
|
1644
1721
|
t,
|
|
1645
1722
|
n
|
|
1646
1723
|
]);
|
|
1647
|
-
return
|
|
1724
|
+
return Bn("pushState", r), i;
|
|
1648
1725
|
}, history.replaceState = function(e, t, n) {
|
|
1649
|
-
let r =
|
|
1726
|
+
let r = K || Y(), i = J == null ? void 0 : J.apply(this, [
|
|
1650
1727
|
e,
|
|
1651
1728
|
t,
|
|
1652
1729
|
n
|
|
1653
1730
|
]);
|
|
1654
|
-
return
|
|
1655
|
-
}, window.addEventListener("popstate",
|
|
1656
|
-
},
|
|
1657
|
-
!
|
|
1658
|
-
},
|
|
1659
|
-
|
|
1731
|
+
return Bn("replaceState", r), i;
|
|
1732
|
+
}, window.addEventListener("popstate", Vn), window.addEventListener("hashchange", Hn));
|
|
1733
|
+
}, Wn = () => {
|
|
1734
|
+
!zn || typeof window > "u" || typeof history > "u" || (q && (history.pushState = q), J && (history.replaceState = J), window.removeEventListener("popstate", Vn), window.removeEventListener("hashchange", Hn), q = void 0, J = void 0, zn = !1, K = "");
|
|
1735
|
+
}, Gn = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (Un(), Rn.add(e), () => {
|
|
1736
|
+
Rn.delete(e), Rn.size === 0 && Wn();
|
|
1660
1737
|
});
|
|
1661
1738
|
//#endregion
|
|
1662
1739
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
1663
|
-
function
|
|
1740
|
+
function Kn(e, t) {
|
|
1664
1741
|
if (e == null) return {};
|
|
1665
1742
|
var n = {};
|
|
1666
1743
|
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
@@ -1671,9 +1748,9 @@ function Un(e, t) {
|
|
|
1671
1748
|
}
|
|
1672
1749
|
//#endregion
|
|
1673
1750
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
1674
|
-
function
|
|
1751
|
+
function qn(e, t) {
|
|
1675
1752
|
if (e == null) return {};
|
|
1676
|
-
var n, r, i =
|
|
1753
|
+
var n, r, i = Kn(e, t);
|
|
1677
1754
|
if (Object.getOwnPropertySymbols) {
|
|
1678
1755
|
var a = Object.getOwnPropertySymbols(e);
|
|
1679
1756
|
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
@@ -1682,7 +1759,7 @@ function Wn(e, t) {
|
|
|
1682
1759
|
}
|
|
1683
1760
|
//#endregion
|
|
1684
1761
|
//#region src/plugins/page-view.ts
|
|
1685
|
-
var
|
|
1762
|
+
var Jn = ["stopLoadingTime"], Yn = new Set(Object.values(g)), Xn = () => typeof location > "u" ? "" : location.href, Zn = () => {
|
|
1686
1763
|
if (typeof performance > "u") return {};
|
|
1687
1764
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1688
1765
|
if (!e) return {};
|
|
@@ -1690,10 +1767,10 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1690
1767
|
Number.isFinite(n) && n > 0 && (t[e] = n);
|
|
1691
1768
|
};
|
|
1692
1769
|
return n(g.viewFirstByte, e.responseStart), n(g.viewDomInteractive, e.domInteractive), n(g.viewDomContentLoaded, e.domContentLoadedEventEnd), n(g.viewDomComplete, e.domComplete), n(g.viewLoadEvent, e.loadEventEnd), t;
|
|
1693
|
-
},
|
|
1770
|
+
}, Qn = (e) => {
|
|
1694
1771
|
let t = e.indexOf("?");
|
|
1695
1772
|
return t < 0 ? e : e.slice(0, t);
|
|
1696
|
-
},
|
|
1773
|
+
}, $n = (e) => {
|
|
1697
1774
|
let t = e.slice(1);
|
|
1698
1775
|
if (!t || typeof document > "u" || typeof document.getElementById != "function") return !1;
|
|
1699
1776
|
try {
|
|
@@ -1701,29 +1778,35 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1701
1778
|
} catch (e) {
|
|
1702
1779
|
return !!document.getElementById(t);
|
|
1703
1780
|
}
|
|
1704
|
-
},
|
|
1781
|
+
}, er = (e, t) => {
|
|
1705
1782
|
try {
|
|
1706
1783
|
let n = typeof location > "u" ? "http://localhost" : location.href, r = new URL(e, n), i = new URL(t, n);
|
|
1707
|
-
return r.pathname !== i.pathname ||
|
|
1784
|
+
return r.pathname !== i.pathname || !$n(i.hash) && Qn(r.hash) !== Qn(i.hash);
|
|
1708
1785
|
} catch (n) {
|
|
1709
1786
|
return e !== t;
|
|
1710
1787
|
}
|
|
1711
|
-
},
|
|
1788
|
+
}, tr = () => {
|
|
1712
1789
|
let e = [];
|
|
1713
1790
|
return {
|
|
1714
1791
|
name: "page-view",
|
|
1715
1792
|
init(t) {
|
|
1716
1793
|
if (typeof window > "u") return;
|
|
1717
1794
|
let n, r, i, a = (e = Date.now()) => t.setView({}, e), o = (e, n, r = Date.now(), i) => {
|
|
1718
|
-
e.version += 1
|
|
1795
|
+
e.version += 1;
|
|
1796
|
+
let a = S(S(S(S(S({}, t.config.hooks.getPageAttributes()), e.attributes), e.snapshotAttributes), {}, {
|
|
1719
1797
|
[g.viewPhase]: n,
|
|
1720
1798
|
[g.viewStartedAt]: e.startedAt,
|
|
1721
1799
|
[g.viewVersion]: e.version
|
|
1722
1800
|
}, i ? { "view.end_reason": i } : {}), e.loadingTime === void 0 ? {} : {
|
|
1723
1801
|
[g.viewLoadingTime]: e.loadingTime,
|
|
1724
1802
|
[g.viewLoadingTimeSource]: e.loadingTimeSource
|
|
1725
|
-
})
|
|
1803
|
+
});
|
|
1804
|
+
t.startSpan(N({
|
|
1805
|
+
attributes: a,
|
|
1806
|
+
spanType: j.view
|
|
1807
|
+
}), a, {
|
|
1726
1808
|
contextTime: r,
|
|
1809
|
+
rumSpanType: j.view,
|
|
1727
1810
|
startTime: r
|
|
1728
1811
|
}).end(r);
|
|
1729
1812
|
}, s = (e, t = !0, r = Date.now()) => {
|
|
@@ -1735,10 +1818,10 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1735
1818
|
let s = S({}, n);
|
|
1736
1819
|
(i = n.stopLoadingTime) == null || i.call(n), o(n, "end", r, e), n = void 0, t && a(r);
|
|
1737
1820
|
let { stopLoadingTime: c } = s;
|
|
1738
|
-
return
|
|
1821
|
+
return qn(s, Jn);
|
|
1739
1822
|
}, c = (e, t, r) => {
|
|
1740
1823
|
if (n !== e || !Number.isFinite(t) || t < 0) return;
|
|
1741
|
-
let i = S(S({}, e.loadingType === "initial_load" ?
|
|
1824
|
+
let i = S(S({}, e.loadingType === "initial_load" ? Zn() : {}), {}, {
|
|
1742
1825
|
[g.viewLoadingTime]: t,
|
|
1743
1826
|
[g.viewLoadingTimeSource]: r
|
|
1744
1827
|
});
|
|
@@ -1774,39 +1857,39 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1774
1857
|
}, d();
|
|
1775
1858
|
}, u = (e) => {
|
|
1776
1859
|
let n = t.applyRedact(e == null ? {} : e);
|
|
1777
|
-
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !
|
|
1860
|
+
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !Yn.has(e)));
|
|
1778
1861
|
}, d = (e, r, i, a = ((e) => (e = n == null ? void 0 : n.rawUrl) == null ? "" : e)()) => {
|
|
1779
|
-
var c;
|
|
1862
|
+
var c, d;
|
|
1780
1863
|
if (!t.isSessionActive()) return;
|
|
1781
|
-
let
|
|
1864
|
+
let f = (c = e.url) == null ? Xn() : c, p = t.config.hooks.getViewUrlTemplate(f), m = a ? t.config.hooks.getViewUrlTemplate(a) : "", _ = (d = e.name) == null ? p : d, v = u(e.attributes);
|
|
1782
1865
|
s(r, !1);
|
|
1783
|
-
let
|
|
1866
|
+
let y = h("view"), b = t.config.hooks.redactUrl(f), x = t.config.hooks.redactUrl(a), C = i === "initial_load", w = C && typeof performance < "u" ? performance.timeOrigin : Date.now(), T = C ? Zn() : {};
|
|
1784
1867
|
t.setView({
|
|
1785
|
-
attributes:
|
|
1786
|
-
id:
|
|
1868
|
+
attributes: v,
|
|
1869
|
+
id: y,
|
|
1787
1870
|
loadingType: i,
|
|
1788
|
-
name:
|
|
1789
|
-
startedAt:
|
|
1790
|
-
url:
|
|
1791
|
-
urlTemplate:
|
|
1792
|
-
},
|
|
1793
|
-
attributes:
|
|
1871
|
+
name: _,
|
|
1872
|
+
startedAt: w,
|
|
1873
|
+
url: b,
|
|
1874
|
+
urlTemplate: p
|
|
1875
|
+
}, w), n = {
|
|
1876
|
+
attributes: v,
|
|
1794
1877
|
version: 0,
|
|
1795
|
-
id:
|
|
1878
|
+
id: y,
|
|
1796
1879
|
loadingType: i,
|
|
1797
|
-
name:
|
|
1798
|
-
rawUrl:
|
|
1799
|
-
snapshotAttributes: S(S(S(S(S(S({},
|
|
1800
|
-
[g.viewUrl]:
|
|
1801
|
-
[g.viewUrlTemplate]:
|
|
1880
|
+
name: _,
|
|
1881
|
+
rawUrl: f,
|
|
1882
|
+
snapshotAttributes: S(S(S(S(S(S({}, v), t.config.hooks.getPageAttributes()), T), P({ spanType: j.view })), {}, { [g.viewId]: y }, _ ? { [g.viewName]: _ } : {}), {}, {
|
|
1883
|
+
[g.viewUrl]: b,
|
|
1884
|
+
[g.viewUrlTemplate]: p,
|
|
1802
1885
|
[g.viewLoadingType]: i,
|
|
1803
|
-
[g.viewPrevious]:
|
|
1804
|
-
[g.viewPreviousUrlTemplate]:
|
|
1805
|
-
},
|
|
1806
|
-
startedAt:
|
|
1807
|
-
url:
|
|
1808
|
-
urlTemplate:
|
|
1809
|
-
}, o(n, "start",
|
|
1886
|
+
[g.viewPrevious]: x,
|
|
1887
|
+
[g.viewPreviousUrlTemplate]: m
|
|
1888
|
+
}, C && document.referrer ? { [g.viewReferrer]: t.config.hooks.redactUrl(document.referrer) } : {}),
|
|
1889
|
+
startedAt: w,
|
|
1890
|
+
url: b,
|
|
1891
|
+
urlTemplate: p
|
|
1892
|
+
}, o(n, "start", w), l(n);
|
|
1810
1893
|
}, f = t.onViewCommand((e) => {
|
|
1811
1894
|
if (e.type === "start") {
|
|
1812
1895
|
d(e.options, "manual", n ? "route_change" : "initial_load");
|
|
@@ -1829,8 +1912,8 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1829
1912
|
}), o(n, "update"));
|
|
1830
1913
|
}
|
|
1831
1914
|
}), p = () => {};
|
|
1832
|
-
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p =
|
|
1833
|
-
|
|
1915
|
+
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p = Gn((e) => {
|
|
1916
|
+
er(e.fromUrl, e.toUrl) && d({}, e.source, "route_change", e.fromUrl);
|
|
1834
1917
|
}));
|
|
1835
1918
|
let m = (e) => {
|
|
1836
1919
|
if (e.persisted) {
|
|
@@ -1872,7 +1955,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1872
1955
|
}
|
|
1873
1956
|
}
|
|
1874
1957
|
};
|
|
1875
|
-
},
|
|
1958
|
+
}, nr = 5e3, rr = (e) => typeof e == "number" && Number.isFinite(e) && e > 0, ir = (e, t, n, r) => ({
|
|
1876
1959
|
expiresAt: Math.min(t + n, t + r),
|
|
1877
1960
|
id: e,
|
|
1878
1961
|
startedAt: t,
|
|
@@ -1880,19 +1963,19 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1880
1963
|
}), X = (e, t, n) => {
|
|
1881
1964
|
if (t >= e.startedAt + n) return "maxLifetime";
|
|
1882
1965
|
if (t >= e.expiresAt) return "inactivity";
|
|
1883
|
-
},
|
|
1966
|
+
}, ar = (e, t, n, r) => S(S({}, e), {}, { expiresAt: Math.min(t + n, e.startedAt + r) }), or = (e, t, n) => {
|
|
1884
1967
|
if (!e) return null;
|
|
1885
1968
|
try {
|
|
1886
1969
|
let r = JSON.parse(e);
|
|
1887
|
-
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 &&
|
|
1970
|
+
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 && rr(r.startedAt) && r.startedAt <= t + nr && rr(r.expiresAt) && r.expiresAt >= r.startedAt && r.expiresAt <= r.startedAt + n || r.status === "expired" && typeof r.previousId == "string" && r.previousId.length > 0 && (r.reason === "inactivity" || r.reason === "maxLifetime") && rr(r.expiredAt) && r.expiredAt <= t + nr) return r;
|
|
1888
1971
|
} catch (e) {}
|
|
1889
1972
|
return null;
|
|
1890
|
-
},
|
|
1973
|
+
}, sr = 900 * 1e3, Z = 14400 * 1e3, cr = 1e3, lr = 6e4, ur = [
|
|
1891
1974
|
"click",
|
|
1892
1975
|
"keydown",
|
|
1893
1976
|
"scroll",
|
|
1894
1977
|
"touchstart"
|
|
1895
|
-
],
|
|
1978
|
+
], dr = /* @__PURE__ */ new Map(), fr = (e) => {
|
|
1896
1979
|
let t = typeof window < "u", n = () => {
|
|
1897
1980
|
var n;
|
|
1898
1981
|
if (t) try {
|
|
@@ -1900,21 +1983,21 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1900
1983
|
} catch (e) {
|
|
1901
1984
|
t = !1;
|
|
1902
1985
|
}
|
|
1903
|
-
return (n =
|
|
1986
|
+
return (n = dr.get(e)) == null ? null : n;
|
|
1904
1987
|
};
|
|
1905
1988
|
return n(), {
|
|
1906
1989
|
isLocalStorage: () => t,
|
|
1907
1990
|
read: n,
|
|
1908
1991
|
write: (n) => {
|
|
1909
1992
|
let r = JSON.stringify(n);
|
|
1910
|
-
if (
|
|
1993
|
+
if (dr.set(e, r), t) try {
|
|
1911
1994
|
window.localStorage.setItem(e, r);
|
|
1912
1995
|
} catch (e) {
|
|
1913
1996
|
t = !1;
|
|
1914
1997
|
}
|
|
1915
1998
|
}
|
|
1916
1999
|
};
|
|
1917
|
-
},
|
|
2000
|
+
}, pr = (e, t) => {
|
|
1918
2001
|
let n = "";
|
|
1919
2002
|
try {
|
|
1920
2003
|
n = new URL(e).host;
|
|
@@ -1922,17 +2005,21 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1922
2005
|
n = e;
|
|
1923
2006
|
}
|
|
1924
2007
|
return `bk_ot_session__${m(`${t}\0${n || "default"}`)}`;
|
|
1925
|
-
},
|
|
1926
|
-
|
|
2008
|
+
}, mr = (e, t, n, r) => {
|
|
2009
|
+
let i = S(S(S({}, e.config.hooks.getPageAttributes()), P({ spanType: j.session })), {}, {
|
|
1927
2010
|
[g.sessionPhase]: t,
|
|
1928
2011
|
[g.sessionHasReplay]: !1,
|
|
1929
2012
|
[g.sessionId]: n,
|
|
1930
2013
|
[g.sessionType]: "user"
|
|
1931
|
-
})
|
|
2014
|
+
});
|
|
2015
|
+
e.startSpan(N({
|
|
2016
|
+
attributes: i,
|
|
2017
|
+
spanType: j.session
|
|
2018
|
+
}), i, {
|
|
1932
2019
|
contextTime: r,
|
|
1933
2020
|
startTime: r
|
|
1934
2021
|
}).end(r);
|
|
1935
|
-
},
|
|
2022
|
+
}, hr = (e = {}) => {
|
|
1936
2023
|
let t = [];
|
|
1937
2024
|
return {
|
|
1938
2025
|
name: "session",
|
|
@@ -1947,7 +2034,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1947
2034
|
}, e);
|
|
1948
2035
|
return;
|
|
1949
2036
|
}
|
|
1950
|
-
let i = (r = e.storageKey) == null ?
|
|
2037
|
+
let i = (r = e.storageKey) == null ? pr(n.config.transport.endpoint, n.config.application.name) : r, a = fr(i), o = typeof performance < "u" && Number.isFinite(performance.timeOrigin) ? performance.timeOrigin : Date.now(), s, c, l = (e = Date.now()) => or(a.read(), e, Z), u = () => {
|
|
1951
2038
|
c !== void 0 && (clearTimeout(c), c = void 0);
|
|
1952
2039
|
}, d = (e, t = Date.now()) => {
|
|
1953
2040
|
let r = s;
|
|
@@ -1956,7 +2043,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
1956
2043
|
id: r,
|
|
1957
2044
|
reason: e,
|
|
1958
2045
|
type: "expired"
|
|
1959
|
-
}),
|
|
2046
|
+
}), mr(n, "end", r, t), u(), s = void 0, n.setRuntimeAttributes({
|
|
1960
2047
|
[g.sessionHasReplay]: void 0,
|
|
1961
2048
|
[g.sessionId]: void 0,
|
|
1962
2049
|
[g.sessionType]: void 0
|
|
@@ -2007,15 +2094,15 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2007
2094
|
}, _ = (e = !1) => {
|
|
2008
2095
|
let t = Date.now(), r = l(t);
|
|
2009
2096
|
if ((r == null ? void 0 : r.status) === "active" && !X(r, t, Z)) {
|
|
2010
|
-
let e =
|
|
2097
|
+
let e = ar(r, t, sr, Z);
|
|
2011
2098
|
a.write(e), m(e, s ? void 0 : { reason: "shared" });
|
|
2012
2099
|
return;
|
|
2013
2100
|
}
|
|
2014
|
-
let i = (r == null ? void 0 : r.status) === "expired" ? r.previousId : r == null ? void 0 : r.id, o = (r == null ? void 0 : r.status) === "expired" ? r.reason : r ? X(r, t, Z) : e ? "init" : void 0, c =
|
|
2101
|
+
let i = (r == null ? void 0 : r.status) === "expired" ? r.previousId : r == null ? void 0 : r.id, o = (r == null ? void 0 : r.status) === "expired" ? r.reason : r ? X(r, t, Z) : e ? "init" : void 0, c = ir(h("session"), t, sr, Z);
|
|
2015
2102
|
a.write(c), m(c, {
|
|
2016
2103
|
previousId: i,
|
|
2017
2104
|
reason: o == null ? "init" : o
|
|
2018
|
-
}),
|
|
2105
|
+
}), mr(n, (o == null ? "init" : o) === "init" ? "start" : "rotate", c.id, c.startedAt);
|
|
2019
2106
|
}, v = () => {
|
|
2020
2107
|
if (!s) return;
|
|
2021
2108
|
let e = Date.now(), t = l(e);
|
|
@@ -2023,31 +2110,31 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2023
2110
|
f();
|
|
2024
2111
|
return;
|
|
2025
2112
|
}
|
|
2026
|
-
let n =
|
|
2113
|
+
let n = ar(t, e, sr, Z);
|
|
2027
2114
|
a.write(n), m(n);
|
|
2028
2115
|
};
|
|
2029
2116
|
_(!0);
|
|
2030
2117
|
let y = 0, b = () => {
|
|
2031
2118
|
let e = Date.now();
|
|
2032
|
-
e - y <
|
|
2119
|
+
e - y < cr || (y = e, _());
|
|
2033
2120
|
}, x = {
|
|
2034
2121
|
capture: !0,
|
|
2035
2122
|
passive: !0
|
|
2036
2123
|
};
|
|
2037
|
-
|
|
2038
|
-
|
|
2124
|
+
ur.forEach((e) => window.addEventListener(e, b, x)), t.push(() => {
|
|
2125
|
+
ur.forEach((e) => window.removeEventListener(e, b, x));
|
|
2039
2126
|
});
|
|
2040
2127
|
let S = () => {
|
|
2041
2128
|
document.visibilityState === "visible" && v();
|
|
2042
2129
|
};
|
|
2043
2130
|
document.addEventListener("visibilitychange", S);
|
|
2044
|
-
let C = window.setInterval(S,
|
|
2131
|
+
let C = window.setInterval(S, lr);
|
|
2045
2132
|
t.push(() => {
|
|
2046
2133
|
document.removeEventListener("visibilitychange", S), window.clearInterval(C);
|
|
2047
2134
|
});
|
|
2048
2135
|
let w = (e) => {
|
|
2049
2136
|
if (!a.isLocalStorage() || e.storageArea !== window.localStorage || e.key !== i) return;
|
|
2050
|
-
let t = Date.now(), n =
|
|
2137
|
+
let t = Date.now(), n = or(e.newValue, t, Z);
|
|
2051
2138
|
if ((n == null ? void 0 : n.status) === "active" && n.id === s && !X(n, t, Z)) {
|
|
2052
2139
|
p(n);
|
|
2053
2140
|
return;
|
|
@@ -2060,38 +2147,38 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2060
2147
|
for (var e; t.length;) (e = t.pop()) == null || e();
|
|
2061
2148
|
}
|
|
2062
2149
|
};
|
|
2063
|
-
},
|
|
2150
|
+
}, gr = 10, _r = 6e4, vr = 5e3, yr = 1e3, br = (e, t) => !!t && e === t, xr = (e, t) => {
|
|
2064
2151
|
let [n, r] = e === "CLS" ? [.1, .25] : [200, 500];
|
|
2065
2152
|
return t <= n ? "good" : t <= r ? "needs-improvement" : "poor";
|
|
2066
|
-
},
|
|
2153
|
+
}, Sr = (e) => {
|
|
2067
2154
|
var t, n, r;
|
|
2068
2155
|
if (!(typeof Element > "u" || !(e instanceof Element))) return (t = (n = (r = e.getAttribute("data-bk-action-name")) == null ? e.getAttribute("aria-label") : r) == null ? e.getAttribute("name") : n) == null ? e.tagName.toLowerCase() : t;
|
|
2069
|
-
},
|
|
2156
|
+
}, Cr = () => {
|
|
2070
2157
|
if (typeof performance > "u") return;
|
|
2071
2158
|
let e = performance.interactionCount;
|
|
2072
2159
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
2073
|
-
},
|
|
2160
|
+
}, wr = (e, t) => {
|
|
2074
2161
|
var n, r;
|
|
2075
2162
|
let i = (n = t.value) == null ? 0 : n;
|
|
2076
|
-
t.hadRecentInput || !Number.isFinite(i) || (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >=
|
|
2077
|
-
},
|
|
2163
|
+
t.hadRecentInput || !Number.isFinite(i) || (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >= yr || t.startTime - e.clsWindowStart >= vr ? (e.clsWindowStart = t.startTime, e.clsWindowValue = i) : e.clsWindowValue += i, e.clsWindowEnd = t.startTime, e.clsWindowValue > e.cls && (e.cls = Math.round(e.clsWindowValue * 1e4) / 1e4));
|
|
2164
|
+
}, Tr = (e, t) => {
|
|
2078
2165
|
var n, r;
|
|
2079
2166
|
if (!t.interactionId || !Number.isFinite(t.duration)) return;
|
|
2080
2167
|
e.interactionIdMin = Math.min(e.interactionIdMin, t.interactionId), e.interactionIdMax = Math.max(e.interactionIdMax, t.interactionId);
|
|
2081
2168
|
let i = (n = t.processingStart) == null ? t.startTime : n, a = (r = t.processingEnd) == null ? i : r, o = {
|
|
2082
|
-
duration: Math.min(t.duration,
|
|
2169
|
+
duration: Math.min(t.duration, _r),
|
|
2083
2170
|
inputDelay: Math.max(0, i - t.startTime),
|
|
2084
2171
|
interactionId: t.interactionId,
|
|
2085
|
-
interactionTarget:
|
|
2172
|
+
interactionTarget: Sr(t.target),
|
|
2086
2173
|
interactionType: t.name,
|
|
2087
2174
|
presentationDelay: Math.max(0, t.startTime + t.duration - a),
|
|
2088
2175
|
processingDuration: Math.max(0, a - i)
|
|
2089
2176
|
}, s = e.inpCandidates.findIndex((e) => e.interactionId === t.interactionId);
|
|
2090
|
-
s >= 0 ? o.duration > e.inpCandidates[s].duration && (e.inpCandidates[s] = o) : e.inpCandidates.push(o), e.inpCandidates.sort((e, t) => t.duration - e.duration).splice(
|
|
2091
|
-
},
|
|
2092
|
-
let t =
|
|
2177
|
+
s >= 0 ? o.duration > e.inpCandidates[s].duration && (e.inpCandidates[s] = o) : e.inpCandidates.push(o), e.inpCandidates.sort((e, t) => t.duration - e.duration).splice(gr);
|
|
2178
|
+
}, Er = (e) => {
|
|
2179
|
+
let t = Cr(), n = t !== void 0 && e.interactionCountAtStart !== void 0 ? Math.max(0, t - e.interactionCountAtStart) : e.interactionIdMin === Infinity ? 0 : (e.interactionIdMax - e.interactionIdMin) / 7 + 1;
|
|
2093
2180
|
if (e.inpCandidates.length) return e.inpCandidates[Math.min(e.inpCandidates.length - 1, Math.floor(n / 50))];
|
|
2094
|
-
},
|
|
2181
|
+
}, Dr = (e, t) => {
|
|
2095
2182
|
var n;
|
|
2096
2183
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
2097
2184
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -2112,7 +2199,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2112
2199
|
default: break;
|
|
2113
2200
|
}
|
|
2114
2201
|
return i;
|
|
2115
|
-
},
|
|
2202
|
+
}, Or = () => {
|
|
2116
2203
|
let e, t = !1;
|
|
2117
2204
|
return {
|
|
2118
2205
|
name: "web-vitals",
|
|
@@ -2132,15 +2219,18 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2132
2219
|
if (t) return;
|
|
2133
2220
|
let { onFCP: a, onLCP: o, onTTFB: s } = r, c = (e, t, r, i = r == null ? Date.now() : r) => {
|
|
2134
2221
|
if (!n.isSampled()) return;
|
|
2135
|
-
let a = e.name.toLowerCase()
|
|
2136
|
-
|
|
2137
|
-
outcome: Je(e.rating),
|
|
2222
|
+
let a = e.name.toLowerCase(), o = S(S(S(S({}, n.config.hooks.getPageAttributes()), t), P({
|
|
2223
|
+
outcome: Le(e.rating),
|
|
2138
2224
|
spanType: j.vital
|
|
2139
2225
|
})), {}, {
|
|
2140
2226
|
[g.vitalMetric]: a,
|
|
2141
2227
|
[g.vitalValue]: e.value,
|
|
2142
2228
|
"vital.id": e.id
|
|
2143
|
-
},
|
|
2229
|
+
}, Dr(e, n.config.hooks.redactUrl));
|
|
2230
|
+
n.startSpan(N({
|
|
2231
|
+
attributes: o,
|
|
2232
|
+
spanType: j.vital
|
|
2233
|
+
}), o, {
|
|
2144
2234
|
contextTime: r,
|
|
2145
2235
|
startTime: i
|
|
2146
2236
|
}).end(i);
|
|
@@ -2158,10 +2248,10 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2158
2248
|
entries: [],
|
|
2159
2249
|
id: h("vital"),
|
|
2160
2250
|
name: "CLS",
|
|
2161
|
-
rating:
|
|
2251
|
+
rating: xr("CLS", e.cls),
|
|
2162
2252
|
value: e.cls
|
|
2163
2253
|
}, e.runtimeAttributes, e.startedAt);
|
|
2164
|
-
let t =
|
|
2254
|
+
let t = Er(e);
|
|
2165
2255
|
t && p({
|
|
2166
2256
|
attribution: {
|
|
2167
2257
|
inputDelay: t.inputDelay,
|
|
@@ -2173,13 +2263,13 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2173
2263
|
entries: [],
|
|
2174
2264
|
id: h("vital"),
|
|
2175
2265
|
name: "INP",
|
|
2176
|
-
rating:
|
|
2266
|
+
rating: xr("INP", t.duration),
|
|
2177
2267
|
value: t.duration
|
|
2178
2268
|
}, e.runtimeAttributes, e.startedAt);
|
|
2179
2269
|
}, _ = n.onViewChange((e) => {
|
|
2180
2270
|
var t;
|
|
2181
2271
|
let r = u;
|
|
2182
|
-
if (r &&
|
|
2272
|
+
if (r && br(r.id, e.id)) {
|
|
2183
2273
|
r.runtimeAttributes = S(S(S({}, r.runtimeAttributes), {}, { [g.viewId]: e.id }, e.name ? { [g.viewName]: e.name } : {}), {}, {
|
|
2184
2274
|
[g.viewUrl]: e.url,
|
|
2185
2275
|
[g.viewUrlTemplate]: e.urlTemplate
|
|
@@ -2189,7 +2279,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2189
2279
|
m(), u = e.id ? {
|
|
2190
2280
|
cls: 0,
|
|
2191
2281
|
clsWindowValue: 0,
|
|
2192
|
-
interactionCountAtStart:
|
|
2282
|
+
interactionCountAtStart: Cr(),
|
|
2193
2283
|
interactionIdMax: 0,
|
|
2194
2284
|
interactionIdMin: Infinity,
|
|
2195
2285
|
inpCandidates: [],
|
|
@@ -2201,12 +2291,12 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2201
2291
|
if (typeof PerformanceObserver < "u") {
|
|
2202
2292
|
var v, y;
|
|
2203
2293
|
(v = PerformanceObserver.supportedEntryTypes) != null && v.includes("layout-shift") && (f = new PerformanceObserver((e) => {
|
|
2204
|
-
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt ||
|
|
2294
|
+
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt || wr(u, t);
|
|
2205
2295
|
}), f.observe({
|
|
2206
2296
|
buffered: !0,
|
|
2207
2297
|
type: "layout-shift"
|
|
2208
2298
|
})), (y = PerformanceObserver.supportedEntryTypes) != null && y.includes("event") && (d = new PerformanceObserver((e) => {
|
|
2209
|
-
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt || !t.interactionId || !Number.isFinite(t.duration) ||
|
|
2299
|
+
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt || !t.interactionId || !Number.isFinite(t.duration) || Tr(u, t);
|
|
2210
2300
|
}), d.observe({
|
|
2211
2301
|
buffered: !0,
|
|
2212
2302
|
durationThreshold: 40,
|
|
@@ -2222,7 +2312,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2222
2312
|
t = !0, e == null || e(), e = void 0;
|
|
2223
2313
|
}
|
|
2224
2314
|
};
|
|
2225
|
-
},
|
|
2315
|
+
}, kr = (e, t) => {
|
|
2226
2316
|
let n = {
|
|
2227
2317
|
"network.protocol.name": "websocket",
|
|
2228
2318
|
"url.full": t(e)
|
|
@@ -2232,17 +2322,20 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2232
2322
|
n["server.address"] = t.hostname, t.port && (n["server.port"] = Number(t.port)), n["url.scheme"] = t.protocol.replace(":", "");
|
|
2233
2323
|
} catch (e) {}
|
|
2234
2324
|
return n;
|
|
2235
|
-
},
|
|
2236
|
-
let a = h("websocket"), o =
|
|
2325
|
+
}, Ar = (t, n, r, i) => {
|
|
2326
|
+
let a = h("websocket"), o = kr(r, n.config.hooks.redactUrl), s = !1, c = (t, r, s = {}) => {
|
|
2237
2327
|
if (i() || !n.isSampled()) return;
|
|
2238
|
-
let c = t === "error"
|
|
2239
|
-
n.startSpan("browser.websocket", S(S(S({}, o), M({
|
|
2328
|
+
let c = t === "error", l = S(S(S({}, o), P({
|
|
2240
2329
|
outcome: c ? A.error : A.success,
|
|
2241
2330
|
spanType: j.websocket
|
|
2242
2331
|
})), {}, {
|
|
2243
2332
|
[g.websocketPhase]: t,
|
|
2244
2333
|
"websocket.connection.id": a
|
|
2245
|
-
}, s)
|
|
2334
|
+
}, s);
|
|
2335
|
+
n.startSpan(N({
|
|
2336
|
+
attributes: l,
|
|
2337
|
+
spanType: j.websocket
|
|
2338
|
+
}), l, {
|
|
2246
2339
|
kind: e.CLIENT,
|
|
2247
2340
|
startTime: r
|
|
2248
2341
|
}).end(r);
|
|
@@ -2258,7 +2351,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2258
2351
|
"websocket.close.was_clean": e.wasClean
|
|
2259
2352
|
});
|
|
2260
2353
|
});
|
|
2261
|
-
},
|
|
2354
|
+
}, jr = () => {
|
|
2262
2355
|
let e, t, n = !1;
|
|
2263
2356
|
return {
|
|
2264
2357
|
name: "websocket",
|
|
@@ -2269,29 +2362,29 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2269
2362
|
let a = Reflect.construct(e, t, i);
|
|
2270
2363
|
if (n || !r.isSampled()) return a;
|
|
2271
2364
|
let o = t[0] == null ? "" : String(t[0]);
|
|
2272
|
-
return o && !D(r.config, o) &&
|
|
2365
|
+
return o && !D(r.config, o) && Ar(a, r, o, () => n), a;
|
|
2273
2366
|
} }), window.WebSocket = t;
|
|
2274
2367
|
},
|
|
2275
2368
|
shutdown() {
|
|
2276
2369
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
2277
2370
|
}
|
|
2278
2371
|
};
|
|
2279
|
-
},
|
|
2372
|
+
}, Mr = class {
|
|
2280
2373
|
constructor() {
|
|
2281
2374
|
b(this, "listeners", /* @__PURE__ */ new Set()), b(this, "notify", (e) => {
|
|
2282
2375
|
this.listeners.forEach((t) => t(e));
|
|
2283
2376
|
}), b(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
|
|
2284
2377
|
}
|
|
2285
|
-
},
|
|
2378
|
+
}, Nr = (e) => {
|
|
2286
2379
|
let t = 2166136261;
|
|
2287
2380
|
for (let n = 0; n < e.length; n += 1) t = Math.imul(t ^ e.charCodeAt(n), 16777619);
|
|
2288
2381
|
return t += t << 13, t ^= t >>> 7, t += t << 3, t ^= t >>> 17, t += t << 5, (t >>> 0) / 4294967296;
|
|
2289
|
-
},
|
|
2382
|
+
}, Pr = ({ application: e, session: t }, n) => t.sampleRate <= 0 ? !1 : t.sampleRate >= 1 ? !0 : Nr(`${e.name}\0${n}`) < t.sampleRate, Fr = (e) => ({
|
|
2290
2383
|
url: e.endpoint,
|
|
2291
2384
|
headers: e.headers,
|
|
2292
2385
|
concurrencyLimit: e.concurrencyLimit,
|
|
2293
2386
|
timeoutMillis: e.timeoutMillis
|
|
2294
|
-
}),
|
|
2387
|
+
}), Ir = "bk-rum", Lr = class {
|
|
2295
2388
|
constructor(e) {
|
|
2296
2389
|
this.isSampled = e;
|
|
2297
2390
|
}
|
|
@@ -2301,7 +2394,7 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2301
2394
|
toString() {
|
|
2302
2395
|
return "RumSessionSampler";
|
|
2303
2396
|
}
|
|
2304
|
-
}, Q,
|
|
2397
|
+
}, Q, Rr = () => {
|
|
2305
2398
|
if (Q) Q.users += 1;
|
|
2306
2399
|
else {
|
|
2307
2400
|
let e = new a().enable(), t = r.setGlobalContextManager(e);
|
|
@@ -2316,28 +2409,28 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2316
2409
|
return () => {
|
|
2317
2410
|
e || !Q || (e = !0, --Q.users, !(Q.users > 0) && (Q.ownsContext && r.disable(), Q.ownsPropagator && i.disable(), Q = void 0));
|
|
2318
2411
|
};
|
|
2319
|
-
},
|
|
2412
|
+
}, zr = (e, t) => t ? new Proxy(e, { get(e, t, n) {
|
|
2320
2413
|
if (t === "export") return (t, n) => {
|
|
2321
2414
|
var r;
|
|
2322
2415
|
return (r = globalThis.console) == null || r.log("[bk-ot][rum]", t), e.export(t, n);
|
|
2323
2416
|
};
|
|
2324
2417
|
let r = Reflect.get(e, t, n);
|
|
2325
2418
|
return typeof r == "function" ? r.bind(e) : r;
|
|
2326
|
-
} }) : e,
|
|
2327
|
-
|
|
2419
|
+
} }) : e, Br = (e) => [Tn(e.tracking.request)], Vr = (e) => [
|
|
2420
|
+
hr(e.session),
|
|
2328
2421
|
...$(e.tracking.device, !0, ce),
|
|
2329
2422
|
_t(),
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
],
|
|
2333
|
-
...$(e.error, !0,
|
|
2334
|
-
...$(e.webVitals, !0,
|
|
2423
|
+
tr(),
|
|
2424
|
+
sn(Hr(e.tracking.resource, !0))
|
|
2425
|
+
], Hr = (e, t) => e === void 0 ? t : e !== !1, Ur = (e) => typeof e == "object" && e ? e : void 0, $ = (e, t, n) => Hr(e, t) ? [n(Ur(e))] : [], Wr = (e) => [
|
|
2426
|
+
...$(e.error, !0, jn),
|
|
2427
|
+
...$(e.webVitals, !0, Or),
|
|
2335
2428
|
...$(e.blankScreen, !0, Mt),
|
|
2336
2429
|
...$(e.action, !0, mt),
|
|
2337
|
-
...$(e.websocket, !1,
|
|
2430
|
+
...$(e.websocket, !1, jr),
|
|
2338
2431
|
...$(e.longTask, !1, Ln),
|
|
2339
|
-
...$(e.cspViolation, !1,
|
|
2340
|
-
],
|
|
2432
|
+
...$(e.cspViolation, !1, On)
|
|
2433
|
+
], Gr = class {
|
|
2341
2434
|
assertBeforeStart(e) {
|
|
2342
2435
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
2343
2436
|
}
|
|
@@ -2368,19 +2461,19 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2368
2461
|
createPluginManager() {
|
|
2369
2462
|
var e;
|
|
2370
2463
|
return new Fe([
|
|
2371
|
-
...
|
|
2372
|
-
...
|
|
2373
|
-
...
|
|
2464
|
+
...Vr(this.config),
|
|
2465
|
+
...Br(this.config),
|
|
2466
|
+
...Wr(this.config.tracking),
|
|
2374
2467
|
...(e = this.config.extensions.plugins) == null ? [] : e
|
|
2375
2468
|
]);
|
|
2376
2469
|
}
|
|
2377
2470
|
constructor(n) {
|
|
2378
2471
|
var r = this;
|
|
2379
|
-
b(this, "activityObserver", new
|
|
2472
|
+
b(this, "activityObserver", new Mr()), b(this, "flushProviders", k(function* () {
|
|
2380
2473
|
yield r.tracerProvider.forceFlush();
|
|
2381
2474
|
})), b(this, "phase", "idle"), b(this, "pluginManager", void 0), b(this, "registeredInstrumentations", void 0), b(this, "releaseOtelGlobals", void 0), b(this, "runtimeContext", void 0), b(this, "sampled", !1), b(this, "startCollection", k(function* () {
|
|
2382
2475
|
if (r.pluginManager || !r.config.enabled || r.config.trackingConsent !== "granted") return;
|
|
2383
|
-
r.releaseOtelGlobals =
|
|
2476
|
+
r.releaseOtelGlobals = Rr();
|
|
2384
2477
|
let e = r.createPluginManager();
|
|
2385
2478
|
r.pluginManager = e;
|
|
2386
2479
|
try {
|
|
@@ -2417,11 +2510,18 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2417
2510
|
}), this.registeredInstrumentations.push(...e));
|
|
2418
2511
|
}), b(this, "reportAction", ({ attributes: e = {}, name: t }) => {
|
|
2419
2512
|
if (!this.isSampled()) return;
|
|
2420
|
-
let n = h("action"), r = Date.now()
|
|
2421
|
-
this.startSpan(`action.${t}`, S(S(S(S({}, this.config.hooks.getPageAttributes()), e), M({ spanType: j.action })), {}, {
|
|
2513
|
+
let n = h("action"), r = Date.now(), i = S(S(S(S({}, this.config.hooks.getPageAttributes()), e), P({ spanType: j.action })), {}, {
|
|
2422
2514
|
[g.actionId]: n,
|
|
2515
|
+
[g.actionName]: t,
|
|
2423
2516
|
[g.actionType]: "custom"
|
|
2424
|
-
})
|
|
2517
|
+
});
|
|
2518
|
+
this.startSpan(N({
|
|
2519
|
+
attributes: i,
|
|
2520
|
+
spanType: j.action
|
|
2521
|
+
}), i, {
|
|
2522
|
+
rumSpanType: j.action,
|
|
2523
|
+
startTime: r
|
|
2524
|
+
}).end(r);
|
|
2425
2525
|
}), b(this, "reportCustomEvent", ({ attributes: e = {}, error: n, name: r }) => {
|
|
2426
2526
|
if (!this.isSampled()) {
|
|
2427
2527
|
if (this.config.debug) {
|
|
@@ -2430,19 +2530,23 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2430
2530
|
}
|
|
2431
2531
|
return;
|
|
2432
2532
|
}
|
|
2433
|
-
let a = Date.now(), o =
|
|
2533
|
+
let a = Date.now(), o = S(S(S(S({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), e), P({
|
|
2434
2534
|
outcome: n ? A.error : A.success,
|
|
2435
2535
|
spanType: j.custom
|
|
2436
|
-
})),
|
|
2437
|
-
|
|
2536
|
+
})), s = this.startSpan(N({
|
|
2537
|
+
attributes: o,
|
|
2538
|
+
nameHint: r,
|
|
2539
|
+
spanType: j.custom
|
|
2540
|
+
}), o, { startTime: a });
|
|
2541
|
+
n && (s.recordException(n), s.setStatus({
|
|
2438
2542
|
code: t.ERROR,
|
|
2439
2543
|
message: n.message
|
|
2440
|
-
})),
|
|
2544
|
+
})), s.end(a);
|
|
2441
2545
|
}), b(this, "setRuntimeAttributes", (e, t) => {
|
|
2442
2546
|
let n = S({}, e), r = t == null ? Date.now() : t;
|
|
2443
2547
|
if (g.sessionId in e) {
|
|
2444
2548
|
let t = e[g.sessionId];
|
|
2445
|
-
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ?
|
|
2549
|
+
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ? Pr(this.config, t) : !1, this.runtimeContext.setSessionSampled(this.sampled, r);
|
|
2446
2550
|
}
|
|
2447
2551
|
this.runtimeContext.setAttributes(n, r);
|
|
2448
2552
|
}), b(this, "setTrackingConsent", function() {
|
|
@@ -2502,12 +2606,15 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2502
2606
|
var i, a;
|
|
2503
2607
|
let o = (i = r == null ? void 0 : r.contextTime) == null ? typeof (r == null ? void 0 : r.startTime) == "number" ? r.startTime : void 0 : i;
|
|
2504
2608
|
if (!this.isSampled() || o !== void 0 && !this.runtimeContext.isSessionSampledAt(o)) return this.tracer.startSpan(t);
|
|
2505
|
-
let s = o === void 0 ? this.getRuntimeAttributes() : this.runtimeContext.getAttributesAt(o)
|
|
2506
|
-
|
|
2609
|
+
let s = o === void 0 ? this.getRuntimeAttributes() : this.runtimeContext.getAttributesAt(o), c = this.applyRedact(S(S({}, s), n)), l = r != null && r.rumSpanType ? N({
|
|
2610
|
+
attributes: c,
|
|
2611
|
+
spanType: r.rumSpanType
|
|
2612
|
+
}) : t;
|
|
2613
|
+
return this.tracer.startSpan(l, {
|
|
2507
2614
|
kind: (a = r == null ? void 0 : r.kind) == null ? e.INTERNAL : a,
|
|
2508
2615
|
links: r == null ? void 0 : r.links,
|
|
2509
2616
|
startTime: r == null ? void 0 : r.startTime,
|
|
2510
|
-
attributes:
|
|
2617
|
+
attributes: c
|
|
2511
2618
|
});
|
|
2512
2619
|
}), b(this, "startView", (e = {}) => {
|
|
2513
2620
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
@@ -2520,20 +2627,20 @@ var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof
|
|
|
2520
2627
|
}), b(this, "useInstrumentation", (e) => {
|
|
2521
2628
|
var t;
|
|
2522
2629
|
return this.assertBeforeStart("useInstrumentation"), this.config.enabled && ((t = this.config.extensions.instrumentations) == null || t.push(e)), this;
|
|
2523
|
-
}), this.config = je(n), this.runtimeContext = new
|
|
2630
|
+
}), this.config = je(n), this.runtimeContext = new Ze({}, this.config.user);
|
|
2524
2631
|
let i = c(this.config.resourceAttributes), a = (() => {
|
|
2525
|
-
let e =
|
|
2526
|
-
return [new
|
|
2632
|
+
let e = zr(new s(Fr(this.config.transport)), this.config.debug);
|
|
2633
|
+
return [new Je(this.config.spanProcessor === "simple" ? new d(e) : new l(e, this.config.spanBatch), this.config, () => this.applyRedact(S(S({}, this.runtimeContext.getAttributes()), this.config.hooks.getPageAttributes())))];
|
|
2527
2634
|
})();
|
|
2528
2635
|
this.tracerProvider = new f({
|
|
2529
2636
|
resource: i,
|
|
2530
|
-
sampler: new
|
|
2637
|
+
sampler: new Lr(this.isSampled),
|
|
2531
2638
|
spanProcessors: a
|
|
2532
|
-
}), this.tracer = this.tracerProvider.getTracer(
|
|
2639
|
+
}), this.tracer = this.tracerProvider.getTracer(Ir), this.registeredInstrumentations = [], this.config.autoStart && this.start().catch((e) => {
|
|
2533
2640
|
var t;
|
|
2534
2641
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
2535
2642
|
});
|
|
2536
2643
|
}
|
|
2537
2644
|
};
|
|
2538
2645
|
//#endregion
|
|
2539
|
-
export {
|
|
2646
|
+
export { Gr as BkOpenTelemetry, ht as EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE, Je as FilteringSpanProcessor, g as RUM_ATTRIBUTES, A as RUM_SPAN_OUTCOME, j as RUM_SPAN_TYPE, Ze as RumRuntimeContext, P as buildRumSpanAttributes, mt as createActionPlugin, Mt as createBlankScreenPlugin, Tn as createCommonInstrumentationsPlugin, On as createCspViolationPlugin, ce as createDevicePlugin, jn as createErrorPlugin, Ln as createLongTaskPlugin, Pe as createPlugin, sn as createResourcePlugin, hr as createSessionPlugin, jr as createWebSocketPlugin, Or as createWebVitalsPlugin, je as resolveConfig };
|