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