@blueking/open-telemetry 0.0.21 → 0.0.22
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 +11 -25
- package/dist/bk-rum.global.js +2 -12
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/config.d.ts +10 -48
- package/dist/core/hash.d.ts +2 -0
- package/dist/core/plugin.d.ts +2 -7
- package/dist/core/processor.d.ts +0 -20
- package/dist/core/runtime-context.d.ts +1 -1
- package/dist/core/sdk.d.ts +2 -8
- package/dist/core/telemetry-attributes.d.ts +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1074 -1484
- package/dist/index.js.map +1 -1
- package/dist/plugins/common.d.ts +1 -1
- package/dist/plugins/csp-violation.d.ts +0 -8
- package/dist/plugins/device.d.ts +2 -2
- package/dist/plugins/error.d.ts +1 -5
- package/dist/plugins/long-task.d.ts +1 -3
- package/dist/plugins/resource.d.ts +1 -0
- package/dist/plugins/web-vitals.d.ts +2 -7
- package/dist/schema/attributes.d.ts +8 -10
- package/dist/schema/span.d.ts +2 -0
- package/package.json +1 -6
- package/skills/bk-rum-otele/SKILL.md +12 -14
- package/skills/bk-rum-otele/evals/evals.json +2 -2
- package/skills/bk-rum-otele/references/api.md +10 -22
- package/skills/bk-rum-otele/references/architecture.md +38 -118
- package/skills/bk-rum-otele/references/capabilities.md +26 -28
- package/skills/bk-rum-otele/references/concepts.md +14 -106
- package/skills/bk-rum-otele/references/configuration.md +28 -69
- package/skills/bk-rum-otele/references/custom-plugin.md +10 -13
- package/skills/bk-rum-otele/references/data-model.md +23 -95
- package/skills/bk-rum-otele/references/getting-started.md +1 -1
- package/skills/bk-rum-otele/references/plugins-basic.md +7 -7
- package/skills/bk-rum-otele/references/plugins-error-security.md +4 -7
- package/skills/bk-rum-otele/references/plugins-experience.md +8 -9
- package/skills/bk-rum-otele/references/plugins-network.md +19 -128
- package/skills/bk-rum-otele/references/plugins.md +3 -3
- package/skills/bk-rum-otele/references/privacy.md +4 -25
- package/skills/bk-rum-otele/references/telemetry-reference.md +49 -279
- package/skills/bk-rum-otele/references/transport-sampling.md +15 -50
- package/skills/bk-rum-otele/references/troubleshooting.md +7 -34
- package/dist/core/metric.d.ts +0 -2
- package/dist/core/signal.d.ts +0 -3
- package/dist/core/throttle.d.ts +0 -20
- package/dist/plugins/request-body.d.ts +0 -15
package/dist/index.js
CHANGED
|
@@ -1,52 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { registerInstrumentations as _ } from "@opentelemetry/instrumentation";
|
|
9
|
-
import { resourceFromAttributes as v } from "@opentelemetry/resources";
|
|
10
|
-
import { BatchLogRecordProcessor as y, LoggerProvider as b } from "@opentelemetry/sdk-logs";
|
|
11
|
-
import { BatchSpanProcessor as x, SamplingDecision as S, SimpleSpanProcessor as C } from "@opentelemetry/sdk-trace-base";
|
|
12
|
-
import { WebTracerProvider as w } from "@opentelemetry/sdk-trace-web";
|
|
13
|
-
import { SeverityNumber as T } from "@opentelemetry/api-logs";
|
|
1
|
+
import { SpanKind as e, SpanStatusCode as t, context as n, propagation as r, trace as i } from "@opentelemetry/api";
|
|
2
|
+
import { ZoneContextManager as a } from "@opentelemetry/context-zone";
|
|
3
|
+
import { W3CTraceContextPropagator as o } from "@opentelemetry/core";
|
|
4
|
+
import { OTLPTraceExporter as s } from "@opentelemetry/exporter-trace-otlp-http";
|
|
5
|
+
import { resourceFromAttributes as c } from "@opentelemetry/resources";
|
|
6
|
+
import { BatchSpanProcessor as l, SamplingDecision as u, SimpleSpanProcessor as d } from "@opentelemetry/sdk-trace-base";
|
|
7
|
+
import { WebTracerProvider as f } from "@opentelemetry/sdk-trace-web";
|
|
14
8
|
//#region package.json
|
|
15
|
-
var
|
|
9
|
+
var p = "0.0.22", m = (e) => {
|
|
16
10
|
let t = 5381;
|
|
17
11
|
for (let n = 0; n < e.length; n++) t = t * 33 ^ e.charCodeAt(n);
|
|
18
12
|
return (t >>> 0).toString(36);
|
|
19
|
-
},
|
|
20
|
-
let n = /* @__PURE__ */ new Map(), r = 0, i = (t) => {
|
|
21
|
-
if (!(t - r < e)) {
|
|
22
|
-
r = t;
|
|
23
|
-
for (let [r, i] of n) t - i.windowStart > e && n.delete(r);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
return { allow(r) {
|
|
27
|
-
let a = Date.now();
|
|
28
|
-
i(a);
|
|
29
|
-
let o = n.get(r);
|
|
30
|
-
return !o || a - o.windowStart > e ? (n.set(r, {
|
|
31
|
-
count: 1,
|
|
32
|
-
windowStart: a
|
|
33
|
-
}), {
|
|
34
|
-
allowed: !0,
|
|
35
|
-
count: 1
|
|
36
|
-
}) : (o.count += 1, {
|
|
37
|
-
allowed: o.count <= t,
|
|
38
|
-
count: o.count
|
|
39
|
-
});
|
|
40
|
-
} };
|
|
41
|
-
}, O = {
|
|
42
|
-
actionErrorCount: "action.error.count",
|
|
43
|
-
actionFrustrationCount: "action.frustration.count",
|
|
13
|
+
}, h = (e) => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`, g = {
|
|
44
14
|
actionFrustrationType: "action.frustration.type",
|
|
45
15
|
actionId: "action.id",
|
|
46
16
|
actionLoadingTime: "action.loading_time",
|
|
47
|
-
actionLongTaskCount: "action.long_task.count",
|
|
48
17
|
actionName: "action.name",
|
|
49
|
-
actionResourceCount: "action.resource.count",
|
|
50
18
|
actionTargetName: "action.target.name",
|
|
51
19
|
actionTargetTag: "action.target.tag",
|
|
52
20
|
actionType: "action.type",
|
|
@@ -57,17 +25,15 @@ var ee = "0.0.21", E = (e) => typeof crypto < "u" && typeof crypto.randomUUID ==
|
|
|
57
25
|
deviceLogicalProcessorCount: "device.logical_processor_count",
|
|
58
26
|
deviceMemoryGib: "device.memory_gib",
|
|
59
27
|
deviceType: "device.type",
|
|
28
|
+
eventId: "event.id",
|
|
29
|
+
eventPhase: "event.phase",
|
|
30
|
+
eventTimestamp: "event.timestamp",
|
|
31
|
+
eventType: "event.type",
|
|
60
32
|
errorType: "error_type",
|
|
61
|
-
exceptionFingerprint: "exception.fingerprint",
|
|
62
|
-
exceptionMessageShort: "exception.message_short",
|
|
63
|
-
exceptionStackTopFrame: "exception.stack_top_frame",
|
|
64
33
|
longTaskBlockingDuration: "long_task.blocking_duration",
|
|
65
|
-
longTaskCulprit: "long_task.culprit",
|
|
66
34
|
longTaskDuration: "long_task.duration",
|
|
67
35
|
longTaskEntryType: "long_task.entry_type",
|
|
68
36
|
longTaskId: "long_task.id",
|
|
69
|
-
longTaskIsFrozenFrame: "long_task.is_frozen_frame",
|
|
70
|
-
longTaskScriptCount: "long_task.script.count",
|
|
71
37
|
longTaskStartTime: "long_task.start_time",
|
|
72
38
|
networkEffectiveType: "network.effective_type",
|
|
73
39
|
nextHopProtocol: "resource.protocol",
|
|
@@ -78,7 +44,9 @@ var ee = "0.0.21", E = (e) => typeof crypto < "u" && typeof crypto.randomUUID ==
|
|
|
78
44
|
osName: "os.name",
|
|
79
45
|
sessionHasReplay: "session.has_replay",
|
|
80
46
|
sessionId: "session.id",
|
|
47
|
+
sessionSampleRate: "session.sample_rate",
|
|
81
48
|
sessionStartTime: "session.start_time",
|
|
49
|
+
sessionType: "session.type",
|
|
82
50
|
spanSubtype: "span_subtype",
|
|
83
51
|
spanType: "span_type",
|
|
84
52
|
userId: "user.id",
|
|
@@ -94,41 +62,43 @@ var ee = "0.0.21", E = (e) => typeof crypto < "u" && typeof crypto.randomUUID ==
|
|
|
94
62
|
viewLoadingTime: "view.loading_time",
|
|
95
63
|
viewLoadingType: "view.loading_type",
|
|
96
64
|
viewName: "view.name",
|
|
65
|
+
viewStartedAt: "view.started_at",
|
|
97
66
|
viewUrl: "view.url",
|
|
98
|
-
viewUrlPathGroup: "view.url_path_group"
|
|
67
|
+
viewUrlPathGroup: "view.url_path_group",
|
|
68
|
+
viewVersion: "view.version"
|
|
99
69
|
};
|
|
100
70
|
//#endregion
|
|
101
71
|
//#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
|
|
102
|
-
function
|
|
72
|
+
function _(e) {
|
|
103
73
|
"@babel/helpers - typeof";
|
|
104
|
-
return
|
|
74
|
+
return _ = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
105
75
|
return typeof e;
|
|
106
76
|
} : function(e) {
|
|
107
77
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
108
|
-
},
|
|
78
|
+
}, _(e);
|
|
109
79
|
}
|
|
110
80
|
//#endregion
|
|
111
81
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
|
|
112
|
-
function
|
|
113
|
-
if (
|
|
82
|
+
function v(e, t) {
|
|
83
|
+
if (_(e) != "object" || !e) return e;
|
|
114
84
|
var n = e[Symbol.toPrimitive];
|
|
115
85
|
if (n !== void 0) {
|
|
116
86
|
var r = n.call(e, t || "default");
|
|
117
|
-
if (
|
|
87
|
+
if (_(r) != "object") return r;
|
|
118
88
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
119
89
|
}
|
|
120
90
|
return (t === "string" ? String : Number)(e);
|
|
121
91
|
}
|
|
122
92
|
//#endregion
|
|
123
93
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
|
|
124
|
-
function
|
|
125
|
-
var t =
|
|
126
|
-
return
|
|
94
|
+
function y(e) {
|
|
95
|
+
var t = v(e, "string");
|
|
96
|
+
return _(t) == "symbol" ? t : t + "";
|
|
127
97
|
}
|
|
128
98
|
//#endregion
|
|
129
99
|
//#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
|
|
130
|
-
function
|
|
131
|
-
return (t =
|
|
100
|
+
function b(e, t, n) {
|
|
101
|
+
return (t = y(t)) in e ? Object.defineProperty(e, t, {
|
|
132
102
|
value: n,
|
|
133
103
|
enumerable: !0,
|
|
134
104
|
configurable: !0,
|
|
@@ -137,7 +107,7 @@ function A(e, t, n) {
|
|
|
137
107
|
}
|
|
138
108
|
//#endregion
|
|
139
109
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectSpread2.js
|
|
140
|
-
function
|
|
110
|
+
function x(e, t) {
|
|
141
111
|
var n = Object.keys(e);
|
|
142
112
|
if (Object.getOwnPropertySymbols) {
|
|
143
113
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -147,12 +117,12 @@ function ie(e, t) {
|
|
|
147
117
|
}
|
|
148
118
|
return n;
|
|
149
119
|
}
|
|
150
|
-
function
|
|
120
|
+
function S(e) {
|
|
151
121
|
for (var t = 1; t < arguments.length; t++) {
|
|
152
122
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
153
|
-
t % 2 ?
|
|
154
|
-
|
|
155
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
123
|
+
t % 2 ? x(Object(n), !0).forEach(function(t) {
|
|
124
|
+
b(e, t, n[t]);
|
|
125
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : x(Object(n)).forEach(function(t) {
|
|
156
126
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
157
127
|
});
|
|
158
128
|
}
|
|
@@ -160,7 +130,7 @@ function j(e) {
|
|
|
160
130
|
}
|
|
161
131
|
//#endregion
|
|
162
132
|
//#region src/plugins/device.ts
|
|
163
|
-
var
|
|
133
|
+
var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () => navigator.userAgentData, te = (e) => {
|
|
164
134
|
for (let [t, n] of [
|
|
165
135
|
["Edge", /Edg\/([\d.]+)/],
|
|
166
136
|
["Chrome", /Chrome\/([\d.]+)/],
|
|
@@ -177,21 +147,21 @@ var ae = "BK_RUM_DEVICE_ID", oe = 250, se = () => navigator.connection, ce = ()
|
|
|
177
147
|
name: "Other",
|
|
178
148
|
version: void 0
|
|
179
149
|
};
|
|
180
|
-
},
|
|
150
|
+
}, ne = (e, t) => {
|
|
181
151
|
let n = `${t == null ? "" : t} ${e}`;
|
|
182
152
|
return /iphone|ipad|ipod/i.test(n) ? "iOS" : /android/i.test(n) ? "Android" : /mac/i.test(n) ? "macOS" : /win/i.test(n) ? "Windows" : /linux/i.test(n) ? "Linux" : "Other";
|
|
183
|
-
},
|
|
153
|
+
}, re = (e) => {
|
|
184
154
|
let t = null;
|
|
185
155
|
try {
|
|
186
156
|
t = window.localStorage.getItem(e);
|
|
187
157
|
} catch (e) {}
|
|
188
158
|
if (t) return t;
|
|
189
|
-
let n =
|
|
159
|
+
let n = h("device");
|
|
190
160
|
try {
|
|
191
161
|
window.localStorage.setItem(e, n);
|
|
192
162
|
} catch (e) {}
|
|
193
163
|
return n;
|
|
194
|
-
},
|
|
164
|
+
}, ie = () => {
|
|
195
165
|
var e, t;
|
|
196
166
|
return typeof window > "u" ? {} : {
|
|
197
167
|
"browser.viewport.width": window.innerWidth,
|
|
@@ -199,8 +169,8 @@ var ae = "BK_RUM_DEVICE_ID", oe = 250, se = () => navigator.connection, ce = ()
|
|
|
199
169
|
"browser.screen.width": (e = window.screen) == null ? void 0 : e.width,
|
|
200
170
|
"browser.screen.height": (t = window.screen) == null ? void 0 : t.height
|
|
201
171
|
};
|
|
202
|
-
},
|
|
203
|
-
let e =
|
|
172
|
+
}, ae = () => {
|
|
173
|
+
let e = T();
|
|
204
174
|
return e ? {
|
|
205
175
|
"network.effective_type": e.effectiveType,
|
|
206
176
|
"network.connection_type": e.type,
|
|
@@ -208,40 +178,40 @@ var ae = "BK_RUM_DEVICE_ID", oe = 250, se = () => navigator.connection, ce = ()
|
|
|
208
178
|
"network.rtt": e.rtt,
|
|
209
179
|
"network.save_data": e.saveData
|
|
210
180
|
} : {};
|
|
211
|
-
},
|
|
181
|
+
}, oe = () => {
|
|
212
182
|
if (typeof navigator > "u") return {};
|
|
213
|
-
let e =
|
|
183
|
+
let e = ee(), t = navigator.userAgent, n = te(t), r = ne(t, e == null ? void 0 : e.platform), i = e != null && e.mobile || /mobi|android|iphone|ipad|ipod/i.test(t) ? "mobile" : "desktop";
|
|
214
184
|
return {
|
|
215
|
-
[
|
|
216
|
-
[
|
|
217
|
-
[
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
[
|
|
185
|
+
[g.deviceMemoryGib]: navigator.deviceMemory,
|
|
186
|
+
[g.deviceLogicalProcessorCount]: navigator.hardwareConcurrency,
|
|
187
|
+
[g.browserName]: n.name,
|
|
188
|
+
[g.browserVersion]: n.version,
|
|
189
|
+
[g.deviceType]: i,
|
|
190
|
+
[g.osName]: r
|
|
221
191
|
};
|
|
222
|
-
},
|
|
192
|
+
}, se = (e, t) => {
|
|
223
193
|
let n;
|
|
224
194
|
return () => {
|
|
225
195
|
n !== void 0 && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
226
196
|
n = void 0, e();
|
|
227
197
|
}, t);
|
|
228
198
|
};
|
|
229
|
-
},
|
|
199
|
+
}, ce = (e = {}) => {
|
|
230
200
|
let t = [];
|
|
231
201
|
return {
|
|
232
202
|
name: "device",
|
|
233
203
|
init(n) {
|
|
234
204
|
var r;
|
|
235
|
-
let i = (r = e.storageKey) == null ? `${
|
|
236
|
-
if (n.setRuntimeAttributes(
|
|
237
|
-
let o =
|
|
238
|
-
n.setRuntimeAttributes(
|
|
239
|
-
},
|
|
205
|
+
let i = (r = e.storageKey) == null ? `${C}_${m(n.config.application.name)}` : r, a = typeof window > "u" || e.persistentId !== !0 ? h("device") : re(i);
|
|
206
|
+
if (n.setRuntimeAttributes(S(S(S({ "device.id": a }, n.config.tracking.device === !1 ? oe() : {}), ie()), ae())), typeof window > "u") return;
|
|
207
|
+
let o = se(() => {
|
|
208
|
+
n.setRuntimeAttributes(ie());
|
|
209
|
+
}, w);
|
|
240
210
|
window.addEventListener("resize", o), window.addEventListener("orientationchange", o), t.push(() => window.removeEventListener("resize", o), () => window.removeEventListener("orientationchange", o));
|
|
241
|
-
let s =
|
|
211
|
+
let s = T();
|
|
242
212
|
if (s && typeof s.addEventListener == "function") {
|
|
243
213
|
let e = () => {
|
|
244
|
-
n.setRuntimeAttributes(
|
|
214
|
+
n.setRuntimeAttributes(ae());
|
|
245
215
|
};
|
|
246
216
|
s.addEventListener("change", e), t.push(() => {
|
|
247
217
|
var t;
|
|
@@ -256,129 +226,98 @@ var ae = "BK_RUM_DEVICE_ID", oe = 250, se = () => navigator.connection, ce = ()
|
|
|
256
226
|
}
|
|
257
227
|
}
|
|
258
228
|
};
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
logs: "logs"
|
|
263
|
-
}, be = (e, t) => `${ve(e == null ? "" : e)}/v1/${ye[t]}`, xe = (e, t) => {
|
|
264
|
-
var n, r, i;
|
|
265
|
-
let a = (n = e.signals) == null ? void 0 : n[t];
|
|
266
|
-
if (a === !1) return !1;
|
|
267
|
-
let o = a == null ? void 0 : a.endpoint, s = e.token || e.headers || a != null && a.headers ? j(j(j({}, e.token ? { Authorization: `Bearer ${e.token}` } : {}), (r = e.headers) == null ? {} : r), (i = a == null ? void 0 : a.headers) == null ? {} : i) : void 0;
|
|
229
|
+
}, le = (e) => e.trim().replace(/\/+$/, ""), ue = (e) => {
|
|
230
|
+
var t;
|
|
231
|
+
let n = e.token || e.headers ? S(S({}, e.token ? { Authorization: `Bearer ${e.token}` } : {}), (t = e.headers) == null ? {} : t) : void 0;
|
|
268
232
|
return {
|
|
269
|
-
concurrencyLimit:
|
|
270
|
-
endpoint:
|
|
271
|
-
headers:
|
|
272
|
-
timeoutMillis:
|
|
233
|
+
concurrencyLimit: e.concurrencyLimit,
|
|
234
|
+
endpoint: `${le(e.endpoint)}/v1/rum`,
|
|
235
|
+
headers: n,
|
|
236
|
+
timeoutMillis: e.timeoutMillis
|
|
273
237
|
};
|
|
274
|
-
},
|
|
238
|
+
}, de = (e) => typeof e != "number" || !Number.isFinite(e) ? 1 : Math.max(0, Math.min(1, e)), fe = (e) => e, pe = (e) => {
|
|
239
|
+
if (!e) return e;
|
|
275
240
|
try {
|
|
276
241
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
277
242
|
return t.username = "", t.password = "", t.search = "", t.hash = "", t.href;
|
|
278
243
|
} catch (t) {
|
|
279
244
|
return e.replace(/[?#].*$/, "");
|
|
280
245
|
}
|
|
281
|
-
},
|
|
246
|
+
}, me = (e) => {
|
|
282
247
|
try {
|
|
283
248
|
return new URL(e, typeof location > "u" ? "http://localhost" : location.href).pathname || "/";
|
|
284
249
|
} catch (t) {
|
|
285
250
|
return e || "/";
|
|
286
251
|
}
|
|
287
|
-
},
|
|
252
|
+
}, he = (e) => {
|
|
288
253
|
var t;
|
|
289
254
|
return {
|
|
290
255
|
environment: (t = e.environment) == null ? "production" : t,
|
|
291
256
|
name: e.name,
|
|
292
257
|
version: e.version
|
|
293
258
|
};
|
|
294
|
-
},
|
|
295
|
-
[
|
|
296
|
-
[
|
|
297
|
-
}, e.version ? { [
|
|
259
|
+
}, ge = (e, t, n) => S(S(S({ [g.deploymentEnvironmentName]: e.environment }, t === !1 ? {} : oe()), {}, {
|
|
260
|
+
[g.rumSchemaVersion]: "2",
|
|
261
|
+
[g.serviceName]: e.name
|
|
262
|
+
}, e.version ? { [g.serviceVersion]: e.version } : {}), {}, {
|
|
263
|
+
[g.sessionSampleRate]: n,
|
|
298
264
|
"telemetry.sdk.language": "webjs",
|
|
299
265
|
"telemetry.sdk.name": "@blueking/open-telemetry",
|
|
300
|
-
"telemetry.sdk.version":
|
|
301
|
-
}),
|
|
302
|
-
var t
|
|
303
|
-
let r = xe(e, "traces"), i = xe(e, "metrics"), a = xe(e, "logs");
|
|
304
|
-
return {
|
|
305
|
-
endpoint: ve((t = e.endpoint) == null ? "" : t) || ((n = [
|
|
306
|
-
r,
|
|
307
|
-
i,
|
|
308
|
-
a
|
|
309
|
-
].find((e) => e !== !1)) == null ? void 0 : n.endpoint) || "",
|
|
310
|
-
traces: r,
|
|
311
|
-
metrics: i,
|
|
312
|
-
logs: a
|
|
313
|
-
};
|
|
314
|
-
}, ke = (e) => {
|
|
266
|
+
"telemetry.sdk.version": p
|
|
267
|
+
}), _e = (e) => {
|
|
268
|
+
var t;
|
|
315
269
|
if (!e) throw Error("[bk-ot] transport is required.");
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
"logs"
|
|
320
|
-
].filter((t) => {
|
|
321
|
-
var n;
|
|
322
|
-
return ((n = e.signals) == null ? void 0 : n[t]) !== !1;
|
|
323
|
-
});
|
|
324
|
-
if (!t.length) throw Error("[bk-ot] at least one transport signal must be enabled.");
|
|
325
|
-
for (let i of t) {
|
|
326
|
-
var n, r;
|
|
327
|
-
let t = (n = e.signals) == null ? void 0 : n[i], a = t ? t.endpoint : void 0;
|
|
328
|
-
if (!(a != null && a.trim()) && !((r = e.endpoint) != null && r.trim())) throw Error(`[bk-ot] transport.signals.${i}.endpoint or transport.endpoint is required.`);
|
|
329
|
-
}
|
|
330
|
-
}, Ae = (e) => {
|
|
331
|
-
var t, n, r, i, a, o, s, c, l, u, d, f, p;
|
|
270
|
+
if (!((t = e.endpoint) != null && t.trim())) throw Error("[bk-ot] transport.endpoint is required.");
|
|
271
|
+
}, ve = (e) => {
|
|
272
|
+
var t, n, r, i, a, o, s, c, l, u, d;
|
|
332
273
|
return {
|
|
333
274
|
beforeSend: (t = e.tracking) == null ? void 0 : t.beforeSend,
|
|
334
275
|
getPageAttributes: (n = (r = e.context) == null || (r = r.attributes) == null ? void 0 : r.page) == null ? (() => ({
|
|
335
276
|
"rum.page.host": typeof window > "u" ? "" : window.location.host,
|
|
336
277
|
"rum.page.path": typeof window > "u" ? "" : window.location.pathname
|
|
337
278
|
})) : n,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
getCustomAttributes: (c = (l = e.context) == null || (l = l.attributes) == null ? void 0 : l.custom) == null ? (() => ({})) : c,
|
|
279
|
+
getErrorAttributes: (i = (a = e.context) == null || (a = a.attributes) == null ? void 0 : a.error) == null ? (() => ({})) : i,
|
|
280
|
+
getCustomAttributes: (o = (s = e.context) == null || (s = s.attributes) == null ? void 0 : s.custom) == null ? (() => ({})) : o,
|
|
341
281
|
getViewPathGroup: (t) => {
|
|
342
282
|
var n, r, i, a;
|
|
343
|
-
return (n = typeof ((r = e.tracking) == null ? void 0 : r.view) == "object" ? (i = (a = e.tracking.view).getPathGroup) == null ? void 0 : i.call(a, t) : void 0) == null ?
|
|
283
|
+
return (n = typeof ((r = e.tracking) == null ? void 0 : r.view) == "object" ? (i = (a = e.tracking.view).getPathGroup) == null ? void 0 : i.call(a, t) : void 0) == null ? me(t) : n;
|
|
344
284
|
},
|
|
345
|
-
redactAttributes: (
|
|
346
|
-
redactUrl: (
|
|
285
|
+
redactAttributes: (c = (l = e.privacy) == null ? void 0 : l.redactAttributes) == null ? fe : c,
|
|
286
|
+
redactUrl: (u = (d = e.privacy) == null ? void 0 : d.redactUrl) == null ? pe : u
|
|
347
287
|
};
|
|
348
|
-
},
|
|
349
|
-
var t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g
|
|
288
|
+
}, ye = (e) => {
|
|
289
|
+
var t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g;
|
|
350
290
|
if (!(!((t = e.application) == null || (t = t.name) == null) && t.trim())) throw Error("[bk-ot] application.name is required.");
|
|
351
|
-
|
|
352
|
-
let
|
|
291
|
+
_e(e.transport);
|
|
292
|
+
let _ = he(e.application), v = typeof ((n = e.tracking) == null ? void 0 : n.view) == "object" ? e.tracking.view : void 0, y = ve(e), b = de((r = e.session) == null ? void 0 : r.sampleRate);
|
|
353
293
|
return {
|
|
354
|
-
application:
|
|
355
|
-
autoStart: (
|
|
356
|
-
debug: (
|
|
357
|
-
enabled: (
|
|
294
|
+
application: _,
|
|
295
|
+
autoStart: (i = e.autoStart) == null ? !0 : i,
|
|
296
|
+
debug: (a = e.debug) == null ? !1 : a,
|
|
297
|
+
enabled: (o = e.enabled) == null ? !0 : o,
|
|
358
298
|
extensions: {
|
|
359
|
-
instrumentations: [...(
|
|
360
|
-
plugins: [...(
|
|
299
|
+
instrumentations: [...(s = (c = e.extensions) == null ? void 0 : c.instrumentations) == null ? [] : s],
|
|
300
|
+
plugins: [...(l = (u = e.extensions) == null ? void 0 : u.plugins) == null ? [] : l]
|
|
361
301
|
},
|
|
362
|
-
hooks:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
user: (y = e.context) == null ? void 0 : y.user,
|
|
302
|
+
hooks: y,
|
|
303
|
+
resourceAttributes: y.redactAttributes(ge(_, (d = e.tracking) == null ? void 0 : d.device, b)),
|
|
304
|
+
session: S(S({}, e.session), {}, { sampleRate: b }),
|
|
305
|
+
spanBatch: e.transport.batch,
|
|
306
|
+
spanProcessor: (f = e.transport.processor) == null ? "batch" : f,
|
|
307
|
+
tracking: (p = e.tracking) == null ? {} : p,
|
|
308
|
+
trackingConsent: (m = (h = e.privacy) == null ? void 0 : h.trackingConsent) == null ? "granted" : m,
|
|
309
|
+
transport: ue(e.transport),
|
|
310
|
+
user: (g = e.context) == null ? void 0 : g.user,
|
|
372
311
|
view: {
|
|
373
|
-
excludedActivityUrls:
|
|
374
|
-
loadingTime: (
|
|
375
|
-
tracking: (
|
|
312
|
+
excludedActivityUrls: v == null ? void 0 : v.excludedActivityUrls,
|
|
313
|
+
loadingTime: (v == null ? void 0 : v.loadingTime) !== !1,
|
|
314
|
+
tracking: (v == null ? void 0 : v.tracking) === "manual" ? "manual" : "auto"
|
|
376
315
|
}
|
|
377
316
|
};
|
|
378
317
|
};
|
|
379
318
|
//#endregion
|
|
380
319
|
//#region \0@oxc-project+runtime@0.128.0/helpers/asyncToGenerator.js
|
|
381
|
-
function
|
|
320
|
+
function be(e, t, n, r, i, a, o) {
|
|
382
321
|
try {
|
|
383
322
|
var s = e[a](o), c = s.value;
|
|
384
323
|
} catch (e) {
|
|
@@ -387,16 +326,16 @@ function Me(e, t, n, r, i, a, o) {
|
|
|
387
326
|
}
|
|
388
327
|
s.done ? t(c) : Promise.resolve(c).then(r, i);
|
|
389
328
|
}
|
|
390
|
-
function
|
|
329
|
+
function E(e) {
|
|
391
330
|
return function() {
|
|
392
331
|
var t = this, n = arguments;
|
|
393
332
|
return new Promise(function(r, i) {
|
|
394
333
|
var a = e.apply(t, n);
|
|
395
334
|
function o(e) {
|
|
396
|
-
|
|
335
|
+
be(a, r, i, o, s, "next", e);
|
|
397
336
|
}
|
|
398
337
|
function s(e) {
|
|
399
|
-
|
|
338
|
+
be(a, r, i, o, s, "throw", e);
|
|
400
339
|
}
|
|
401
340
|
o(void 0);
|
|
402
341
|
});
|
|
@@ -404,13 +343,13 @@ function M(e) {
|
|
|
404
343
|
}
|
|
405
344
|
//#endregion
|
|
406
345
|
//#region src/core/plugin.ts
|
|
407
|
-
var
|
|
346
|
+
var xe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !== !1, Se = (e) => e, Ce = class {
|
|
408
347
|
constructor(e) {
|
|
409
|
-
|
|
348
|
+
b(this, "plugins", void 0), b(this, "startedPlugins", []), this.plugins = e;
|
|
410
349
|
}
|
|
411
350
|
flush() {
|
|
412
351
|
var e = this;
|
|
413
|
-
return
|
|
352
|
+
return E(function* () {
|
|
414
353
|
yield Promise.all(e.startedPlugins.map((e) => Promise.resolve().then(() => {
|
|
415
354
|
var t;
|
|
416
355
|
return (t = e.flush) == null ? void 0 : t.call(e);
|
|
@@ -419,7 +358,7 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
419
358
|
}
|
|
420
359
|
shutdown() {
|
|
421
360
|
var e = this;
|
|
422
|
-
return
|
|
361
|
+
return E(function* () {
|
|
423
362
|
let t = [...e.startedPlugins].reverse();
|
|
424
363
|
for (let e of t) {
|
|
425
364
|
var n;
|
|
@@ -430,8 +369,8 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
430
369
|
}
|
|
431
370
|
start(e) {
|
|
432
371
|
var t = this;
|
|
433
|
-
return
|
|
434
|
-
for (let r of t.plugins) if (
|
|
372
|
+
return E(function* () {
|
|
373
|
+
for (let r of t.plugins) if (xe(r, e.config)) try {
|
|
435
374
|
yield r.init(e), t.startedPlugins.push(r);
|
|
436
375
|
} catch (t) {
|
|
437
376
|
if (e.config.debug) {
|
|
@@ -441,103 +380,38 @@ var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
441
380
|
}
|
|
442
381
|
})();
|
|
443
382
|
}
|
|
444
|
-
},
|
|
383
|
+
}, D = "bk.rum.sampled", we = (e) => {
|
|
445
384
|
let t = 2166136261;
|
|
446
385
|
for (let n = 0; n < e.length; n += 1) t = Math.imul(t ^ e.charCodeAt(n), 16777619);
|
|
447
386
|
return t += t << 13, t ^= t >>> 7, t += t << 3, t ^= t >>> 17, t += t << 5, (t >>> 0) / 4294967296;
|
|
448
|
-
},
|
|
387
|
+
}, Te = ({ application: e, session: t }, n) => t.sampleRate <= 0 ? !1 : t.sampleRate >= 1 ? !0 : we(`${e.name}\0${n}`) < t.sampleRate, Ee = () => typeof window > "u" ? "http://localhost" : window.location.origin, O = (e) => {
|
|
449
388
|
try {
|
|
450
|
-
return new URL(e,
|
|
389
|
+
return new URL(e, Ee()).href;
|
|
451
390
|
} catch (t) {
|
|
452
391
|
return e;
|
|
453
392
|
}
|
|
454
|
-
},
|
|
455
|
-
let n = (e) =>
|
|
393
|
+
}, De = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Oe = (e, t) => {
|
|
394
|
+
let n = (e) => De(e.replace(/[?#].*$/, ""));
|
|
456
395
|
return n(e) === n(t);
|
|
457
|
-
},
|
|
458
|
-
let n = P(t);
|
|
459
|
-
return [
|
|
460
|
-
e.transport.traces,
|
|
461
|
-
e.transport.metrics,
|
|
462
|
-
e.transport.logs
|
|
463
|
-
].filter((e) => e !== !1).some((e) => Be(n, P(e.endpoint)));
|
|
464
|
-
}, He = (e, t) => Ve(e, t), Ue = (e, t) => typeof e == "function" ? e(t) : typeof e == "string" ? t.includes(e) : (e.lastIndex = 0, e.test(t)), F = (e, t) => (Array.isArray(e) ? e : e ? [e] : []).some((e) => Ue(e, t)), We = (e) => typeof e.tracking.request == "object" ? e.tracking.request : void 0, Ge = (e, t) => {
|
|
396
|
+
}, ke = (e, t) => Oe(O(t), O(e.transport.endpoint)), k = (e, t) => ke(e, t), Ae = (e, t) => typeof e == "function" ? e(t) : typeof e == "string" ? t.includes(e) : (e.lastIndex = 0, e.test(t)), A = (e, t) => (Array.isArray(e) ? e : e ? [e] : []).some((e) => Ae(e, t)), je = (e) => typeof e.tracking.request == "object" ? e.tracking.request : void 0, Me = (e, t) => {
|
|
465
397
|
var n;
|
|
466
|
-
return
|
|
467
|
-
},
|
|
398
|
+
return k(e, t) || A((n = je(e)) == null ? void 0 : n.excludedUrls, O(t));
|
|
399
|
+
}, Ne = (e, t) => {
|
|
468
400
|
var n;
|
|
469
|
-
return
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
473
|
-
function qe(e, t) {
|
|
474
|
-
if (e == null) return {};
|
|
475
|
-
var n = {};
|
|
476
|
-
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
477
|
-
if (t.includes(r)) continue;
|
|
478
|
-
n[r] = e[r];
|
|
479
|
-
}
|
|
480
|
-
return n;
|
|
481
|
-
}
|
|
482
|
-
//#endregion
|
|
483
|
-
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
484
|
-
function Je(e, t) {
|
|
485
|
-
if (e == null) return {};
|
|
486
|
-
var n, r, i = qe(e, t);
|
|
487
|
-
if (Object.getOwnPropertySymbols) {
|
|
488
|
-
var a = Object.getOwnPropertySymbols(e);
|
|
489
|
-
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
490
|
-
}
|
|
491
|
-
return i;
|
|
492
|
-
}
|
|
493
|
-
//#endregion
|
|
494
|
-
//#region src/core/processor.ts
|
|
495
|
-
var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
496
|
-
for (let n of Ye) {
|
|
401
|
+
return A((n = je(e)) == null ? void 0 : n.allowedTracingUrls, O(t));
|
|
402
|
+
}, Pe = ["http.url", "url.full"], Fe = "bk.rum.request.discard", Ie = (e) => {
|
|
403
|
+
for (let n of Pe) {
|
|
497
404
|
var t;
|
|
498
405
|
let r = (t = e.attributes) == null ? void 0 : t[n];
|
|
499
406
|
if (typeof r == "string") return r;
|
|
500
407
|
}
|
|
501
|
-
},
|
|
502
|
-
let t = e == null ? void 0 : e[
|
|
408
|
+
}, Le = (e) => {
|
|
409
|
+
let t = e == null ? void 0 : e[g.sessionId];
|
|
503
410
|
return typeof t == "string" && t.length > 0;
|
|
504
|
-
},
|
|
505
|
-
let t = e == null ? void 0 : e[
|
|
411
|
+
}, Re = (e) => {
|
|
412
|
+
let t = e == null ? void 0 : e[g.viewId];
|
|
506
413
|
return typeof t == "string" && t.length > 0;
|
|
507
|
-
},
|
|
508
|
-
constructor(e, t) {
|
|
509
|
-
this.inner = e, this.config = t;
|
|
510
|
-
}
|
|
511
|
-
enabled(e) {
|
|
512
|
-
var t, n, r;
|
|
513
|
-
return (t = (n = (r = this.inner).enabled) == null ? void 0 : n.call(r, e)) == null ? !0 : t;
|
|
514
|
-
}
|
|
515
|
-
forceFlush() {
|
|
516
|
-
return this.inner.forceFlush();
|
|
517
|
-
}
|
|
518
|
-
onEmit(e, t) {
|
|
519
|
-
var n;
|
|
520
|
-
let r = e.body === "session.start" || e.body === "session.rotate";
|
|
521
|
-
if (et(e.attributes) || r && ((n = e.attributes) == null ? void 0 : n["bk.rum.sampled"]) === !0 && Qe(e.attributes)) {
|
|
522
|
-
delete e.attributes[N];
|
|
523
|
-
try {
|
|
524
|
-
var i, a, o, s, c;
|
|
525
|
-
if (((i = this.config) == null || (o = (a = i.hooks).beforeSend) == null ? void 0 : o.call(a, {
|
|
526
|
-
attributes: e.attributes,
|
|
527
|
-
name: (s = e.eventName) == null ? String((c = e.body) == null ? "" : c) : s,
|
|
528
|
-
signal: "log"
|
|
529
|
-
})) === !1) return;
|
|
530
|
-
} catch (e) {
|
|
531
|
-
var l, u;
|
|
532
|
-
(l = this.config) != null && l.debug && ((u = globalThis.console) == null || u.warn("[bk-ot] tracking.beforeSend failed:", e));
|
|
533
|
-
}
|
|
534
|
-
this.inner.onEmit(e, t);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
shutdown() {
|
|
538
|
-
return this.inner.shutdown();
|
|
539
|
-
}
|
|
540
|
-
}, nt = class {
|
|
414
|
+
}, ze = (e) => (e == null ? void 0 : e["bk.rum.sampled"]) === !0 && Le(e) && Re(e), Be = class {
|
|
541
415
|
constructor(e, t, n) {
|
|
542
416
|
this.inner = e, this.config = t, this.getRuntimeAttributes = n;
|
|
543
417
|
}
|
|
@@ -545,9 +419,9 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
545
419
|
return this.inner.forceFlush();
|
|
546
420
|
}
|
|
547
421
|
onEnd(e) {
|
|
548
|
-
let t =
|
|
549
|
-
if (!(e.attributes["bk.rum.request.discard"] === !0 || t &&
|
|
550
|
-
delete e.attributes[
|
|
422
|
+
let t = Ie(e);
|
|
423
|
+
if (!(e.attributes["bk.rum.request.discard"] === !0 || t && ke(this.config, t) || !ze(e.attributes) && !(e.name === "browser.session" && e.attributes["bk.rum.sampled"] === !0 && Le(e.attributes)))) {
|
|
424
|
+
delete e.attributes[D];
|
|
551
425
|
try {
|
|
552
426
|
var n, r;
|
|
553
427
|
if (((n = this.config.hooks) == null || (r = n.beforeSend) == null ? void 0 : r.call(n, {
|
|
@@ -571,34 +445,9 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
571
445
|
shutdown() {
|
|
572
446
|
return this.inner.shutdown();
|
|
573
447
|
}
|
|
574
|
-
},
|
|
575
|
-
let t = e.attributes, { [N]: n } = t, r = Je(t, [N].map(re));
|
|
576
|
-
return j(j({}, e), {}, { attributes: r });
|
|
577
|
-
}) }), it = class {
|
|
578
|
-
constructor(e) {
|
|
579
|
-
this.inner = e;
|
|
580
|
-
}
|
|
581
|
-
export(t, n) {
|
|
582
|
-
let r = j(j({}, t), {}, { scopeMetrics: t.scopeMetrics.map((e) => j(j({}, e), {}, { metrics: e.metrics.map(rt).filter((e) => e.dataPoints.length > 0) })).filter((e) => e.metrics.length > 0) });
|
|
583
|
-
if (r.scopeMetrics.length === 0) {
|
|
584
|
-
n({ code: e.SUCCESS });
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
this.inner.export(r, n);
|
|
588
|
-
}
|
|
589
|
-
forceFlush() {
|
|
590
|
-
return this.inner.forceFlush();
|
|
591
|
-
}
|
|
592
|
-
selectAggregationTemporality(e) {
|
|
593
|
-
var t, n, r;
|
|
594
|
-
return (t = (n = (r = this.inner).selectAggregationTemporality) == null ? void 0 : n.call(r, e)) == null ? i.CUMULATIVE : t;
|
|
595
|
-
}
|
|
596
|
-
shutdown() {
|
|
597
|
-
return this.inner.shutdown();
|
|
598
|
-
}
|
|
599
|
-
}, at = new Set([...Object.values(O), N]), ot = class {
|
|
448
|
+
}, Ve = new Set([...Object.values(g), D]), He = class {
|
|
600
449
|
constructor(e = {}, t) {
|
|
601
|
-
|
|
450
|
+
b(this, "actionHistory", []), b(this, "attributes", {}), b(this, "queuedViewCommands", []), b(this, "recordAssociation", (e, t, n, r) => {
|
|
602
451
|
let i = e.at(-1);
|
|
603
452
|
if (i && i.endedAt === void 0 && (i.endedAt = Math.max(i.startedAt, n)), r) {
|
|
604
453
|
let r = {};
|
|
@@ -612,19 +461,19 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
612
461
|
});
|
|
613
462
|
}
|
|
614
463
|
e.length > 100 && e.splice(0, e.length - 100);
|
|
615
|
-
}),
|
|
464
|
+
}), b(this, "sessionHistory", []), b(this, "sessionLifecycleListeners", /* @__PURE__ */ new Set()), b(this, "setOptionalAttribute", (e, t) => {
|
|
616
465
|
if (t === void 0) {
|
|
617
466
|
delete this.attributes[e];
|
|
618
467
|
return;
|
|
619
468
|
}
|
|
620
469
|
this.attributes[e] = t;
|
|
621
|
-
}),
|
|
470
|
+
}), b(this, "user", {}), b(this, "view", {}), b(this, "viewAttributeKeys", /* @__PURE__ */ new Set()), b(this, "viewChangeListeners", /* @__PURE__ */ new Set()), b(this, "viewCommandListeners", /* @__PURE__ */ new Set()), b(this, "viewHistory", []), b(this, "viewScopedAttributeKeys", /* @__PURE__ */ new Set()), b(this, "dispatchViewCommand", (e) => {
|
|
622
471
|
if (this.viewCommandListeners.size === 0) {
|
|
623
472
|
this.queuedViewCommands.push(e);
|
|
624
473
|
return;
|
|
625
474
|
}
|
|
626
475
|
this.viewCommandListeners.forEach((t) => t(e));
|
|
627
|
-
}),
|
|
476
|
+
}), b(this, "getAttributes", () => S({}, this.attributes)), b(this, "getAttributesAt", (e) => {
|
|
628
477
|
if (!Number.isFinite(e)) return this.getAttributes();
|
|
629
478
|
let t = this.getAttributes(), n = (n, r) => {
|
|
630
479
|
for (let e of r) delete t[e];
|
|
@@ -632,16 +481,16 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
632
481
|
i && Object.assign(t, i.attributes);
|
|
633
482
|
};
|
|
634
483
|
return n(this.sessionHistory, [
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
]), n(this.viewHistory, this.viewScopedAttributeKeys), n(this.actionHistory, [
|
|
639
|
-
}),
|
|
484
|
+
g.sessionId,
|
|
485
|
+
g.sessionHasReplay,
|
|
486
|
+
D
|
|
487
|
+
]), n(this.viewHistory, this.viewScopedAttributeKeys), n(this.actionHistory, [g.actionId]), t;
|
|
488
|
+
}), b(this, "getUser", () => S({}, this.user)), b(this, "getView", () => S({}, this.view)), b(this, "isSessionActive", () => typeof this.attributes[g.sessionId] == "string"), b(this, "isViewActive", () => typeof this.attributes[g.viewId] == "string"), b(this, "notifySessionLifecycle", (e) => {
|
|
640
489
|
this.sessionLifecycleListeners.forEach((t) => t(e));
|
|
641
|
-
}),
|
|
490
|
+
}), b(this, "onSessionLifecycle", (e) => (this.sessionLifecycleListeners.add(e), () => this.sessionLifecycleListeners.delete(e))), b(this, "onViewChange", (e) => (this.viewChangeListeners.add(e), this.view.id && e(this.getView()), () => this.viewChangeListeners.delete(e))), b(this, "onViewCommand", (e) => {
|
|
642
491
|
for (this.viewCommandListeners.add(e); this.queuedViewCommands.length;) e(this.queuedViewCommands.shift());
|
|
643
492
|
return () => this.viewCommandListeners.delete(e);
|
|
644
|
-
}),
|
|
493
|
+
}), b(this, "setAttributes", (e, t = Date.now()) => {
|
|
645
494
|
for (let [t, n] of Object.entries(e)) {
|
|
646
495
|
if (n === void 0) {
|
|
647
496
|
delete this.attributes[t];
|
|
@@ -649,43 +498,43 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
649
498
|
}
|
|
650
499
|
this.attributes[t] = n;
|
|
651
500
|
}
|
|
652
|
-
if (
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
], t, typeof this.attributes[
|
|
657
|
-
let e = this.attributes[
|
|
658
|
-
this.recordAssociation(this.actionHistory, [
|
|
501
|
+
if (g.sessionId in e && this.recordAssociation(this.sessionHistory, [
|
|
502
|
+
g.sessionId,
|
|
503
|
+
g.sessionHasReplay,
|
|
504
|
+
D
|
|
505
|
+
], t, typeof this.attributes[g.sessionId] == "string"), g.actionId in e) {
|
|
506
|
+
let e = this.attributes[g.actionId];
|
|
507
|
+
this.recordAssociation(this.actionHistory, [g.actionId], t, Array.isArray(e) ? e.length > 0 : typeof e == "string");
|
|
659
508
|
}
|
|
660
|
-
}),
|
|
661
|
-
if (this.user =
|
|
509
|
+
}), b(this, "setUser", (e) => {
|
|
510
|
+
if (this.user = S(S({}, this.user), e), "id" in e) {
|
|
662
511
|
if (e.id === void 0) {
|
|
663
|
-
delete this.attributes[
|
|
512
|
+
delete this.attributes[g.userId];
|
|
664
513
|
return;
|
|
665
514
|
}
|
|
666
|
-
this.attributes[
|
|
515
|
+
this.attributes[g.userId] = e.id;
|
|
667
516
|
}
|
|
668
|
-
}),
|
|
517
|
+
}), b(this, "setView", (e, t = ((t) => (t = e.startedAt) == null ? Date.now() : t)()) => {
|
|
669
518
|
var n;
|
|
670
519
|
this.viewAttributeKeys.forEach((e) => delete this.attributes[e]), this.viewAttributeKeys.clear();
|
|
671
520
|
let r = {};
|
|
672
|
-
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 ||
|
|
673
|
-
this.view =
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
521
|
+
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 || Ve.has(t) || (r[t] = i, this.attributes[t] = i, this.viewAttributeKeys.add(t), this.viewScopedAttributeKeys.add(t));
|
|
522
|
+
this.view = S(S({}, e), {}, { attributes: r }), this.setOptionalAttribute(g.viewId, e.id), this.setOptionalAttribute(g.viewUrl, e.url), this.setOptionalAttribute(g.viewUrlPathGroup, e.urlPathGroup), this.setOptionalAttribute(g.viewLoadingType, e.loadingType), this.setOptionalAttribute(g.viewName, e.name), [
|
|
523
|
+
g.viewId,
|
|
524
|
+
g.viewUrl,
|
|
525
|
+
g.viewUrlPathGroup,
|
|
526
|
+
g.viewLoadingType,
|
|
527
|
+
g.viewName
|
|
679
528
|
].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()));
|
|
680
529
|
}), this.setAttributes(e), t && this.setUser(t);
|
|
681
530
|
}
|
|
682
|
-
},
|
|
531
|
+
}, j = {
|
|
683
532
|
abort: "abort",
|
|
684
533
|
error: "error",
|
|
685
534
|
success: "success",
|
|
686
535
|
timeout: "timeout",
|
|
687
536
|
warning: "warning"
|
|
688
|
-
},
|
|
537
|
+
}, M = {
|
|
689
538
|
action: "action",
|
|
690
539
|
custom: "custom",
|
|
691
540
|
document: "document",
|
|
@@ -693,8 +542,10 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
693
542
|
longtask: "longtask",
|
|
694
543
|
resource: "resource",
|
|
695
544
|
route: "route",
|
|
696
|
-
|
|
697
|
-
|
|
545
|
+
session: "session",
|
|
546
|
+
vital: "vital",
|
|
547
|
+
websocket: "websocket"
|
|
548
|
+
}, Ue = (e) => e === 408 || e === 504 ? j.timeout : typeof e == "number" && e >= 400 ? j.error : j.success, We = (e) => e === 408 || e === 504 ? "network_timeout" : typeof e != "number" || e < 400 ? "none" : e >= 500 ? "http_5xx" : "http_4xx", Ge = (e) => e === "good" ? j.success : j.warning, Ke = (e) => {
|
|
698
549
|
if (!e) return {};
|
|
699
550
|
try {
|
|
700
551
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
@@ -705,39 +556,39 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
705
556
|
} catch (e) {
|
|
706
557
|
return {};
|
|
707
558
|
}
|
|
708
|
-
},
|
|
709
|
-
[
|
|
710
|
-
[
|
|
711
|
-
[
|
|
712
|
-
[
|
|
713
|
-
}),
|
|
714
|
-
let o =
|
|
715
|
-
return
|
|
716
|
-
errorType: n ? "network" : typeof r == "number" ?
|
|
559
|
+
}, N = ({ errorType: e = "none", result: t = j.success, spanSubtype: n, spanType: r }) => ({
|
|
560
|
+
[g.spanType]: r,
|
|
561
|
+
[g.spanSubtype]: n,
|
|
562
|
+
[g.result]: t,
|
|
563
|
+
[g.errorType]: e
|
|
564
|
+
}), qe = ({ initiatorType: e = "other", method: t, networkError: n = !1, responseStatus: r, transferSize: i, url: a }) => {
|
|
565
|
+
let o = Ke(a), s = n ? j.error : typeof r == "number" ? Ue(r) : j.success, c = t == null ? void 0 : t.toUpperCase();
|
|
566
|
+
return S(S(S(S(S(S({}, N({
|
|
567
|
+
errorType: n ? "network" : typeof r == "number" ? We(r) : "none",
|
|
717
568
|
result: s,
|
|
718
569
|
spanSubtype: e,
|
|
719
|
-
spanType:
|
|
570
|
+
spanType: M.resource
|
|
720
571
|
})), o.serverAddress ? { "server.address": o.serverAddress } : {}), o.serverPort === void 0 ? {} : { "server.port": o.serverPort }), {}, { "resource.type": e }, c ? { "http.request.method": c } : {}), typeof i == "number" ? { "resource.size": i } : {}), typeof r == "number" ? { "http.response.status_code": r } : {});
|
|
721
|
-
},
|
|
572
|
+
}, Je = 100, Ye = 100, Xe = 1e3, Ze = 100, Qe = 1e4, $e = "data-bk-action-name", et = 100, tt = 10, P = (e) => e.replace(/\s+/g, " ").trim().slice(0, et), F = (e) => {
|
|
722
573
|
var t;
|
|
723
574
|
if (e.parentElement) return e.parentElement;
|
|
724
575
|
let n = (t = e.getRootNode) == null ? void 0 : t.call(e);
|
|
725
576
|
return typeof ShadowRoot < "u" && n instanceof ShadowRoot ? n.host : null;
|
|
726
|
-
},
|
|
577
|
+
}, nt = (e, t) => {
|
|
727
578
|
let n = e;
|
|
728
579
|
for (; n;) {
|
|
729
580
|
let e = n.getAttribute(t);
|
|
730
|
-
if (e) return
|
|
731
|
-
n =
|
|
581
|
+
if (e) return P(e);
|
|
582
|
+
n = F(n);
|
|
732
583
|
}
|
|
733
|
-
},
|
|
584
|
+
}, I = (e) => {
|
|
734
585
|
var t;
|
|
735
|
-
return e.isContentEditable ? "" :
|
|
736
|
-
},
|
|
586
|
+
return e.isContentEditable ? "" : P((t = e.textContent) == null ? "" : t);
|
|
587
|
+
}, rt = (e) => {
|
|
737
588
|
var t, n;
|
|
738
589
|
let r = e, i = (t = r.labels) == null ? void 0 : t[0];
|
|
739
590
|
if (i) {
|
|
740
|
-
let e =
|
|
591
|
+
let e = I(i);
|
|
741
592
|
if (e) return e;
|
|
742
593
|
}
|
|
743
594
|
let a = e.tagName.toLowerCase(), o = (n = e.getAttribute("type")) == null ? void 0 : n.toLowerCase();
|
|
@@ -747,11 +598,11 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
747
598
|
"submit"
|
|
748
599
|
].includes(o == null ? "" : o)) {
|
|
749
600
|
var s;
|
|
750
|
-
let e =
|
|
601
|
+
let e = P((s = r.value) == null ? "" : s);
|
|
751
602
|
if (e) return e;
|
|
752
603
|
}
|
|
753
604
|
if (a === "button" || a === "label" || e.getAttribute("role") === "button") {
|
|
754
|
-
let t =
|
|
605
|
+
let t = I(e);
|
|
755
606
|
if (t) return t;
|
|
756
607
|
}
|
|
757
608
|
for (let t of [
|
|
@@ -762,39 +613,39 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
762
613
|
"placeholder"
|
|
763
614
|
]) {
|
|
764
615
|
var c;
|
|
765
|
-
let n =
|
|
616
|
+
let n = P((c = e.getAttribute(t)) == null ? "" : c);
|
|
766
617
|
if (n) return n;
|
|
767
618
|
}
|
|
768
|
-
},
|
|
769
|
-
let r =
|
|
619
|
+
}, it = (e, t = $e, n = !1) => {
|
|
620
|
+
let r = nt(e, t);
|
|
770
621
|
if (r) return r;
|
|
771
622
|
if (!n) return e.tagName.toLowerCase();
|
|
772
623
|
let i = e, a = 0;
|
|
773
|
-
for (; i && a <=
|
|
624
|
+
for (; i && a <= tt;) {
|
|
774
625
|
let e = i.tagName.toLowerCase();
|
|
775
626
|
if (e === "body" || e === "html" || e === "head") break;
|
|
776
|
-
let t =
|
|
627
|
+
let t = rt(i);
|
|
777
628
|
if (t) return t;
|
|
778
629
|
if (e === "form") break;
|
|
779
|
-
i =
|
|
630
|
+
i = F(i), a += 1;
|
|
780
631
|
}
|
|
781
|
-
for (i = e, a = 0; i && a <=
|
|
632
|
+
for (i = e, a = 0; i && a <= tt;) {
|
|
782
633
|
let e = i.tagName.toLowerCase();
|
|
783
634
|
if (e === "body" || e === "html" || e === "head") break;
|
|
784
|
-
let t =
|
|
635
|
+
let t = I(i);
|
|
785
636
|
if (t) return t;
|
|
786
637
|
if (e === "form") break;
|
|
787
|
-
i =
|
|
638
|
+
i = F(i), a += 1;
|
|
788
639
|
}
|
|
789
640
|
return e.tagName.toLowerCase();
|
|
790
|
-
},
|
|
641
|
+
}, at = (e) => {
|
|
791
642
|
var t;
|
|
792
643
|
let n = (t = e.composedPath) == null ? void 0 : t.call(e)[0];
|
|
793
644
|
return n instanceof Element ? n : e.target instanceof Element ? e.target : void 0;
|
|
794
|
-
},
|
|
645
|
+
}, ot = (e) => {
|
|
795
646
|
let t = e.timeStamp;
|
|
796
647
|
return !Number.isFinite(t) || t <= 0 ? Date.now() : t > 0xe8d4a51000 ? t : typeof performance > "u" ? Date.now() : performance.timeOrigin + t;
|
|
797
|
-
},
|
|
648
|
+
}, st = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, ct = (e) => {
|
|
798
649
|
let t = e;
|
|
799
650
|
if (t.tagName.toLowerCase() === "label" && t.hasAttribute("for")) {
|
|
800
651
|
var n;
|
|
@@ -814,95 +665,88 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
814
665
|
"submit"
|
|
815
666
|
].includes((r = (i = t.getAttribute("type")) == null ? void 0 : i.toLowerCase()) == null ? "text" : r);
|
|
816
667
|
}
|
|
817
|
-
t =
|
|
668
|
+
t = F(t);
|
|
818
669
|
}
|
|
819
670
|
return !1;
|
|
820
|
-
},
|
|
821
|
-
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute ||
|
|
822
|
-
s == null || s.setRuntimeAttributes({ [
|
|
823
|
-
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
let n = [
|
|
671
|
+
}, lt = (e = {}) => {
|
|
672
|
+
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute || $e, a = st(e.maxDuration, Qe), o = [], s, c = () => {
|
|
673
|
+
s == null || s.setRuntimeAttributes({ [g.actionId]: n.size ? [...n.keys()] : void 0 });
|
|
674
|
+
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !ct(e.target), u = (e) => {
|
|
675
|
+
if (!r.delete(e) || !s || !e.completed) return;
|
|
676
|
+
clearTimeout(e.reportTimer), e.hadError && e.frustrations.add("error_click"), l(e) && e.frustrations.add("dead_click");
|
|
677
|
+
let t = [
|
|
828
678
|
"rage_click",
|
|
829
679
|
"dead_click",
|
|
830
680
|
"error_click"
|
|
831
|
-
].filter((t) => e.frustrations.has(t)), { endTime:
|
|
832
|
-
s.startSpan("action.click",
|
|
833
|
-
errorType: e.
|
|
834
|
-
result:
|
|
681
|
+
].filter((t) => e.frustrations.has(t)), { endTime: n, hasLoadingTime: i } = e.completed, a = Math.max(0, n - e.startTime), o = e.hadError || t.length > 0;
|
|
682
|
+
s.startSpan("action.click", S(S(S(S(S({}, s.config.hooks.getPageAttributes()), N({
|
|
683
|
+
errorType: e.hadError ? "js" : t.length ? "frustration" : "none",
|
|
684
|
+
result: o ? j.warning : j.success,
|
|
835
685
|
spanSubtype: "click",
|
|
836
|
-
spanType:
|
|
686
|
+
spanType: M.action
|
|
837
687
|
})), e.runtimeAttributes), {}, {
|
|
838
|
-
[
|
|
839
|
-
[
|
|
840
|
-
[
|
|
841
|
-
[
|
|
842
|
-
[
|
|
843
|
-
[
|
|
844
|
-
[
|
|
845
|
-
[
|
|
846
|
-
|
|
847
|
-
}, n.length ? { [O.actionFrustrationType]: n } : {}), a ? { [O.actionLoadingTime]: o } : {}), { startTime: e.startTime }).end(a ? i : e.startTime);
|
|
688
|
+
[g.eventId]: h("event"),
|
|
689
|
+
[g.eventTimestamp]: e.startTime,
|
|
690
|
+
[g.eventType]: "action",
|
|
691
|
+
[g.actionId]: e.id,
|
|
692
|
+
[g.actionType]: "click",
|
|
693
|
+
[g.actionName]: `Click on ${e.targetName}`,
|
|
694
|
+
[g.actionTargetName]: e.targetName,
|
|
695
|
+
[g.actionTargetTag]: e.targetTag
|
|
696
|
+
}, t.length ? { [g.actionFrustrationType]: t } : {}), i ? { [g.actionLoadingTime]: a } : {}), { startTime: e.startTime }).end(i ? n : e.startTime);
|
|
848
697
|
}, d = (e, t, i) => {
|
|
849
698
|
if (!n.delete(e.id) || !s) return;
|
|
850
699
|
clearTimeout(e.validationTimer), clearTimeout(e.quietTimer), clearTimeout(e.maxDurationTimer), c(), e.completed = {
|
|
851
700
|
endTime: t,
|
|
852
701
|
hasLoadingTime: i
|
|
853
702
|
}, r.add(e);
|
|
854
|
-
let a = Math.max(0, e.startTime +
|
|
703
|
+
let a = Math.max(0, e.startTime + Xe - Date.now());
|
|
855
704
|
e.reportTimer = setTimeout(() => u(e), a);
|
|
856
705
|
}, f = () => {
|
|
857
706
|
[...r].forEach(u);
|
|
858
707
|
}, p = (e) => {
|
|
859
708
|
if (clearTimeout(e.quietTimer), !e.hadActivity || e.pendingRequests.size) return;
|
|
860
|
-
let t = Math.max(0, e.lastActivityTime +
|
|
709
|
+
let t = Math.max(0, e.lastActivityTime + Ye - Date.now());
|
|
861
710
|
e.quietTimer = setTimeout(() => d(e, e.lastActivityTime, !0), t);
|
|
862
711
|
}, m = (e, t) => {
|
|
863
712
|
e.hadActivity = !0, e.lastActivityTime = Math.max(e.lastActivityTime, t), p(e);
|
|
864
|
-
},
|
|
713
|
+
}, _ = (e, t) => t >= e.startTime && t <= e.startTime + a, v = (e) => {
|
|
865
714
|
for (let i of n.values()) {
|
|
866
715
|
if (e.type === "request_start") {
|
|
867
716
|
var t;
|
|
868
|
-
if (e.url &&
|
|
717
|
+
if (e.url && A(s == null || (t = s.config.view) == null ? void 0 : t.excludedActivityUrls, e.url) || !_(i, e.time)) continue;
|
|
869
718
|
i.pendingRequests.add(e.id), m(i, e.time);
|
|
870
719
|
continue;
|
|
871
720
|
}
|
|
872
721
|
if (e.type === "request_end") {
|
|
873
722
|
if (!i.pendingRequests.delete(e.id)) continue;
|
|
874
|
-
|
|
723
|
+
m(i, e.time);
|
|
875
724
|
continue;
|
|
876
725
|
}
|
|
877
726
|
if (e.type === "long_task" || e.type === "resource") {
|
|
878
727
|
var r;
|
|
879
|
-
if (e.type === "resource" && e.url &&
|
|
880
|
-
|
|
728
|
+
if (e.type === "resource" && e.url && A(s == null || (r = s.config.view) == null ? void 0 : r.excludedActivityUrls, e.url) || e.startTime > i.startTime + a || (e.type === "resource" ? e.startTime < i.startTime : e.endTime < i.startTime)) continue;
|
|
729
|
+
m(i, e.endTime);
|
|
881
730
|
continue;
|
|
882
731
|
}
|
|
883
732
|
if (e.type === "dom_mutation" || e.type === "window_open") {
|
|
884
|
-
|
|
733
|
+
_(i, e.time) && m(i, e.time);
|
|
885
734
|
continue;
|
|
886
735
|
}
|
|
887
|
-
e.type === "error" &&
|
|
736
|
+
e.type === "error" && _(i, e.time) && (i.hadError = !0, m(i, e.time));
|
|
888
737
|
}
|
|
889
|
-
},
|
|
738
|
+
}, y = (e = Date.now()) => {
|
|
890
739
|
[...n.values()].forEach((t) => d(t, e, t.hadActivity));
|
|
891
|
-
},
|
|
740
|
+
}, b = (e, t) => {
|
|
892
741
|
let n = "clientX" in t && typeof t.clientX == "number" ? t.clientX : 0, r = "clientY" in t && typeof t.clientY == "number" ? t.clientY : 0;
|
|
893
|
-
o = o.filter((t) => e.startTime - t.action.startTime <=
|
|
894
|
-
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) <=
|
|
895
|
-
|
|
742
|
+
o = o.filter((t) => e.startTime - t.action.startTime <= Xe);
|
|
743
|
+
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) <= Ze;
|
|
744
|
+
(a || i && !s) && (o = []), o.push({
|
|
896
745
|
action: e,
|
|
897
746
|
target: e.target,
|
|
898
747
|
x: n,
|
|
899
748
|
y: r
|
|
900
|
-
}), o.length >= 3 && e.startTime - o[o.length - 3].action.startTime <=
|
|
901
|
-
let t = o.slice(-3).map((e) => e.action);
|
|
902
|
-
t.slice(0, -1).forEach((e) => {
|
|
903
|
-
e.discardedByRage = !0;
|
|
904
|
-
}), e.frustrations.add("rage_click"), e.rageSources = t, o = [];
|
|
905
|
-
}
|
|
749
|
+
}), o.length >= 3 && e.startTime - o[o.length - 3].action.startTime <= Xe && (o.slice(-3).map((e) => e.action).forEach((e) => e.frustrations.add("rage_click")), o = []);
|
|
906
750
|
};
|
|
907
751
|
return {
|
|
908
752
|
name: "action",
|
|
@@ -913,17 +757,13 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
913
757
|
capture: !0,
|
|
914
758
|
passive: !0
|
|
915
759
|
}, p = (t) => {
|
|
916
|
-
if (!
|
|
917
|
-
let r =
|
|
760
|
+
if (!l.isSampled() || "button" in t && typeof t.button == "number" && t.button !== 0) return;
|
|
761
|
+
let r = at(t);
|
|
918
762
|
if (!r) return;
|
|
919
|
-
let o =
|
|
920
|
-
counts: {
|
|
921
|
-
error: 0,
|
|
922
|
-
longTask: 0,
|
|
923
|
-
resource: 0
|
|
924
|
-
},
|
|
763
|
+
let o = ot(t), s = h("action"), u = {
|
|
925
764
|
frustrations: /* @__PURE__ */ new Set(),
|
|
926
765
|
hadActivity: !1,
|
|
766
|
+
hadError: !1,
|
|
927
767
|
id: s,
|
|
928
768
|
lastActivityTime: o,
|
|
929
769
|
maxDurationTimer: setTimeout(() => d(u, o + a, !0), a),
|
|
@@ -931,7 +771,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
931
771
|
runtimeAttributes: l.getRuntimeAttributes(),
|
|
932
772
|
startTime: o,
|
|
933
773
|
target: r,
|
|
934
|
-
targetName:
|
|
774
|
+
targetName: it(r, i, e.nameCollection === "text"),
|
|
935
775
|
targetTag: r.tagName.toLowerCase(),
|
|
936
776
|
userActivity: {
|
|
937
777
|
input: !1,
|
|
@@ -940,55 +780,50 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
940
780
|
},
|
|
941
781
|
validationTimer: setTimeout(() => {
|
|
942
782
|
u.hadActivity || d(u, u.startTime, !1);
|
|
943
|
-
},
|
|
783
|
+
}, Je)
|
|
944
784
|
};
|
|
945
|
-
n.set(s, u),
|
|
785
|
+
n.set(s, u), b(u, t), c();
|
|
946
786
|
};
|
|
947
787
|
window.addEventListener("click", p, u), t.push(() => window.removeEventListener("click", p, u));
|
|
948
|
-
let m = l.onActivity(
|
|
949
|
-
e.type === "expired" && (
|
|
788
|
+
let m = l.onActivity(v), g = l.onSessionLifecycle((e) => {
|
|
789
|
+
e.type === "expired" && (y(e.expiredAt), f());
|
|
950
790
|
});
|
|
951
|
-
t.push(m,
|
|
952
|
-
let
|
|
953
|
-
document.visibilityState === "hidden" && (
|
|
954
|
-
},
|
|
955
|
-
|
|
791
|
+
t.push(m, g);
|
|
792
|
+
let _ = () => {
|
|
793
|
+
document.visibilityState === "hidden" && (y(), f());
|
|
794
|
+
}, x = () => {
|
|
795
|
+
y(), f();
|
|
956
796
|
};
|
|
957
|
-
window.addEventListener("pagehide",
|
|
958
|
-
let
|
|
797
|
+
window.addEventListener("pagehide", x), document.addEventListener("visibilitychange", _), t.push(() => window.removeEventListener("pagehide", x), () => document.removeEventListener("visibilitychange", _));
|
|
798
|
+
let S = (e) => {
|
|
959
799
|
new Set([
|
|
960
800
|
...n.values(),
|
|
961
801
|
...r,
|
|
962
802
|
...o.map((e) => e.action)
|
|
963
803
|
]).forEach((t) => {
|
|
964
|
-
|
|
965
|
-
var n;
|
|
966
|
-
(n = t.rageSources) == null || n.slice(0, -1).forEach((e) => {
|
|
967
|
-
e.discardedByRage = !1;
|
|
968
|
-
}), t.rageSources = void 0;
|
|
969
|
-
}
|
|
804
|
+
t.userActivity[e] = !0, e !== "input" && t.frustrations.delete("rage_click");
|
|
970
805
|
});
|
|
971
|
-
},
|
|
972
|
-
window.addEventListener("input",
|
|
806
|
+
}, C = () => S("input"), w = () => S("scroll"), T = () => S("selection");
|
|
807
|
+
window.addEventListener("input", C, u), window.addEventListener("scroll", w, u), document.addEventListener("selectionchange", T, u), t.push(() => window.removeEventListener("input", C, u), () => window.removeEventListener("scroll", w, u), () => document.removeEventListener("selectionchange", T, u));
|
|
973
808
|
},
|
|
974
809
|
shutdown() {
|
|
975
|
-
for (
|
|
810
|
+
for (y(), f(); t.length;) {
|
|
976
811
|
var e;
|
|
977
812
|
(e = t.pop()) == null || e();
|
|
978
813
|
}
|
|
979
814
|
o = [], s = void 0;
|
|
980
815
|
}
|
|
981
816
|
};
|
|
982
|
-
},
|
|
817
|
+
}, ut = "data-bk-excluded-activity-mutations", dt = (e) => {
|
|
983
818
|
let t = e.type === "characterData" ? e.target.parentElement : e.target;
|
|
984
819
|
return t instanceof Element && !!t.closest("[data-bk-excluded-activity-mutations]");
|
|
985
|
-
},
|
|
820
|
+
}, ft = () => {
|
|
986
821
|
let e, t = [];
|
|
987
822
|
return {
|
|
988
823
|
name: "activity",
|
|
989
824
|
init(n) {
|
|
990
825
|
if (typeof document < "u" && typeof MutationObserver < "u" && (e = new MutationObserver((e) => {
|
|
991
|
-
e.length && !e.every(
|
|
826
|
+
e.length && !e.every(dt) && n.notifyActivity({
|
|
992
827
|
time: Date.now(),
|
|
993
828
|
type: "dom_mutation"
|
|
994
829
|
});
|
|
@@ -1012,7 +847,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1012
847
|
for (e == null || e.disconnect(), e = void 0; t.length;) (n = t.pop()) == null || n();
|
|
1013
848
|
}
|
|
1014
849
|
};
|
|
1015
|
-
},
|
|
850
|
+
}, pt = (e, t) => !!(t && A(e.config.view.excludedActivityUrls, t)), mt = (e, t, n) => {
|
|
1016
851
|
let r = /* @__PURE__ */ new Set(), i = !1, a = !1, o = t, s, c = (e) => {
|
|
1017
852
|
i || (i = !0, clearTimeout(f), clearTimeout(s), d(), n(e));
|
|
1018
853
|
}, l = () => {
|
|
@@ -1025,7 +860,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1025
860
|
}, d = e.onActivity((n) => {
|
|
1026
861
|
if (!(n.type === "error" || n.type === "long_task")) {
|
|
1027
862
|
if (n.type === "request_start") {
|
|
1028
|
-
if (n.time < t ||
|
|
863
|
+
if (n.time < t || pt(e, n.url)) return;
|
|
1029
864
|
r.add(n.id), u(n.time);
|
|
1030
865
|
return;
|
|
1031
866
|
}
|
|
@@ -1035,7 +870,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1035
870
|
return;
|
|
1036
871
|
}
|
|
1037
872
|
if (n.type === "resource") {
|
|
1038
|
-
if (n.endTime < t ||
|
|
873
|
+
if (n.endTime < t || pt(e, n.url)) return;
|
|
1039
874
|
u(n.endTime);
|
|
1040
875
|
return;
|
|
1041
876
|
}
|
|
@@ -1047,10 +882,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1047
882
|
return () => {
|
|
1048
883
|
i || (i = !0, clearTimeout(f), clearTimeout(s), d());
|
|
1049
884
|
};
|
|
1050
|
-
},
|
|
1051
|
-
let t = Rt(e);
|
|
1052
|
-
return t ? { [O.viewUrlPathGroup]: t } : {};
|
|
1053
|
-
}, B = (e) => j(j({}, zt(e[O.viewUrlPathGroup])), {}, { [N]: e[N] === !0 }), Bt = 1e3, Vt = 200, Ht = "body", Ut = .8, Wt = [
|
|
885
|
+
}, ht = 1e3, gt = 200, _t = "body", vt = .8, yt = [
|
|
1054
886
|
"[data-loading=\"true\"]",
|
|
1055
887
|
"[aria-busy=\"true\"]",
|
|
1056
888
|
".loading",
|
|
@@ -1058,7 +890,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1058
890
|
".spinner",
|
|
1059
891
|
".skeleton",
|
|
1060
892
|
".bk-loading"
|
|
1061
|
-
],
|
|
893
|
+
], L = [
|
|
1062
894
|
[.2, .2],
|
|
1063
895
|
[.5, .2],
|
|
1064
896
|
[.8, .2],
|
|
@@ -1068,45 +900,45 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1068
900
|
[.2, .8],
|
|
1069
901
|
[.5, .8],
|
|
1070
902
|
[.8, .8]
|
|
1071
|
-
],
|
|
903
|
+
], bt = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, xt = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.min(1, e)) : t, St = (e) => {
|
|
1072
904
|
if (!e) return "";
|
|
1073
905
|
let t = e.tagName.toLowerCase();
|
|
1074
906
|
return e.id ? `${t}#${e.id}` : t;
|
|
1075
|
-
},
|
|
907
|
+
}, Ct = (e, t) => t.some((t) => {
|
|
1076
908
|
try {
|
|
1077
909
|
return e.matches(t) || !!e.closest(t);
|
|
1078
910
|
} catch (e) {
|
|
1079
911
|
return !1;
|
|
1080
912
|
}
|
|
1081
|
-
}),
|
|
913
|
+
}), wt = (e) => {
|
|
1082
914
|
if (typeof getComputedStyle != "function") return !0;
|
|
1083
915
|
let t = getComputedStyle(e);
|
|
1084
916
|
return t.display !== "none" && t.visibility !== "hidden" && Number(t.opacity || 1) > 0;
|
|
1085
|
-
},
|
|
917
|
+
}, Tt = (e, t) => {
|
|
1086
918
|
if (typeof document.elementsFromPoint == "function") return document.elementsFromPoint(e, t);
|
|
1087
919
|
let n = document.elementFromPoint(e, t);
|
|
1088
920
|
return n ? [n] : [];
|
|
1089
|
-
},
|
|
921
|
+
}, Et = (e, t) => {
|
|
1090
922
|
let n = document.querySelector(e);
|
|
1091
923
|
if (!n) return {
|
|
1092
|
-
centerElement:
|
|
1093
|
-
emptyCount:
|
|
924
|
+
centerElement: St(Tt(window.innerWidth / 2, window.innerHeight / 2)[0]),
|
|
925
|
+
emptyCount: L.length,
|
|
1094
926
|
ignoredCount: 0,
|
|
1095
927
|
reason: "missing_root",
|
|
1096
928
|
rootFound: !1,
|
|
1097
929
|
score: 1,
|
|
1098
|
-
validCount:
|
|
930
|
+
validCount: L.length
|
|
1099
931
|
};
|
|
1100
932
|
let r = 0, i = 0, a = "";
|
|
1101
|
-
for (let [e, o] of
|
|
1102
|
-
let s =
|
|
1103
|
-
if (e === .5 && o === .5 && (a =
|
|
933
|
+
for (let [e, o] of L) {
|
|
934
|
+
let s = Tt(window.innerWidth * e, window.innerHeight * o);
|
|
935
|
+
if (e === .5 && o === .5 && (a = St(s[0])), s.some((e) => Ct(e, t))) {
|
|
1104
936
|
i += 1;
|
|
1105
937
|
continue;
|
|
1106
938
|
}
|
|
1107
|
-
s.some((e) => e !== n && e !== document.body && e !== document.documentElement && n.contains(e) &&
|
|
939
|
+
s.some((e) => e !== n && e !== document.body && e !== document.documentElement && n.contains(e) && wt(e)) || (r += 1);
|
|
1108
940
|
}
|
|
1109
|
-
let o =
|
|
941
|
+
let o = L.length - i;
|
|
1110
942
|
return {
|
|
1111
943
|
centerElement: a,
|
|
1112
944
|
emptyCount: r,
|
|
@@ -1116,42 +948,43 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1116
948
|
score: o ? r / o : 0,
|
|
1117
949
|
validCount: o
|
|
1118
950
|
};
|
|
1119
|
-
},
|
|
951
|
+
}, Dt = (e = {}) => {
|
|
1120
952
|
var t;
|
|
1121
|
-
let n =
|
|
953
|
+
let n = bt(e.checkDelay, ht), r = bt(e.confirmationDelay, gt), i = e.rootSelector || _t, a = xt(e.threshold, vt), o = [...yt, ...(t = e.ignoreSelectors) == null ? [] : t], s, c, l, u, d = () => {}, f;
|
|
1122
954
|
return {
|
|
1123
955
|
name: "blank-screen",
|
|
1124
956
|
init(e) {
|
|
1125
957
|
if (typeof window > "u" || typeof document > "u") return;
|
|
1126
|
-
let t =
|
|
958
|
+
let t = () => {
|
|
1127
959
|
clearTimeout(u), u = void 0;
|
|
1128
|
-
},
|
|
1129
|
-
if (s !==
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
"blank_screen.root_selector": i
|
|
1134
|
-
}))), o && e.startSpan("browser.blank_screen", j(j({}, z({
|
|
960
|
+
}, p = (t, n) => {
|
|
961
|
+
if (s !== t || c === t || !e.isSampled()) return;
|
|
962
|
+
c = t;
|
|
963
|
+
let r = Date.now();
|
|
964
|
+
e.startSpan("browser.blank_screen", S(S({}, N({
|
|
1135
965
|
errorType: "blank_screen",
|
|
1136
|
-
result:
|
|
1137
|
-
spanSubtype:
|
|
1138
|
-
spanType:
|
|
966
|
+
result: j.error,
|
|
967
|
+
spanSubtype: n.reason,
|
|
968
|
+
spanType: M.error
|
|
1139
969
|
})), {}, {
|
|
1140
|
-
"blank_screen.center_element":
|
|
1141
|
-
"blank_screen.empty_ratio":
|
|
1142
|
-
"blank_screen.empty_sample_count":
|
|
1143
|
-
"blank_screen.ignored_sample_count":
|
|
1144
|
-
"blank_screen.reason":
|
|
1145
|
-
"blank_screen.root_found":
|
|
970
|
+
"blank_screen.center_element": n.centerElement,
|
|
971
|
+
"blank_screen.empty_ratio": n.score,
|
|
972
|
+
"blank_screen.empty_sample_count": n.emptyCount,
|
|
973
|
+
"blank_screen.ignored_sample_count": n.ignoredCount,
|
|
974
|
+
"blank_screen.reason": n.reason,
|
|
975
|
+
"blank_screen.root_found": n.rootFound,
|
|
1146
976
|
"blank_screen.root_selector": i,
|
|
1147
|
-
"blank_screen.sample_count":
|
|
1148
|
-
"blank_screen.valid_sample_count":
|
|
1149
|
-
|
|
1150
|
-
|
|
977
|
+
"blank_screen.sample_count": L.length,
|
|
978
|
+
"blank_screen.valid_sample_count": n.validCount,
|
|
979
|
+
[g.eventId]: h("event"),
|
|
980
|
+
[g.eventTimestamp]: r,
|
|
981
|
+
[g.eventType]: "error"
|
|
982
|
+
}), { startTime: r }).end(r);
|
|
983
|
+
}, m = (t) => {
|
|
1151
984
|
if (s !== t || c === t || document.visibilityState === "hidden") return;
|
|
1152
985
|
let n;
|
|
1153
986
|
try {
|
|
1154
|
-
n =
|
|
987
|
+
n = Et(i, o);
|
|
1155
988
|
} catch (t) {
|
|
1156
989
|
var l;
|
|
1157
990
|
e.config.debug && ((l = globalThis.console) == null || l.warn("[bk-ot][blank-screen] detection failed:", t));
|
|
@@ -1161,206 +994,61 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1161
994
|
if (s !== t || document.visibilityState === "hidden") return;
|
|
1162
995
|
let n;
|
|
1163
996
|
try {
|
|
1164
|
-
n =
|
|
997
|
+
n = Et(i, o);
|
|
1165
998
|
} catch (t) {
|
|
1166
999
|
var r;
|
|
1167
1000
|
e.config.debug && ((r = globalThis.console) == null || r.warn("[bk-ot][blank-screen] confirmation failed:", t));
|
|
1168
1001
|
return;
|
|
1169
1002
|
}
|
|
1170
|
-
n.validCount && n.score >= a &&
|
|
1003
|
+
n.validCount && n.score >= a && p(t, n);
|
|
1171
1004
|
}, r));
|
|
1172
|
-
},
|
|
1173
|
-
|
|
1005
|
+
}, _ = (r) => {
|
|
1006
|
+
t(), !(document.visibilityState === "hidden" || !e.isSampled()) && (u = setTimeout(() => m(r), n));
|
|
1174
1007
|
};
|
|
1175
|
-
d = e.onViewChange((
|
|
1176
|
-
if (
|
|
1177
|
-
let
|
|
1178
|
-
l =
|
|
1179
|
-
l = void 0,
|
|
1008
|
+
d = e.onViewChange((n) => {
|
|
1009
|
+
if (n.id !== s && (t(), l == null || l(), l = void 0, s = n.id, c = void 0, n.id)) {
|
|
1010
|
+
let t = n.id;
|
|
1011
|
+
l = mt(e, Date.now(), () => {
|
|
1012
|
+
l = void 0, _(t);
|
|
1180
1013
|
});
|
|
1181
1014
|
}
|
|
1182
1015
|
});
|
|
1183
|
-
let
|
|
1184
|
-
document.visibilityState === "hidden" ?
|
|
1016
|
+
let v = () => {
|
|
1017
|
+
document.visibilityState === "hidden" ? t() : s && c !== s && _(s);
|
|
1185
1018
|
};
|
|
1186
|
-
document.addEventListener("visibilitychange",
|
|
1019
|
+
document.addEventListener("visibilitychange", v), f = () => document.removeEventListener("visibilitychange", v);
|
|
1187
1020
|
},
|
|
1188
1021
|
shutdown() {
|
|
1189
1022
|
clearTimeout(u), u = void 0, d(), l == null || l(), l = void 0, f == null || f(), f = void 0, s = void 0, c = void 0;
|
|
1190
1023
|
}
|
|
1191
1024
|
};
|
|
1192
|
-
},
|
|
1193
|
-
let t =
|
|
1194
|
-
t >= 0 &&
|
|
1195
|
-
},
|
|
1025
|
+
}, Ot = 100, kt = 200, R = [], At = (e) => e.replace(/#.*$/, ""), jt = (e) => {
|
|
1026
|
+
let t = R.indexOf(e);
|
|
1027
|
+
t >= 0 && R.splice(t, 1), e.timer !== void 0 && clearTimeout(e.timer);
|
|
1028
|
+
}, z = (e, t) => {
|
|
1196
1029
|
let n = e.callback;
|
|
1197
|
-
|
|
1198
|
-
},
|
|
1199
|
-
let t = performance.timeOrigin + e.startTime, n =
|
|
1200
|
-
n && (n.entry = e, n.callback &&
|
|
1201
|
-
},
|
|
1030
|
+
jt(e), e.callback = void 0, n == null || n(t);
|
|
1031
|
+
}, Mt = (e) => {
|
|
1032
|
+
let t = performance.timeOrigin + e.startTime, n = R.filter((n) => !n.entry && At(n.url) === At(e.name) && t >= n.startTime - 50).sort((e, n) => Math.abs(e.startTime - t) - Math.abs(n.startTime - t))[0];
|
|
1033
|
+
n && (n.entry = e, n.callback && z(n, e));
|
|
1034
|
+
}, Nt = (e, t = Date.now()) => {
|
|
1202
1035
|
let n = {
|
|
1203
1036
|
startTime: t,
|
|
1204
1037
|
url: e
|
|
1205
1038
|
};
|
|
1206
|
-
return
|
|
1207
|
-
cancel: () =>
|
|
1039
|
+
return R.push(n), R.length > Ot && z(R[0]), {
|
|
1040
|
+
cancel: () => z(n),
|
|
1208
1041
|
complete: (e) => {
|
|
1209
1042
|
if (n.callback = e, n.entry) {
|
|
1210
|
-
|
|
1043
|
+
z(n, n.entry);
|
|
1211
1044
|
return;
|
|
1212
1045
|
}
|
|
1213
|
-
n.timer = setTimeout(() =>
|
|
1046
|
+
n.timer = setTimeout(() => z(n), kt);
|
|
1214
1047
|
}
|
|
1215
1048
|
};
|
|
1216
|
-
},
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
"application/x-www-form-urlencoded",
|
|
1220
|
-
"application/graphql"
|
|
1221
|
-
], cn = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.floor(e) : on, ln = (e, t, n) => e ? t.some((t) => typeof t == "string" ? e.toLowerCase().includes(t.toLowerCase()) : (t.lastIndex = 0, t.test(e))) : n, un = (e) => {
|
|
1222
|
-
try {
|
|
1223
|
-
var t;
|
|
1224
|
-
return e ? (t = new Headers(e).get("content-type")) == null ? void 0 : t : void 0;
|
|
1225
|
-
} catch (e) {
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
}, dn = function() {
|
|
1229
|
-
var e = M(function* (e, t) {
|
|
1230
|
-
let n = e.getReader(), r = new TextDecoder(), i = "";
|
|
1231
|
-
try {
|
|
1232
|
-
for (; i.length <= t;) {
|
|
1233
|
-
let { done: e, value: t } = yield n.read();
|
|
1234
|
-
if (e) {
|
|
1235
|
-
i += r.decode();
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
i += r.decode(t, { stream: !0 });
|
|
1239
|
-
}
|
|
1240
|
-
i.length > t && (yield n.cancel().catch(() => void 0));
|
|
1241
|
-
} finally {
|
|
1242
|
-
n.releaseLock();
|
|
1243
|
-
}
|
|
1244
|
-
return i;
|
|
1245
|
-
});
|
|
1246
|
-
return function(t, n) {
|
|
1247
|
-
return e.apply(this, arguments);
|
|
1248
|
-
};
|
|
1249
|
-
}(), fn = function() {
|
|
1250
|
-
var e = M(function* (e, t) {
|
|
1251
|
-
if (typeof e == "string") return e;
|
|
1252
|
-
if (typeof URLSearchParams < "u" && e instanceof URLSearchParams) return e.toString();
|
|
1253
|
-
if (typeof Blob < "u" && e instanceof Blob) return dn(e.stream(), t);
|
|
1254
|
-
});
|
|
1255
|
-
return function(t, n) {
|
|
1256
|
-
return e.apply(this, arguments);
|
|
1257
|
-
};
|
|
1258
|
-
}(), pn = function() {
|
|
1259
|
-
var e = M(function* (e, t) {
|
|
1260
|
-
if (typeof Request < "u" && e instanceof Request) {
|
|
1261
|
-
var n;
|
|
1262
|
-
let r = (n = e.headers.get("content-type")) == null ? void 0 : n, i = e.clone();
|
|
1263
|
-
return {
|
|
1264
|
-
contentType: r,
|
|
1265
|
-
text: i.body ? yield dn(i.body, t) : ""
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
return {
|
|
1269
|
-
contentType: un(e.headers),
|
|
1270
|
-
text: yield fn(e.body, t)
|
|
1271
|
-
};
|
|
1272
|
-
});
|
|
1273
|
-
return function(t, n) {
|
|
1274
|
-
return e.apply(this, arguments);
|
|
1275
|
-
};
|
|
1276
|
-
}(), mn = (e) => {
|
|
1277
|
-
if (typeof Request > "u" || !(e instanceof Request)) return e;
|
|
1278
|
-
try {
|
|
1279
|
-
return e.clone();
|
|
1280
|
-
} catch (e) {
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
}, hn = function() {
|
|
1284
|
-
var e = M(function* (e, t) {
|
|
1285
|
-
var n;
|
|
1286
|
-
if (!e) return {};
|
|
1287
|
-
let r = (n = e.headers.get("content-type")) == null ? void 0 : n, i = e.clone();
|
|
1288
|
-
return {
|
|
1289
|
-
contentType: r,
|
|
1290
|
-
text: i.body ? yield dn(i.body, t) : ""
|
|
1291
|
-
};
|
|
1292
|
-
});
|
|
1293
|
-
return function(t, n) {
|
|
1294
|
-
return e.apply(this, arguments);
|
|
1295
|
-
};
|
|
1296
|
-
}(), gn = (e) => {
|
|
1297
|
-
var t;
|
|
1298
|
-
let n = (t = e.getResponseHeader("content-type")) == null ? void 0 : t;
|
|
1299
|
-
return e.responseType === "" || e.responseType === "text" ? {
|
|
1300
|
-
contentType: n,
|
|
1301
|
-
text: e.responseText
|
|
1302
|
-
} : e.responseType === "json" ? {
|
|
1303
|
-
contentType: n,
|
|
1304
|
-
text: JSON.stringify(e.response)
|
|
1305
|
-
} : { contentType: n };
|
|
1306
|
-
}, _n = (e, t, n, r, i) => {
|
|
1307
|
-
if (i === void 0) return;
|
|
1308
|
-
let a = cn(e.maxSize), o = i.length > a, s = {
|
|
1309
|
-
body: i.slice(0, a * 2),
|
|
1310
|
-
contentType: r,
|
|
1311
|
-
kind: n,
|
|
1312
|
-
method: t.resource.method,
|
|
1313
|
-
statusCode: t.resource.statusCode,
|
|
1314
|
-
truncated: o,
|
|
1315
|
-
type: t.resource.type,
|
|
1316
|
-
url: t.resource.url
|
|
1317
|
-
}, c = e.redact(s);
|
|
1318
|
-
if (c !== void 0) return {
|
|
1319
|
-
body: c.slice(0, a),
|
|
1320
|
-
contentType: r,
|
|
1321
|
-
truncated: o || c.length > a
|
|
1322
|
-
};
|
|
1323
|
-
}, vn = function() {
|
|
1324
|
-
var e = M(function* ({ bodyConfig: e, domainContext: t, event: n, fetchRequest: r, occurredAt: i, runtimeContext: a, span: o }) {
|
|
1325
|
-
var s, c;
|
|
1326
|
-
let u = n.resource.statusCode, f = u === void 0 || u === 0 || u >= 400;
|
|
1327
|
-
if (((s = e.capture) == null ? "errors" : s) === "errors" && !f) return;
|
|
1328
|
-
let p = cn(e.maxSize) * 2, m = (c = e.allowedContentTypes) == null ? sn : c, h = {}, g = {};
|
|
1329
|
-
try {
|
|
1330
|
-
t.type === "fetch" ? [h, g] = yield Promise.all([pn(r == null ? t.request : r, p), hn(t.response, p)]) : (h = { text: yield fn(t.requestBody, p) }, g = gn(t.xhr));
|
|
1331
|
-
} catch (e) {
|
|
1332
|
-
return;
|
|
1333
|
-
}
|
|
1334
|
-
let _, v;
|
|
1335
|
-
try {
|
|
1336
|
-
_ = ln(h.contentType, m, !0) ? _n(e, n, "request", h.contentType, h.text) : void 0, v = ln(g.contentType, m, !1) ? _n(e, n, "response", g.contentType, g.text) : void 0;
|
|
1337
|
-
} catch (e) {
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
!_ && !v || a.emitLog({
|
|
1341
|
-
attributes: j(j(j({}, n.attributes), _ ? {
|
|
1342
|
-
"request.body": _.body,
|
|
1343
|
-
"request.body.content_type": _.contentType,
|
|
1344
|
-
"request.body.truncated": _.truncated
|
|
1345
|
-
} : {}), v ? {
|
|
1346
|
-
"response.body": v.body,
|
|
1347
|
-
"response.body.content_type": v.contentType,
|
|
1348
|
-
"response.body.truncated": v.truncated
|
|
1349
|
-
} : {}),
|
|
1350
|
-
body: "browser.request.body",
|
|
1351
|
-
context: d.setSpan(l.active(), o),
|
|
1352
|
-
eventName: "browser.request.body",
|
|
1353
|
-
severityNumber: f ? T.ERROR : T.INFO,
|
|
1354
|
-
severityText: f ? "ERROR" : "INFO",
|
|
1355
|
-
timestamp: i
|
|
1356
|
-
});
|
|
1357
|
-
});
|
|
1358
|
-
return function(t) {
|
|
1359
|
-
return e.apply(this, arguments);
|
|
1360
|
-
};
|
|
1361
|
-
}(), yn = (e) => e.deliveryType === "cache" || e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, bn = (...e) => e.every((t, n) => n === 0 || e[n - 1] <= t), W = (e, t, n, r, i) => {
|
|
1362
|
-
bn(n, r, i) && (e[`resource.${t}.start`] = r - n, e[`resource.${t}.duration`] = i - r);
|
|
1363
|
-
}, xn = (e) => {
|
|
1049
|
+
}, Pt = (e) => e.deliveryType === "cache" || e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, Ft = (...e) => e.every((t, n) => n === 0 || e[n - 1] <= t), B = (e, t, n, r, i) => {
|
|
1050
|
+
Ft(n, r, i) && (e[`resource.${t}.start`] = r - n, e[`resource.${t}.duration`] = i - r);
|
|
1051
|
+
}, It = (e) => {
|
|
1364
1052
|
let t = {}, n = [
|
|
1365
1053
|
e.startTime,
|
|
1366
1054
|
e.fetchStart,
|
|
@@ -1372,82 +1060,87 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1372
1060
|
e.responseStart,
|
|
1373
1061
|
e.responseEnd
|
|
1374
1062
|
];
|
|
1375
|
-
return !n.every(Number.isFinite) || !
|
|
1376
|
-
},
|
|
1063
|
+
return !n.every(Number.isFinite) || !Ft(...n) ? t : (B(t, "first_byte", e.startTime, e.requestStart, e.responseStart), B(t, "download", e.startTime, e.responseStart, e.responseEnd), e.workerStart > 0 && e.workerStart < e.fetchStart && B(t, "worker", e.startTime, e.workerStart, e.fetchStart), e.fetchStart < e.domainLookupEnd && B(t, "dns", e.startTime, e.domainLookupStart, e.domainLookupEnd), e.fetchStart < e.connectEnd && (B(t, "connect", e.startTime, e.connectStart, e.connectEnd), e.connectStart <= e.secureConnectionStart && e.secureConnectionStart <= e.connectEnd && B(t, "ssl", e.startTime, e.secureConnectionStart, e.connectEnd)), e.redirectEnd > e.startTime && Ft(e.startTime, e.redirectStart, e.redirectEnd, e.fetchStart) && B(t, "redirect", e.startTime, e.redirectStart, e.redirectEnd), t);
|
|
1064
|
+
}, Lt = (e) => e.duration === 0 && e.responseEnd > e.startTime ? e.responseEnd - e.startTime : e.duration, Rt = (e) => {
|
|
1377
1065
|
let t = typeof e.deliveryType == "string" ? e.deliveryType || "other" : void 0;
|
|
1378
|
-
return
|
|
1379
|
-
[
|
|
1380
|
-
[
|
|
1381
|
-
},
|
|
1066
|
+
return S(S(S(S({
|
|
1067
|
+
[g.cacheHit]: Pt(e),
|
|
1068
|
+
[g.nextHopProtocol]: e.nextHopProtocol
|
|
1069
|
+
}, It(e)), t ? { "resource.delivery_type": t } : {}), e.renderBlockingStatus ? { "resource.render_blocking_status": e.renderBlockingStatus } : {}), {}, {
|
|
1382
1070
|
"resource.encoded_body_size": e.encodedBodySize,
|
|
1383
1071
|
"resource.decoded_body_size": e.decodedBodySize
|
|
1384
1072
|
});
|
|
1385
|
-
},
|
|
1386
|
-
let
|
|
1073
|
+
}, zt = (t = !0) => {
|
|
1074
|
+
let n;
|
|
1387
1075
|
return {
|
|
1388
1076
|
name: "resource",
|
|
1389
|
-
init(
|
|
1390
|
-
var
|
|
1391
|
-
if (typeof PerformanceObserver > "u" || !((
|
|
1392
|
-
let
|
|
1393
|
-
if (!
|
|
1394
|
-
if (
|
|
1395
|
-
|
|
1077
|
+
init(r) {
|
|
1078
|
+
var i;
|
|
1079
|
+
if (typeof PerformanceObserver > "u" || !((i = PerformanceObserver.supportedEntryTypes) != null && i.includes("resource"))) return;
|
|
1080
|
+
let a = (n) => {
|
|
1081
|
+
if (!r.isSampled() || !n.name || k(r.config, n.name)) return;
|
|
1082
|
+
if (n.initiatorType === "fetch" || n.initiatorType === "xmlhttprequest") {
|
|
1083
|
+
Mt(n);
|
|
1396
1084
|
return;
|
|
1397
1085
|
}
|
|
1398
|
-
if (
|
|
1399
|
-
let
|
|
1400
|
-
|
|
1401
|
-
initiatorType:
|
|
1402
|
-
responseStatus:
|
|
1403
|
-
transferSize:
|
|
1404
|
-
url:
|
|
1405
|
-
})), {}, {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1086
|
+
if (n.duration < 0) return;
|
|
1087
|
+
let i = r.config.hooks.redactUrl(n.name), a = Lt(n), o = performance.timeOrigin + n.startTime, s = o + a;
|
|
1088
|
+
t && r.isSampled() && r.startSpan("browser.resource", S(S(S({}, r.config.hooks.getPageAttributes()), qe({
|
|
1089
|
+
initiatorType: n.initiatorType || "other",
|
|
1090
|
+
responseStatus: n.responseStatus,
|
|
1091
|
+
transferSize: n.transferSize,
|
|
1092
|
+
url: i
|
|
1093
|
+
})), {}, {
|
|
1094
|
+
[g.eventId]: h("event"),
|
|
1095
|
+
[g.eventTimestamp]: o,
|
|
1096
|
+
[g.eventType]: "resource",
|
|
1097
|
+
"url.full": i
|
|
1098
|
+
}, Rt(n)), {
|
|
1099
|
+
kind: e.CLIENT,
|
|
1100
|
+
startTime: o
|
|
1101
|
+
}).end(s), r.notifyActivity({
|
|
1102
|
+
endTime: s,
|
|
1103
|
+
startTime: o,
|
|
1411
1104
|
type: "resource",
|
|
1412
|
-
url:
|
|
1105
|
+
url: n.name
|
|
1413
1106
|
});
|
|
1414
1107
|
};
|
|
1415
1108
|
try {
|
|
1416
|
-
|
|
1417
|
-
for (let t of e.getEntries())
|
|
1418
|
-
}),
|
|
1109
|
+
n = new PerformanceObserver((e) => {
|
|
1110
|
+
for (let t of e.getEntries()) a(t);
|
|
1111
|
+
}), n.observe({
|
|
1419
1112
|
type: "resource",
|
|
1420
1113
|
buffered: !0
|
|
1421
1114
|
});
|
|
1422
1115
|
} catch (e) {
|
|
1423
|
-
|
|
1116
|
+
n = void 0;
|
|
1424
1117
|
}
|
|
1425
1118
|
},
|
|
1426
1119
|
shutdown() {
|
|
1427
|
-
|
|
1120
|
+
n == null || n.disconnect(), n = void 0;
|
|
1428
1121
|
}
|
|
1429
1122
|
};
|
|
1430
|
-
},
|
|
1123
|
+
}, Bt = (e) => typeof e.config.tracking.request == "object" ? e.config.tracking.request : void 0, Vt = (e) => {
|
|
1431
1124
|
if (e.type === "xhr") return e.xhr.status;
|
|
1432
1125
|
if (e.response) return e.response.status;
|
|
1433
1126
|
if (typeof e.error == "object" && e.error && "status" in e.error) {
|
|
1434
1127
|
let t = e.error.status;
|
|
1435
1128
|
return typeof t == "number" ? t : void 0;
|
|
1436
1129
|
}
|
|
1437
|
-
},
|
|
1130
|
+
}, Ht = (e) => typeof e == "string" || e instanceof URL ? O(String(e)) : O(e.url), Ut = (e, t) => {
|
|
1438
1131
|
var n;
|
|
1439
1132
|
return ((n = t == null ? void 0 : t.method) == null ? typeof Request < "u" && e instanceof Request ? e.method : "GET" : n).toUpperCase();
|
|
1440
|
-
},
|
|
1441
|
-
var
|
|
1442
|
-
let
|
|
1443
|
-
return
|
|
1444
|
-
},
|
|
1445
|
-
let
|
|
1446
|
-
|
|
1447
|
-
for (let [t,
|
|
1448
|
-
},
|
|
1449
|
-
if (
|
|
1450
|
-
let n =
|
|
1133
|
+
}, Wt = (e, t) => typeof Request < "u" && e instanceof Request ? e : t == null ? {} : t, Gt = (e, t, a) => {
|
|
1134
|
+
var o;
|
|
1135
|
+
let s = typeof Request < "u" && e instanceof Request ? e.headers : void 0, c = new Headers((o = t == null ? void 0 : t.headers) == null ? s : o);
|
|
1136
|
+
return r.inject(i.setSpan(n.active(), a), c, { set: (e, t, n) => e.set(t, n) }), S(S({}, t), {}, { headers: c });
|
|
1137
|
+
}, Kt = (e, t) => {
|
|
1138
|
+
let a = {};
|
|
1139
|
+
r.inject(i.setSpan(n.active(), t), a);
|
|
1140
|
+
for (let [t, n] of Object.entries(a)) e.setRequestHeader(t, n);
|
|
1141
|
+
}, qt = (e, t) => k(e.config, t) || A(e.config.view.excludedActivityUrls, t), Jt = (e, t) => {
|
|
1142
|
+
if (qt(e, t)) return () => {};
|
|
1143
|
+
let n = h("request");
|
|
1451
1144
|
e.notifyActivity({
|
|
1452
1145
|
id: n,
|
|
1453
1146
|
time: Date.now(),
|
|
@@ -1462,59 +1155,56 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1462
1155
|
type: "request_end"
|
|
1463
1156
|
}));
|
|
1464
1157
|
};
|
|
1465
|
-
},
|
|
1158
|
+
}, Yt = (e, t) => e.isSampled() ? Nt(t) : {
|
|
1466
1159
|
cancel() {},
|
|
1467
1160
|
complete(e) {
|
|
1468
1161
|
e();
|
|
1469
1162
|
}
|
|
1470
|
-
}
|
|
1471
|
-
var
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
},
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1163
|
+
}, Xt = (t, n, r) => {
|
|
1164
|
+
var i, a;
|
|
1165
|
+
let o = (i = r.startedAt) == null ? Date.now() : i;
|
|
1166
|
+
return t.startSpan("browser.resource", S(S(S({}, t.config.hooks.getPageAttributes()), qe({
|
|
1167
|
+
initiatorType: n,
|
|
1168
|
+
method: r.method,
|
|
1169
|
+
url: (a = r.url) == null ? "" : a
|
|
1170
|
+
})), {}, {
|
|
1171
|
+
[g.eventId]: h("event"),
|
|
1172
|
+
[g.eventTimestamp]: o,
|
|
1173
|
+
[g.eventType]: "resource"
|
|
1174
|
+
}, r.url ? { "url.full": t.config.hooks.redactUrl(r.url) } : {}), {
|
|
1175
|
+
kind: e.CLIENT,
|
|
1176
|
+
startTime: o
|
|
1177
|
+
});
|
|
1178
|
+
}, Zt = (e, n, r, i, a = {}) => {
|
|
1179
|
+
let o = a.url, s = o ? e.config.hooks.redactUrl(o) : void 0, c = Vt(i), l = a.method, u = {
|
|
1180
|
+
attributes: S(S(S({}, e.config.hooks.getPageAttributes()), qe({
|
|
1181
|
+
initiatorType: r,
|
|
1182
|
+
method: l,
|
|
1183
|
+
networkError: i.type === "fetch" ? !i.response : i.xhr.status === 0,
|
|
1184
|
+
responseStatus: c,
|
|
1185
|
+
url: s == null ? "" : s
|
|
1186
|
+
})), s ? { "url.full": s } : {}),
|
|
1487
1187
|
resource: {
|
|
1488
|
-
method:
|
|
1489
|
-
statusCode:
|
|
1490
|
-
type:
|
|
1491
|
-
url:
|
|
1188
|
+
method: l,
|
|
1189
|
+
statusCode: c,
|
|
1190
|
+
type: r,
|
|
1191
|
+
url: s
|
|
1492
1192
|
},
|
|
1493
1193
|
type: "resource"
|
|
1494
|
-
},
|
|
1194
|
+
}, d = !0;
|
|
1495
1195
|
try {
|
|
1496
|
-
var
|
|
1497
|
-
|
|
1196
|
+
var f, p;
|
|
1197
|
+
d = (f = Bt(e)) == null || (p = f.beforeSend) == null ? void 0 : p.call(f, u, i);
|
|
1498
1198
|
} catch (t) {
|
|
1499
|
-
var
|
|
1500
|
-
e.config.debug && ((
|
|
1199
|
+
var m;
|
|
1200
|
+
e.config.debug && ((m = globalThis.console) == null || m.warn("[bk-ot] request.beforeSend failed:", t));
|
|
1501
1201
|
}
|
|
1502
|
-
if (
|
|
1503
|
-
|
|
1202
|
+
if (n.setAttributes(e.applyRedact(u.attributes)), d === !1) {
|
|
1203
|
+
n.setAttribute(Fe, !0);
|
|
1504
1204
|
return;
|
|
1505
1205
|
}
|
|
1506
|
-
((
|
|
1507
|
-
|
|
1508
|
-
_ && vn({
|
|
1509
|
-
bodyConfig: _,
|
|
1510
|
-
domainContext: r,
|
|
1511
|
-
event: f,
|
|
1512
|
-
fetchRequest: a,
|
|
1513
|
-
occurredAt: i.startedAt,
|
|
1514
|
-
runtimeContext: e,
|
|
1515
|
-
span: t
|
|
1516
|
-
});
|
|
1517
|
-
}, Ln = (e) => {
|
|
1206
|
+
((c == null ? 0 : c) >= 400 || c === 0 || i.type === "fetch" && i.error) && n.setStatus({ code: t.ERROR });
|
|
1207
|
+
}, Qt = (e) => {
|
|
1518
1208
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
1519
1209
|
return {
|
|
1520
1210
|
name: "request",
|
|
@@ -1523,35 +1213,44 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1523
1213
|
if (!(typeof window > "u")) {
|
|
1524
1214
|
if (typeof window.fetch == "function") {
|
|
1525
1215
|
let r = window.fetch, i = /* @__PURE__ */ function() {
|
|
1526
|
-
var t =
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
method: On(t, i),
|
|
1216
|
+
var t = E(function* (t, i) {
|
|
1217
|
+
let a = Ht(t);
|
|
1218
|
+
if (!e.isSampled() || Me(e.config, a)) return r.call(this, t, i);
|
|
1219
|
+
let o = {
|
|
1220
|
+
method: Ut(t, i),
|
|
1532
1221
|
startedAt: Date.now(),
|
|
1533
|
-
url:
|
|
1534
|
-
},
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1222
|
+
url: a
|
|
1223
|
+
}, s = Xt(e, "fetch", o), c = Yt(e, a), l = Jt(e, a), u = Wt(t, i), d = Ne(e.config, a) ? Gt(t, i, s) : i, f = !1, p = (t, r = Date.now()) => {
|
|
1224
|
+
if (!f) {
|
|
1225
|
+
if (f = !0, n.delete(m), t) {
|
|
1226
|
+
s.setAttributes(e.applyRedact(Rt(t))), s.end(performance.timeOrigin + t.startTime + Lt(t));
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
s.end(r);
|
|
1230
|
+
}
|
|
1231
|
+
}, m = () => {
|
|
1232
|
+
c.cancel(), p();
|
|
1538
1233
|
};
|
|
1539
|
-
n.add(
|
|
1234
|
+
n.add(m);
|
|
1540
1235
|
try {
|
|
1541
|
-
let n = yield r.call(this, t,
|
|
1542
|
-
|
|
1543
|
-
request:
|
|
1236
|
+
let n = yield r.call(this, t, d);
|
|
1237
|
+
Zt(e, s, "fetch", {
|
|
1238
|
+
request: u,
|
|
1544
1239
|
response: n,
|
|
1545
1240
|
type: "fetch"
|
|
1546
|
-
},
|
|
1241
|
+
}, o);
|
|
1242
|
+
let i = Date.now();
|
|
1243
|
+
return c.complete((e) => p(e, i)), n;
|
|
1547
1244
|
} catch (t) {
|
|
1548
|
-
|
|
1245
|
+
Zt(e, s, "fetch", {
|
|
1549
1246
|
error: t,
|
|
1550
|
-
request:
|
|
1247
|
+
request: u,
|
|
1551
1248
|
type: "fetch"
|
|
1552
|
-
},
|
|
1249
|
+
}, o), t instanceof Error && s.recordException(t);
|
|
1250
|
+
let n = Date.now();
|
|
1251
|
+
throw c.complete((e) => p(e, n)), t;
|
|
1553
1252
|
} finally {
|
|
1554
|
-
|
|
1253
|
+
l();
|
|
1555
1254
|
}
|
|
1556
1255
|
});
|
|
1557
1256
|
return function(e, n) {
|
|
@@ -1566,27 +1265,35 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1566
1265
|
let r = /* @__PURE__ */ new WeakMap(), i = XMLHttpRequest.prototype.open, a = XMLHttpRequest.prototype.send, o = function(e, t, n = !0, a, o) {
|
|
1567
1266
|
return r.set(this, {
|
|
1568
1267
|
method: e.toUpperCase(),
|
|
1569
|
-
url:
|
|
1268
|
+
url: O(String(t))
|
|
1570
1269
|
}), i.call(this, e, String(t), n, a, o);
|
|
1571
1270
|
}, s = function(t) {
|
|
1572
1271
|
var i;
|
|
1573
1272
|
let o = (i = r.get(this)) == null ? {} : i;
|
|
1574
|
-
if (!e.isSampled() || !o.url ||
|
|
1273
|
+
if (!e.isSampled() || !o.url || Me(e.config, o.url)) return a.call(this, t);
|
|
1575
1274
|
o.startedAt = Date.now();
|
|
1576
|
-
let s =
|
|
1577
|
-
|
|
1275
|
+
let s = Xt(e, "xhr", o), c = Yt(e, o.url), l = Jt(e, o.url);
|
|
1276
|
+
Ne(e.config, o.url) && Kt(this, s);
|
|
1578
1277
|
let u = !1, d = () => {
|
|
1579
1278
|
c.cancel(), !u && (u = !0, n.delete(d), l(), s.end());
|
|
1580
1279
|
};
|
|
1581
1280
|
n.add(d);
|
|
1582
1281
|
let f = () => {
|
|
1583
|
-
|
|
1584
|
-
|
|
1282
|
+
if (u) return;
|
|
1283
|
+
Zt(e, s, "xhr", {
|
|
1585
1284
|
type: "xhr",
|
|
1586
1285
|
xhr: this
|
|
1587
|
-
}, o), l()
|
|
1588
|
-
|
|
1589
|
-
|
|
1286
|
+
}, o), l();
|
|
1287
|
+
let t = Date.now();
|
|
1288
|
+
c.complete((r) => {
|
|
1289
|
+
if (!u) {
|
|
1290
|
+
if (u = !0, n.delete(d), r) {
|
|
1291
|
+
s.setAttributes(e.applyRedact(Rt(r))), s.end(performance.timeOrigin + r.startTime + Lt(r));
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
s.end(t);
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1590
1297
|
};
|
|
1591
1298
|
this.addEventListener("loadend", f, { once: !0 });
|
|
1592
1299
|
try {
|
|
@@ -1607,50 +1314,45 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1607
1314
|
for (; t.length;) (e = t.pop()) == null || e();
|
|
1608
1315
|
}
|
|
1609
1316
|
};
|
|
1610
|
-
},
|
|
1611
|
-
if (t) return
|
|
1612
|
-
},
|
|
1317
|
+
}, $t = /^https?:|^\/\//i, en = (e, t) => {
|
|
1318
|
+
if (t) return $t.test(t) ? e(t) : t;
|
|
1319
|
+
}, tn = () => {
|
|
1613
1320
|
let e;
|
|
1614
1321
|
return {
|
|
1615
1322
|
name: "csp-violation",
|
|
1616
1323
|
init(t) {
|
|
1617
1324
|
if (typeof window > "u" || typeof document > "u") return;
|
|
1618
|
-
let n =
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
"csp.effective_directive": e.effectiveDirective
|
|
1623
|
-
}))), !a)) return;
|
|
1624
|
-
let o = D(`${e.violatedDirective}|${e.blockedURI}|${e.sourceFile}|${e.lineNumber}`), s = n.allow(o);
|
|
1625
|
-
if (!s.allowed) return;
|
|
1626
|
-
let c = Vn(t.config.hooks.redactUrl, e.blockedURI), l = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0, u = s.count === 1;
|
|
1627
|
-
t.startSpan("csp.violation", j(j(j({}, t.config.hooks.getPageAttributes()), z({
|
|
1325
|
+
let n = (e) => {
|
|
1326
|
+
if (!t.isSampled()) return;
|
|
1327
|
+
let n = Date.now(), r = en(t.config.hooks.redactUrl, e.blockedURI), i = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0;
|
|
1328
|
+
t.startSpan("csp.violation", S(S(S({}, t.config.hooks.getPageAttributes()), N({
|
|
1628
1329
|
errorType: "csp",
|
|
1629
|
-
result:
|
|
1330
|
+
result: j.error,
|
|
1630
1331
|
spanSubtype: "csp",
|
|
1631
|
-
spanType:
|
|
1332
|
+
spanType: M.error
|
|
1632
1333
|
})), {}, {
|
|
1633
|
-
"csp.blocked_uri":
|
|
1334
|
+
"csp.blocked_uri": r,
|
|
1634
1335
|
"csp.violated_directive": e.violatedDirective,
|
|
1635
1336
|
"csp.effective_directive": e.effectiveDirective,
|
|
1636
1337
|
"csp.disposition": e.disposition,
|
|
1637
|
-
"csp.source_file":
|
|
1338
|
+
"csp.source_file": i,
|
|
1638
1339
|
"csp.line_number": e.lineNumber,
|
|
1639
1340
|
"csp.column_number": e.columnNumber,
|
|
1640
1341
|
"csp.status_code": e.statusCode,
|
|
1641
|
-
"csp.
|
|
1642
|
-
|
|
1643
|
-
[
|
|
1342
|
+
"csp.original_policy": e.originalPolicy,
|
|
1343
|
+
[g.eventId]: h("event"),
|
|
1344
|
+
[g.eventTimestamp]: n,
|
|
1345
|
+
[g.eventType]: "error",
|
|
1644
1346
|
"error.source": "csp"
|
|
1645
|
-
},
|
|
1347
|
+
}), { startTime: n }).end(n);
|
|
1646
1348
|
};
|
|
1647
|
-
document.addEventListener("securitypolicyviolation",
|
|
1349
|
+
document.addEventListener("securitypolicyviolation", n), e = () => document.removeEventListener("securitypolicyviolation", n);
|
|
1648
1350
|
},
|
|
1649
1351
|
shutdown() {
|
|
1650
1352
|
e == null || e(), e = void 0;
|
|
1651
1353
|
}
|
|
1652
1354
|
};
|
|
1653
|
-
},
|
|
1355
|
+
}, nn = (e) => {
|
|
1654
1356
|
if (e instanceof Error) return e.message;
|
|
1655
1357
|
if (typeof e == "string") return e;
|
|
1656
1358
|
try {
|
|
@@ -1658,137 +1360,88 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1658
1360
|
} catch (t) {
|
|
1659
1361
|
return String(e);
|
|
1660
1362
|
}
|
|
1661
|
-
},
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
}, Jn = (e) => e.slice(0, 80), Yn = (e) => {
|
|
1665
|
-
var t, n;
|
|
1666
|
-
return (t = (n = e.split("\n").find((e) => e.trim().startsWith("at "))) == null ? void 0 : n.trim()) == null ? "" : t;
|
|
1667
|
-
}, Xn = (e) => e === "unhandledrejection" ? "promise" : e === "resource" ? "resource_load" : "js", Zn = ({ context: e, counter: t, error: n, exceptionType: r, extra: i = {}, source: a, spanName: o, throttle: s }) => {
|
|
1668
|
-
let l = I(e, "metrics"), u = I(e, "traces");
|
|
1669
|
-
if (!l && !u) return;
|
|
1670
|
-
let d = Kn(n), f = qn(n), p = D(`${a}|${d}|${f.slice(0, 256)}`);
|
|
1671
|
-
if (l && t.add(1, e.applyRedact(j(j(j({}, e.config.hooks.getMetricAttributes()), B(e.getRuntimeAttributes())), {}, {
|
|
1672
|
-
"error.source": a,
|
|
1673
|
-
"error.subtype": Xn(a)
|
|
1674
|
-
}))), !u) return;
|
|
1363
|
+
}, rn = (e) => e === "unhandledrejection" ? "promise" : e === "resource" ? "resource_load" : "js", an = ({ context: e, error: n, exceptionType: r, extra: i = {}, source: a, spanName: o }) => {
|
|
1364
|
+
if (!e.isSampled()) return;
|
|
1365
|
+
let s = Date.now(), c = nn(n);
|
|
1675
1366
|
e.notifyActivity({
|
|
1676
|
-
time:
|
|
1367
|
+
time: s,
|
|
1677
1368
|
type: "error"
|
|
1678
1369
|
});
|
|
1679
|
-
let
|
|
1680
|
-
|
|
1681
|
-
let h = n instanceof Error ? n : {
|
|
1682
|
-
message: d,
|
|
1370
|
+
let l = n instanceof Error ? n : {
|
|
1371
|
+
message: c,
|
|
1683
1372
|
name: r == null ? a : r
|
|
1684
|
-
},
|
|
1685
|
-
errorType:
|
|
1686
|
-
result:
|
|
1687
|
-
spanSubtype:
|
|
1688
|
-
spanType:
|
|
1373
|
+
}, u = S(S(S(S({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), N({
|
|
1374
|
+
errorType: rn(a),
|
|
1375
|
+
result: j.error,
|
|
1376
|
+
spanSubtype: rn(a),
|
|
1377
|
+
spanType: M.error
|
|
1689
1378
|
})), {}, {
|
|
1690
|
-
[
|
|
1691
|
-
[
|
|
1692
|
-
[
|
|
1379
|
+
[g.eventId]: h("event"),
|
|
1380
|
+
[g.eventTimestamp]: s,
|
|
1381
|
+
[g.eventType]: "error",
|
|
1382
|
+
"error.message": c,
|
|
1693
1383
|
"error.handled": !1,
|
|
1694
|
-
"error.source": a
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
let t = [], n = Gn(e.windowMs, Un), r = Gn(e.maxPerWindow, Wn);
|
|
1384
|
+
"error.source": a
|
|
1385
|
+
}, i), d = e.startSpan(o, u, { startTime: s });
|
|
1386
|
+
d.recordException(l), d.setStatus({
|
|
1387
|
+
code: t.ERROR,
|
|
1388
|
+
message: c
|
|
1389
|
+
}), d.end();
|
|
1390
|
+
}, on = () => {
|
|
1391
|
+
let e = [];
|
|
1703
1392
|
return {
|
|
1704
1393
|
name: "error",
|
|
1705
|
-
init(
|
|
1394
|
+
init(t) {
|
|
1706
1395
|
if (typeof window > "u") return;
|
|
1707
|
-
let
|
|
1396
|
+
let n = (e) => {
|
|
1708
1397
|
var n;
|
|
1709
|
-
let r = !
|
|
1710
|
-
|
|
1711
|
-
context:
|
|
1712
|
-
counter: a,
|
|
1713
|
-
throttle: i,
|
|
1398
|
+
let r = !e.error && !e.filename && e.message === "Script error.";
|
|
1399
|
+
an({
|
|
1400
|
+
context: t,
|
|
1714
1401
|
spanName: "browser.error",
|
|
1715
1402
|
source: "window.error",
|
|
1716
|
-
error: (n =
|
|
1717
|
-
extra:
|
|
1718
|
-
"code.filepath":
|
|
1719
|
-
"code.lineno":
|
|
1720
|
-
"code.column":
|
|
1403
|
+
error: (n = e.error) == null ? e.message : n,
|
|
1404
|
+
extra: S({
|
|
1405
|
+
"code.filepath": e.filename,
|
|
1406
|
+
"code.lineno": e.lineno,
|
|
1407
|
+
"code.column": e.colno
|
|
1721
1408
|
}, r ? { "error.cross_origin": !0 } : {})
|
|
1722
1409
|
});
|
|
1723
|
-
},
|
|
1724
|
-
|
|
1725
|
-
context:
|
|
1726
|
-
counter: a,
|
|
1727
|
-
throttle: i,
|
|
1410
|
+
}, r = (e) => {
|
|
1411
|
+
an({
|
|
1412
|
+
context: t,
|
|
1728
1413
|
spanName: "browser.unhandledrejection",
|
|
1729
1414
|
source: "unhandledrejection",
|
|
1730
|
-
error:
|
|
1731
|
-
exceptionType:
|
|
1415
|
+
error: e.reason,
|
|
1416
|
+
exceptionType: e.reason instanceof Error ? e.reason.name : "UnhandledRejection"
|
|
1732
1417
|
});
|
|
1733
|
-
},
|
|
1734
|
-
if (
|
|
1735
|
-
let n =
|
|
1418
|
+
}, i = (e) => {
|
|
1419
|
+
if (e instanceof ErrorEvent) return;
|
|
1420
|
+
let n = e.target;
|
|
1736
1421
|
if (!(n instanceof Element)) return;
|
|
1737
|
-
let r = n,
|
|
1738
|
-
|
|
1739
|
-
context:
|
|
1740
|
-
counter: a,
|
|
1741
|
-
throttle: i,
|
|
1422
|
+
let r = n, i = r.src || r.href || n.currentSrc || "";
|
|
1423
|
+
an({
|
|
1424
|
+
context: t,
|
|
1742
1425
|
spanName: "browser.resource_error",
|
|
1743
1426
|
source: "resource",
|
|
1744
|
-
error: /* @__PURE__ */ Error(`Resource load failed: ${n.tagName.toLowerCase()} ${
|
|
1427
|
+
error: /* @__PURE__ */ Error(`Resource load failed: ${n.tagName.toLowerCase()} ${i}`),
|
|
1745
1428
|
exceptionType: "ResourceError",
|
|
1746
1429
|
extra: {
|
|
1747
|
-
"url.full":
|
|
1430
|
+
"url.full": t.config.hooks.redactUrl(i),
|
|
1748
1431
|
"html.tag": n.tagName
|
|
1749
1432
|
}
|
|
1750
1433
|
});
|
|
1751
1434
|
};
|
|
1752
|
-
window.addEventListener("error",
|
|
1435
|
+
window.addEventListener("error", n), window.addEventListener("unhandledrejection", r), window.addEventListener("error", i, !0), e.push(() => window.removeEventListener("error", n), () => window.removeEventListener("unhandledrejection", r), () => window.removeEventListener("error", i, !0));
|
|
1753
1436
|
},
|
|
1754
1437
|
shutdown() {
|
|
1755
|
-
for (;
|
|
1756
|
-
var
|
|
1757
|
-
(
|
|
1438
|
+
for (; e.length;) {
|
|
1439
|
+
var t;
|
|
1440
|
+
(t = e.pop()) == null || t();
|
|
1758
1441
|
}
|
|
1759
1442
|
}
|
|
1760
1443
|
};
|
|
1761
|
-
},
|
|
1762
|
-
0,
|
|
1763
|
-
.01,
|
|
1764
|
-
.025,
|
|
1765
|
-
.05,
|
|
1766
|
-
.075,
|
|
1767
|
-
.1,
|
|
1768
|
-
.15,
|
|
1769
|
-
.25,
|
|
1770
|
-
.5,
|
|
1771
|
-
1
|
|
1772
|
-
], G = [
|
|
1773
|
-
0,
|
|
1774
|
-
50,
|
|
1775
|
-
100,
|
|
1776
|
-
200,
|
|
1777
|
-
300,
|
|
1778
|
-
500,
|
|
1779
|
-
800,
|
|
1780
|
-
1e3,
|
|
1781
|
-
1500,
|
|
1782
|
-
2e3,
|
|
1783
|
-
2500,
|
|
1784
|
-
4e3,
|
|
1785
|
-
5e3,
|
|
1786
|
-
1e4
|
|
1787
|
-
], er = 50, tr = 100, nr = 700, rr = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, ir = (e) => Number.isFinite(e) ? e : void 0, ar = (e, t) => {
|
|
1788
|
-
var n;
|
|
1789
|
-
let r = (n = e.attribution) == null ? void 0 : n[0];
|
|
1790
|
-
return r != null && r.containerSrc ? t(r.containerSrc) : (r == null ? void 0 : r.containerName) || (r == null ? void 0 : r.name) || e.name || "unknown";
|
|
1791
|
-
}, or = (e, t) => ({
|
|
1444
|
+
}, sn = 50, cn = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, V = (e) => Number.isFinite(e) ? e : void 0, ln = (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 } : {}), un = (e, t) => ({
|
|
1792
1445
|
"long_task.script.duration": e.duration,
|
|
1793
1446
|
"long_task.script.execution_start": e.executionStart,
|
|
1794
1447
|
"long_task.script.forced_style_and_layout_duration": e.forcedStyleAndLayoutDuration,
|
|
@@ -1800,127 +1453,132 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1800
1453
|
"long_task.script.source_url": e.sourceURL ? t(e.sourceURL) : "",
|
|
1801
1454
|
"long_task.script.start_time": e.startTime,
|
|
1802
1455
|
"long_task.script.window_attribution": e.windowAttribution
|
|
1803
|
-
}),
|
|
1804
|
-
let t =
|
|
1456
|
+
}), dn = (e = {}) => {
|
|
1457
|
+
let t = cn(e.threshold, sn), n, r, i = [];
|
|
1805
1458
|
return {
|
|
1806
1459
|
name: "long-task",
|
|
1807
1460
|
init(e) {
|
|
1808
|
-
var
|
|
1461
|
+
var a;
|
|
1809
1462
|
if (typeof PerformanceObserver > "u" || typeof performance > "u") return;
|
|
1810
|
-
let
|
|
1811
|
-
if (!
|
|
1812
|
-
let
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
}, b ? { [O.longTaskCulprit]: b } : {}), p ? {
|
|
1840
|
-
[O.longTaskCulprit]: x,
|
|
1841
|
-
"long_task.culprit.duration": p.duration,
|
|
1842
|
-
"long_task.culprit.forced_style_and_layout_duration": p.forcedStyleAndLayoutDuration,
|
|
1843
|
-
"long_task.culprit.function_name": p.sourceFunctionName,
|
|
1844
|
-
"long_task.culprit.invoker_type": p.invokerType
|
|
1845
|
-
} : {}), ir(c == null ? void 0 : c.firstUIEventTimestamp) === void 0 ? {} : { "long_task.first_ui_event_timestamp": c.firstUIEventTimestamp }), ir(c == null ? void 0 : c.renderStart) === void 0 ? {} : { "long_task.render_start": c.renderStart }), ir(c == null ? void 0 : c.styleAndLayoutStart) === void 0 ? {} : { "long_task.style_and_layout_start": c.styleAndLayoutStart }), c ? { [O.longTaskStartTime]: c.startTime } : {}), { startTime: h });
|
|
1846
|
-
f.forEach((n) => {
|
|
1847
|
-
t.addEvent("long_task.script", e.applyRedact(or(n, e.config.hooks.redactUrl)), performance.timeOrigin + n.startTime);
|
|
1848
|
-
}), t.end(g), e.notifyActivity({
|
|
1849
|
-
endTime: g,
|
|
1850
|
-
startTime: h,
|
|
1851
|
-
type: "long_task"
|
|
1852
|
-
});
|
|
1853
|
-
}
|
|
1854
|
-
if (a) {
|
|
1855
|
-
let t = e.applyRedact(j(j(j({}, e.config.hooks.getMetricAttributes()), B(e.getRuntimeAttributesAt(h))), {}, { [O.longTaskEntryType]: v }));
|
|
1856
|
-
l.add(1, t), u.record(r.duration, t), c && d.record(c.blockingDuration, t);
|
|
1857
|
-
}
|
|
1858
|
-
}, p = (e) => e.forEach((e) => f(e));
|
|
1463
|
+
let o = (a = PerformanceObserver.supportedEntryTypes) == null ? [] : a, s = o.includes("long-animation-frame") ? "long-animation-frame" : o.includes("longtask") ? "longtask" : void 0;
|
|
1464
|
+
if (!s) return;
|
|
1465
|
+
let c = (n) => {
|
|
1466
|
+
var r, i;
|
|
1467
|
+
if (!e.isSampled() || !Number.isFinite(n.duration) || n.duration < t) return;
|
|
1468
|
+
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 = e.startSpan("browser.long_task", S(S(S(S(S(S(S({}, e.config.hooks.getPageAttributes()), N({
|
|
1469
|
+
errorType: "none",
|
|
1470
|
+
result: j.success,
|
|
1471
|
+
spanSubtype: d,
|
|
1472
|
+
spanType: M.longtask
|
|
1473
|
+
})), V(o == null ? void 0 : o.blockingDuration) === void 0 ? {} : { [g.longTaskBlockingDuration]: o.blockingDuration }), {}, {
|
|
1474
|
+
[g.longTaskDuration]: n.duration,
|
|
1475
|
+
[g.longTaskEntryType]: d,
|
|
1476
|
+
[g.longTaskId]: c,
|
|
1477
|
+
[g.eventId]: h("event"),
|
|
1478
|
+
[g.eventTimestamp]: l,
|
|
1479
|
+
[g.eventType]: "long_task",
|
|
1480
|
+
"long_task.name": n.name
|
|
1481
|
+
}, V(o == null ? void 0 : o.firstUIEventTimestamp) === void 0 ? {} : { "long_task.first_ui_event_timestamp": o.firstUIEventTimestamp }), V(o == null ? void 0 : o.renderStart) === void 0 ? {} : { "long_task.render_start": o.renderStart }), V(o == null ? void 0 : o.styleAndLayoutStart) === void 0 ? {} : { "long_task.style_and_layout_start": o.styleAndLayoutStart }), o ? { [g.longTaskStartTime]: o.startTime } : {}), { startTime: l });
|
|
1482
|
+
s.forEach((t) => {
|
|
1483
|
+
p.addEvent("long_task.script", e.applyRedact(un(t, e.config.hooks.redactUrl)), performance.timeOrigin + t.startTime);
|
|
1484
|
+
}), f.forEach((t, n) => {
|
|
1485
|
+
p.addEvent("long_task.attribution", e.applyRedact(S({ "long_task.attribution.index": n }, ln(t, e.config.hooks.redactUrl))), l);
|
|
1486
|
+
}), p.end(u), e.notifyActivity({
|
|
1487
|
+
endTime: u,
|
|
1488
|
+
startTime: l,
|
|
1489
|
+
type: "long_task"
|
|
1490
|
+
});
|
|
1491
|
+
}, l = (e) => e.forEach((e) => c(e));
|
|
1859
1492
|
try {
|
|
1860
1493
|
let e = !0;
|
|
1861
|
-
|
|
1494
|
+
n = new PerformanceObserver((t) => {
|
|
1862
1495
|
let n = t.getEntries();
|
|
1863
|
-
e ? (
|
|
1864
|
-
let e =
|
|
1865
|
-
|
|
1866
|
-
}))) :
|
|
1867
|
-
}),
|
|
1868
|
-
type:
|
|
1496
|
+
e ? (i.push(...n), r || (r = setTimeout(() => {
|
|
1497
|
+
let e = i;
|
|
1498
|
+
i = [], r = void 0, l(e);
|
|
1499
|
+
}))) : l(n);
|
|
1500
|
+
}), n.observe({
|
|
1501
|
+
type: s,
|
|
1869
1502
|
buffered: !0
|
|
1870
1503
|
}), e = !1;
|
|
1871
1504
|
} catch (e) {
|
|
1872
|
-
|
|
1505
|
+
n = void 0;
|
|
1873
1506
|
}
|
|
1874
1507
|
},
|
|
1875
1508
|
shutdown() {
|
|
1876
|
-
|
|
1509
|
+
n == null || n.disconnect(), n = void 0, clearTimeout(r), r = void 0, i = [];
|
|
1877
1510
|
}
|
|
1878
1511
|
};
|
|
1879
|
-
},
|
|
1880
|
-
let n =
|
|
1881
|
-
|
|
1512
|
+
}, H = /* @__PURE__ */ new Set(), U = "", W, G, K = !1, q = () => typeof location > "u" ? "" : location.href, J = (e, t) => {
|
|
1513
|
+
let n = q();
|
|
1514
|
+
U = n;
|
|
1882
1515
|
let r = {
|
|
1883
1516
|
fromUrl: t,
|
|
1884
1517
|
source: e,
|
|
1885
1518
|
toUrl: n
|
|
1886
1519
|
};
|
|
1887
|
-
for (let e of Array.from(
|
|
1888
|
-
},
|
|
1889
|
-
|
|
1890
|
-
},
|
|
1891
|
-
|
|
1892
|
-
},
|
|
1893
|
-
|
|
1894
|
-
let r =
|
|
1520
|
+
for (let e of Array.from(H)) e(r);
|
|
1521
|
+
}, fn = () => {
|
|
1522
|
+
J("popstate", U || q());
|
|
1523
|
+
}, pn = () => {
|
|
1524
|
+
J("hashchange", U || q());
|
|
1525
|
+
}, mn = () => {
|
|
1526
|
+
K || typeof window > "u" || typeof history > "u" || (K = !0, U = q(), W = history.pushState, G = history.replaceState, history.pushState = function(e, t, n) {
|
|
1527
|
+
let r = U || q(), i = W == null ? void 0 : W.apply(this, [
|
|
1895
1528
|
e,
|
|
1896
1529
|
t,
|
|
1897
1530
|
n
|
|
1898
1531
|
]);
|
|
1899
|
-
return
|
|
1532
|
+
return J("pushState", r), i;
|
|
1900
1533
|
}, history.replaceState = function(e, t, n) {
|
|
1901
|
-
let r =
|
|
1534
|
+
let r = U || q(), i = G == null ? void 0 : G.apply(this, [
|
|
1902
1535
|
e,
|
|
1903
1536
|
t,
|
|
1904
1537
|
n
|
|
1905
1538
|
]);
|
|
1906
|
-
return
|
|
1907
|
-
}, window.addEventListener("popstate",
|
|
1908
|
-
},
|
|
1909
|
-
!
|
|
1910
|
-
},
|
|
1911
|
-
|
|
1912
|
-
})
|
|
1539
|
+
return J("replaceState", r), i;
|
|
1540
|
+
}, window.addEventListener("popstate", fn), window.addEventListener("hashchange", pn));
|
|
1541
|
+
}, hn = () => {
|
|
1542
|
+
!K || typeof window > "u" || typeof history > "u" || (W && (history.pushState = W), G && (history.replaceState = G), window.removeEventListener("popstate", fn), window.removeEventListener("hashchange", pn), W = void 0, G = void 0, K = !1, U = "");
|
|
1543
|
+
}, gn = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (mn(), H.add(e), () => {
|
|
1544
|
+
H.delete(e), H.size === 0 && hn();
|
|
1545
|
+
});
|
|
1546
|
+
//#endregion
|
|
1547
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
1548
|
+
function _n(e, t) {
|
|
1549
|
+
if (e == null) return {};
|
|
1550
|
+
var n = {};
|
|
1551
|
+
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
1552
|
+
if (t.includes(r)) continue;
|
|
1553
|
+
n[r] = e[r];
|
|
1554
|
+
}
|
|
1555
|
+
return n;
|
|
1556
|
+
}
|
|
1557
|
+
//#endregion
|
|
1558
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
1559
|
+
function vn(e, t) {
|
|
1560
|
+
if (e == null) return {};
|
|
1561
|
+
var n, r, i = _n(e, t);
|
|
1562
|
+
if (Object.getOwnPropertySymbols) {
|
|
1563
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
1564
|
+
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
1565
|
+
}
|
|
1566
|
+
return i;
|
|
1567
|
+
}
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region src/plugins/page-view.ts
|
|
1570
|
+
var yn = ["stopLoadingTime"], bn = new Set([...Object.values(g), D]), xn = () => typeof location > "u" ? "" : location.href, Sn = () => {
|
|
1913
1571
|
if (typeof performance > "u") return {};
|
|
1914
1572
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1915
1573
|
if (!e) return {};
|
|
1916
1574
|
let t = {}, n = (e, n) => {
|
|
1917
1575
|
Number.isFinite(n) && n > 0 && (t[e] = n);
|
|
1918
1576
|
};
|
|
1919
|
-
return n(
|
|
1920
|
-
},
|
|
1577
|
+
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;
|
|
1578
|
+
}, Cn = (e) => {
|
|
1921
1579
|
let t = e.indexOf("?");
|
|
1922
1580
|
return t < 0 ? e : e.slice(0, t);
|
|
1923
|
-
},
|
|
1581
|
+
}, wn = (e) => {
|
|
1924
1582
|
let t = e.slice(1);
|
|
1925
1583
|
if (!t || typeof document > "u" || typeof document.getElementById != "function") return !1;
|
|
1926
1584
|
try {
|
|
@@ -1928,58 +1586,51 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
1928
1586
|
} catch (e) {
|
|
1929
1587
|
return !!document.getElementById(t);
|
|
1930
1588
|
}
|
|
1931
|
-
},
|
|
1589
|
+
}, Tn = (e, t) => {
|
|
1932
1590
|
try {
|
|
1933
1591
|
let n = typeof location > "u" ? "http://localhost" : location.href, r = new URL(e, n), i = new URL(t, n);
|
|
1934
|
-
return r.pathname !== i.pathname || !
|
|
1592
|
+
return r.pathname !== i.pathname || !wn(i.hash) && Cn(r.hash) !== Cn(i.hash);
|
|
1935
1593
|
} catch (n) {
|
|
1936
1594
|
return e !== t;
|
|
1937
1595
|
}
|
|
1938
|
-
},
|
|
1596
|
+
}, En = () => {
|
|
1939
1597
|
let e = [];
|
|
1940
1598
|
return {
|
|
1941
1599
|
name: "page-view",
|
|
1942
1600
|
init(t) {
|
|
1943
1601
|
if (typeof window > "u") return;
|
|
1944
|
-
let n, r, i =
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
eventName: "browser.view",
|
|
1962
|
-
severityNumber: T.INFO,
|
|
1963
|
-
severityText: "INFO",
|
|
1964
|
-
timestamp: r
|
|
1965
|
-
}));
|
|
1966
|
-
}, s = (e, r = !0, s = Date.now()) => {
|
|
1967
|
-
var c;
|
|
1602
|
+
let n, r, i, a = (e = Date.now()) => t.setView({}, e), o = (e, n, r = Date.now(), i) => {
|
|
1603
|
+
e.version += 1, t.startSpan("browser.view", S(S(S(S(S({}, t.config.hooks.getPageAttributes()), e.attributes), e.snapshotAttributes), {}, {
|
|
1604
|
+
[g.eventId]: h("event"),
|
|
1605
|
+
[g.eventPhase]: n,
|
|
1606
|
+
[g.eventTimestamp]: r,
|
|
1607
|
+
[g.eventType]: "view",
|
|
1608
|
+
[g.viewStartedAt]: e.startedAt,
|
|
1609
|
+
[g.viewVersion]: e.version
|
|
1610
|
+
}, i ? { "view.end_reason": i } : {}), e.loadingTime === void 0 ? {} : {
|
|
1611
|
+
[g.viewLoadingTime]: e.loadingTime,
|
|
1612
|
+
"view.loading_time.source": e.loadingTimeSource
|
|
1613
|
+
}), {
|
|
1614
|
+
contextTime: r,
|
|
1615
|
+
startTime: r
|
|
1616
|
+
}).end(r);
|
|
1617
|
+
}, s = (e, t = !0, r = Date.now()) => {
|
|
1618
|
+
var i;
|
|
1968
1619
|
if (!n) {
|
|
1969
|
-
|
|
1620
|
+
t && a(r);
|
|
1970
1621
|
return;
|
|
1971
1622
|
}
|
|
1972
|
-
let
|
|
1973
|
-
(
|
|
1974
|
-
let {
|
|
1975
|
-
return
|
|
1623
|
+
let s = S({}, n);
|
|
1624
|
+
(i = n.stopLoadingTime) == null || i.call(n), o(n, "end", r, e), n = void 0, t && a(r);
|
|
1625
|
+
let { stopLoadingTime: c } = s;
|
|
1626
|
+
return vn(s, yn);
|
|
1976
1627
|
}, c = (e, t, r) => {
|
|
1977
1628
|
if (n !== e || !Number.isFinite(t) || t < 0) return;
|
|
1978
|
-
let i =
|
|
1979
|
-
[
|
|
1629
|
+
let i = S(S({}, e.loadingType === "initial_load" ? Sn() : {}), {}, {
|
|
1630
|
+
[g.viewLoadingTime]: t,
|
|
1980
1631
|
"view.loading_time.source": r
|
|
1981
1632
|
});
|
|
1982
|
-
|
|
1633
|
+
Object.assign(e.snapshotAttributes, i), e.loadingTime = t, e.loadingTimeSource = r, o(e, "update");
|
|
1983
1634
|
}, l = (e) => {
|
|
1984
1635
|
if (!t.config.view.loadingTime || document.visibilityState === "hidden") return;
|
|
1985
1636
|
let r = !1, i, a = e.loadingType !== "initial_load", o, s, l = !1, u, d = () => {
|
|
@@ -2000,7 +1651,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2000
1651
|
};
|
|
2001
1652
|
window.addEventListener("load", t, { once: !0 }), s = () => window.removeEventListener("load", t);
|
|
2002
1653
|
}
|
|
2003
|
-
let p =
|
|
1654
|
+
let p = mt(t, e.startedAt, (t) => {
|
|
2004
1655
|
r = !0, t.hadActivity && (i = Math.max(0, t.endTime - e.startedAt)), d();
|
|
2005
1656
|
}), m = () => {
|
|
2006
1657
|
var t;
|
|
@@ -2011,48 +1662,45 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2011
1662
|
}, d();
|
|
2012
1663
|
}, u = (e) => {
|
|
2013
1664
|
let n = t.applyRedact(e == null ? {} : e);
|
|
2014
|
-
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !
|
|
1665
|
+
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !bn.has(e)));
|
|
2015
1666
|
}, d = (e, r, i, a = ((e) => (e = n == null ? void 0 : n.rawUrl) == null ? "" : e)()) => {
|
|
2016
1667
|
var c, d;
|
|
2017
1668
|
if (!t.isSessionActive()) return;
|
|
2018
|
-
let f = (c = e.url) == null ?
|
|
1669
|
+
let f = (c = e.url) == null ? xn() : c, p = t.config.hooks.getViewPathGroup(f), m = (d = e.name) == null ? p : d, _ = u(e.attributes);
|
|
2019
1670
|
s(r, !1);
|
|
2020
|
-
let
|
|
1671
|
+
let v = h("view"), y = t.config.hooks.redactUrl(f), b = t.config.hooks.redactUrl(a), x = i === "initial_load", C = x && typeof performance < "u" ? performance.timeOrigin : Date.now(), w = x ? Sn() : {};
|
|
2021
1672
|
t.setView({
|
|
2022
|
-
attributes:
|
|
2023
|
-
id:
|
|
1673
|
+
attributes: _,
|
|
1674
|
+
id: v,
|
|
2024
1675
|
loadingType: i,
|
|
2025
1676
|
name: m,
|
|
2026
|
-
startedAt:
|
|
2027
|
-
url:
|
|
1677
|
+
startedAt: C,
|
|
1678
|
+
url: y,
|
|
2028
1679
|
urlPathGroup: p
|
|
2029
|
-
},
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
spanType: y ? R.document : R.route
|
|
2034
|
-
})), {}, {
|
|
2035
|
-
[O.viewId]: g,
|
|
2036
|
-
[O.viewName]: m,
|
|
2037
|
-
[O.viewUrl]: _,
|
|
2038
|
-
[O.viewUrlPathGroup]: p,
|
|
2039
|
-
[O.viewLoadingType]: i,
|
|
2040
|
-
"url.previous": v,
|
|
2041
|
-
"event.source": r
|
|
2042
|
-
}, y ? { "document.referrer": t.config.hooks.redactUrl(document.referrer || "") } : {});
|
|
2043
|
-
n = {
|
|
2044
|
-
attributes: h,
|
|
2045
|
-
documentVersion: 0,
|
|
2046
|
-
id: g,
|
|
1680
|
+
}, C), n = {
|
|
1681
|
+
attributes: _,
|
|
1682
|
+
version: 0,
|
|
1683
|
+
id: v,
|
|
2047
1684
|
loadingType: i,
|
|
2048
1685
|
name: m,
|
|
2049
1686
|
rawUrl: f,
|
|
2050
|
-
snapshotAttributes: S,
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
1687
|
+
snapshotAttributes: S(S(S(S(S({}, _), t.config.hooks.getPageAttributes()), w), N({
|
|
1688
|
+
errorType: "none",
|
|
1689
|
+
spanSubtype: x ? "navigate" : r,
|
|
1690
|
+
spanType: x ? M.document : M.route
|
|
1691
|
+
})), {}, {
|
|
1692
|
+
[g.viewId]: v,
|
|
1693
|
+
[g.viewName]: m,
|
|
1694
|
+
[g.viewUrl]: y,
|
|
1695
|
+
[g.viewUrlPathGroup]: p,
|
|
1696
|
+
[g.viewLoadingType]: i,
|
|
1697
|
+
"url.previous": b,
|
|
1698
|
+
"event.source": r
|
|
1699
|
+
}, x ? { "document.referrer": t.config.hooks.redactUrl(document.referrer || "") } : {}),
|
|
1700
|
+
startedAt: C,
|
|
1701
|
+
url: y,
|
|
2054
1702
|
urlPathGroup: p
|
|
2055
|
-
}, o(n, "
|
|
1703
|
+
}, o(n, "start", C), l(n);
|
|
2056
1704
|
}, f = t.onViewCommand((e) => {
|
|
2057
1705
|
if (e.type === "start") {
|
|
2058
1706
|
d(e.options, "manual", n ? "route_change" : "initial_load");
|
|
@@ -2064,7 +1712,7 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2064
1712
|
(r = n.stopLoadingTime) == null || r.call(n), n.stopLoadingTime = void 0, c(n, Math.max(0, e.time - n.startedAt), "manual");
|
|
2065
1713
|
return;
|
|
2066
1714
|
}
|
|
2067
|
-
n.name !== e.name && (n.name = e.name, n.
|
|
1715
|
+
n.name !== e.name && (n.name = e.name, n.snapshotAttributes[g.viewName] = e.name, t.setView({
|
|
2068
1716
|
attributes: n.attributes,
|
|
2069
1717
|
id: n.id,
|
|
2070
1718
|
loadingType: n.loadingType,
|
|
@@ -2075,25 +1723,41 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2075
1723
|
}), o(n, "update"));
|
|
2076
1724
|
}
|
|
2077
1725
|
}), p = () => {};
|
|
2078
|
-
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p =
|
|
2079
|
-
|
|
1726
|
+
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p = gn((e) => {
|
|
1727
|
+
Tn(e.fromUrl, e.toUrl) && d({}, e.source, "route_change", e.fromUrl);
|
|
2080
1728
|
}));
|
|
2081
1729
|
let m = (e) => {
|
|
2082
|
-
e.persisted
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
1730
|
+
if (e.persisted) {
|
|
1731
|
+
r = s("bfcache");
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
r = void 0, s("pagehide");
|
|
1735
|
+
}, _ = (e) => {
|
|
1736
|
+
if (e.persisted && t.config.view.tracking === "auto") {
|
|
1737
|
+
let e = r;
|
|
1738
|
+
if (r = void 0, !t.isSessionActive()) {
|
|
1739
|
+
i = e;
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
d(e ? {
|
|
1743
|
+
attributes: e.attributes,
|
|
1744
|
+
name: e.name,
|
|
1745
|
+
url: e.rawUrl
|
|
1746
|
+
} : {}, "bfCache", "bf_cache", e == null ? void 0 : e.rawUrl);
|
|
1747
|
+
}
|
|
1748
|
+
}, v = t.onSessionLifecycle((e) => {
|
|
2086
1749
|
if (e.type === "expired") {
|
|
2087
|
-
|
|
1750
|
+
var t;
|
|
1751
|
+
i = (t = s("session_expired", !0, e.expiredAt)) == null ? r : t, r = void 0;
|
|
2088
1752
|
return;
|
|
2089
1753
|
}
|
|
2090
|
-
|
|
2091
|
-
attributes:
|
|
2092
|
-
name:
|
|
2093
|
-
url:
|
|
2094
|
-
}, "sessionRenewal", "session_renewal",
|
|
1754
|
+
i && (d({
|
|
1755
|
+
attributes: i.attributes,
|
|
1756
|
+
name: i.name,
|
|
1757
|
+
url: i.rawUrl
|
|
1758
|
+
}, "sessionRenewal", "session_renewal", i.rawUrl), i = void 0);
|
|
2095
1759
|
});
|
|
2096
|
-
window.addEventListener("pagehide", m), window.addEventListener("pageshow",
|
|
1760
|
+
window.addEventListener("pagehide", m), window.addEventListener("pageshow", _), e.push(p, v, f, () => window.removeEventListener("pagehide", m), () => window.removeEventListener("pageshow", _), () => s("shutdown"));
|
|
2097
1761
|
},
|
|
2098
1762
|
shutdown() {
|
|
2099
1763
|
for (; e.length;) {
|
|
@@ -2102,27 +1766,27 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2102
1766
|
}
|
|
2103
1767
|
}
|
|
2104
1768
|
};
|
|
2105
|
-
},
|
|
1769
|
+
}, Dn = 5e3, On = (e) => typeof e == "number" && Number.isFinite(e) && e > 0, kn = (e, t, n, r) => ({
|
|
2106
1770
|
expiresAt: Math.min(t + n, t + r),
|
|
2107
1771
|
id: e,
|
|
2108
1772
|
startedAt: t,
|
|
2109
1773
|
status: "active"
|
|
2110
|
-
}),
|
|
1774
|
+
}), Y = (e, t, n) => {
|
|
2111
1775
|
if (t >= e.startedAt + n) return "maxLifetime";
|
|
2112
1776
|
if (t >= e.expiresAt) return "inactivity";
|
|
2113
|
-
},
|
|
1777
|
+
}, An = (e, t, n, r) => S(S({}, e), {}, { expiresAt: Math.min(t + n, e.startedAt + r) }), jn = (e, t, n) => {
|
|
2114
1778
|
if (!e) return null;
|
|
2115
1779
|
try {
|
|
2116
1780
|
let r = JSON.parse(e);
|
|
2117
|
-
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 &&
|
|
1781
|
+
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 && On(r.startedAt) && r.startedAt <= t + Dn && On(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") && On(r.expiredAt) && r.expiredAt <= t + Dn) return r;
|
|
2118
1782
|
} catch (e) {}
|
|
2119
1783
|
return null;
|
|
2120
|
-
},
|
|
1784
|
+
}, Mn = 900 * 1e3, X = 14400 * 1e3, Nn = 1e3, Pn = 6e4, Fn = [
|
|
2121
1785
|
"click",
|
|
2122
1786
|
"keydown",
|
|
2123
1787
|
"scroll",
|
|
2124
1788
|
"touchstart"
|
|
2125
|
-
],
|
|
1789
|
+
], In = /* @__PURE__ */ new Map(), Ln = (e) => {
|
|
2126
1790
|
let t = typeof window < "u", n = () => {
|
|
2127
1791
|
var n;
|
|
2128
1792
|
if (t) try {
|
|
@@ -2130,86 +1794,95 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2130
1794
|
} catch (e) {
|
|
2131
1795
|
t = !1;
|
|
2132
1796
|
}
|
|
2133
|
-
return (n =
|
|
1797
|
+
return (n = In.get(e)) == null ? null : n;
|
|
2134
1798
|
};
|
|
2135
1799
|
return n(), {
|
|
2136
1800
|
isLocalStorage: () => t,
|
|
2137
1801
|
read: n,
|
|
2138
1802
|
write: (n) => {
|
|
2139
1803
|
let r = JSON.stringify(n);
|
|
2140
|
-
if (
|
|
1804
|
+
if (In.set(e, r), t) try {
|
|
2141
1805
|
window.localStorage.setItem(e, r);
|
|
2142
1806
|
} catch (e) {
|
|
2143
1807
|
t = !1;
|
|
2144
1808
|
}
|
|
2145
1809
|
}
|
|
2146
1810
|
};
|
|
2147
|
-
},
|
|
1811
|
+
}, Rn = (e, t) => {
|
|
2148
1812
|
let n = "";
|
|
2149
1813
|
try {
|
|
2150
1814
|
n = new URL(e).host;
|
|
2151
1815
|
} catch (t) {
|
|
2152
1816
|
n = e;
|
|
2153
1817
|
}
|
|
2154
|
-
return `bk_ot_session__${
|
|
2155
|
-
},
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
})
|
|
2170
|
-
|
|
1818
|
+
return `bk_ot_session__${m(`${t}\0${n || "default"}`)}`;
|
|
1819
|
+
}, zn = (e, t, n, r, i, a, o) => {
|
|
1820
|
+
e.startSpan("browser.session", S(S(S({}, e.config.hooks.getPageAttributes()), N({
|
|
1821
|
+
spanSubtype: t,
|
|
1822
|
+
spanType: M.session
|
|
1823
|
+
})), {}, {
|
|
1824
|
+
[g.eventId]: h("event"),
|
|
1825
|
+
[g.eventPhase]: t,
|
|
1826
|
+
[g.eventTimestamp]: i,
|
|
1827
|
+
[g.eventType]: "session",
|
|
1828
|
+
[g.sessionHasReplay]: !1,
|
|
1829
|
+
[g.sessionId]: n,
|
|
1830
|
+
[g.sessionStartTime]: r,
|
|
1831
|
+
[g.sessionType]: "user",
|
|
1832
|
+
"session.lifecycle.reason": a
|
|
1833
|
+
}, o ? { "session.previous_id": o } : {}), {
|
|
1834
|
+
contextTime: i,
|
|
1835
|
+
startTime: i
|
|
1836
|
+
}).end(i);
|
|
1837
|
+
}, Bn = (e = {}) => {
|
|
2171
1838
|
let t = [];
|
|
2172
1839
|
return {
|
|
2173
1840
|
name: "session",
|
|
2174
1841
|
init(n) {
|
|
2175
1842
|
var r;
|
|
2176
1843
|
if (typeof window > "u" || typeof document > "u") {
|
|
1844
|
+
let e = Date.now(), t = h("session");
|
|
2177
1845
|
n.setRuntimeAttributes({
|
|
2178
|
-
[
|
|
2179
|
-
[
|
|
2180
|
-
|
|
1846
|
+
[g.sessionHasReplay]: !1,
|
|
1847
|
+
[g.sessionId]: t,
|
|
1848
|
+
[g.sessionStartTime]: e,
|
|
1849
|
+
[g.sessionType]: "user"
|
|
1850
|
+
}, e);
|
|
2181
1851
|
return;
|
|
2182
1852
|
}
|
|
2183
|
-
let i = (r = e.storageKey) == null ?
|
|
2184
|
-
|
|
2185
|
-
},
|
|
2186
|
-
|
|
2187
|
-
|
|
1853
|
+
let i = (r = e.storageKey) == null ? Rn(n.config.transport.endpoint, n.config.application.name) : r, a = Ln(i), o = typeof performance < "u" && Number.isFinite(performance.timeOrigin) ? performance.timeOrigin : Date.now(), s, c, l, u = (e = Date.now()) => jn(a.read(), e, X), d = () => {
|
|
1854
|
+
l !== void 0 && (clearTimeout(l), l = void 0);
|
|
1855
|
+
}, f = (e, t = Date.now()) => {
|
|
1856
|
+
var r;
|
|
1857
|
+
let i = s;
|
|
1858
|
+
i && (n.notifySessionLifecycle({
|
|
2188
1859
|
expiredAt: t,
|
|
2189
|
-
id:
|
|
1860
|
+
id: i,
|
|
2190
1861
|
reason: e,
|
|
2191
1862
|
type: "expired"
|
|
2192
|
-
}),
|
|
2193
|
-
[
|
|
2194
|
-
[
|
|
1863
|
+
}), zn(n, "end", i, (r = c) == null ? t : r, t, e), d(), s = void 0, c = void 0, n.setRuntimeAttributes({
|
|
1864
|
+
[g.sessionHasReplay]: void 0,
|
|
1865
|
+
[g.sessionId]: void 0,
|
|
1866
|
+
[g.sessionStartTime]: void 0,
|
|
1867
|
+
[g.sessionType]: void 0
|
|
2195
1868
|
}, t), n.flush());
|
|
2196
|
-
},
|
|
2197
|
-
let e = Date.now(), t =
|
|
1869
|
+
}, p = () => {
|
|
1870
|
+
let e = Date.now(), t = u(e);
|
|
2198
1871
|
if (!t) {
|
|
2199
|
-
|
|
1872
|
+
f("external", e);
|
|
2200
1873
|
return;
|
|
2201
1874
|
}
|
|
2202
1875
|
if (t.status === "expired") {
|
|
2203
|
-
|
|
1876
|
+
f(t.reason, t.expiredAt);
|
|
2204
1877
|
return;
|
|
2205
1878
|
}
|
|
2206
1879
|
if (t.id !== s) {
|
|
2207
|
-
|
|
1880
|
+
f("external", e);
|
|
2208
1881
|
return;
|
|
2209
1882
|
}
|
|
2210
|
-
let n =
|
|
1883
|
+
let n = Y(t, e, X);
|
|
2211
1884
|
if (!n) {
|
|
2212
|
-
|
|
1885
|
+
m(t);
|
|
2213
1886
|
return;
|
|
2214
1887
|
}
|
|
2215
1888
|
let r = {
|
|
@@ -2218,135 +1891,131 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2218
1891
|
reason: n,
|
|
2219
1892
|
status: "expired"
|
|
2220
1893
|
};
|
|
2221
|
-
a.write(r),
|
|
2222
|
-
},
|
|
2223
|
-
|
|
2224
|
-
let t = Math.min(e.expiresAt, e.startedAt +
|
|
2225
|
-
|
|
2226
|
-
},
|
|
1894
|
+
a.write(r), f(n, e);
|
|
1895
|
+
}, m = (e) => {
|
|
1896
|
+
d();
|
|
1897
|
+
let t = Math.min(e.expiresAt, e.startedAt + X);
|
|
1898
|
+
l = setTimeout(p, Math.max(0, t - Date.now()));
|
|
1899
|
+
}, _ = (e, t) => {
|
|
2227
1900
|
let r = e.id !== s;
|
|
2228
|
-
s = e.id, n.setRuntimeAttributes({
|
|
2229
|
-
[
|
|
2230
|
-
[
|
|
2231
|
-
|
|
1901
|
+
s = e.id, c = e.startedAt, n.setRuntimeAttributes({
|
|
1902
|
+
[g.sessionHasReplay]: !1,
|
|
1903
|
+
[g.sessionId]: e.id,
|
|
1904
|
+
[g.sessionStartTime]: e.startedAt,
|
|
1905
|
+
[g.sessionType]: "user"
|
|
1906
|
+
}, Math.min(e.startedAt, o)), m(e), r && t && n.notifySessionLifecycle({
|
|
2232
1907
|
id: e.id,
|
|
2233
1908
|
previousId: t.previousId,
|
|
2234
1909
|
reason: t.reason,
|
|
2235
1910
|
startedAt: e.startedAt,
|
|
2236
1911
|
type: "renewed"
|
|
2237
1912
|
});
|
|
2238
|
-
},
|
|
2239
|
-
let t = Date.now(), r =
|
|
2240
|
-
if ((r == null ? void 0 : r.status) === "active" && !
|
|
2241
|
-
let e =
|
|
2242
|
-
a.write(e),
|
|
1913
|
+
}, v = (e = !1) => {
|
|
1914
|
+
let t = Date.now(), r = u(t);
|
|
1915
|
+
if ((r == null ? void 0 : r.status) === "active" && !Y(r, t, X)) {
|
|
1916
|
+
let e = An(r, t, Mn, X);
|
|
1917
|
+
a.write(e), _(e, s ? void 0 : { reason: "shared" });
|
|
2243
1918
|
return;
|
|
2244
1919
|
}
|
|
2245
|
-
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 ?
|
|
2246
|
-
a.write(c),
|
|
1920
|
+
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 ? Y(r, t, X) : e ? "init" : void 0, c = kn(h("session"), t, Mn, X);
|
|
1921
|
+
a.write(c), _(c, {
|
|
2247
1922
|
previousId: i,
|
|
2248
1923
|
reason: o == null ? "init" : o
|
|
2249
|
-
}), Ir(n, {
|
|
2250
|
-
previousId: i,
|
|
2251
|
-
reason: o == null ? "init" : o,
|
|
2252
|
-
record: c
|
|
2253
1924
|
});
|
|
2254
|
-
|
|
1925
|
+
let l = o == null ? "init" : o;
|
|
1926
|
+
zn(n, l === "init" ? "start" : "rotate", c.id, c.startedAt, c.startedAt, l, i);
|
|
1927
|
+
}, y = () => {
|
|
2255
1928
|
if (!s) return;
|
|
2256
|
-
let e = Date.now(), t =
|
|
2257
|
-
if ((t == null ? void 0 : t.status) !== "active" || t.id !== s ||
|
|
2258
|
-
|
|
1929
|
+
let e = Date.now(), t = u(e);
|
|
1930
|
+
if ((t == null ? void 0 : t.status) !== "active" || t.id !== s || Y(t, e, X)) {
|
|
1931
|
+
p();
|
|
2259
1932
|
return;
|
|
2260
1933
|
}
|
|
2261
|
-
let n =
|
|
2262
|
-
a.write(n),
|
|
1934
|
+
let n = An(t, e, Mn, X);
|
|
1935
|
+
a.write(n), _(n);
|
|
2263
1936
|
};
|
|
2264
|
-
|
|
2265
|
-
let
|
|
1937
|
+
v(!0);
|
|
1938
|
+
let b = 0, x = () => {
|
|
2266
1939
|
let e = Date.now();
|
|
2267
|
-
e -
|
|
2268
|
-
},
|
|
1940
|
+
e - b < Nn || (b = e, v());
|
|
1941
|
+
}, S = {
|
|
2269
1942
|
capture: !0,
|
|
2270
1943
|
passive: !0
|
|
2271
1944
|
};
|
|
2272
|
-
|
|
2273
|
-
|
|
1945
|
+
Fn.forEach((e) => window.addEventListener(e, x, S)), t.push(() => {
|
|
1946
|
+
Fn.forEach((e) => window.removeEventListener(e, x, S));
|
|
2274
1947
|
});
|
|
2275
|
-
let
|
|
2276
|
-
document.visibilityState === "visible" &&
|
|
1948
|
+
let C = () => {
|
|
1949
|
+
document.visibilityState === "visible" && y();
|
|
2277
1950
|
};
|
|
2278
|
-
document.addEventListener("visibilitychange",
|
|
2279
|
-
let
|
|
1951
|
+
document.addEventListener("visibilitychange", C);
|
|
1952
|
+
let w = window.setInterval(C, Pn);
|
|
2280
1953
|
t.push(() => {
|
|
2281
|
-
document.removeEventListener("visibilitychange",
|
|
1954
|
+
document.removeEventListener("visibilitychange", C), window.clearInterval(w);
|
|
2282
1955
|
});
|
|
2283
|
-
let
|
|
1956
|
+
let T = (e) => {
|
|
2284
1957
|
if (!a.isLocalStorage() || e.storageArea !== window.localStorage || e.key !== i) return;
|
|
2285
|
-
let t = Date.now(), n =
|
|
2286
|
-
if ((n == null ? void 0 : n.status) === "active" && n.id === s && !
|
|
2287
|
-
|
|
1958
|
+
let t = Date.now(), n = jn(e.newValue, t, X);
|
|
1959
|
+
if ((n == null ? void 0 : n.status) === "active" && n.id === s && !Y(n, t, X)) {
|
|
1960
|
+
m(n);
|
|
2288
1961
|
return;
|
|
2289
1962
|
}
|
|
2290
|
-
|
|
1963
|
+
f((n == null ? void 0 : n.status) === "expired" ? n.reason : "external", (n == null ? void 0 : n.status) === "expired" ? n.expiredAt : t);
|
|
2291
1964
|
};
|
|
2292
|
-
window.addEventListener("storage",
|
|
1965
|
+
window.addEventListener("storage", T), t.push(() => window.removeEventListener("storage", T)), t.push(d);
|
|
2293
1966
|
},
|
|
2294
1967
|
shutdown() {
|
|
2295
1968
|
for (var e; t.length;) (e = t.pop()) == null || e();
|
|
2296
1969
|
}
|
|
2297
1970
|
};
|
|
2298
|
-
},
|
|
2299
|
-
if (typeof performance > "u") return
|
|
1971
|
+
}, Vn = "unknown", Hn = 10, Un = 6e4, Wn = 5e3, Gn = 1e3, Kn = (e, t) => !!t && e === t, qn = (e) => e ? e.replace(/_/g, "-") : Vn, Jn = () => {
|
|
1972
|
+
if (typeof performance > "u") return Vn;
|
|
2300
1973
|
let e = performance.getEntriesByType("navigation")[0];
|
|
2301
|
-
return
|
|
2302
|
-
},
|
|
1974
|
+
return qn(e == null ? void 0 : e.type);
|
|
1975
|
+
}, Yn = (e, t) => {
|
|
2303
1976
|
let [n, r] = e === "CLS" ? [.1, .25] : [200, 500];
|
|
2304
1977
|
return t <= n ? "good" : t <= r ? "needs-improvement" : "poor";
|
|
2305
|
-
},
|
|
1978
|
+
}, Z = (e) => {
|
|
2306
1979
|
var t, n, r;
|
|
2307
1980
|
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;
|
|
2308
|
-
},
|
|
1981
|
+
}, Xn = () => {
|
|
2309
1982
|
if (typeof performance > "u") return;
|
|
2310
1983
|
let e = performance.interactionCount;
|
|
2311
1984
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
2312
|
-
},
|
|
1985
|
+
}, Zn = (e, t) => {
|
|
2313
1986
|
var n, r;
|
|
2314
1987
|
let i = (n = t.value) == null ? 0 : n;
|
|
2315
1988
|
if (!(t.hadRecentInput || !Number.isFinite(i))) {
|
|
2316
|
-
if (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >=
|
|
1989
|
+
if (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >= Gn || t.startTime - e.clsWindowStart >= Wn) {
|
|
2317
1990
|
var a;
|
|
2318
|
-
e.clsWindowStart = t.startTime, e.clsWindowValue = i, e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget =
|
|
1991
|
+
e.clsWindowStart = t.startTime, e.clsWindowValue = i, e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget = Z((a = t.sources) == null || (a = a[0]) == null ? void 0 : a.node);
|
|
2319
1992
|
} else if (e.clsWindowValue += i, i > e.clsWindowLargestShiftValue) {
|
|
2320
1993
|
var o;
|
|
2321
|
-
e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget =
|
|
1994
|
+
e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget = Z((o = t.sources) == null || (o = o[0]) == null ? void 0 : o.node);
|
|
2322
1995
|
}
|
|
2323
1996
|
e.clsWindowEnd = t.startTime, e.clsWindowValue > e.cls && (e.cls = Math.round(e.clsWindowValue * 1e4) / 1e4, e.largestShiftValue = e.clsWindowLargestShiftValue, e.largestShiftTarget = e.clsWindowLargestShiftTarget);
|
|
2324
1997
|
}
|
|
2325
|
-
},
|
|
1998
|
+
}, Qn = (e, t) => {
|
|
2326
1999
|
var n, r;
|
|
2327
2000
|
if (!t.interactionId || !Number.isFinite(t.duration)) return;
|
|
2328
2001
|
e.interactionIdMin = Math.min(e.interactionIdMin, t.interactionId), e.interactionIdMax = Math.max(e.interactionIdMax, t.interactionId);
|
|
2329
2002
|
let i = (n = t.processingStart) == null ? t.startTime : n, a = (r = t.processingEnd) == null ? i : r, o = {
|
|
2330
|
-
duration: Math.min(t.duration,
|
|
2003
|
+
duration: Math.min(t.duration, Un),
|
|
2331
2004
|
inputDelay: Math.max(0, i - t.startTime),
|
|
2332
2005
|
interactionId: t.interactionId,
|
|
2333
|
-
interactionTarget:
|
|
2006
|
+
interactionTarget: Z(t.target),
|
|
2334
2007
|
interactionType: t.name,
|
|
2335
2008
|
presentationDelay: Math.max(0, t.startTime + t.duration - a),
|
|
2336
2009
|
processingDuration: Math.max(0, a - i)
|
|
2337
2010
|
}, s = e.inpCandidates.findIndex((e) => e.interactionId === t.interactionId);
|
|
2338
|
-
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(
|
|
2339
|
-
},
|
|
2340
|
-
let t =
|
|
2011
|
+
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(Hn);
|
|
2012
|
+
}, $n = (e) => {
|
|
2013
|
+
let t = Xn(), n = t !== void 0 && e.interactionCountAtStart !== void 0 ? Math.max(0, t - e.interactionCountAtStart) : e.interactionIdMin === Infinity ? 0 : (e.interactionIdMax - e.interactionIdMin) / 7 + 1;
|
|
2341
2014
|
if (e.inpCandidates.length) return e.inpCandidates[Math.min(e.inpCandidates.length - 1, Math.floor(n / 50))];
|
|
2342
|
-
},
|
|
2015
|
+
}, er = (e, t) => {
|
|
2343
2016
|
var n;
|
|
2344
|
-
return {
|
|
2345
|
-
|
|
2346
|
-
[O.vitalMetric]: e.name.toLowerCase(),
|
|
2347
|
-
[O.vitalRating]: e.rating
|
|
2348
|
-
};
|
|
2349
|
-
}, $r = (e, t) => {
|
|
2017
|
+
return { "rum.navigation.type": (n = e.navigationType) == null ? t : n };
|
|
2018
|
+
}, tr = (e, t) => {
|
|
2350
2019
|
var n;
|
|
2351
2020
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
2352
2021
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -2370,12 +2039,12 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2370
2039
|
default: break;
|
|
2371
2040
|
}
|
|
2372
2041
|
return i;
|
|
2373
|
-
},
|
|
2042
|
+
}, nr = () => {
|
|
2374
2043
|
let e, t = !1;
|
|
2375
2044
|
return {
|
|
2376
2045
|
name: "web-vitals",
|
|
2377
2046
|
init(n) {
|
|
2378
|
-
return
|
|
2047
|
+
return E(function* () {
|
|
2379
2048
|
if (typeof window > "u") return;
|
|
2380
2049
|
let r;
|
|
2381
2050
|
try {
|
|
@@ -2388,55 +2057,49 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2388
2057
|
return;
|
|
2389
2058
|
}
|
|
2390
2059
|
if (t) return;
|
|
2391
|
-
let { onFCP: a, onLCP: o, onTTFB: s } = r, c =
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}), u = n.meter.createHistogram("browser.web_vital.duration", {
|
|
2396
|
-
unit: "ms",
|
|
2397
|
-
description: "Web Vitals duration metrics, including FCP, INP, LCP and TTFB",
|
|
2398
|
-
advice: { explicitBucketBoundaries: G }
|
|
2399
|
-
}), d = (e, t, r) => {
|
|
2400
|
-
if (!I(n, "traces")) return;
|
|
2401
|
-
let i = e.name.toLowerCase();
|
|
2402
|
-
n.startSpan("browser.web_vital", j(j(j(j(j({}, n.config.hooks.getPageAttributes()), t), Qr(e, c)), z({
|
|
2060
|
+
let { onFCP: a, onLCP: o, onTTFB: s } = r, c = Jn(), l = (e, t, r, i = r == null ? Date.now() : r) => {
|
|
2061
|
+
if (!n.isSampled()) return;
|
|
2062
|
+
let a = e.name.toLowerCase();
|
|
2063
|
+
n.startSpan("browser.web_vital", S(S(S(S(S({}, n.config.hooks.getPageAttributes()), t), er(e, c)), N({
|
|
2403
2064
|
errorType: e.rating === "good" ? "none" : "slow",
|
|
2404
|
-
result:
|
|
2405
|
-
spanSubtype:
|
|
2406
|
-
spanType:
|
|
2065
|
+
result: Ge(e.rating),
|
|
2066
|
+
spanSubtype: a,
|
|
2067
|
+
spanType: M.vital
|
|
2407
2068
|
})), {}, {
|
|
2408
|
-
[
|
|
2409
|
-
[
|
|
2410
|
-
[
|
|
2069
|
+
[g.vitalMetric]: a,
|
|
2070
|
+
[g.vitalValue]: e.value,
|
|
2071
|
+
[g.vitalRating]: e.rating,
|
|
2072
|
+
[g.eventId]: h("event"),
|
|
2073
|
+
[g.eventTimestamp]: i,
|
|
2074
|
+
[g.eventType]: "vital",
|
|
2411
2075
|
"vital.id": e.id
|
|
2412
|
-
},
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
d(e, t, r);
|
|
2076
|
+
}, tr(e, n.config.hooks.redactUrl)), {
|
|
2077
|
+
contextTime: r,
|
|
2078
|
+
startTime: i
|
|
2079
|
+
}).end(i);
|
|
2080
|
+
}, u = (e) => {
|
|
2081
|
+
if (t || !Number.isFinite(e.value) || !n.isSampled()) return;
|
|
2082
|
+
let r = e.entries[0], i = r && typeof performance < "u" ? performance.timeOrigin + r.startTime : void 0;
|
|
2083
|
+
l(e, i === void 0 ? n.getRuntimeAttributes() : n.getRuntimeAttributesAt(i), i);
|
|
2084
|
+
}, d, f, p, m = (e, t, n) => {
|
|
2085
|
+
l(e, t, n, Date.now());
|
|
2423
2086
|
}, _ = () => {
|
|
2424
|
-
let e =
|
|
2425
|
-
if (!e || !
|
|
2426
|
-
|
|
2087
|
+
let e = d;
|
|
2088
|
+
if (!e || !n.isSampled()) return;
|
|
2089
|
+
m({
|
|
2427
2090
|
attribution: {
|
|
2428
2091
|
largestShiftTarget: e.largestShiftTarget,
|
|
2429
2092
|
largestShiftValue: e.largestShiftValue
|
|
2430
2093
|
},
|
|
2431
2094
|
entries: [],
|
|
2432
|
-
id:
|
|
2095
|
+
id: h("vital"),
|
|
2433
2096
|
name: "CLS",
|
|
2434
2097
|
navigationType: c,
|
|
2435
|
-
rating:
|
|
2098
|
+
rating: Yn("CLS", e.cls),
|
|
2436
2099
|
value: e.cls
|
|
2437
2100
|
}, e.runtimeAttributes, e.startedAt);
|
|
2438
|
-
let t =
|
|
2439
|
-
t &&
|
|
2101
|
+
let t = $n(e);
|
|
2102
|
+
t && m({
|
|
2440
2103
|
attribution: {
|
|
2441
2104
|
inputDelay: t.inputDelay,
|
|
2442
2105
|
interactionTarget: t.interactionTarget,
|
|
@@ -2445,29 +2108,29 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2445
2108
|
processingDuration: t.processingDuration
|
|
2446
2109
|
},
|
|
2447
2110
|
entries: [],
|
|
2448
|
-
id:
|
|
2111
|
+
id: h("vital"),
|
|
2449
2112
|
name: "INP",
|
|
2450
2113
|
navigationType: c,
|
|
2451
|
-
rating:
|
|
2114
|
+
rating: Yn("INP", t.duration),
|
|
2452
2115
|
value: t.duration
|
|
2453
2116
|
}, e.runtimeAttributes, e.startedAt);
|
|
2454
2117
|
}, v = n.onViewChange((e) => {
|
|
2455
2118
|
var t;
|
|
2456
|
-
let r =
|
|
2457
|
-
if (r &&
|
|
2458
|
-
r.runtimeAttributes =
|
|
2459
|
-
[
|
|
2460
|
-
[
|
|
2461
|
-
[
|
|
2462
|
-
[
|
|
2119
|
+
let r = d;
|
|
2120
|
+
if (r && Kn(r.id, e.id)) {
|
|
2121
|
+
r.runtimeAttributes = S(S({}, r.runtimeAttributes), {}, {
|
|
2122
|
+
[g.viewId]: e.id,
|
|
2123
|
+
[g.viewName]: e.name,
|
|
2124
|
+
[g.viewUrl]: e.url,
|
|
2125
|
+
[g.viewUrlPathGroup]: e.urlPathGroup
|
|
2463
2126
|
});
|
|
2464
2127
|
return;
|
|
2465
2128
|
}
|
|
2466
|
-
_(),
|
|
2129
|
+
_(), d = e.id ? {
|
|
2467
2130
|
cls: 0,
|
|
2468
2131
|
clsWindowLargestShiftValue: 0,
|
|
2469
2132
|
clsWindowValue: 0,
|
|
2470
|
-
interactionCountAtStart:
|
|
2133
|
+
interactionCountAtStart: Xn(),
|
|
2471
2134
|
interactionIdMax: 0,
|
|
2472
2135
|
interactionIdMin: Infinity,
|
|
2473
2136
|
inpCandidates: [],
|
|
@@ -2479,21 +2142,21 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2479
2142
|
});
|
|
2480
2143
|
if (typeof PerformanceObserver < "u") {
|
|
2481
2144
|
var y, b;
|
|
2482
|
-
(y = PerformanceObserver.supportedEntryTypes) != null && y.includes("layout-shift") && (
|
|
2483
|
-
if (
|
|
2484
|
-
}),
|
|
2145
|
+
(y = PerformanceObserver.supportedEntryTypes) != null && y.includes("layout-shift") && (p = new PerformanceObserver((e) => {
|
|
2146
|
+
if (d) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < d.startedAt || Zn(d, t);
|
|
2147
|
+
}), p.observe({
|
|
2485
2148
|
buffered: !0,
|
|
2486
2149
|
type: "layout-shift"
|
|
2487
|
-
})), (b = PerformanceObserver.supportedEntryTypes) != null && b.includes("event") && (
|
|
2488
|
-
if (
|
|
2489
|
-
}),
|
|
2150
|
+
})), (b = PerformanceObserver.supportedEntryTypes) != null && b.includes("event") && (f = new PerformanceObserver((e) => {
|
|
2151
|
+
if (d) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < d.startedAt || !t.interactionId || !Number.isFinite(t.duration) || Qn(d, t);
|
|
2152
|
+
}), f.observe({
|
|
2490
2153
|
buffered: !0,
|
|
2491
2154
|
durationThreshold: 40,
|
|
2492
2155
|
type: "event"
|
|
2493
2156
|
}));
|
|
2494
2157
|
}
|
|
2495
|
-
a(
|
|
2496
|
-
_(),
|
|
2158
|
+
a(u), o(u), s(u), e = () => {
|
|
2159
|
+
_(), d = void 0, v(), p == null || p.disconnect(), f == null || f.disconnect();
|
|
2497
2160
|
};
|
|
2498
2161
|
})();
|
|
2499
2162
|
},
|
|
@@ -2501,184 +2164,123 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2501
2164
|
t = !0, e == null || e(), e = void 0;
|
|
2502
2165
|
}
|
|
2503
2166
|
};
|
|
2504
|
-
},
|
|
2167
|
+
}, rr = (e, t) => {
|
|
2505
2168
|
let n = {
|
|
2506
2169
|
"network.protocol.name": "websocket",
|
|
2507
2170
|
"url.full": t(e)
|
|
2508
|
-
}
|
|
2171
|
+
};
|
|
2509
2172
|
try {
|
|
2510
2173
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
2511
|
-
n["server.address"] = t.hostname,
|
|
2174
|
+
n["server.address"] = t.hostname, t.port && (n["server.port"] = Number(t.port)), n["url.scheme"] = t.protocol.replace(":", "");
|
|
2512
2175
|
} catch (e) {}
|
|
2513
|
-
return
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
}),
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
spanType: R.custom
|
|
2534
|
-
})), g.end(), e === "opened" && !l() && I(i, "metrics") && r.record(t, h());
|
|
2176
|
+
return n;
|
|
2177
|
+
}, ir = (t, n, r, i) => {
|
|
2178
|
+
let a = h("websocket"), o = rr(r, n.config.hooks.redactUrl), s = !1, c = (t, r, s = {}) => {
|
|
2179
|
+
if (i() || !n.isSampled()) return;
|
|
2180
|
+
let c = t === "error";
|
|
2181
|
+
n.startSpan("browser.websocket", S(S(S({}, o), N({
|
|
2182
|
+
errorType: c ? "network" : "none",
|
|
2183
|
+
result: c ? j.error : j.success,
|
|
2184
|
+
spanSubtype: t,
|
|
2185
|
+
spanType: M.websocket
|
|
2186
|
+
})), {}, {
|
|
2187
|
+
[g.eventId]: h("event"),
|
|
2188
|
+
[g.eventPhase]: t,
|
|
2189
|
+
[g.eventTimestamp]: r,
|
|
2190
|
+
[g.eventType]: "websocket",
|
|
2191
|
+
"websocket.connection.id": a
|
|
2192
|
+
}, s), {
|
|
2193
|
+
kind: e.CLIENT,
|
|
2194
|
+
startTime: r
|
|
2195
|
+
}).end(r);
|
|
2535
2196
|
};
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
}),
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
if (I(i, "metrics") && a.add(1, j(j({}, h()), {}, { "websocket.error.phase": e })), y("error"), !I(i, "logs")) return;
|
|
2546
|
-
let t = o.allow(`ws:error:${d}`);
|
|
2547
|
-
t.allowed && i.emitLog({
|
|
2548
|
-
severityNumber: T.ERROR,
|
|
2549
|
-
severityText: "ERROR",
|
|
2550
|
-
body: "websocket.error",
|
|
2551
|
-
eventName: "websocket.error",
|
|
2552
|
-
attributes: j(j(j({}, p), z({
|
|
2553
|
-
errorType: "network",
|
|
2554
|
-
result: L.error,
|
|
2555
|
-
spanSubtype: "websocket",
|
|
2556
|
-
spanType: R.custom
|
|
2557
|
-
})), {}, {
|
|
2558
|
-
"websocket.error.phase": e,
|
|
2559
|
-
"websocket.error.window_occurrence_index": t.count
|
|
2560
|
-
})
|
|
2197
|
+
c("connect", Date.now()), t.addEventListener("open", () => {
|
|
2198
|
+
s = !0, c("open", Date.now());
|
|
2199
|
+
}), t.addEventListener("error", () => {
|
|
2200
|
+
c("error", Date.now(), { "websocket.error.phase": s ? "runtime" : "connect" });
|
|
2201
|
+
}), t.addEventListener("close", (e) => {
|
|
2202
|
+
c("close", Date.now(), {
|
|
2203
|
+
"websocket.close.code": e.code,
|
|
2204
|
+
"websocket.close.reason": e.reason,
|
|
2205
|
+
"websocket.close.was_clean": e.wasClean
|
|
2561
2206
|
});
|
|
2562
|
-
}), e.addEventListener("close", (e) => {
|
|
2563
|
-
l() || (v || y("error"), I(i, "logs") && i.emitLog({
|
|
2564
|
-
severityNumber: T.INFO,
|
|
2565
|
-
severityText: "INFO",
|
|
2566
|
-
body: "websocket.close",
|
|
2567
|
-
eventName: "websocket.close",
|
|
2568
|
-
attributes: j(j(j({}, p), z({
|
|
2569
|
-
errorType: e.wasClean ? "none" : "network",
|
|
2570
|
-
result: e.wasClean ? L.success : L.warning,
|
|
2571
|
-
spanSubtype: "websocket",
|
|
2572
|
-
spanType: R.custom
|
|
2573
|
-
})), {}, {
|
|
2574
|
-
"websocket.close.code": e.code,
|
|
2575
|
-
"websocket.close.reason": e.reason,
|
|
2576
|
-
"websocket.close.was_clean": e.wasClean
|
|
2577
|
-
})
|
|
2578
|
-
}));
|
|
2579
2207
|
});
|
|
2580
|
-
|
|
2581
|
-
e.send = (e) => {
|
|
2582
|
-
if (!l() && I(i, "metrics")) {
|
|
2583
|
-
let t = j(j({}, h()), {}, { "websocket.direction": "out" });
|
|
2584
|
-
u.add(1, t), n.add(ii(e), t);
|
|
2585
|
-
}
|
|
2586
|
-
return b(e);
|
|
2587
|
-
};
|
|
2588
|
-
}, si = () => {
|
|
2208
|
+
}, ar = () => {
|
|
2589
2209
|
let e, t, n = !1;
|
|
2590
2210
|
return {
|
|
2591
2211
|
name: "websocket",
|
|
2592
2212
|
init(r) {
|
|
2593
2213
|
if (typeof window > "u" || window.WebSocket === void 0) return;
|
|
2594
2214
|
let i = window.WebSocket;
|
|
2595
|
-
e = i
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
unit: "ms",
|
|
2601
|
-
description: "WebSocket connection establishment duration (only successful connects)",
|
|
2602
|
-
advice: { explicitBucketBoundaries: G }
|
|
2603
|
-
}), l = te(ni, ri), u = () => n;
|
|
2604
|
-
t = new Proxy(i, { construct(e, t, i) {
|
|
2605
|
-
let d = Reflect.construct(e, t, i);
|
|
2606
|
-
if (n || !r.isSampled()) return d;
|
|
2607
|
-
let f = t[0] == null ? "" : String(t[0]);
|
|
2608
|
-
return !f || He(r.config, f) || oi(d, {
|
|
2609
|
-
bytesCounter: o,
|
|
2610
|
-
connectDurationHistogram: c,
|
|
2611
|
-
context: r,
|
|
2612
|
-
errorCounter: s,
|
|
2613
|
-
errorThrottle: l,
|
|
2614
|
-
isDisposed: u,
|
|
2615
|
-
messageCounter: a,
|
|
2616
|
-
url: f
|
|
2617
|
-
}), d;
|
|
2215
|
+
e = i, t = new Proxy(i, { construct(e, t, i) {
|
|
2216
|
+
let a = Reflect.construct(e, t, i);
|
|
2217
|
+
if (n || !r.isSampled()) return a;
|
|
2218
|
+
let o = t[0] == null ? "" : String(t[0]);
|
|
2219
|
+
return o && !k(r.config, o) && ir(a, r, o, () => n), a;
|
|
2618
2220
|
} }), window.WebSocket = t;
|
|
2619
2221
|
},
|
|
2620
2222
|
shutdown() {
|
|
2621
2223
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
2622
2224
|
}
|
|
2623
2225
|
};
|
|
2624
|
-
},
|
|
2226
|
+
}, or = class {
|
|
2625
2227
|
constructor() {
|
|
2626
|
-
|
|
2228
|
+
b(this, "listeners", /* @__PURE__ */ new Set()), b(this, "notify", (e) => {
|
|
2627
2229
|
this.listeners.forEach((t) => t(e));
|
|
2628
|
-
}),
|
|
2230
|
+
}), b(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
|
|
2629
2231
|
}
|
|
2630
|
-
},
|
|
2232
|
+
}, sr = (e) => ({
|
|
2631
2233
|
url: e.endpoint,
|
|
2632
2234
|
headers: e.headers,
|
|
2633
2235
|
concurrencyLimit: e.concurrencyLimit,
|
|
2634
2236
|
timeoutMillis: e.timeoutMillis
|
|
2635
|
-
}),
|
|
2237
|
+
}), cr = "bk-rum", lr = class {
|
|
2636
2238
|
constructor(e) {
|
|
2637
2239
|
this.isSampled = e;
|
|
2638
2240
|
}
|
|
2639
2241
|
shouldSample() {
|
|
2640
|
-
return { decision: this.isSampled() ?
|
|
2242
|
+
return { decision: this.isSampled() ? u.RECORD_AND_SAMPLED : u.NOT_RECORD };
|
|
2641
2243
|
}
|
|
2642
2244
|
toString() {
|
|
2643
2245
|
return "RumSessionSampler";
|
|
2644
2246
|
}
|
|
2645
|
-
}, Q,
|
|
2247
|
+
}, Q, ur = () => {
|
|
2646
2248
|
if (Q) Q.users += 1;
|
|
2647
2249
|
else {
|
|
2648
|
-
let e = new
|
|
2649
|
-
|
|
2650
|
-
contextManager:
|
|
2651
|
-
ownsContext:
|
|
2652
|
-
ownsPropagator:
|
|
2250
|
+
let e = new a().enable(), t = n.setGlobalContextManager(e);
|
|
2251
|
+
t || e.disable(), Q = {
|
|
2252
|
+
contextManager: t ? e : void 0,
|
|
2253
|
+
ownsContext: t,
|
|
2254
|
+
ownsPropagator: r.setGlobalPropagator(new o()),
|
|
2653
2255
|
users: 1
|
|
2654
2256
|
};
|
|
2655
2257
|
}
|
|
2656
2258
|
let e = !1;
|
|
2657
2259
|
return () => {
|
|
2658
|
-
e || !Q || (e = !0, --Q.users, !(Q.users > 0) && (Q.ownsContext &&
|
|
2260
|
+
e || !Q || (e = !0, --Q.users, !(Q.users > 0) && (Q.ownsContext && n.disable(), Q.ownsPropagator && r.disable(), Q = void 0));
|
|
2659
2261
|
};
|
|
2660
|
-
},
|
|
2661
|
-
if (
|
|
2662
|
-
var
|
|
2663
|
-
return (
|
|
2262
|
+
}, dr = (e, t) => t ? new Proxy(e, { get(e, t, n) {
|
|
2263
|
+
if (t === "export") return (t, n) => {
|
|
2264
|
+
var r;
|
|
2265
|
+
return (r = globalThis.console) == null || r.log("[bk-ot][rum]", t), e.export(t, n);
|
|
2664
2266
|
};
|
|
2665
|
-
let
|
|
2666
|
-
return typeof
|
|
2667
|
-
} }) : e,
|
|
2668
|
-
|
|
2669
|
-
...$(e.tracking.device, !0,
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
],
|
|
2674
|
-
...$(e.error, !0,
|
|
2675
|
-
...$(e.webVitals, !0,
|
|
2676
|
-
...$(e.blankScreen, !0,
|
|
2677
|
-
...$(e.action, !0,
|
|
2678
|
-
...$(e.websocket, !1,
|
|
2679
|
-
...$(e.longTask, !1,
|
|
2680
|
-
...$(e.cspViolation, !1,
|
|
2681
|
-
],
|
|
2267
|
+
let r = Reflect.get(e, t, n);
|
|
2268
|
+
return typeof r == "function" ? r.bind(e) : r;
|
|
2269
|
+
} }) : e, fr = (e) => [Qt(e.tracking.request)], pr = (e) => [
|
|
2270
|
+
Bn(e.session),
|
|
2271
|
+
...$(e.tracking.device, !0, ce),
|
|
2272
|
+
ft(),
|
|
2273
|
+
En(),
|
|
2274
|
+
zt(mr(e.tracking.resource, !0))
|
|
2275
|
+
], mr = (e, t) => e === void 0 ? t : e !== !1, hr = (e) => typeof e == "object" && e ? e : void 0, $ = (e, t, n) => mr(e, t) ? [n(hr(e))] : [], gr = (e) => [
|
|
2276
|
+
...$(e.error, !0, on),
|
|
2277
|
+
...$(e.webVitals, !0, nr),
|
|
2278
|
+
...$(e.blankScreen, !0, Dt),
|
|
2279
|
+
...$(e.action, !0, lt),
|
|
2280
|
+
...$(e.websocket, !1, ar),
|
|
2281
|
+
...$(e.longTask, !1, dn),
|
|
2282
|
+
...$(e.cspViolation, !1, tn)
|
|
2283
|
+
], _r = class {
|
|
2682
2284
|
assertBeforeStart(e) {
|
|
2683
2285
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
2684
2286
|
}
|
|
@@ -2686,15 +2288,12 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2686
2288
|
return {
|
|
2687
2289
|
applyRedact: this.applyRedact,
|
|
2688
2290
|
config: this.config,
|
|
2689
|
-
emitLog: this.emitLog,
|
|
2690
2291
|
flush: this.flush,
|
|
2691
2292
|
getRuntimeAttributes: this.getRuntimeAttributes,
|
|
2692
2293
|
getRuntimeAttributesAt: this.getRuntimeAttributesAt,
|
|
2693
2294
|
isSampled: this.isSampled,
|
|
2694
2295
|
isSessionActive: this.isSessionActive,
|
|
2695
2296
|
isViewActive: this.isViewActive,
|
|
2696
|
-
logger: this.logger,
|
|
2697
|
-
meter: this.meter,
|
|
2698
2297
|
notifySessionLifecycle: this.notifySessionLifecycle,
|
|
2699
2298
|
notifyActivity: this.activityObserver.notify,
|
|
2700
2299
|
onActivity: this.activityObserver.subscribe,
|
|
@@ -2711,195 +2310,186 @@ var Ye = ["http.url", "url.full"], Xe = "bk.rum.request.discard", Ze = (e) => {
|
|
|
2711
2310
|
}
|
|
2712
2311
|
createPluginManager() {
|
|
2713
2312
|
var e;
|
|
2714
|
-
return new
|
|
2715
|
-
...
|
|
2716
|
-
...
|
|
2717
|
-
...
|
|
2313
|
+
return new Ce([
|
|
2314
|
+
...pr(this.config),
|
|
2315
|
+
...fr(this.config),
|
|
2316
|
+
...gr(this.config.tracking),
|
|
2718
2317
|
...(e = this.config.extensions.plugins) == null ? [] : e
|
|
2719
2318
|
]);
|
|
2720
2319
|
}
|
|
2721
|
-
constructor(
|
|
2722
|
-
var
|
|
2723
|
-
|
|
2724
|
-
yield
|
|
2725
|
-
})),
|
|
2726
|
-
if (
|
|
2727
|
-
|
|
2728
|
-
let e =
|
|
2729
|
-
|
|
2320
|
+
constructor(n) {
|
|
2321
|
+
var r = this;
|
|
2322
|
+
b(this, "activityObserver", new or()), b(this, "flushProviders", E(function* () {
|
|
2323
|
+
yield r.tracerProvider.forceFlush();
|
|
2324
|
+
})), 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", E(function* () {
|
|
2325
|
+
if (r.pluginManager || !r.config.enabled || r.config.trackingConsent !== "granted") return;
|
|
2326
|
+
r.releaseOtelGlobals = ur();
|
|
2327
|
+
let e = r.createPluginManager();
|
|
2328
|
+
r.pluginManager = e;
|
|
2730
2329
|
try {
|
|
2731
|
-
var
|
|
2732
|
-
yield e.start(
|
|
2733
|
-
} catch (
|
|
2734
|
-
var
|
|
2735
|
-
for (yield e.shutdown(),
|
|
2736
|
-
throw (a =
|
|
2330
|
+
var t;
|
|
2331
|
+
yield e.start(r.createPluginContext()), r.registerInstrumentations((t = r.config.extensions.instrumentations) == null ? [] : t);
|
|
2332
|
+
} catch (t) {
|
|
2333
|
+
var n, i, a;
|
|
2334
|
+
for (yield e.shutdown(), r.pluginManager = void 0; r.registeredInstrumentations.length;) (n = r.registeredInstrumentations.pop()) == null || (i = n.disable) == null || i.call(n);
|
|
2335
|
+
throw (a = r.releaseOtelGlobals) == null || a.call(r), r.releaseOtelGlobals = void 0, t;
|
|
2737
2336
|
}
|
|
2738
|
-
})),
|
|
2739
|
-
var e =
|
|
2740
|
-
var
|
|
2741
|
-
let a =
|
|
2337
|
+
})), b(this, "stopCollection", function() {
|
|
2338
|
+
var e = E(function* (e) {
|
|
2339
|
+
var t, n, i;
|
|
2340
|
+
let a = r.pluginManager;
|
|
2742
2341
|
if (a) {
|
|
2743
|
-
for (yield a.shutdown(),
|
|
2744
|
-
|
|
2745
|
-
[
|
|
2746
|
-
[
|
|
2747
|
-
}), e && (yield
|
|
2342
|
+
for (yield a.shutdown(), r.pluginManager = void 0; r.registeredInstrumentations.length;) (t = r.registeredInstrumentations.pop()) == null || (n = t.disable) == null || n.call(t);
|
|
2343
|
+
r.setRuntimeAttributes({
|
|
2344
|
+
[g.sessionHasReplay]: void 0,
|
|
2345
|
+
[g.sessionId]: void 0
|
|
2346
|
+
}), e && (yield r.flushProviders()), (i = r.releaseOtelGlobals) == null || i.call(r), r.releaseOtelGlobals = void 0;
|
|
2748
2347
|
}
|
|
2749
2348
|
});
|
|
2750
2349
|
return function(t) {
|
|
2751
2350
|
return e.apply(this, arguments);
|
|
2752
2351
|
};
|
|
2753
|
-
}()),
|
|
2754
|
-
var t;
|
|
2755
|
-
if (!this.isSampled() || this.config.transport.logs === !1) return;
|
|
2756
|
-
let i = e.timestamp ? n(r(e.timestamp)) : void 0, a = j(j({}, e), {}, { attributes: this.applyRedact(j(j({}, i === void 0 ? this.getRuntimeAttributes() : this.getRuntimeAttributesAt(i)), (t = e.attributes) == null ? {} : t)) });
|
|
2757
|
-
this.logger.emit(a);
|
|
2758
|
-
}), A(this, "flush", M(function* () {
|
|
2352
|
+
}()), b(this, "teardownCallbacks", []), b(this, "tracerProvider", void 0), b(this, "applyRedact", (e) => this.config.hooks.redactAttributes(e)), b(this, "config", void 0), b(this, "flush", E(function* () {
|
|
2759
2353
|
var e;
|
|
2760
|
-
yield (e =
|
|
2761
|
-
})),
|
|
2354
|
+
yield (e = r.pluginManager) == null ? void 0 : e.flush(), yield r.flushProviders();
|
|
2355
|
+
})), b(this, "getRuntimeAttributes", () => this.runtimeContext.getAttributes()), b(this, "getRuntimeAttributesAt", (e) => this.runtimeContext.getAttributesAt(e)), b(this, "isSampled", () => this.sampled), b(this, "isSessionActive", () => this.runtimeContext.isSessionActive()), b(this, "isViewActive", () => this.runtimeContext.isViewActive()), b(this, "notifySessionLifecycle", (e) => {
|
|
2762
2356
|
this.runtimeContext.notifySessionLifecycle(e);
|
|
2763
|
-
}),
|
|
2764
|
-
e.length && (
|
|
2765
|
-
|
|
2766
|
-
meterProvider: this.meterProvider,
|
|
2767
|
-
tracerProvider: this.tracerProvider
|
|
2357
|
+
}), b(this, "onSessionLifecycle", (e) => this.runtimeContext.onSessionLifecycle(e)), b(this, "registerInstrumentations", (e) => {
|
|
2358
|
+
e.length && (e.forEach((e) => {
|
|
2359
|
+
e.setTracerProvider(this.tracerProvider), e.getConfig().enabled || e.enable();
|
|
2768
2360
|
}), this.registeredInstrumentations.push(...e));
|
|
2769
|
-
}),
|
|
2770
|
-
if (!this.isSampled()
|
|
2771
|
-
let n =
|
|
2772
|
-
this.startSpan("action.custom",
|
|
2361
|
+
}), b(this, "reportAction", ({ attributes: e = {}, name: t }) => {
|
|
2362
|
+
if (!this.isSampled()) return;
|
|
2363
|
+
let n = h("action"), r = Date.now();
|
|
2364
|
+
this.startSpan("action.custom", S(S(S(S({}, this.config.hooks.getPageAttributes()), e), N({
|
|
2773
2365
|
errorType: "none",
|
|
2774
2366
|
spanSubtype: "custom",
|
|
2775
|
-
spanType:
|
|
2367
|
+
spanType: M.action
|
|
2776
2368
|
})), {}, {
|
|
2777
|
-
[
|
|
2778
|
-
[
|
|
2779
|
-
[
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2369
|
+
[g.actionId]: n,
|
|
2370
|
+
[g.actionName]: t,
|
|
2371
|
+
[g.actionType]: "custom",
|
|
2372
|
+
[g.eventId]: h("event"),
|
|
2373
|
+
[g.eventTimestamp]: r,
|
|
2374
|
+
[g.eventType]: "action"
|
|
2375
|
+
}), { startTime: r }).end(r);
|
|
2376
|
+
}), b(this, "reportCustomEvent", ({ attributes: e = {}, error: n, name: r }) => {
|
|
2377
|
+
if (!this.isSampled()) {
|
|
2783
2378
|
if (this.config.debug) {
|
|
2784
|
-
var
|
|
2785
|
-
(
|
|
2379
|
+
var i;
|
|
2380
|
+
(i = globalThis.console) == null || i.warn("[bk-ot] custom event dropped (not sampled):", r);
|
|
2786
2381
|
}
|
|
2787
2382
|
return;
|
|
2788
2383
|
}
|
|
2789
|
-
let
|
|
2790
|
-
errorType:
|
|
2791
|
-
result:
|
|
2792
|
-
spanSubtype:
|
|
2793
|
-
spanType:
|
|
2794
|
-
})), e), {}, {
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2384
|
+
let a = Date.now(), o = this.startSpan(`custom.${r}`, S(S(S(S(S({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), N({
|
|
2385
|
+
errorType: n ? "custom" : "none",
|
|
2386
|
+
result: n ? j.error : j.success,
|
|
2387
|
+
spanSubtype: r,
|
|
2388
|
+
spanType: M.custom
|
|
2389
|
+
})), e), {}, {
|
|
2390
|
+
[g.eventId]: h("event"),
|
|
2391
|
+
[g.eventTimestamp]: a,
|
|
2392
|
+
[g.eventType]: "custom",
|
|
2393
|
+
"rum.custom.name": r
|
|
2394
|
+
}), { startTime: a });
|
|
2395
|
+
n && (o.recordException(n), o.setStatus({
|
|
2396
|
+
code: t.ERROR,
|
|
2397
|
+
message: n.message
|
|
2398
|
+
})), o.end(a);
|
|
2399
|
+
}), b(this, "setRuntimeAttributes", (e, t) => {
|
|
2400
|
+
let n = S({}, e);
|
|
2401
|
+
if (g.sessionId in e) {
|
|
2402
|
+
let t = e[g.sessionId];
|
|
2403
|
+
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ? Te(this.config, t) : !1, n[D] = this.sampled;
|
|
2804
2404
|
}
|
|
2805
2405
|
this.runtimeContext.setAttributes(n, t);
|
|
2806
|
-
}),
|
|
2807
|
-
var e =
|
|
2808
|
-
|
|
2406
|
+
}), b(this, "setTrackingConsent", function() {
|
|
2407
|
+
var e = E(function* (e) {
|
|
2408
|
+
r.config.trackingConsent !== e && (r.config.trackingConsent = e, r.phase === "started" && (e === "granted" ? yield r.startCollection() : yield r.stopCollection(!0)));
|
|
2809
2409
|
});
|
|
2810
2410
|
return function(t) {
|
|
2811
2411
|
return e.apply(this, arguments);
|
|
2812
2412
|
};
|
|
2813
|
-
}()),
|
|
2413
|
+
}()), b(this, "setUser", (e) => {
|
|
2814
2414
|
this.runtimeContext.setUser(e);
|
|
2815
|
-
}),
|
|
2415
|
+
}), b(this, "setViewLoadingTime", () => {
|
|
2816
2416
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2817
2417
|
time: Date.now(),
|
|
2818
2418
|
type: "set_loading_time"
|
|
2819
2419
|
});
|
|
2820
|
-
}),
|
|
2420
|
+
}), b(this, "setViewName", (e) => {
|
|
2821
2421
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2822
2422
|
name: e,
|
|
2823
2423
|
type: "set_name"
|
|
2824
2424
|
});
|
|
2825
|
-
}),
|
|
2826
|
-
if (
|
|
2827
|
-
for (yield
|
|
2425
|
+
}), b(this, "shutdown", E(function* () {
|
|
2426
|
+
if (r.phase !== "stopped") {
|
|
2427
|
+
for (yield r.stopCollection(!1), yield r.flushProviders(); r.teardownCallbacks.length;) {
|
|
2828
2428
|
var e;
|
|
2829
|
-
(e =
|
|
2429
|
+
(e = r.teardownCallbacks.pop()) == null || e();
|
|
2830
2430
|
}
|
|
2831
|
-
yield
|
|
2431
|
+
yield r.tracerProvider.shutdown(), r.phase = "stopped";
|
|
2832
2432
|
}
|
|
2833
|
-
})),
|
|
2834
|
-
if (!(
|
|
2835
|
-
if (
|
|
2836
|
-
if (!
|
|
2837
|
-
|
|
2433
|
+
})), b(this, "start", E(function* () {
|
|
2434
|
+
if (!(r.phase === "started" || r.phase === "starting")) {
|
|
2435
|
+
if (r.phase === "stopped") throw Error("[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.");
|
|
2436
|
+
if (!r.config.enabled) {
|
|
2437
|
+
r.phase = "started";
|
|
2838
2438
|
return;
|
|
2839
2439
|
}
|
|
2840
|
-
|
|
2440
|
+
r.phase = "starting";
|
|
2841
2441
|
try {
|
|
2842
|
-
if (yield
|
|
2442
|
+
if (yield r.startCollection(), typeof window < "u" && typeof document < "u") {
|
|
2843
2443
|
let e = () => {
|
|
2844
|
-
|
|
2845
|
-
},
|
|
2846
|
-
document.visibilityState === "hidden" &&
|
|
2444
|
+
r.flush();
|
|
2445
|
+
}, t = () => {
|
|
2446
|
+
document.visibilityState === "hidden" && r.flush();
|
|
2847
2447
|
};
|
|
2848
|
-
window.addEventListener("pagehide", e), document.addEventListener("visibilitychange",
|
|
2448
|
+
window.addEventListener("pagehide", e), document.addEventListener("visibilitychange", t), r.teardownCallbacks.push(() => window.removeEventListener("pagehide", e), () => document.removeEventListener("visibilitychange", t));
|
|
2849
2449
|
}
|
|
2850
|
-
} catch (
|
|
2851
|
-
for (;
|
|
2450
|
+
} catch (t) {
|
|
2451
|
+
for (; r.teardownCallbacks.length;) {
|
|
2852
2452
|
var e;
|
|
2853
|
-
(e =
|
|
2453
|
+
(e = r.teardownCallbacks.pop()) == null || e();
|
|
2854
2454
|
}
|
|
2855
|
-
throw yield
|
|
2455
|
+
throw yield r.stopCollection(!1), r.phase = "idle", t;
|
|
2856
2456
|
}
|
|
2857
|
-
|
|
2457
|
+
r.phase = "started";
|
|
2858
2458
|
}
|
|
2859
|
-
})),
|
|
2860
|
-
var
|
|
2861
|
-
if (!this.isSampled()
|
|
2862
|
-
let
|
|
2863
|
-
return this.tracer.startSpan(
|
|
2864
|
-
kind: (
|
|
2865
|
-
startTime:
|
|
2866
|
-
attributes: this.applyRedact(
|
|
2459
|
+
})), b(this, "startSpan", (t, n = {}, r) => {
|
|
2460
|
+
var i, a;
|
|
2461
|
+
if (!this.isSampled()) return this.tracer.startSpan(t);
|
|
2462
|
+
let o = (i = r == null ? void 0 : r.contextTime) == null ? typeof (r == null ? void 0 : r.startTime) == "number" ? r.startTime : void 0 : i, s = o === void 0 ? this.getRuntimeAttributes() : this.runtimeContext.getAttributesAt(o);
|
|
2463
|
+
return this.tracer.startSpan(t, {
|
|
2464
|
+
kind: (a = r == null ? void 0 : r.kind) == null ? e.INTERNAL : a,
|
|
2465
|
+
startTime: r == null ? void 0 : r.startTime,
|
|
2466
|
+
attributes: this.applyRedact(S(S({}, s), n))
|
|
2867
2467
|
});
|
|
2868
|
-
}),
|
|
2468
|
+
}), b(this, "startView", (e = {}) => {
|
|
2869
2469
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2870
2470
|
options: e,
|
|
2871
2471
|
type: "start"
|
|
2872
2472
|
});
|
|
2873
|
-
}),
|
|
2473
|
+
}), b(this, "tracer", void 0), b(this, "use", (e) => {
|
|
2874
2474
|
var t;
|
|
2875
2475
|
return this.assertBeforeStart("use"), (t = this.config.extensions.plugins) == null || t.push(e), this;
|
|
2876
|
-
}),
|
|
2476
|
+
}), b(this, "useInstrumentation", (e) => {
|
|
2877
2477
|
var t;
|
|
2878
2478
|
return this.assertBeforeStart("useInstrumentation"), this.config.enabled && ((t = this.config.extensions.instrumentations) == null || t.push(e)), this;
|
|
2879
|
-
}), this.config =
|
|
2880
|
-
let i =
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
exporter: new it(pi(new h(j(j({}, li(this.config.transport.metrics)), {}, { temporalityPreference: m.DELTA })), "metrics", this.config.debug)),
|
|
2886
|
-
exportIntervalMillis: this.config.metricIntervalMillis
|
|
2887
|
-
})], d = this.config.transport.logs === !1 ? [] : [new tt(new y(pi(new p(li(this.config.transport.logs)), "logs", this.config.debug)), this.config)];
|
|
2888
|
-
this.tracerProvider = new w({
|
|
2889
|
-
resource: i,
|
|
2890
|
-
sampler: new di(() => this.config.transport.traces !== !1 && this.isSampled()),
|
|
2891
|
-
spanProcessors: l
|
|
2892
|
-
}), this.meterProvider = new a({
|
|
2893
|
-
resource: i,
|
|
2894
|
-
readers: u
|
|
2895
|
-
}), this.loggerProvider = new b({
|
|
2479
|
+
}), this.config = ye(n), this.runtimeContext = new He({ [D]: !1 }, this.config.user);
|
|
2480
|
+
let i = c(this.config.resourceAttributes), a = (() => {
|
|
2481
|
+
let e = dr(new s(sr(this.config.transport)), this.config.debug);
|
|
2482
|
+
return [new Be(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())))];
|
|
2483
|
+
})();
|
|
2484
|
+
this.tracerProvider = new f({
|
|
2896
2485
|
resource: i,
|
|
2897
|
-
|
|
2898
|
-
|
|
2486
|
+
sampler: new lr(this.isSampled),
|
|
2487
|
+
spanProcessors: a
|
|
2488
|
+
}), this.tracer = this.tracerProvider.getTracer(cr), this.registeredInstrumentations = [], this.config.autoStart && this.start().catch((e) => {
|
|
2899
2489
|
var t;
|
|
2900
2490
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
2901
2491
|
});
|
|
2902
2492
|
}
|
|
2903
2493
|
};
|
|
2904
2494
|
//#endregion
|
|
2905
|
-
export {
|
|
2495
|
+
export { _r as BkOpenTelemetry, ut as EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE, Be as FilteringSpanProcessor, g as RUM_ATTRIBUTES, j as RUM_SPAN_RESULT, M as RUM_SPAN_TYPE, He as RumRuntimeContext, N as buildRumSpanAttributes, lt as createActionPlugin, Dt as createBlankScreenPlugin, Qt as createCommonInstrumentationsPlugin, tn as createCspViolationPlugin, ce as createDevicePlugin, on as createErrorPlugin, dn as createLongTaskPlugin, Se as createPlugin, zt as createResourcePlugin, Bn as createSessionPlugin, ar as createWebSocketPlugin, nr as createWebVitalsPlugin, ye as resolveConfig };
|