@blueking/open-telemetry 0.0.19 → 0.0.20
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 +711 -711
- 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 +1 -1
- 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.md +3 -3
- package/skills/bk-rum-otele/references/privacy.md +1 -1
- package/skills/bk-rum-otele/references/telemetry-reference.md +29 -26
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.20", 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,19 @@ 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)), { startTime: a }).end(o), n.notifyActivity({
|
|
1282
1406
|
endTime: o,
|
|
1283
1407
|
startTime: a,
|
|
1284
1408
|
type: "resource",
|
|
@@ -1300,27 +1424,27 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1300
1424
|
t == null || t.disconnect(), t = void 0;
|
|
1301
1425
|
}
|
|
1302
1426
|
};
|
|
1303
|
-
},
|
|
1427
|
+
}, Tn = (e) => typeof e.config.tracking.request == "object" ? e.config.tracking.request : void 0, En = (e) => {
|
|
1304
1428
|
if (e.type === "xhr") return e.xhr.status;
|
|
1305
1429
|
if (e.response) return e.response.status;
|
|
1306
1430
|
if (typeof e.error == "object" && e.error && "status" in e.error) {
|
|
1307
1431
|
let t = e.error.status;
|
|
1308
1432
|
return typeof t == "number" ? t : void 0;
|
|
1309
1433
|
}
|
|
1310
|
-
},
|
|
1434
|
+
}, Dn = (e) => typeof e == "string" || e instanceof URL ? P(String(e)) : P(e.url), On = (e, t) => {
|
|
1311
1435
|
var n;
|
|
1312
1436
|
return ((n = t == null ? void 0 : t.method) == null ? typeof Request < "u" && e instanceof Request ? e.method : "GET" : n).toUpperCase();
|
|
1313
|
-
},
|
|
1437
|
+
}, kn = (e, t) => typeof Request < "u" && e instanceof Request ? e : t == null ? {} : t, An = (e, t, n) => {
|
|
1314
1438
|
var r;
|
|
1315
1439
|
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
|
-
},
|
|
1440
|
+
return u.inject(d.setSpan(l.active(), n), a, { set: (e, t, n) => e.set(t, n) }), j(j({}, t), {}, { headers: a });
|
|
1441
|
+
}, jn = (e, t) => {
|
|
1318
1442
|
let n = {};
|
|
1319
1443
|
u.inject(d.setSpan(l.active(), t), n);
|
|
1320
1444
|
for (let [t, r] of Object.entries(n)) e.setRequestHeader(t, r);
|
|
1321
|
-
},
|
|
1322
|
-
if (
|
|
1323
|
-
let n =
|
|
1445
|
+
}, Mn = (e, t) => He(e.config, t) || F(e.config.view.excludedActivityUrls, t), Nn = (e, t) => {
|
|
1446
|
+
if (Mn(e, t)) return () => {};
|
|
1447
|
+
let n = E("request");
|
|
1324
1448
|
e.notifyActivity({
|
|
1325
1449
|
id: n,
|
|
1326
1450
|
time: Date.now(),
|
|
@@ -1335,22 +1459,22 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1335
1459
|
type: "request_end"
|
|
1336
1460
|
}));
|
|
1337
1461
|
};
|
|
1338
|
-
},
|
|
1462
|
+
}, Pn = (e, t) => e.config.transport.traces === !1 || !e.isSampled() ? {
|
|
1339
1463
|
cancel() {},
|
|
1340
1464
|
complete(e) {
|
|
1341
1465
|
e();
|
|
1342
1466
|
}
|
|
1343
|
-
} :
|
|
1467
|
+
} : an(t), Fn = (e, t, n) => {
|
|
1344
1468
|
var r;
|
|
1345
|
-
return e.startSpan("browser.resource",
|
|
1469
|
+
return e.startSpan("browser.resource", j(j(j({}, e.config.hooks.getPageAttributes()), dt({
|
|
1346
1470
|
initiatorType: t,
|
|
1347
1471
|
method: n.method,
|
|
1348
1472
|
url: (r = n.url) == null ? "" : r
|
|
1349
1473
|
})), n.url ? { "url.full": e.config.hooks.redactUrl(n.url) } : {}), { kind: s.CLIENT });
|
|
1350
|
-
},
|
|
1474
|
+
}, In = (e, t, n, r, i = {}, a) => {
|
|
1351
1475
|
var o;
|
|
1352
|
-
let s = i.url, l = s ? e.config.hooks.redactUrl(s) : void 0, u =
|
|
1353
|
-
attributes:
|
|
1476
|
+
let s = i.url, l = s ? e.config.hooks.redactUrl(s) : void 0, u = En(r), d = i.method, f = {
|
|
1477
|
+
attributes: j(j(j({}, e.config.hooks.getPageAttributes()), dt({
|
|
1354
1478
|
initiatorType: n,
|
|
1355
1479
|
method: d,
|
|
1356
1480
|
networkError: r.type === "fetch" ? !r.response : r.xhr.status === 0,
|
|
@@ -1367,18 +1491,18 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1367
1491
|
}, p = !0;
|
|
1368
1492
|
try {
|
|
1369
1493
|
var m, h;
|
|
1370
|
-
p = (m =
|
|
1494
|
+
p = (m = Tn(e)) == null || (h = m.beforeSend) == null ? void 0 : h.call(m, f, r);
|
|
1371
1495
|
} catch (t) {
|
|
1372
1496
|
var g;
|
|
1373
1497
|
e.config.debug && ((g = globalThis.console) == null || g.warn("[bk-ot] request.beforeSend failed:", t));
|
|
1374
1498
|
}
|
|
1375
1499
|
if (t.setAttributes(e.applyRedact(f.attributes)), p === !1) {
|
|
1376
|
-
t.setAttribute(
|
|
1500
|
+
t.setAttribute(Xe, !0);
|
|
1377
1501
|
return;
|
|
1378
1502
|
}
|
|
1379
1503
|
((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
|
-
_ &&
|
|
1504
|
+
let _ = e.config.transport.logs === !1 || (o = Tn(e)) == null ? void 0 : o.body;
|
|
1505
|
+
_ && vn({
|
|
1382
1506
|
bodyConfig: _,
|
|
1383
1507
|
domainContext: r,
|
|
1384
1508
|
event: f,
|
|
@@ -1387,7 +1511,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1387
1511
|
runtimeContext: e,
|
|
1388
1512
|
span: t
|
|
1389
1513
|
});
|
|
1390
|
-
},
|
|
1514
|
+
}, Ln = (e) => {
|
|
1391
1515
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
1392
1516
|
return {
|
|
1393
1517
|
name: "request",
|
|
@@ -1396,29 +1520,29 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1396
1520
|
if (!(typeof window > "u")) {
|
|
1397
1521
|
if (typeof window.fetch == "function") {
|
|
1398
1522
|
let r = window.fetch, i = /* @__PURE__ */ function() {
|
|
1399
|
-
var t =
|
|
1523
|
+
var t = M(function* (t, i) {
|
|
1400
1524
|
var a;
|
|
1401
|
-
let o =
|
|
1402
|
-
if (!e.isSampled() ||
|
|
1525
|
+
let o = Dn(t);
|
|
1526
|
+
if (!e.isSampled() || Ge(e.config, o)) return r.call(this, t, i);
|
|
1403
1527
|
let s = {
|
|
1404
|
-
method:
|
|
1528
|
+
method: On(t, i),
|
|
1405
1529
|
startedAt: Date.now(),
|
|
1406
1530
|
url: o
|
|
1407
|
-
}, c =
|
|
1408
|
-
m || (m = !0, n.delete(g), t && c.setAttributes(e.applyRedact(
|
|
1531
|
+
}, 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) => {
|
|
1532
|
+
m || (m = !0, n.delete(g), t && c.setAttributes(e.applyRedact(Cn(t))), c.end());
|
|
1409
1533
|
}, g = () => {
|
|
1410
1534
|
l.cancel(), h();
|
|
1411
1535
|
};
|
|
1412
1536
|
n.add(g);
|
|
1413
1537
|
try {
|
|
1414
1538
|
let n = yield r.call(this, t, p);
|
|
1415
|
-
return
|
|
1539
|
+
return In(e, c, "fetch", {
|
|
1416
1540
|
request: d,
|
|
1417
1541
|
response: n,
|
|
1418
1542
|
type: "fetch"
|
|
1419
1543
|
}, s, f), l.complete(h), n;
|
|
1420
1544
|
} catch (t) {
|
|
1421
|
-
throw
|
|
1545
|
+
throw In(e, c, "fetch", {
|
|
1422
1546
|
error: t,
|
|
1423
1547
|
request: d,
|
|
1424
1548
|
type: "fetch"
|
|
@@ -1439,26 +1563,26 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1439
1563
|
let r = /* @__PURE__ */ new WeakMap(), i = XMLHttpRequest.prototype.open, a = XMLHttpRequest.prototype.send, o = function(e, t, n = !0, a, o) {
|
|
1440
1564
|
return r.set(this, {
|
|
1441
1565
|
method: e.toUpperCase(),
|
|
1442
|
-
url:
|
|
1566
|
+
url: P(String(t))
|
|
1443
1567
|
}), i.call(this, e, String(t), n, a, o);
|
|
1444
1568
|
}, s = function(t) {
|
|
1445
1569
|
var i;
|
|
1446
1570
|
let o = (i = r.get(this)) == null ? {} : i;
|
|
1447
|
-
if (!e.isSampled() || !o.url ||
|
|
1571
|
+
if (!e.isSampled() || !o.url || Ge(e.config, o.url)) return a.call(this, t);
|
|
1448
1572
|
o.startedAt = Date.now();
|
|
1449
|
-
let s =
|
|
1450
|
-
|
|
1573
|
+
let s = Fn(e, "xhr", o), c = Pn(e, o.url), l = Nn(e, o.url);
|
|
1574
|
+
Ke(e.config, o.url) && jn(this, s);
|
|
1451
1575
|
let u = !1, d = () => {
|
|
1452
1576
|
c.cancel(), !u && (u = !0, n.delete(d), l(), s.end());
|
|
1453
1577
|
};
|
|
1454
1578
|
n.add(d);
|
|
1455
1579
|
let f = () => {
|
|
1456
|
-
u || (
|
|
1580
|
+
u || (In(e, s, "xhr", {
|
|
1457
1581
|
requestBody: t,
|
|
1458
1582
|
type: "xhr",
|
|
1459
1583
|
xhr: this
|
|
1460
1584
|
}, o), l(), c.complete((t) => {
|
|
1461
|
-
u || (u = !0, n.delete(d), t && s.setAttributes(e.applyRedact(
|
|
1585
|
+
u || (u = !0, n.delete(d), t && s.setAttributes(e.applyRedact(Cn(t))), s.end());
|
|
1462
1586
|
}));
|
|
1463
1587
|
};
|
|
1464
1588
|
this.addEventListener("loadend", f, { once: !0 });
|
|
@@ -1480,54 +1604,28 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1480
1604
|
for (; t.length;) (e = t.pop()) == null || e();
|
|
1481
1605
|
}
|
|
1482
1606
|
};
|
|
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 = () => {
|
|
1607
|
+
}, Rn = 6e4, zn = 5, Bn = /^https?:|^\/\//i, Vn = (e, t) => {
|
|
1608
|
+
if (t) return Bn.test(t) ? e(t) : t;
|
|
1609
|
+
}, Hn = () => {
|
|
1512
1610
|
let e;
|
|
1513
1611
|
return {
|
|
1514
1612
|
name: "csp-violation",
|
|
1515
1613
|
init(t) {
|
|
1516
1614
|
if (typeof window > "u" || typeof document > "u") return;
|
|
1517
|
-
let n =
|
|
1518
|
-
let i =
|
|
1519
|
-
if (!i && !a || (i && r.add(1, t.applyRedact(
|
|
1615
|
+
let n = te(Rn, zn), r = t.meter.createCounter("browser.csp_violation.count", { description: "Total number of CSP violations before span throttling" }), i = (e) => {
|
|
1616
|
+
let i = I(t, "metrics"), a = I(t, "traces");
|
|
1617
|
+
if (!i && !a || (i && r.add(1, t.applyRedact(j(j(j({}, t.config.hooks.getMetricAttributes()), B(t.getRuntimeAttributes())), {}, {
|
|
1520
1618
|
"csp.disposition": e.disposition,
|
|
1521
1619
|
"csp.effective_directive": e.effectiveDirective
|
|
1522
1620
|
}))), !a)) return;
|
|
1523
|
-
let o =
|
|
1621
|
+
let o = D(`${e.violatedDirective}|${e.blockedURI}|${e.sourceFile}|${e.lineNumber}`), s = n.allow(o);
|
|
1524
1622
|
if (!s.allowed) return;
|
|
1525
|
-
let c =
|
|
1526
|
-
t.startSpan("csp.violation",
|
|
1623
|
+
let c = Vn(t.config.hooks.redactUrl, e.blockedURI), l = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0, u = s.count === 1;
|
|
1624
|
+
t.startSpan("csp.violation", j(j(j({}, t.config.hooks.getPageAttributes()), z({
|
|
1527
1625
|
errorType: "csp",
|
|
1528
|
-
result:
|
|
1626
|
+
result: L.error,
|
|
1529
1627
|
spanSubtype: "csp",
|
|
1530
|
-
spanType:
|
|
1628
|
+
spanType: R.error
|
|
1531
1629
|
})), {}, {
|
|
1532
1630
|
"csp.blocked_uri": c,
|
|
1533
1631
|
"csp.violated_directive": e.violatedDirective,
|
|
@@ -1539,7 +1637,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1539
1637
|
"csp.status_code": e.statusCode,
|
|
1540
1638
|
"csp.fingerprint": o,
|
|
1541
1639
|
"csp.window_occurrence_index": s.count,
|
|
1542
|
-
[
|
|
1640
|
+
[O.exceptionFingerprint]: o,
|
|
1543
1641
|
"error.source": "csp"
|
|
1544
1642
|
}, u ? { "csp.original_policy": e.originalPolicy } : {})).end();
|
|
1545
1643
|
};
|
|
@@ -1549,104 +1647,6 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1549
1647
|
e == null || e(), e = void 0;
|
|
1550
1648
|
}
|
|
1551
1649
|
};
|
|
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
1650
|
}, Un = 6e4, Wn = 5, Gn = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, Kn = (e) => {
|
|
1651
1651
|
if (e instanceof Error) return e.message;
|
|
1652
1652
|
if (typeof e == "string") return e;
|
|
@@ -1662,10 +1662,10 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1662
1662
|
var t, n;
|
|
1663
1663
|
return (t = (n = e.split("\n").find((e) => e.trim().startsWith("at "))) == null ? void 0 : n.trim()) == null ? "" : t;
|
|
1664
1664
|
}, 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 =
|
|
1665
|
+
let l = I(e, "metrics"), u = I(e, "traces");
|
|
1666
1666
|
if (!l && !u) return;
|
|
1667
|
-
let d = Kn(n), f = qn(n), p =
|
|
1668
|
-
if (l && t.add(1, e.applyRedact(
|
|
1667
|
+
let d = Kn(n), f = qn(n), p = D(`${a}|${d}|${f.slice(0, 256)}`);
|
|
1668
|
+
if (l && t.add(1, e.applyRedact(j(j(j({}, e.config.hooks.getMetricAttributes()), B(e.getRuntimeAttributes())), {}, {
|
|
1669
1669
|
"error.source": a,
|
|
1670
1670
|
"error.subtype": Xn(a)
|
|
1671
1671
|
}))), !u) return;
|
|
@@ -1678,15 +1678,15 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1678
1678
|
let h = n instanceof Error ? n : {
|
|
1679
1679
|
message: d,
|
|
1680
1680
|
name: r == null ? a : r
|
|
1681
|
-
}, g =
|
|
1681
|
+
}, g = j(j(j(j({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), z({
|
|
1682
1682
|
errorType: Xn(a),
|
|
1683
|
-
result:
|
|
1683
|
+
result: L.error,
|
|
1684
1684
|
spanSubtype: Xn(a),
|
|
1685
|
-
spanType:
|
|
1685
|
+
spanType: R.error
|
|
1686
1686
|
})), {}, {
|
|
1687
|
-
[
|
|
1688
|
-
[
|
|
1689
|
-
[
|
|
1687
|
+
[O.exceptionMessageShort]: Jn(d),
|
|
1688
|
+
[O.exceptionStackTopFrame]: Yn(f),
|
|
1689
|
+
[O.exceptionFingerprint]: p,
|
|
1690
1690
|
"error.handled": !1,
|
|
1691
1691
|
"error.source": a,
|
|
1692
1692
|
"error.window_occurrence_index": m.count
|
|
@@ -1701,7 +1701,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1701
1701
|
name: "error",
|
|
1702
1702
|
init(e) {
|
|
1703
1703
|
if (typeof window > "u") return;
|
|
1704
|
-
let i =
|
|
1704
|
+
let i = te(n, r), a = e.meter.createCounter("browser.error.count", { description: "Total number of browser errors before span throttling" }), o = (t) => {
|
|
1705
1705
|
var n;
|
|
1706
1706
|
let r = !t.error && !t.filename && t.message === "Script error.";
|
|
1707
1707
|
Zn({
|
|
@@ -1711,7 +1711,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1711
1711
|
spanName: "browser.error",
|
|
1712
1712
|
source: "window.error",
|
|
1713
1713
|
error: (n = t.error) == null ? t.message : n,
|
|
1714
|
-
extra:
|
|
1714
|
+
extra: j({
|
|
1715
1715
|
"code.filepath": t.filename,
|
|
1716
1716
|
"code.lineno": t.lineno,
|
|
1717
1717
|
"code.column": t.colno
|
|
@@ -1766,7 +1766,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1766
1766
|
.25,
|
|
1767
1767
|
.5,
|
|
1768
1768
|
1
|
|
1769
|
-
],
|
|
1769
|
+
], G = [
|
|
1770
1770
|
0,
|
|
1771
1771
|
50,
|
|
1772
1772
|
100,
|
|
@@ -1809,37 +1809,37 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1809
1809
|
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
1810
|
description: "Duration of long tasks and long animation frames",
|
|
1811
1811
|
unit: "ms",
|
|
1812
|
-
advice: { explicitBucketBoundaries:
|
|
1812
|
+
advice: { explicitBucketBoundaries: G }
|
|
1813
1813
|
}), d = e.meter.createHistogram("browser.long_task.blocking_duration", {
|
|
1814
1814
|
description: "Blocking duration of long animation frames",
|
|
1815
1815
|
unit: "ms",
|
|
1816
|
-
advice: { explicitBucketBoundaries:
|
|
1816
|
+
advice: { explicitBucketBoundaries: G }
|
|
1817
1817
|
}), f = (r) => {
|
|
1818
1818
|
var i;
|
|
1819
|
-
let a =
|
|
1819
|
+
let a = I(e, "metrics"), o = I(e, "traces");
|
|
1820
1820
|
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 =
|
|
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 = 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
1822
|
if (o) {
|
|
1823
1823
|
var S;
|
|
1824
|
-
let t = e.startSpan("browser.long_task",
|
|
1825
|
-
errorType: _ ===
|
|
1824
|
+
let t = e.startSpan("browser.long_task", j(j(j(j(j(j(j(j({}, e.config.hooks.getPageAttributes()), z({
|
|
1825
|
+
errorType: _ === L.warning ? "main_thread_blocked" : "none",
|
|
1826
1826
|
result: _,
|
|
1827
1827
|
spanSubtype: v,
|
|
1828
|
-
spanType:
|
|
1828
|
+
spanType: R.longtask
|
|
1829
1829
|
})), {}, {
|
|
1830
|
-
[
|
|
1831
|
-
[
|
|
1832
|
-
[
|
|
1833
|
-
[
|
|
1834
|
-
[
|
|
1835
|
-
[
|
|
1836
|
-
}, b ? { [
|
|
1837
|
-
[
|
|
1830
|
+
[O.longTaskBlockingDuration]: (S = c == null ? void 0 : c.blockingDuration) == null ? r.duration : S,
|
|
1831
|
+
[O.longTaskDuration]: r.duration,
|
|
1832
|
+
[O.longTaskEntryType]: v,
|
|
1833
|
+
[O.longTaskId]: m,
|
|
1834
|
+
[O.longTaskIsFrozenFrame]: r.duration >= nr,
|
|
1835
|
+
[O.longTaskScriptCount]: f.length
|
|
1836
|
+
}, b ? { [O.longTaskCulprit]: b } : {}), p ? {
|
|
1837
|
+
[O.longTaskCulprit]: x,
|
|
1838
1838
|
"long_task.culprit.duration": p.duration,
|
|
1839
1839
|
"long_task.culprit.forced_style_and_layout_duration": p.forcedStyleAndLayoutDuration,
|
|
1840
1840
|
"long_task.culprit.function_name": p.sourceFunctionName,
|
|
1841
1841
|
"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 ? { [
|
|
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 ? { [O.longTaskStartTime]: c.startTime } : {}), { startTime: h });
|
|
1843
1843
|
f.forEach((n) => {
|
|
1844
1844
|
t.addEvent("long_task.script", e.applyRedact(or(n, e.config.hooks.redactUrl)), performance.timeOrigin + n.startTime);
|
|
1845
1845
|
}), t.end(g), e.notifyActivity({
|
|
@@ -1849,7 +1849,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1849
1849
|
});
|
|
1850
1850
|
}
|
|
1851
1851
|
if (a) {
|
|
1852
|
-
let t = e.applyRedact(
|
|
1852
|
+
let t = e.applyRedact(j(j(j({}, e.config.hooks.getMetricAttributes()), B(e.getRuntimeAttributesAt(h))), {}, { [O.longTaskEntryType]: v }));
|
|
1853
1853
|
l.add(1, t), u.record(r.duration, t), c && d.record(c.blockingDuration, t);
|
|
1854
1854
|
}
|
|
1855
1855
|
}, p = (e) => e.forEach((e) => f(e));
|
|
@@ -1873,7 +1873,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1873
1873
|
r == null || r.disconnect(), r = void 0, clearTimeout(i), i = void 0, a = [];
|
|
1874
1874
|
}
|
|
1875
1875
|
};
|
|
1876
|
-
},
|
|
1876
|
+
}, cr = /* @__PURE__ */ new Set(), K = "", q, J, lr = !1, Y = () => typeof location > "u" ? "" : location.href, ur = (e, t) => {
|
|
1877
1877
|
let n = Y();
|
|
1878
1878
|
K = n;
|
|
1879
1879
|
let r = {
|
|
@@ -1881,43 +1881,43 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1881
1881
|
source: e,
|
|
1882
1882
|
toUrl: n
|
|
1883
1883
|
};
|
|
1884
|
-
for (let e of Array.from(
|
|
1885
|
-
}, ur = () => {
|
|
1886
|
-
lr("popstate", K || Y());
|
|
1884
|
+
for (let e of Array.from(cr)) e(r);
|
|
1887
1885
|
}, dr = () => {
|
|
1888
|
-
|
|
1886
|
+
ur("popstate", K || Y());
|
|
1889
1887
|
}, fr = () => {
|
|
1890
|
-
|
|
1888
|
+
ur("hashchange", K || Y());
|
|
1889
|
+
}, pr = () => {
|
|
1890
|
+
lr || typeof window > "u" || typeof history > "u" || (lr = !0, K = Y(), q = history.pushState, J = history.replaceState, history.pushState = function(e, t, n) {
|
|
1891
1891
|
let r = K || Y(), i = q == null ? void 0 : q.apply(this, [
|
|
1892
1892
|
e,
|
|
1893
1893
|
t,
|
|
1894
1894
|
n
|
|
1895
1895
|
]);
|
|
1896
|
-
return
|
|
1896
|
+
return ur("pushState", r), i;
|
|
1897
1897
|
}, history.replaceState = function(e, t, n) {
|
|
1898
1898
|
let r = K || Y(), i = J == null ? void 0 : J.apply(this, [
|
|
1899
1899
|
e,
|
|
1900
1900
|
t,
|
|
1901
1901
|
n
|
|
1902
1902
|
]);
|
|
1903
|
-
return
|
|
1904
|
-
}, window.addEventListener("popstate",
|
|
1905
|
-
},
|
|
1906
|
-
!
|
|
1907
|
-
},
|
|
1908
|
-
|
|
1909
|
-
}),
|
|
1903
|
+
return ur("replaceState", r), i;
|
|
1904
|
+
}, window.addEventListener("popstate", dr), window.addEventListener("hashchange", fr));
|
|
1905
|
+
}, mr = () => {
|
|
1906
|
+
!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 = "");
|
|
1907
|
+
}, hr = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (pr(), cr.add(e), () => {
|
|
1908
|
+
cr.delete(e), cr.size === 0 && mr();
|
|
1909
|
+
}), gr = ["span", "stopLoadingTime"], _r = new Set([...Object.values(O), N]), vr = () => typeof location > "u" ? "" : location.href, yr = () => {
|
|
1910
1910
|
if (typeof performance > "u") return {};
|
|
1911
1911
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1912
1912
|
if (!e) return {};
|
|
1913
1913
|
let t = {}, n = (e, n) => {
|
|
1914
1914
|
Number.isFinite(n) && n > 0 && (t[e] = n);
|
|
1915
1915
|
};
|
|
1916
|
-
return n(
|
|
1917
|
-
},
|
|
1916
|
+
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;
|
|
1917
|
+
}, br = (e) => {
|
|
1918
1918
|
let t = e.indexOf("?");
|
|
1919
1919
|
return t < 0 ? e : e.slice(0, t);
|
|
1920
|
-
},
|
|
1920
|
+
}, xr = (e) => {
|
|
1921
1921
|
let t = e.slice(1);
|
|
1922
1922
|
if (!t || typeof document > "u" || typeof document.getElementById != "function") return !1;
|
|
1923
1923
|
try {
|
|
@@ -1925,14 +1925,14 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1925
1925
|
} catch (e) {
|
|
1926
1926
|
return !!document.getElementById(t);
|
|
1927
1927
|
}
|
|
1928
|
-
},
|
|
1928
|
+
}, Sr = (e, t) => {
|
|
1929
1929
|
try {
|
|
1930
1930
|
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 || !
|
|
1931
|
+
return r.pathname !== i.pathname || !xr(i.hash) && br(r.hash) !== br(i.hash);
|
|
1932
1932
|
} catch (n) {
|
|
1933
1933
|
return e !== t;
|
|
1934
1934
|
}
|
|
1935
|
-
},
|
|
1935
|
+
}, Cr = () => {
|
|
1936
1936
|
let e = [];
|
|
1937
1937
|
return {
|
|
1938
1938
|
name: "page-view",
|
|
@@ -1941,22 +1941,22 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1941
1941
|
let n, r, i = t.config.view.loadingTime ? t.meter.createHistogram("browser.view.loading_time", {
|
|
1942
1942
|
description: "Time from view start until network and DOM activity become idle",
|
|
1943
1943
|
unit: "ms",
|
|
1944
|
-
advice: { explicitBucketBoundaries:
|
|
1944
|
+
advice: { explicitBucketBoundaries: G }
|
|
1945
1945
|
}) : void 0, a = (e = Date.now()) => t.setView({}, e), o = (e, n, r = Date.now(), i) => {
|
|
1946
|
-
|
|
1947
|
-
attributes:
|
|
1946
|
+
I(t, "logs") && (e.documentVersion += 1, t.emitLog({
|
|
1947
|
+
attributes: j(j(j(j(j({}, t.config.hooks.getPageAttributes()), e.attributes), e.snapshotAttributes), {}, {
|
|
1948
1948
|
"event.type": "view",
|
|
1949
1949
|
"view.document_version": e.documentVersion,
|
|
1950
1950
|
"view.duration": Math.max(0, r - e.startedAt),
|
|
1951
1951
|
"view.is_active": n !== "final",
|
|
1952
1952
|
"view.snapshot.type": n
|
|
1953
1953
|
}, i ? { "view.end_reason": i } : {}), e.loadingTime === void 0 ? {} : {
|
|
1954
|
-
[
|
|
1954
|
+
[O.viewLoadingTime]: e.loadingTime,
|
|
1955
1955
|
"view.loading_time.source": e.loadingTimeSource
|
|
1956
1956
|
}),
|
|
1957
1957
|
body: "browser.view",
|
|
1958
1958
|
eventName: "browser.view",
|
|
1959
|
-
severityNumber:
|
|
1959
|
+
severityNumber: T.INFO,
|
|
1960
1960
|
severityText: "INFO",
|
|
1961
1961
|
timestamp: r
|
|
1962
1962
|
}));
|
|
@@ -1966,14 +1966,14 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1966
1966
|
r && a(s);
|
|
1967
1967
|
return;
|
|
1968
1968
|
}
|
|
1969
|
-
let l =
|
|
1970
|
-
(c = n.stopLoadingTime) == null || c.call(n), n.loadingTime !== void 0 &&
|
|
1969
|
+
let l = j({}, n);
|
|
1970
|
+
(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
1971
|
let { span: u, stopLoadingTime: d } = l;
|
|
1972
|
-
return
|
|
1972
|
+
return Je(l, gr);
|
|
1973
1973
|
}, c = (e, t, r) => {
|
|
1974
1974
|
if (n !== e || !Number.isFinite(t) || t < 0) return;
|
|
1975
|
-
let i =
|
|
1976
|
-
[
|
|
1975
|
+
let i = j(j({}, e.loadingType === "initial_load" ? yr() : {}), {}, {
|
|
1976
|
+
[O.viewLoadingTime]: t,
|
|
1977
1977
|
"view.loading_time.source": r
|
|
1978
1978
|
});
|
|
1979
1979
|
e.span.setAttributes(i), Object.assign(e.snapshotAttributes, i), e.loadingTime = t, e.loadingTimeSource = r, o(e, "update");
|
|
@@ -1997,7 +1997,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
1997
1997
|
};
|
|
1998
1998
|
window.addEventListener("load", t, { once: !0 }), s = () => window.removeEventListener("load", t);
|
|
1999
1999
|
}
|
|
2000
|
-
let p =
|
|
2000
|
+
let p = Ft(t, e.startedAt, (t) => {
|
|
2001
2001
|
r = !0, t.hadActivity && (i = Math.max(0, t.endTime - e.startedAt)), d();
|
|
2002
2002
|
}), m = () => {
|
|
2003
2003
|
var t;
|
|
@@ -2008,13 +2008,13 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2008
2008
|
}, d();
|
|
2009
2009
|
}, u = (e) => {
|
|
2010
2010
|
let n = t.applyRedact(e == null ? {} : e);
|
|
2011
|
-
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !
|
|
2011
|
+
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !_r.has(e)));
|
|
2012
2012
|
}, d = (e, r, i, a = ((e) => (e = n == null ? void 0 : n.rawUrl) == null ? "" : e)()) => {
|
|
2013
2013
|
var c, d;
|
|
2014
2014
|
if (!t.isSessionActive()) return;
|
|
2015
|
-
let f = (c = e.url) == null ?
|
|
2015
|
+
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
2016
|
s(r, !1);
|
|
2017
|
-
let g =
|
|
2017
|
+
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
2018
|
t.setView({
|
|
2019
2019
|
attributes: h,
|
|
2020
2020
|
id: g,
|
|
@@ -2024,16 +2024,16 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2024
2024
|
url: _,
|
|
2025
2025
|
urlPathGroup: p
|
|
2026
2026
|
}, b);
|
|
2027
|
-
let S =
|
|
2027
|
+
let S = j(j(j(j(j({}, h), t.config.hooks.getPageAttributes()), x), z({
|
|
2028
2028
|
errorType: "none",
|
|
2029
2029
|
spanSubtype: y ? "navigate" : r,
|
|
2030
|
-
spanType: y ?
|
|
2030
|
+
spanType: y ? R.document : R.route
|
|
2031
2031
|
})), {}, {
|
|
2032
|
-
[
|
|
2033
|
-
[
|
|
2034
|
-
[
|
|
2035
|
-
[
|
|
2036
|
-
[
|
|
2032
|
+
[O.viewId]: g,
|
|
2033
|
+
[O.viewName]: m,
|
|
2034
|
+
[O.viewUrl]: _,
|
|
2035
|
+
[O.viewUrlPathGroup]: p,
|
|
2036
|
+
[O.viewLoadingType]: i,
|
|
2037
2037
|
"url.previous": v,
|
|
2038
2038
|
"event.source": r
|
|
2039
2039
|
}, y ? { "document.referrer": t.config.hooks.redactUrl(document.referrer || "") } : {});
|
|
@@ -2061,7 +2061,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2061
2061
|
(r = n.stopLoadingTime) == null || r.call(n), n.stopLoadingTime = void 0, c(n, Math.max(0, e.time - n.startedAt), "manual");
|
|
2062
2062
|
return;
|
|
2063
2063
|
}
|
|
2064
|
-
n.name !== e.name && (n.name = e.name, n.span.setAttribute(
|
|
2064
|
+
n.name !== e.name && (n.name = e.name, n.span.setAttribute(O.viewName, e.name), n.snapshotAttributes[O.viewName] = e.name, t.setView({
|
|
2065
2065
|
attributes: n.attributes,
|
|
2066
2066
|
id: n.id,
|
|
2067
2067
|
loadingType: n.loadingType,
|
|
@@ -2072,8 +2072,8 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2072
2072
|
}), o(n, "update"));
|
|
2073
2073
|
}
|
|
2074
2074
|
}), p = () => {};
|
|
2075
|
-
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p =
|
|
2076
|
-
|
|
2075
|
+
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p = hr((e) => {
|
|
2076
|
+
Sr(e.fromUrl, e.toUrl) && d({}, e.source, "route_change", e.fromUrl);
|
|
2077
2077
|
}));
|
|
2078
2078
|
let m = (e) => {
|
|
2079
2079
|
e.persisted || s("pagehide");
|
|
@@ -2099,7 +2099,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2099
2099
|
}
|
|
2100
2100
|
}
|
|
2101
2101
|
};
|
|
2102
|
-
},
|
|
2102
|
+
}, wr = 5e3, Tr = (e) => typeof e == "number" && Number.isFinite(e) && e > 0, Er = (e, t, n, r) => ({
|
|
2103
2103
|
expiresAt: Math.min(t + n, t + r),
|
|
2104
2104
|
id: e,
|
|
2105
2105
|
startedAt: t,
|
|
@@ -2107,19 +2107,19 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2107
2107
|
}), X = (e, t, n) => {
|
|
2108
2108
|
if (t >= e.startedAt + n) return "maxLifetime";
|
|
2109
2109
|
if (t >= e.expiresAt) return "inactivity";
|
|
2110
|
-
},
|
|
2110
|
+
}, Dr = (e, t, n, r) => j(j({}, e), {}, { expiresAt: Math.min(t + n, e.startedAt + r) }), Or = (e, t, n) => {
|
|
2111
2111
|
if (!e) return null;
|
|
2112
2112
|
try {
|
|
2113
2113
|
let r = JSON.parse(e);
|
|
2114
|
-
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 &&
|
|
2114
|
+
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
2115
|
} catch (e) {}
|
|
2116
2116
|
return null;
|
|
2117
|
-
},
|
|
2117
|
+
}, kr = 900 * 1e3, Z = 14400 * 1e3, Ar = 1e3, jr = 6e4, Mr = [
|
|
2118
2118
|
"click",
|
|
2119
2119
|
"keydown",
|
|
2120
2120
|
"scroll",
|
|
2121
2121
|
"touchstart"
|
|
2122
|
-
],
|
|
2122
|
+
], Nr = /* @__PURE__ */ new Map(), Pr = (e) => {
|
|
2123
2123
|
let t = typeof window < "u", n = () => {
|
|
2124
2124
|
var n;
|
|
2125
2125
|
if (t) try {
|
|
@@ -2127,41 +2127,41 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2127
2127
|
} catch (e) {
|
|
2128
2128
|
t = !1;
|
|
2129
2129
|
}
|
|
2130
|
-
return (n =
|
|
2130
|
+
return (n = Nr.get(e)) == null ? null : n;
|
|
2131
2131
|
};
|
|
2132
2132
|
return n(), {
|
|
2133
2133
|
isLocalStorage: () => t,
|
|
2134
2134
|
read: n,
|
|
2135
2135
|
write: (n) => {
|
|
2136
2136
|
let r = JSON.stringify(n);
|
|
2137
|
-
if (
|
|
2137
|
+
if (Nr.set(e, r), t) try {
|
|
2138
2138
|
window.localStorage.setItem(e, r);
|
|
2139
2139
|
} catch (e) {
|
|
2140
2140
|
t = !1;
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
2143
|
};
|
|
2144
|
-
},
|
|
2144
|
+
}, Fr = (e, t) => {
|
|
2145
2145
|
let n = "";
|
|
2146
2146
|
try {
|
|
2147
2147
|
n = new URL(e).host;
|
|
2148
2148
|
} catch (t) {
|
|
2149
2149
|
n = e;
|
|
2150
2150
|
}
|
|
2151
|
-
return `bk_ot_session__${
|
|
2152
|
-
},
|
|
2151
|
+
return `bk_ot_session__${D(`${t}\0${n || "default"}`)}`;
|
|
2152
|
+
}, Ir = (e, t) => {
|
|
2153
2153
|
t.reason && e.emitLog({
|
|
2154
|
-
severityNumber:
|
|
2154
|
+
severityNumber: T.INFO,
|
|
2155
2155
|
severityText: "INFO",
|
|
2156
2156
|
body: t.reason === "init" ? "session.start" : "session.rotate",
|
|
2157
|
-
attributes:
|
|
2158
|
-
[
|
|
2159
|
-
[
|
|
2160
|
-
[
|
|
2157
|
+
attributes: j(j({}, e.config.hooks.getPageAttributes()), {}, {
|
|
2158
|
+
[O.sessionHasReplay]: !1,
|
|
2159
|
+
[O.sessionId]: t.record.id,
|
|
2160
|
+
[O.sessionStartTime]: t.record.startedAt,
|
|
2161
2161
|
"session.rotate.reason": t.reason
|
|
2162
2162
|
}, t.previousId ? { "session.previous_id": t.previousId } : {})
|
|
2163
2163
|
});
|
|
2164
|
-
},
|
|
2164
|
+
}, Lr = (e = {}) => {
|
|
2165
2165
|
let t = [];
|
|
2166
2166
|
return {
|
|
2167
2167
|
name: "session",
|
|
@@ -2169,12 +2169,12 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2169
2169
|
var r;
|
|
2170
2170
|
if (typeof window > "u" || typeof document > "u") {
|
|
2171
2171
|
n.setRuntimeAttributes({
|
|
2172
|
-
[
|
|
2173
|
-
[
|
|
2172
|
+
[O.sessionHasReplay]: !1,
|
|
2173
|
+
[O.sessionId]: E("session")
|
|
2174
2174
|
});
|
|
2175
2175
|
return;
|
|
2176
2176
|
}
|
|
2177
|
-
let i = (r = e.storageKey) == null ?
|
|
2177
|
+
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
2178
|
c !== void 0 && (clearTimeout(c), c = void 0);
|
|
2179
2179
|
}, d = (e, t = Date.now()) => {
|
|
2180
2180
|
let r = s;
|
|
@@ -2184,8 +2184,8 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2184
2184
|
reason: e,
|
|
2185
2185
|
type: "expired"
|
|
2186
2186
|
}), u(), s = void 0, n.setRuntimeAttributes({
|
|
2187
|
-
[
|
|
2188
|
-
[
|
|
2187
|
+
[O.sessionHasReplay]: void 0,
|
|
2188
|
+
[O.sessionId]: void 0
|
|
2189
2189
|
}, t), n.flush());
|
|
2190
2190
|
}, f = () => {
|
|
2191
2191
|
let e = Date.now(), t = l(e);
|
|
@@ -2220,8 +2220,8 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2220
2220
|
}, m = (e, t) => {
|
|
2221
2221
|
let r = e.id !== s;
|
|
2222
2222
|
s = e.id, n.setRuntimeAttributes({
|
|
2223
|
-
[
|
|
2224
|
-
[
|
|
2223
|
+
[O.sessionHasReplay]: !1,
|
|
2224
|
+
[O.sessionId]: e.id
|
|
2225
2225
|
}, Math.min(e.startedAt, o)), p(e), r && t && n.notifySessionLifecycle({
|
|
2226
2226
|
id: e.id,
|
|
2227
2227
|
previousId: t.previousId,
|
|
@@ -2232,15 +2232,15 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2232
2232
|
}, h = (e = !1) => {
|
|
2233
2233
|
let t = Date.now(), r = l(t);
|
|
2234
2234
|
if ((r == null ? void 0 : r.status) === "active" && !X(r, t, Z)) {
|
|
2235
|
-
let e =
|
|
2235
|
+
let e = Dr(r, t, kr, Z);
|
|
2236
2236
|
a.write(e), m(e, s ? void 0 : { reason: "shared" });
|
|
2237
2237
|
return;
|
|
2238
2238
|
}
|
|
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 =
|
|
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 = Er(E("session"), t, kr, Z);
|
|
2240
2240
|
a.write(c), m(c, {
|
|
2241
2241
|
previousId: i,
|
|
2242
2242
|
reason: o == null ? "init" : o
|
|
2243
|
-
}),
|
|
2243
|
+
}), Ir(n, {
|
|
2244
2244
|
previousId: i,
|
|
2245
2245
|
reason: o == null ? "init" : o,
|
|
2246
2246
|
record: c
|
|
@@ -2252,31 +2252,31 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2252
2252
|
f();
|
|
2253
2253
|
return;
|
|
2254
2254
|
}
|
|
2255
|
-
let n =
|
|
2255
|
+
let n = Dr(t, e, kr, Z);
|
|
2256
2256
|
a.write(n), m(n);
|
|
2257
2257
|
};
|
|
2258
2258
|
h(!0);
|
|
2259
2259
|
let _ = 0, v = () => {
|
|
2260
2260
|
let e = Date.now();
|
|
2261
|
-
e - _ <
|
|
2261
|
+
e - _ < Ar || (_ = e, h());
|
|
2262
2262
|
}, y = {
|
|
2263
2263
|
capture: !0,
|
|
2264
2264
|
passive: !0
|
|
2265
2265
|
};
|
|
2266
|
-
|
|
2267
|
-
|
|
2266
|
+
Mr.forEach((e) => window.addEventListener(e, v, y)), t.push(() => {
|
|
2267
|
+
Mr.forEach((e) => window.removeEventListener(e, v, y));
|
|
2268
2268
|
});
|
|
2269
2269
|
let b = () => {
|
|
2270
2270
|
document.visibilityState === "visible" && g();
|
|
2271
2271
|
};
|
|
2272
2272
|
document.addEventListener("visibilitychange", b);
|
|
2273
|
-
let x = window.setInterval(b,
|
|
2273
|
+
let x = window.setInterval(b, jr);
|
|
2274
2274
|
t.push(() => {
|
|
2275
2275
|
document.removeEventListener("visibilitychange", b), window.clearInterval(x);
|
|
2276
2276
|
});
|
|
2277
2277
|
let S = (e) => {
|
|
2278
2278
|
if (!a.isLocalStorage() || e.storageArea !== window.localStorage || e.key !== i) return;
|
|
2279
|
-
let t = Date.now(), n =
|
|
2279
|
+
let t = Date.now(), n = Or(e.newValue, t, Z);
|
|
2280
2280
|
if ((n == null ? void 0 : n.status) === "active" && n.id === s && !X(n, t, Z)) {
|
|
2281
2281
|
p(n);
|
|
2282
2282
|
return;
|
|
@@ -2289,58 +2289,58 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2289
2289
|
for (var e; t.length;) (e = t.pop()) == null || e();
|
|
2290
2290
|
}
|
|
2291
2291
|
};
|
|
2292
|
-
},
|
|
2293
|
-
if (typeof performance > "u") return
|
|
2292
|
+
}, Rr = "unknown", zr = 10, Br = 6e4, Vr = 5e3, Hr = 1e3, Ur = (e, t) => !!t && e === t, Wr = (e) => e ? e.replace(/_/g, "-") : Rr, Gr = () => {
|
|
2293
|
+
if (typeof performance > "u") return Rr;
|
|
2294
2294
|
let e = performance.getEntriesByType("navigation")[0];
|
|
2295
|
-
return
|
|
2296
|
-
},
|
|
2295
|
+
return Wr(e == null ? void 0 : e.type);
|
|
2296
|
+
}, Kr = (e, t) => {
|
|
2297
2297
|
let [n, r] = e === "CLS" ? [.1, .25] : [200, 500];
|
|
2298
2298
|
return t <= n ? "good" : t <= r ? "needs-improvement" : "poor";
|
|
2299
|
-
},
|
|
2299
|
+
}, qr = (e) => {
|
|
2300
2300
|
var t, n, r;
|
|
2301
2301
|
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
|
-
},
|
|
2302
|
+
}, Jr = () => {
|
|
2303
2303
|
if (typeof performance > "u") return;
|
|
2304
2304
|
let e = performance.interactionCount;
|
|
2305
2305
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
2306
|
-
},
|
|
2306
|
+
}, Yr = (e, t) => {
|
|
2307
2307
|
var n, r;
|
|
2308
2308
|
let i = (n = t.value) == null ? 0 : n;
|
|
2309
2309
|
if (!(t.hadRecentInput || !Number.isFinite(i))) {
|
|
2310
|
-
if (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >=
|
|
2310
|
+
if (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >= Hr || t.startTime - e.clsWindowStart >= Vr) {
|
|
2311
2311
|
var a;
|
|
2312
|
-
e.clsWindowStart = t.startTime, e.clsWindowValue = i, e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget =
|
|
2312
|
+
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
2313
|
} else if (e.clsWindowValue += i, i > e.clsWindowLargestShiftValue) {
|
|
2314
2314
|
var o;
|
|
2315
|
-
e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget =
|
|
2315
|
+
e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget = qr((o = t.sources) == null || (o = o[0]) == null ? void 0 : o.node);
|
|
2316
2316
|
}
|
|
2317
2317
|
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
2318
|
}
|
|
2319
|
-
},
|
|
2319
|
+
}, Xr = (e, t) => {
|
|
2320
2320
|
var n, r;
|
|
2321
2321
|
if (!t.interactionId || !Number.isFinite(t.duration)) return;
|
|
2322
2322
|
e.interactionIdMin = Math.min(e.interactionIdMin, t.interactionId), e.interactionIdMax = Math.max(e.interactionIdMax, t.interactionId);
|
|
2323
2323
|
let i = (n = t.processingStart) == null ? t.startTime : n, a = (r = t.processingEnd) == null ? i : r, o = {
|
|
2324
|
-
duration: Math.min(t.duration,
|
|
2324
|
+
duration: Math.min(t.duration, Br),
|
|
2325
2325
|
inputDelay: Math.max(0, i - t.startTime),
|
|
2326
2326
|
interactionId: t.interactionId,
|
|
2327
|
-
interactionTarget:
|
|
2327
|
+
interactionTarget: qr(t.target),
|
|
2328
2328
|
interactionType: t.name,
|
|
2329
2329
|
presentationDelay: Math.max(0, t.startTime + t.duration - a),
|
|
2330
2330
|
processingDuration: Math.max(0, a - i)
|
|
2331
2331
|
}, 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 =
|
|
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(zr);
|
|
2333
|
+
}, Zr = (e) => {
|
|
2334
|
+
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
2335
|
if (e.inpCandidates.length) return e.inpCandidates[Math.min(e.inpCandidates.length - 1, Math.floor(n / 50))];
|
|
2336
|
-
},
|
|
2336
|
+
}, Qr = (e, t) => {
|
|
2337
2337
|
var n;
|
|
2338
2338
|
return {
|
|
2339
2339
|
"rum.navigation.type": (n = e.navigationType) == null ? t : n,
|
|
2340
|
-
[
|
|
2341
|
-
[
|
|
2340
|
+
[O.vitalMetric]: e.name.toLowerCase(),
|
|
2341
|
+
[O.vitalRating]: e.rating
|
|
2342
2342
|
};
|
|
2343
|
-
},
|
|
2343
|
+
}, $r = (e, t) => {
|
|
2344
2344
|
var n;
|
|
2345
2345
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
2346
2346
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -2364,12 +2364,12 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2364
2364
|
default: break;
|
|
2365
2365
|
}
|
|
2366
2366
|
return i;
|
|
2367
|
-
},
|
|
2367
|
+
}, ei = () => {
|
|
2368
2368
|
let e, t = !1;
|
|
2369
2369
|
return {
|
|
2370
2370
|
name: "web-vitals",
|
|
2371
2371
|
init(n) {
|
|
2372
|
-
return
|
|
2372
|
+
return M(function* () {
|
|
2373
2373
|
if (typeof window > "u") return;
|
|
2374
2374
|
let r;
|
|
2375
2375
|
try {
|
|
@@ -2382,54 +2382,54 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2382
2382
|
return;
|
|
2383
2383
|
}
|
|
2384
2384
|
if (t) return;
|
|
2385
|
-
let { onFCP: a, onLCP: o, onTTFB: s } = r, c =
|
|
2385
|
+
let { onFCP: a, onLCP: o, onTTFB: s } = r, c = Gr(), l = n.meter.createHistogram("browser.web_vital.cls", {
|
|
2386
2386
|
unit: "1",
|
|
2387
2387
|
description: "Cumulative Layout Shift",
|
|
2388
2388
|
advice: { explicitBucketBoundaries: $n }
|
|
2389
2389
|
}), u = n.meter.createHistogram("browser.web_vital.duration", {
|
|
2390
2390
|
unit: "ms",
|
|
2391
2391
|
description: "Web Vitals duration metrics, including FCP, INP, LCP and TTFB",
|
|
2392
|
-
advice: { explicitBucketBoundaries:
|
|
2392
|
+
advice: { explicitBucketBoundaries: G }
|
|
2393
2393
|
}), d = (e, t, r) => {
|
|
2394
|
-
if (!
|
|
2394
|
+
if (!I(n, "traces")) return;
|
|
2395
2395
|
let i = e.name.toLowerCase();
|
|
2396
|
-
n.startSpan("browser.web_vital",
|
|
2396
|
+
n.startSpan("browser.web_vital", j(j(j(j(j({}, n.config.hooks.getPageAttributes()), t), Qr(e, c)), z({
|
|
2397
2397
|
errorType: e.rating === "good" ? "none" : "slow",
|
|
2398
|
-
result:
|
|
2398
|
+
result: lt(e.rating),
|
|
2399
2399
|
spanSubtype: i,
|
|
2400
|
-
spanType:
|
|
2400
|
+
spanType: R.vital
|
|
2401
2401
|
})), {}, {
|
|
2402
|
-
[
|
|
2403
|
-
[
|
|
2404
|
-
[
|
|
2402
|
+
[O.vitalMetric]: i,
|
|
2403
|
+
[O.vitalValue]: e.value,
|
|
2404
|
+
[O.vitalRating]: e.rating,
|
|
2405
2405
|
"vital.id": e.id
|
|
2406
|
-
},
|
|
2406
|
+
}, $r(e, n.config.hooks.redactUrl)), r === void 0 ? void 0 : { contextTime: r }).end();
|
|
2407
2407
|
}, f = (e) => {
|
|
2408
|
-
if (t || !Number.isFinite(e.value) || !
|
|
2408
|
+
if (t || !Number.isFinite(e.value) || !I(n, "metrics") && !I(n, "traces")) return;
|
|
2409
2409
|
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
|
-
|
|
2410
|
+
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
2411
|
}, p, m, h, g = (e, t, r) => {
|
|
2412
|
-
if (
|
|
2413
|
-
let r = n.applyRedact(
|
|
2412
|
+
if (I(n, "metrics")) {
|
|
2413
|
+
let r = n.applyRedact(j(j(j({}, n.config.hooks.getMetricAttributes()), B(t)), Qr(e, c)));
|
|
2414
2414
|
e.name === "CLS" ? l.record(e.value, r) : u.record(e.value, r);
|
|
2415
2415
|
}
|
|
2416
2416
|
d(e, t, r);
|
|
2417
2417
|
}, _ = () => {
|
|
2418
2418
|
let e = p;
|
|
2419
|
-
if (!e || !
|
|
2419
|
+
if (!e || !I(n, "metrics") && !I(n, "traces")) return;
|
|
2420
2420
|
g({
|
|
2421
2421
|
attribution: {
|
|
2422
2422
|
largestShiftTarget: e.largestShiftTarget,
|
|
2423
2423
|
largestShiftValue: e.largestShiftValue
|
|
2424
2424
|
},
|
|
2425
2425
|
entries: [],
|
|
2426
|
-
id:
|
|
2426
|
+
id: E("vital"),
|
|
2427
2427
|
name: "CLS",
|
|
2428
2428
|
navigationType: c,
|
|
2429
|
-
rating:
|
|
2429
|
+
rating: Kr("CLS", e.cls),
|
|
2430
2430
|
value: e.cls
|
|
2431
2431
|
}, e.runtimeAttributes, e.startedAt);
|
|
2432
|
-
let t =
|
|
2432
|
+
let t = Zr(e);
|
|
2433
2433
|
t && g({
|
|
2434
2434
|
attribution: {
|
|
2435
2435
|
inputDelay: t.inputDelay,
|
|
@@ -2439,21 +2439,21 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2439
2439
|
processingDuration: t.processingDuration
|
|
2440
2440
|
},
|
|
2441
2441
|
entries: [],
|
|
2442
|
-
id:
|
|
2442
|
+
id: E("vital"),
|
|
2443
2443
|
name: "INP",
|
|
2444
2444
|
navigationType: c,
|
|
2445
|
-
rating:
|
|
2445
|
+
rating: Kr("INP", t.duration),
|
|
2446
2446
|
value: t.duration
|
|
2447
2447
|
}, e.runtimeAttributes, e.startedAt);
|
|
2448
2448
|
}, v = n.onViewChange((e) => {
|
|
2449
2449
|
var t;
|
|
2450
2450
|
let r = p;
|
|
2451
|
-
if (r &&
|
|
2452
|
-
r.runtimeAttributes =
|
|
2453
|
-
[
|
|
2454
|
-
[
|
|
2455
|
-
[
|
|
2456
|
-
[
|
|
2451
|
+
if (r && Ur(r.id, e.id)) {
|
|
2452
|
+
r.runtimeAttributes = j(j({}, r.runtimeAttributes), {}, {
|
|
2453
|
+
[O.viewId]: e.id,
|
|
2454
|
+
[O.viewName]: e.name,
|
|
2455
|
+
[O.viewUrl]: e.url,
|
|
2456
|
+
[O.viewUrlPathGroup]: e.urlPathGroup
|
|
2457
2457
|
});
|
|
2458
2458
|
return;
|
|
2459
2459
|
}
|
|
@@ -2461,7 +2461,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2461
2461
|
cls: 0,
|
|
2462
2462
|
clsWindowLargestShiftValue: 0,
|
|
2463
2463
|
clsWindowValue: 0,
|
|
2464
|
-
interactionCountAtStart:
|
|
2464
|
+
interactionCountAtStart: Jr(),
|
|
2465
2465
|
interactionIdMax: 0,
|
|
2466
2466
|
interactionIdMin: Infinity,
|
|
2467
2467
|
inpCandidates: [],
|
|
@@ -2474,12 +2474,12 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2474
2474
|
if (typeof PerformanceObserver < "u") {
|
|
2475
2475
|
var y, b;
|
|
2476
2476
|
(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 ||
|
|
2477
|
+
if (p) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < p.startedAt || Yr(p, t);
|
|
2478
2478
|
}), h.observe({
|
|
2479
2479
|
buffered: !0,
|
|
2480
2480
|
type: "layout-shift"
|
|
2481
2481
|
})), (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) ||
|
|
2482
|
+
if (p) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < p.startedAt || !t.interactionId || !Number.isFinite(t.duration) || Xr(p, t);
|
|
2483
2483
|
}), m.observe({
|
|
2484
2484
|
buffered: !0,
|
|
2485
2485
|
durationThreshold: 40,
|
|
@@ -2495,7 +2495,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2495
2495
|
t = !0, e == null || e(), e = void 0;
|
|
2496
2496
|
}
|
|
2497
2497
|
};
|
|
2498
|
-
},
|
|
2498
|
+
}, 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
2499
|
let n = {
|
|
2500
2500
|
"network.protocol.name": "websocket",
|
|
2501
2501
|
"url.full": t(e)
|
|
@@ -2508,11 +2508,11 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2508
2508
|
metricAttributes: r,
|
|
2509
2509
|
spanAttributes: n
|
|
2510
2510
|
};
|
|
2511
|
-
},
|
|
2512
|
-
let { bytesCounter: n, connectDurationHistogram: r, context: i, errorCounter: a, errorThrottle: o, isDisposed: s, messageCounter: l, url: u } = t, { metricAttributes: d, spanAttributes: f } =
|
|
2511
|
+
}, oi = (e, t) => {
|
|
2512
|
+
let { bytesCounter: n, connectDurationHistogram: r, context: i, errorCounter: a, errorThrottle: o, isDisposed: s, messageCounter: l, url: u } = t, { metricAttributes: d, spanAttributes: f } = ai(u, i.config.hooks.redactUrl), p = i.config.hooks.getMetricAttributes(), m = () => i.applyRedact(j(j(j({}, p), B(i.getRuntimeAttributes())), d)), h = i.startSpan("websocket.connect", j(j({}, f), z({
|
|
2513
2513
|
errorType: "none",
|
|
2514
2514
|
spanSubtype: "websocket",
|
|
2515
|
-
spanType:
|
|
2515
|
+
spanType: R.custom
|
|
2516
2516
|
}))), g = performance.now(), _ = !1, v = (e) => {
|
|
2517
2517
|
if (_) return;
|
|
2518
2518
|
_ = !0;
|
|
@@ -2520,48 +2520,48 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2520
2520
|
e === "error" && h.setStatus({
|
|
2521
2521
|
code: c.ERROR,
|
|
2522
2522
|
message: "websocket connect failed"
|
|
2523
|
-
}), h.setAttributes(
|
|
2523
|
+
}), h.setAttributes(z({
|
|
2524
2524
|
errorType: e === "error" ? "network" : "none",
|
|
2525
|
-
result: e === "error" ?
|
|
2525
|
+
result: e === "error" ? L.error : L.success,
|
|
2526
2526
|
spanSubtype: "websocket",
|
|
2527
|
-
spanType:
|
|
2528
|
-
})), h.end(), e === "opened" && !s() &&
|
|
2527
|
+
spanType: R.custom
|
|
2528
|
+
})), h.end(), e === "opened" && !s() && I(i, "metrics") && r.record(t, m());
|
|
2529
2529
|
};
|
|
2530
2530
|
e.addEventListener("open", () => {
|
|
2531
2531
|
s() || v("opened");
|
|
2532
2532
|
}), e.addEventListener("message", (e) => {
|
|
2533
|
-
if (s() || !
|
|
2534
|
-
let t =
|
|
2535
|
-
l.add(1, t), n.add(
|
|
2533
|
+
if (s() || !I(i, "metrics")) return;
|
|
2534
|
+
let t = j(j({}, m()), {}, { "websocket.direction": "in" });
|
|
2535
|
+
l.add(1, t), n.add(ii(e.data), t);
|
|
2536
2536
|
}), e.addEventListener("error", () => {
|
|
2537
2537
|
if (s()) return;
|
|
2538
2538
|
let e = _ ? "runtime" : "connect";
|
|
2539
|
-
if (
|
|
2539
|
+
if (I(i, "metrics") && a.add(1, j(j({}, m()), {}, { "websocket.error.phase": e })), v("error"), !I(i, "logs")) return;
|
|
2540
2540
|
let t = o.allow(`ws:error:${u}`);
|
|
2541
2541
|
t.allowed && i.emitLog({
|
|
2542
|
-
severityNumber:
|
|
2542
|
+
severityNumber: T.ERROR,
|
|
2543
2543
|
severityText: "ERROR",
|
|
2544
2544
|
body: "websocket.error",
|
|
2545
|
-
attributes:
|
|
2545
|
+
attributes: j(j(j({}, f), z({
|
|
2546
2546
|
errorType: "network",
|
|
2547
|
-
result:
|
|
2547
|
+
result: L.error,
|
|
2548
2548
|
spanSubtype: "websocket",
|
|
2549
|
-
spanType:
|
|
2549
|
+
spanType: R.custom
|
|
2550
2550
|
})), {}, {
|
|
2551
2551
|
"websocket.error.phase": e,
|
|
2552
2552
|
"websocket.error.window_occurrence_index": t.count
|
|
2553
2553
|
})
|
|
2554
2554
|
});
|
|
2555
2555
|
}), e.addEventListener("close", (e) => {
|
|
2556
|
-
s() || (_ || v("error"),
|
|
2557
|
-
severityNumber:
|
|
2556
|
+
s() || (_ || v("error"), I(i, "logs") && i.emitLog({
|
|
2557
|
+
severityNumber: T.INFO,
|
|
2558
2558
|
severityText: "INFO",
|
|
2559
2559
|
body: "websocket.close",
|
|
2560
|
-
attributes:
|
|
2560
|
+
attributes: j(j(j({}, f), z({
|
|
2561
2561
|
errorType: e.wasClean ? "none" : "network",
|
|
2562
|
-
result: e.wasClean ?
|
|
2562
|
+
result: e.wasClean ? L.success : L.warning,
|
|
2563
2563
|
spanSubtype: "websocket",
|
|
2564
|
-
spanType:
|
|
2564
|
+
spanType: R.custom
|
|
2565
2565
|
})), {}, {
|
|
2566
2566
|
"websocket.close.code": e.code,
|
|
2567
2567
|
"websocket.close.reason": e.reason,
|
|
@@ -2571,13 +2571,13 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2571
2571
|
});
|
|
2572
2572
|
let y = e.send.bind(e);
|
|
2573
2573
|
e.send = (e) => {
|
|
2574
|
-
if (!s() &&
|
|
2575
|
-
let t =
|
|
2576
|
-
l.add(1, t), n.add(
|
|
2574
|
+
if (!s() && I(i, "metrics")) {
|
|
2575
|
+
let t = j(j({}, m()), {}, { "websocket.direction": "out" });
|
|
2576
|
+
l.add(1, t), n.add(ii(e), t);
|
|
2577
2577
|
}
|
|
2578
2578
|
return y(e);
|
|
2579
2579
|
};
|
|
2580
|
-
},
|
|
2580
|
+
}, si = () => {
|
|
2581
2581
|
let e, t, n = !1;
|
|
2582
2582
|
return {
|
|
2583
2583
|
name: "websocket",
|
|
@@ -2591,13 +2591,13 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2591
2591
|
}), s = r.meter.createCounter("browser.websocket.error.count", { description: "Total number of WebSocket error events" }), c = r.meter.createHistogram("browser.websocket.connect.duration", {
|
|
2592
2592
|
unit: "ms",
|
|
2593
2593
|
description: "WebSocket connection establishment duration (only successful connects)",
|
|
2594
|
-
advice: { explicitBucketBoundaries:
|
|
2595
|
-
}), l =
|
|
2594
|
+
advice: { explicitBucketBoundaries: G }
|
|
2595
|
+
}), l = te(ni, ri), u = () => n;
|
|
2596
2596
|
t = new Proxy(i, { construct(e, t, i) {
|
|
2597
2597
|
let d = Reflect.construct(e, t, i);
|
|
2598
2598
|
if (n || !r.isSampled()) return d;
|
|
2599
2599
|
let f = t[0] == null ? "" : String(t[0]);
|
|
2600
|
-
return !f ||
|
|
2600
|
+
return !f || He(r.config, f) || oi(d, {
|
|
2601
2601
|
bytesCounter: o,
|
|
2602
2602
|
connectDurationHistogram: c,
|
|
2603
2603
|
context: r,
|
|
@@ -2613,18 +2613,18 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2613
2613
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
2614
2614
|
}
|
|
2615
2615
|
};
|
|
2616
|
-
},
|
|
2616
|
+
}, ci = class {
|
|
2617
2617
|
constructor() {
|
|
2618
|
-
|
|
2618
|
+
A(this, "listeners", /* @__PURE__ */ new Set()), A(this, "notify", (e) => {
|
|
2619
2619
|
this.listeners.forEach((t) => t(e));
|
|
2620
|
-
}),
|
|
2620
|
+
}), A(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
|
|
2621
2621
|
}
|
|
2622
|
-
},
|
|
2622
|
+
}, li = (e) => ({
|
|
2623
2623
|
url: e.endpoint,
|
|
2624
2624
|
headers: e.headers,
|
|
2625
2625
|
concurrencyLimit: e.concurrencyLimit,
|
|
2626
2626
|
timeoutMillis: e.timeoutMillis
|
|
2627
|
-
}),
|
|
2627
|
+
}), ui = "bk-rum", di = class {
|
|
2628
2628
|
constructor(e) {
|
|
2629
2629
|
this.isSampled = e;
|
|
2630
2630
|
}
|
|
@@ -2634,7 +2634,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2634
2634
|
toString() {
|
|
2635
2635
|
return "RumSessionSampler";
|
|
2636
2636
|
}
|
|
2637
|
-
}, Q,
|
|
2637
|
+
}, Q, fi = () => {
|
|
2638
2638
|
if (Q) Q.users += 1;
|
|
2639
2639
|
else {
|
|
2640
2640
|
let e = new f().enable(), n = l.setGlobalContextManager(e);
|
|
@@ -2649,28 +2649,28 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2649
2649
|
return () => {
|
|
2650
2650
|
e || !Q || (e = !0, --Q.users, !(Q.users > 0) && (Q.ownsContext && l.disable(), Q.ownsPropagator && u.disable(), Q = void 0));
|
|
2651
2651
|
};
|
|
2652
|
-
},
|
|
2652
|
+
}, pi = (e, t, n) => n ? new Proxy(e, { get(e, n, r) {
|
|
2653
2653
|
if (n === "export") return (n, r) => {
|
|
2654
2654
|
var i;
|
|
2655
2655
|
return (i = globalThis.console) == null || i.log(`[bk-ot][${t}]`, n), e.export(n, r);
|
|
2656
2656
|
};
|
|
2657
2657
|
let i = Reflect.get(e, n, r);
|
|
2658
2658
|
return typeof i == "function" ? i.bind(e) : i;
|
|
2659
|
-
} }) : e,
|
|
2660
|
-
|
|
2661
|
-
...$(e.tracking.device, !0,
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
],
|
|
2659
|
+
} }) : e, mi = (e) => [Ln(e.tracking.request)], hi = (e) => [
|
|
2660
|
+
Lr(e.session),
|
|
2661
|
+
...$(e.tracking.device, !0, ge),
|
|
2662
|
+
Nt(),
|
|
2663
|
+
Cr(),
|
|
2664
|
+
wn(gi(e.tracking.resource, !0))
|
|
2665
|
+
], 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
2666
|
...$(e.error, !0, Qn),
|
|
2667
|
-
...$(e.webVitals, !0,
|
|
2668
|
-
...$(e.blankScreen, !0,
|
|
2669
|
-
...$(e.action, !0,
|
|
2670
|
-
...$(e.websocket, !1,
|
|
2667
|
+
...$(e.webVitals, !0, ei),
|
|
2668
|
+
...$(e.blankScreen, !0, Qt),
|
|
2669
|
+
...$(e.action, !0, At),
|
|
2670
|
+
...$(e.websocket, !1, si),
|
|
2671
2671
|
...$(e.longTask, !1, sr),
|
|
2672
|
-
...$(e.cspViolation, !1,
|
|
2673
|
-
],
|
|
2672
|
+
...$(e.cspViolation, !1, Hn)
|
|
2673
|
+
], yi = class {
|
|
2674
2674
|
assertBeforeStart(e) {
|
|
2675
2675
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
2676
2676
|
}
|
|
@@ -2703,20 +2703,20 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
createPluginManager() {
|
|
2705
2705
|
var e;
|
|
2706
|
-
return new
|
|
2706
|
+
return new Fe([
|
|
2707
|
+
...hi(this.config),
|
|
2707
2708
|
...mi(this.config),
|
|
2708
|
-
...
|
|
2709
|
-
..._i(this.config.tracking),
|
|
2709
|
+
...vi(this.config.tracking),
|
|
2710
2710
|
...(e = this.config.extensions.plugins) == null ? [] : e
|
|
2711
2711
|
]);
|
|
2712
2712
|
}
|
|
2713
2713
|
constructor(e) {
|
|
2714
2714
|
var t = this;
|
|
2715
|
-
|
|
2715
|
+
A(this, "activityObserver", new ci()), A(this, "flushProviders", M(function* () {
|
|
2716
2716
|
yield t.tracerProvider.forceFlush(), yield t.meterProvider.forceFlush(), yield t.loggerProvider.forceFlush();
|
|
2717
|
-
})),
|
|
2717
|
+
})), 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
2718
|
if (t.pluginManager || !t.config.enabled || t.config.trackingConsent !== "granted") return;
|
|
2719
|
-
t.config.transport.traces !== !1 && (t.releaseOtelGlobals =
|
|
2719
|
+
t.config.transport.traces !== !1 && (t.releaseOtelGlobals = fi());
|
|
2720
2720
|
let e = t.createPluginManager();
|
|
2721
2721
|
t.pluginManager = e;
|
|
2722
2722
|
try {
|
|
@@ -2727,50 +2727,50 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2727
2727
|
for (yield e.shutdown(), t.pluginManager = void 0; t.registeredInstrumentations.length;) (r = t.registeredInstrumentations.pop()) == null || (i = r.disable) == null || i.call(r);
|
|
2728
2728
|
throw (a = t.releaseOtelGlobals) == null || a.call(t), t.releaseOtelGlobals = void 0, n;
|
|
2729
2729
|
}
|
|
2730
|
-
})),
|
|
2731
|
-
var e =
|
|
2730
|
+
})), A(this, "stopCollection", function() {
|
|
2731
|
+
var e = M(function* (e) {
|
|
2732
2732
|
var n, r, i;
|
|
2733
2733
|
let a = t.pluginManager;
|
|
2734
2734
|
if (a) {
|
|
2735
2735
|
for (yield a.shutdown(), t.pluginManager = void 0; t.registeredInstrumentations.length;) (n = t.registeredInstrumentations.pop()) == null || (r = n.disable) == null || r.call(n);
|
|
2736
2736
|
t.setRuntimeAttributes({
|
|
2737
|
-
[
|
|
2738
|
-
[
|
|
2737
|
+
[O.sessionHasReplay]: void 0,
|
|
2738
|
+
[O.sessionId]: void 0
|
|
2739
2739
|
}), e && (yield t.flushProviders()), (i = t.releaseOtelGlobals) == null || i.call(t), t.releaseOtelGlobals = void 0;
|
|
2740
2740
|
}
|
|
2741
2741
|
});
|
|
2742
2742
|
return function(t) {
|
|
2743
2743
|
return e.apply(this, arguments);
|
|
2744
2744
|
};
|
|
2745
|
-
}()),
|
|
2745
|
+
}()), 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
2746
|
var t;
|
|
2747
2747
|
if (!this.isSampled() || this.config.transport.logs === !1) return;
|
|
2748
|
-
let i = e.timestamp ? n(r(e.timestamp)) : void 0, a =
|
|
2748
|
+
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
2749
|
this.logger.emit(a);
|
|
2750
|
-
}),
|
|
2750
|
+
}), A(this, "flush", M(function* () {
|
|
2751
2751
|
var e;
|
|
2752
2752
|
yield (e = t.pluginManager) == null ? void 0 : e.flush(), yield t.flushProviders();
|
|
2753
|
-
})),
|
|
2753
|
+
})), 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
2754
|
this.runtimeContext.notifySessionLifecycle(e);
|
|
2755
|
-
}),
|
|
2755
|
+
}), A(this, "onSessionLifecycle", (e) => this.runtimeContext.onSessionLifecycle(e)), A(this, "registerInstrumentations", (e) => {
|
|
2756
2756
|
e.length && (_({
|
|
2757
2757
|
instrumentations: e,
|
|
2758
2758
|
meterProvider: this.meterProvider,
|
|
2759
2759
|
tracerProvider: this.tracerProvider
|
|
2760
2760
|
}), this.registeredInstrumentations.push(...e));
|
|
2761
|
-
}),
|
|
2761
|
+
}), A(this, "reportAction", ({ attributes: e = {}, name: t }) => {
|
|
2762
2762
|
if (!this.isSampled() || this.config.transport.traces === !1) return;
|
|
2763
|
-
let n =
|
|
2764
|
-
this.startSpan("action.custom",
|
|
2763
|
+
let n = E("action");
|
|
2764
|
+
this.startSpan("action.custom", j(j(j(j({}, this.config.hooks.getPageAttributes()), e), z({
|
|
2765
2765
|
errorType: "none",
|
|
2766
2766
|
spanSubtype: "custom",
|
|
2767
|
-
spanType:
|
|
2767
|
+
spanType: R.action
|
|
2768
2768
|
})), {}, {
|
|
2769
|
-
[
|
|
2770
|
-
[
|
|
2771
|
-
[
|
|
2769
|
+
[O.actionId]: n,
|
|
2770
|
+
[O.actionName]: t,
|
|
2771
|
+
[O.actionType]: "custom"
|
|
2772
2772
|
})).end();
|
|
2773
|
-
}),
|
|
2773
|
+
}), A(this, "reportCustomEvent", ({ attributes: e = {}, error: t, name: n }) => {
|
|
2774
2774
|
if (!this.isSampled() || this.config.transport.traces === !1) {
|
|
2775
2775
|
if (this.config.debug) {
|
|
2776
2776
|
var r;
|
|
@@ -2778,43 +2778,43 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2778
2778
|
}
|
|
2779
2779
|
return;
|
|
2780
2780
|
}
|
|
2781
|
-
let i = this.startSpan(`custom.${n}`,
|
|
2781
|
+
let i = this.startSpan(`custom.${n}`, j(j(j(j(j({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), z({
|
|
2782
2782
|
errorType: t ? "custom" : "none",
|
|
2783
|
-
result: t ?
|
|
2783
|
+
result: t ? L.error : L.success,
|
|
2784
2784
|
spanSubtype: n,
|
|
2785
|
-
spanType:
|
|
2785
|
+
spanType: R.custom
|
|
2786
2786
|
})), e), {}, { "rum.custom.name": n }));
|
|
2787
2787
|
t && (i.recordException(t), i.setStatus({
|
|
2788
2788
|
code: c.ERROR,
|
|
2789
2789
|
message: t.message
|
|
2790
2790
|
})), i.end();
|
|
2791
|
-
}),
|
|
2792
|
-
let n =
|
|
2793
|
-
if (
|
|
2794
|
-
let t = e[
|
|
2795
|
-
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ?
|
|
2791
|
+
}), A(this, "setRuntimeAttributes", (e, t) => {
|
|
2792
|
+
let n = j({}, e);
|
|
2793
|
+
if (O.sessionId in e) {
|
|
2794
|
+
let t = e[O.sessionId];
|
|
2795
|
+
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ? Le(this.config, t) : !1, n[N] = this.sampled;
|
|
2796
2796
|
}
|
|
2797
2797
|
this.runtimeContext.setAttributes(n, t);
|
|
2798
|
-
}),
|
|
2799
|
-
var e =
|
|
2798
|
+
}), A(this, "setTrackingConsent", function() {
|
|
2799
|
+
var e = M(function* (e) {
|
|
2800
2800
|
t.config.trackingConsent !== e && (t.config.trackingConsent = e, t.phase === "started" && (e === "granted" ? yield t.startCollection() : yield t.stopCollection(!0)));
|
|
2801
2801
|
});
|
|
2802
2802
|
return function(t) {
|
|
2803
2803
|
return e.apply(this, arguments);
|
|
2804
2804
|
};
|
|
2805
|
-
}()),
|
|
2805
|
+
}()), A(this, "setUser", (e) => {
|
|
2806
2806
|
this.runtimeContext.setUser(e);
|
|
2807
|
-
}),
|
|
2807
|
+
}), A(this, "setViewLoadingTime", () => {
|
|
2808
2808
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2809
2809
|
time: Date.now(),
|
|
2810
2810
|
type: "set_loading_time"
|
|
2811
2811
|
});
|
|
2812
|
-
}),
|
|
2812
|
+
}), A(this, "setViewName", (e) => {
|
|
2813
2813
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2814
2814
|
name: e,
|
|
2815
2815
|
type: "set_name"
|
|
2816
2816
|
});
|
|
2817
|
-
}),
|
|
2817
|
+
}), A(this, "shutdown", M(function* () {
|
|
2818
2818
|
if (t.phase !== "stopped") {
|
|
2819
2819
|
for (yield t.stopCollection(!1), yield t.flushProviders(); t.teardownCallbacks.length;) {
|
|
2820
2820
|
var e;
|
|
@@ -2822,7 +2822,7 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2822
2822
|
}
|
|
2823
2823
|
yield t.tracerProvider.shutdown(), yield t.meterProvider.shutdown(), yield t.loggerProvider.shutdown(), t.phase = "stopped";
|
|
2824
2824
|
}
|
|
2825
|
-
})),
|
|
2825
|
+
})), A(this, "start", M(function* () {
|
|
2826
2826
|
if (!(t.phase === "started" || t.phase === "starting")) {
|
|
2827
2827
|
if (t.phase === "stopped") throw Error("[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.");
|
|
2828
2828
|
if (!t.config.enabled) {
|
|
@@ -2848,38 +2848,38 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2848
2848
|
}
|
|
2849
2849
|
t.phase = "started";
|
|
2850
2850
|
}
|
|
2851
|
-
})),
|
|
2851
|
+
})), A(this, "startSpan", (e, t = {}, n) => {
|
|
2852
2852
|
var r, i;
|
|
2853
2853
|
if (!this.isSampled() || this.config.transport.traces === !1) return this.tracer.startSpan(e);
|
|
2854
2854
|
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
2855
|
return this.tracer.startSpan(e, {
|
|
2856
2856
|
kind: (i = n == null ? void 0 : n.kind) == null ? s.INTERNAL : i,
|
|
2857
2857
|
startTime: n == null ? void 0 : n.startTime,
|
|
2858
|
-
attributes: this.applyRedact(
|
|
2858
|
+
attributes: this.applyRedact(j(j({}, o), t))
|
|
2859
2859
|
});
|
|
2860
|
-
}),
|
|
2860
|
+
}), A(this, "startView", (e = {}) => {
|
|
2861
2861
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2862
2862
|
options: e,
|
|
2863
2863
|
type: "start"
|
|
2864
2864
|
});
|
|
2865
|
-
}),
|
|
2865
|
+
}), A(this, "tracer", void 0), A(this, "use", (e) => {
|
|
2866
2866
|
var t;
|
|
2867
2867
|
return this.assertBeforeStart("use"), (t = this.config.extensions.plugins) == null || t.push(e), this;
|
|
2868
|
-
}),
|
|
2868
|
+
}), A(this, "useInstrumentation", (e) => {
|
|
2869
2869
|
var t;
|
|
2870
2870
|
return this.assertBeforeStart("useInstrumentation"), this.config.enabled && ((t = this.config.extensions.instrumentations) == null || t.push(e)), this;
|
|
2871
|
-
}), this.config =
|
|
2871
|
+
}), this.config = je(e), this.runtimeContext = new ot({ [N]: !1 }, this.config.user);
|
|
2872
2872
|
let i = v(this.config.resourceAttributes), l = (() => {
|
|
2873
2873
|
if (this.config.transport.traces === !1) return [];
|
|
2874
|
-
let e =
|
|
2875
|
-
return [new
|
|
2874
|
+
let e = pi(new g(li(this.config.transport.traces)), "traces", this.config.debug);
|
|
2875
|
+
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
2876
|
})(), u = this.config.transport.metrics === !1 ? [] : [new o({
|
|
2877
|
-
exporter: new
|
|
2877
|
+
exporter: new it(pi(new h(j(j({}, li(this.config.transport.metrics)), {}, { temporalityPreference: m.DELTA })), "metrics", this.config.debug)),
|
|
2878
2878
|
exportIntervalMillis: this.config.metricIntervalMillis
|
|
2879
|
-
})], d = this.config.transport.logs === !1 ? [] : [new
|
|
2880
|
-
this.tracerProvider = new
|
|
2879
|
+
})], d = this.config.transport.logs === !1 ? [] : [new tt(new y(pi(new p(li(this.config.transport.logs)), "logs", this.config.debug)), this.config)];
|
|
2880
|
+
this.tracerProvider = new w({
|
|
2881
2881
|
resource: i,
|
|
2882
|
-
sampler: new
|
|
2882
|
+
sampler: new di(() => this.config.transport.traces !== !1 && this.isSampled()),
|
|
2883
2883
|
spanProcessors: l
|
|
2884
2884
|
}), this.meterProvider = new a({
|
|
2885
2885
|
resource: i,
|
|
@@ -2887,11 +2887,11 @@ var Ie = ["http.url", "url.full"], Le = "bk.rum.request.discard", Re = (e) => {
|
|
|
2887
2887
|
}), this.loggerProvider = new b({
|
|
2888
2888
|
resource: i,
|
|
2889
2889
|
processors: d
|
|
2890
|
-
}), this.tracer = this.tracerProvider.getTracer(
|
|
2890
|
+
}), 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
2891
|
var t;
|
|
2892
2892
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
2893
2893
|
});
|
|
2894
2894
|
}
|
|
2895
2895
|
};
|
|
2896
2896
|
//#endregion
|
|
2897
|
-
export {
|
|
2897
|
+
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 };
|