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