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