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