@blueking/open-telemetry 0.0.10 → 0.0.12
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.js +471 -471
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/skills/bk-rum-otele/SKILL.md +108 -0
- package/skills/bk-rum-otele/evals/evals.json +29 -0
- package/skills/bk-rum-otele/references/api.md +228 -0
- package/skills/bk-rum-otele/references/concepts.md +227 -0
- package/skills/bk-rum-otele/references/configuration.md +318 -0
- package/skills/bk-rum-otele/references/custom-plugin.md +158 -0
- package/skills/bk-rum-otele/references/data-model.md +122 -0
- package/skills/bk-rum-otele/references/framework-integration.md +149 -0
- package/skills/bk-rum-otele/references/getting-started.md +179 -0
- package/skills/bk-rum-otele/references/plugins.md +451 -0
- package/skills/bk-rum-otele/references/privacy.md +117 -0
- package/skills/bk-rum-otele/references/telemetry-reference.md +228 -0
- package/skills/bk-rum-otele/references/troubleshooting.md +239 -0
package/dist/index.js
CHANGED
|
@@ -9,10 +9,10 @@ import { registerInstrumentations as p } from "@opentelemetry/instrumentation";
|
|
|
9
9
|
import { resourceFromAttributes as m } from "@opentelemetry/resources";
|
|
10
10
|
import { BatchLogRecordProcessor as h, LoggerProvider as g } from "@opentelemetry/sdk-logs";
|
|
11
11
|
import { MeterProvider as _, PeriodicExportingMetricReader as v } from "@opentelemetry/sdk-metrics";
|
|
12
|
-
import { BatchSpanProcessor as y, ParentBasedSampler as
|
|
13
|
-
import { WebTracerProvider as
|
|
12
|
+
import { BatchSpanProcessor as y, ParentBasedSampler as b, SimpleSpanProcessor as ee, TraceIdRatioBasedSampler as te } from "@opentelemetry/sdk-trace-base";
|
|
13
|
+
import { WebTracerProvider as ne } from "@opentelemetry/sdk-trace-web";
|
|
14
14
|
//#region src/schema/attributes.ts
|
|
15
|
-
var
|
|
15
|
+
var x = {
|
|
16
16
|
actionType: "action.type",
|
|
17
17
|
deploymentEnvironmentName: "deployment.environment.name",
|
|
18
18
|
browserName: "browser_name",
|
|
@@ -58,36 +58,36 @@ var b = {
|
|
|
58
58
|
};
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
|
|
61
|
-
function
|
|
61
|
+
function S(e) {
|
|
62
62
|
"@babel/helpers - typeof";
|
|
63
|
-
return
|
|
63
|
+
return S = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
64
64
|
return typeof e;
|
|
65
65
|
} : function(e) {
|
|
66
66
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
67
|
-
},
|
|
67
|
+
}, S(e);
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
|
|
71
|
-
function
|
|
72
|
-
if (
|
|
71
|
+
function re(e, t) {
|
|
72
|
+
if (S(e) != "object" || !e) return e;
|
|
73
73
|
var n = e[Symbol.toPrimitive];
|
|
74
74
|
if (n !== void 0) {
|
|
75
75
|
var r = n.call(e, t || "default");
|
|
76
|
-
if (
|
|
76
|
+
if (S(r) != "object") return r;
|
|
77
77
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
78
78
|
}
|
|
79
79
|
return (t === "string" ? String : Number)(e);
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
|
|
83
|
-
function
|
|
84
|
-
var t =
|
|
85
|
-
return
|
|
83
|
+
function C(e) {
|
|
84
|
+
var t = re(e, "string");
|
|
85
|
+
return S(t) == "symbol" ? t : t + "";
|
|
86
86
|
}
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
|
|
89
|
-
function
|
|
90
|
-
return (t =
|
|
89
|
+
function w(e, t, n) {
|
|
90
|
+
return (t = C(t)) in e ? Object.defineProperty(e, t, {
|
|
91
91
|
value: n,
|
|
92
92
|
enumerable: !0,
|
|
93
93
|
configurable: !0,
|
|
@@ -96,7 +96,7 @@ function C(e, t, n) {
|
|
|
96
96
|
}
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectSpread2.js
|
|
99
|
-
function
|
|
99
|
+
function T(e, t) {
|
|
100
100
|
var n = Object.keys(e);
|
|
101
101
|
if (Object.getOwnPropertySymbols) {
|
|
102
102
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -106,12 +106,12 @@ function w(e, t) {
|
|
|
106
106
|
}
|
|
107
107
|
return n;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function E(e) {
|
|
110
110
|
for (var t = 1; t < arguments.length; t++) {
|
|
111
111
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
112
|
-
t % 2 ?
|
|
113
|
-
|
|
114
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
112
|
+
t % 2 ? T(Object(n), !0).forEach(function(t) {
|
|
113
|
+
w(e, t, n[t]);
|
|
114
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : T(Object(n)).forEach(function(t) {
|
|
115
115
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
116
116
|
});
|
|
117
117
|
}
|
|
@@ -119,41 +119,41 @@ function T(e) {
|
|
|
119
119
|
}
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/core/config.ts
|
|
122
|
-
var
|
|
123
|
-
let n =
|
|
122
|
+
var D = "http://localhost:4318", ie = 60 * 1e3, ae = "unknown_service", O = (e) => e.replace(/\/+$/, ""), oe = (e, t) => {
|
|
123
|
+
let n = O(e || D);
|
|
124
124
|
return n.endsWith(`/v1/${t}`) ? n : n.endsWith("/v1") ? `${n}/${t}` : `${n}/v1/${t}`;
|
|
125
|
-
},
|
|
125
|
+
}, k = (e, t) => {
|
|
126
126
|
var n, r, i, a, o;
|
|
127
|
-
let s = e == null || (n = e.signals) == null ? void 0 : n[t], c = e == null || (r = e.signals) == null || (r = r.endpoints) == null ? void 0 : r[t], l = e != null && e.token || e != null && e.headers || s != null && s.headers ?
|
|
127
|
+
let s = e == null || (n = e.signals) == null ? void 0 : n[t], c = e == null || (r = e.signals) == null || (r = r.endpoints) == null ? void 0 : r[t], l = e != null && e.token || e != null && e.headers || s != null && s.headers ? E(E(E({}, e != null && e.token ? { Authorization: `Bearer ${e.token}` } : {}), (i = e == null ? void 0 : e.headers) == null ? {} : i), (a = s == null ? void 0 : s.headers) == null ? {} : a) : void 0;
|
|
128
128
|
return {
|
|
129
129
|
concurrencyLimit: s == null ? void 0 : s.concurrencyLimit,
|
|
130
|
-
endpoint: c ?
|
|
130
|
+
endpoint: c ? O(c) : oe((o = s == null ? void 0 : s.endpoint) == null ? e == null ? void 0 : e.endpoint : o, t),
|
|
131
131
|
headers: l,
|
|
132
132
|
timeoutMillis: s == null ? void 0 : s.timeoutMillis
|
|
133
133
|
};
|
|
134
|
-
},
|
|
134
|
+
}, se = (e) => typeof e != "number" || !Number.isFinite(e) ? 1 : Math.max(0, Math.min(1, e)), ce = (e) => e, le = (e) => e, ue = (e) => {
|
|
135
135
|
try {
|
|
136
136
|
return new URL(e, typeof location > "u" ? "http://localhost" : location.href).pathname || "/";
|
|
137
137
|
} catch (t) {
|
|
138
138
|
return e || "/";
|
|
139
139
|
}
|
|
140
|
-
},
|
|
140
|
+
}, de = (e) => {
|
|
141
141
|
var t, n;
|
|
142
142
|
return {
|
|
143
143
|
environment: (t = e == null ? void 0 : e.environment) == null ? "production" : t,
|
|
144
|
-
name: (n = e == null ? void 0 : e.name) == null ?
|
|
144
|
+
name: (n = e == null ? void 0 : e.name) == null ? ae : n,
|
|
145
145
|
version: e == null ? void 0 : e.version
|
|
146
146
|
};
|
|
147
|
-
},
|
|
148
|
-
[
|
|
147
|
+
}, fe = (e) => E(E({
|
|
148
|
+
[x.deploymentEnvironmentName]: e.environment,
|
|
149
149
|
"rum.provider": "blueking",
|
|
150
|
-
[
|
|
151
|
-
}, e.version ? { [
|
|
152
|
-
endpoint:
|
|
153
|
-
traces:
|
|
154
|
-
metrics:
|
|
155
|
-
logs:
|
|
156
|
-
}),
|
|
150
|
+
[x.serviceName]: e.name
|
|
151
|
+
}, e.version ? { [x.serviceVersion]: e.version } : {}), {}, { "telemetry.sdk.language": "webjs" }), pe = (e) => ({
|
|
152
|
+
endpoint: O((e == null ? void 0 : e.endpoint) || D),
|
|
153
|
+
traces: k(e, "traces"),
|
|
154
|
+
metrics: k(e, "metrics"),
|
|
155
|
+
logs: k(e, "logs")
|
|
156
|
+
}), me = (e) => ({ rate: se(e == null ? void 0 : e.rate) }), he = (e) => {
|
|
157
157
|
var t, n, r, i, a, o, s, c, l, u, d, f;
|
|
158
158
|
return {
|
|
159
159
|
getPageAttributes: (t = (n = e.attributes) == null ? void 0 : n.page) == null ? (() => ({
|
|
@@ -165,34 +165,34 @@ var E = "http://localhost:4318", ae = 60 * 1e3, oe = "unknown_service", D = (e)
|
|
|
165
165
|
getCustomAttributes: (s = (c = e.attributes) == null ? void 0 : c.custom) == null ? (() => ({})) : s,
|
|
166
166
|
getViewPathGroup: (t) => {
|
|
167
167
|
var n, r, i;
|
|
168
|
-
return (n = (r = e.route) == null || (i = r.getPathGroup) == null ? void 0 : i.call(r, t)) == null ?
|
|
168
|
+
return (n = (r = e.route) == null || (i = r.getPathGroup) == null ? void 0 : i.call(r, t)) == null ? ue(t) : n;
|
|
169
169
|
},
|
|
170
|
-
redactAttributes: (l = (u = e.privacy) == null ? void 0 : u.redactAttributes) == null ?
|
|
171
|
-
redactUrl: (d = (f = e.privacy) == null ? void 0 : f.redactUrl) == null ?
|
|
170
|
+
redactAttributes: (l = (u = e.privacy) == null ? void 0 : u.redactAttributes) == null ? ce : l,
|
|
171
|
+
redactUrl: (d = (f = e.privacy) == null ? void 0 : f.redactUrl) == null ? le : d
|
|
172
172
|
};
|
|
173
|
-
},
|
|
173
|
+
}, ge = (e) => {
|
|
174
174
|
var t, n, r, i, a, o;
|
|
175
|
-
let s =
|
|
175
|
+
let s = de(e.app);
|
|
176
176
|
return {
|
|
177
177
|
app: s,
|
|
178
178
|
autoStart: (t = e.autoStart) == null ? !0 : t,
|
|
179
179
|
debug: (n = e.debug) == null ? !1 : n,
|
|
180
180
|
enabled: (r = e.enabled) == null ? !0 : r,
|
|
181
|
-
hooks:
|
|
181
|
+
hooks: he(e),
|
|
182
182
|
instrumentations: (i = e.instrumentations) == null ? {} : i,
|
|
183
|
-
metricIntervalMillis:
|
|
183
|
+
metricIntervalMillis: ie,
|
|
184
184
|
plugins: (a = e.plugins) == null ? {} : a,
|
|
185
|
-
resourceAttributes:
|
|
186
|
-
sampling:
|
|
185
|
+
resourceAttributes: fe(s),
|
|
186
|
+
sampling: me(e.sampling),
|
|
187
187
|
spanBatch: e.spanBatch,
|
|
188
188
|
spanProcessor: (o = e.spanProcessor) == null ? "batch" : o,
|
|
189
|
-
transport:
|
|
189
|
+
transport: pe(e.transport),
|
|
190
190
|
user: e.user
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region \0@oxc-project+runtime@0.128.0/helpers/asyncToGenerator.js
|
|
195
|
-
function
|
|
195
|
+
function _e(e, t, n, r, i, a, o) {
|
|
196
196
|
try {
|
|
197
197
|
var s = e[a](o), c = s.value;
|
|
198
198
|
} catch (e) {
|
|
@@ -201,16 +201,16 @@ function ve(e, t, n, r, i, a, o) {
|
|
|
201
201
|
}
|
|
202
202
|
s.done ? t(c) : Promise.resolve(c).then(r, i);
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function A(e) {
|
|
205
205
|
return function() {
|
|
206
206
|
var t = this, n = arguments;
|
|
207
207
|
return new Promise(function(r, i) {
|
|
208
208
|
var a = e.apply(t, n);
|
|
209
209
|
function o(e) {
|
|
210
|
-
|
|
210
|
+
_e(a, r, i, o, s, "next", e);
|
|
211
211
|
}
|
|
212
212
|
function s(e) {
|
|
213
|
-
|
|
213
|
+
_e(a, r, i, o, s, "throw", e);
|
|
214
214
|
}
|
|
215
215
|
o(void 0);
|
|
216
216
|
});
|
|
@@ -218,13 +218,13 @@ function k(e) {
|
|
|
218
218
|
}
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region src/core/plugin.ts
|
|
221
|
-
var
|
|
221
|
+
var ve = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !== !1, ye = (e) => e, be = class {
|
|
222
222
|
constructor(e) {
|
|
223
|
-
|
|
223
|
+
w(this, "plugins", void 0), w(this, "startedPlugins", []), this.plugins = e;
|
|
224
224
|
}
|
|
225
225
|
flush() {
|
|
226
226
|
var e = this;
|
|
227
|
-
return
|
|
227
|
+
return A(function* () {
|
|
228
228
|
yield Promise.all(e.startedPlugins.map((e) => Promise.resolve().then(() => {
|
|
229
229
|
var t;
|
|
230
230
|
return (t = e.flush) == null ? void 0 : t.call(e);
|
|
@@ -233,7 +233,7 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
233
233
|
}
|
|
234
234
|
shutdown() {
|
|
235
235
|
var e = this;
|
|
236
|
-
return
|
|
236
|
+
return A(function* () {
|
|
237
237
|
let t = [...e.startedPlugins].reverse();
|
|
238
238
|
for (let e of t) {
|
|
239
239
|
var n;
|
|
@@ -244,8 +244,8 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
244
244
|
}
|
|
245
245
|
start(e) {
|
|
246
246
|
var t = this;
|
|
247
|
-
return
|
|
248
|
-
for (let r of t.plugins) if (
|
|
247
|
+
return A(function* () {
|
|
248
|
+
for (let r of t.plugins) if (ve(r, e.config)) try {
|
|
249
249
|
yield r.init(e), t.startedPlugins.push(r);
|
|
250
250
|
} catch (t) {
|
|
251
251
|
if (e.config.debug) {
|
|
@@ -255,39 +255,39 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
255
255
|
}
|
|
256
256
|
})();
|
|
257
257
|
}
|
|
258
|
-
},
|
|
258
|
+
}, j = () => typeof window > "u" ? "http://localhost" : window.location.origin, xe = (e) => {
|
|
259
259
|
try {
|
|
260
|
-
return new URL(e,
|
|
260
|
+
return new URL(e, j()).href;
|
|
261
261
|
} catch (t) {
|
|
262
262
|
return e;
|
|
263
263
|
}
|
|
264
|
-
},
|
|
265
|
-
let n = (e) =>
|
|
264
|
+
}, Se = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Ce = (e, t) => {
|
|
265
|
+
let n = (e) => Se(e.replace(/[?#].*$/, ""));
|
|
266
266
|
return n(e) === n(t);
|
|
267
|
-
},
|
|
267
|
+
}, we = (e) => {
|
|
268
268
|
try {
|
|
269
|
-
return new URL(e,
|
|
269
|
+
return new URL(e, j()).origin === j();
|
|
270
270
|
} catch (e) {
|
|
271
271
|
return !1;
|
|
272
272
|
}
|
|
273
|
-
},
|
|
274
|
-
let n =
|
|
273
|
+
}, Te = (e, t) => {
|
|
274
|
+
let n = xe(t);
|
|
275
275
|
return [
|
|
276
276
|
e.transport.traces.endpoint,
|
|
277
277
|
e.transport.metrics.endpoint,
|
|
278
278
|
e.transport.logs.endpoint
|
|
279
|
-
].some((e) =>
|
|
280
|
-
},
|
|
281
|
-
if (
|
|
279
|
+
].some((e) => Ce(n, xe(e)));
|
|
280
|
+
}, M = (e, t) => Te(e, t), Ee = (e, t) => e === "all" ? !0 : typeof e == "function" ? e(t) : (Array.isArray(e) ? e : [e]).some((e) => typeof e == "string" ? t.includes(e) : e.test(t)), De = (e, t) => {
|
|
281
|
+
if (we(t)) return !0;
|
|
282
282
|
let n = e.instrumentations.propagateTraceHeaderUrls;
|
|
283
|
-
return n ?
|
|
284
|
-
},
|
|
285
|
-
for (let n of
|
|
283
|
+
return n ? Ee(n, xe(t)) : !1;
|
|
284
|
+
}, Oe = ["http.url", "url.full"], ke = (e) => {
|
|
285
|
+
for (let n of Oe) {
|
|
286
286
|
var t;
|
|
287
287
|
let r = (t = e.attributes) == null ? void 0 : t[n];
|
|
288
288
|
if (typeof r == "string") return r;
|
|
289
289
|
}
|
|
290
|
-
},
|
|
290
|
+
}, Ae = class {
|
|
291
291
|
constructor(e, t) {
|
|
292
292
|
this.inner = e, this.config = t;
|
|
293
293
|
}
|
|
@@ -295,8 +295,8 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
295
295
|
return this.inner.forceFlush();
|
|
296
296
|
}
|
|
297
297
|
onEnd(e) {
|
|
298
|
-
let t =
|
|
299
|
-
t &&
|
|
298
|
+
let t = ke(e);
|
|
299
|
+
t && Te(this.config, t) || this.inner.onEnd(e);
|
|
300
300
|
}
|
|
301
301
|
onStart(e, t) {
|
|
302
302
|
this.inner.onStart(e, t);
|
|
@@ -304,15 +304,15 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
304
304
|
shutdown() {
|
|
305
305
|
return this.inner.shutdown();
|
|
306
306
|
}
|
|
307
|
-
},
|
|
307
|
+
}, je = class {
|
|
308
308
|
constructor(e = {}, t) {
|
|
309
|
-
|
|
309
|
+
w(this, "attributes", {}), w(this, "setOptionalAttribute", (e, t) => {
|
|
310
310
|
if (t === void 0) {
|
|
311
311
|
delete this.attributes[e];
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
314
|
this.attributes[e] = t;
|
|
315
|
-
}),
|
|
315
|
+
}), w(this, "user", {}), w(this, "view", {}), w(this, "getAttributes", () => E({}, this.attributes)), w(this, "getUser", () => E({}, this.user)), w(this, "getView", () => E({}, this.view)), w(this, "setAttributes", (e) => {
|
|
316
316
|
for (let [t, n] of Object.entries(e)) {
|
|
317
317
|
if (n === void 0) {
|
|
318
318
|
delete this.attributes[t];
|
|
@@ -320,25 +320,25 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
320
320
|
}
|
|
321
321
|
this.attributes[t] = n;
|
|
322
322
|
}
|
|
323
|
-
}),
|
|
324
|
-
if (this.user =
|
|
323
|
+
}), w(this, "setUser", (e) => {
|
|
324
|
+
if (this.user = E(E({}, this.user), e), "id" in e) {
|
|
325
325
|
if (e.id === void 0) {
|
|
326
|
-
delete this.attributes[
|
|
326
|
+
delete this.attributes[x.userId];
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
|
-
this.attributes[
|
|
329
|
+
this.attributes[x.userId] = e.id;
|
|
330
330
|
}
|
|
331
|
-
}),
|
|
332
|
-
this.view =
|
|
331
|
+
}), w(this, "setView", (e) => {
|
|
332
|
+
this.view = E(E({}, this.view), e), this.setOptionalAttribute(x.viewId, e.id), this.setOptionalAttribute(x.viewUrl, e.url), this.setOptionalAttribute(x.viewUrlPathGroup, e.urlPathGroup), this.setOptionalAttribute(x.viewLoadingType, e.loadingType);
|
|
333
333
|
}), this.setAttributes(e), t && this.setUser(t);
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, N = {
|
|
336
336
|
abort: "abort",
|
|
337
337
|
error: "error",
|
|
338
338
|
success: "success",
|
|
339
339
|
timeout: "timeout",
|
|
340
340
|
warning: "warning"
|
|
341
|
-
},
|
|
341
|
+
}, P = {
|
|
342
342
|
action: "action",
|
|
343
343
|
custom: "custom",
|
|
344
344
|
document: "document",
|
|
@@ -348,7 +348,7 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
348
348
|
resource: "resource",
|
|
349
349
|
route: "route",
|
|
350
350
|
vital: "vital"
|
|
351
|
-
},
|
|
351
|
+
}, Me = (e) => e < 100 ? "<100ms" : e < 500 ? "100~500ms" : e < 2e3 ? "500ms~2s" : ">2s", Ne = (e) => `${Math.trunc(e / 100)}xx`, Pe = (e) => e === 408 || e === 504 ? N.timeout : typeof e == "number" && e >= 400 ? N.error : N.success, Fe = (e) => e === 408 || e === 504 ? "network_timeout" : typeof e != "number" || e < 400 ? "none" : e >= 500 ? "http_5xx" : "http_4xx", Ie = (e) => e === "good" ? N.success : N.warning, Le = (e, t) => {
|
|
352
352
|
if (!e) return {};
|
|
353
353
|
try {
|
|
354
354
|
let n = new URL(e, typeof location > "u" ? "http://localhost" : location.href), r = t == null ? n.pathname : t;
|
|
@@ -363,54 +363,54 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
363
363
|
pathTemplate: t == null ? e : t
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
},
|
|
367
|
-
[
|
|
368
|
-
[
|
|
369
|
-
[
|
|
370
|
-
[
|
|
371
|
-
}, e === void 0 ? {} : { [
|
|
372
|
-
let o =
|
|
373
|
-
return
|
|
366
|
+
}, F = ({ duration: e, errorType: t = "none", eventLabel: n, result: r = N.success, spanSubtype: i, spanType: a, targetLabel: o, targetValue: s, traceScene: c }) => E(E(E(E(E({
|
|
367
|
+
[x.spanType]: a,
|
|
368
|
+
[x.spanSubtype]: i,
|
|
369
|
+
[x.result]: r,
|
|
370
|
+
[x.errorType]: t
|
|
371
|
+
}, e === void 0 ? {} : { [x.durationBucket]: Me(e) }), n === void 0 ? {} : { [x.eventLabel]: n }), o === void 0 ? {} : { [x.targetLabel]: o }), s === void 0 ? {} : { [x.targetValue]: s }), c === void 0 ? {} : { [x.traceScene]: c }), Re = ({ duration: e, method: t, statusCode: n, subtype: r, url: i, urlPathTemplate: a }) => {
|
|
372
|
+
let o = Le(i, a);
|
|
373
|
+
return E(E(E(E(E({}, F({
|
|
374
374
|
duration: e,
|
|
375
|
-
errorType:
|
|
375
|
+
errorType: Fe(n),
|
|
376
376
|
eventLabel: "API 调用",
|
|
377
|
-
result:
|
|
377
|
+
result: Pe(n),
|
|
378
378
|
spanSubtype: r,
|
|
379
|
-
spanType:
|
|
379
|
+
spanType: P.http,
|
|
380
380
|
targetLabel: o.label,
|
|
381
381
|
targetValue: n
|
|
382
|
-
})), t ? { "http.request.method": t.toUpperCase() } : {}), o.domain ? { [
|
|
382
|
+
})), t ? { "http.request.method": t.toUpperCase() } : {}), o.domain ? { [x.targetDomain]: o.domain } : {}), o.pathTemplate ? { [x.targetPathTemplate]: o.pathTemplate } : {}), typeof n == "number" ? {
|
|
383
383
|
"http.response.status_code": n,
|
|
384
|
-
[
|
|
384
|
+
[x.statusClass]: Ne(n)
|
|
385
385
|
} : {});
|
|
386
|
-
},
|
|
386
|
+
}, ze = ({ duration: e, initiatorType: t = "other", responseStatus: n, transferSize: r, url: i, urlPathTemplate: a }) => {
|
|
387
387
|
var o;
|
|
388
|
-
let s =
|
|
389
|
-
return
|
|
388
|
+
let s = Le(i, a), c = typeof n == "number" ? Pe(n) : N.success;
|
|
389
|
+
return E(E(E(E({}, F({
|
|
390
390
|
duration: e,
|
|
391
|
-
errorType: typeof n == "number" ?
|
|
391
|
+
errorType: typeof n == "number" ? Fe(n) : "none",
|
|
392
392
|
eventLabel: "静态资源",
|
|
393
393
|
result: c,
|
|
394
394
|
spanSubtype: t,
|
|
395
|
-
spanType:
|
|
395
|
+
spanType: P.resource,
|
|
396
396
|
targetLabel: (o = s.label) == null ? i : o,
|
|
397
397
|
targetValue: r
|
|
398
|
-
})), s.domain ? { [
|
|
398
|
+
})), s.domain ? { [x.targetDomain]: s.domain } : {}), s.pathTemplate ? { [x.targetPathTemplate]: s.pathTemplate } : {}), typeof n == "number" ? {
|
|
399
399
|
"http.response.status_code": n,
|
|
400
|
-
[
|
|
400
|
+
[x.statusClass]: Ne(n)
|
|
401
401
|
} : {});
|
|
402
|
-
},
|
|
402
|
+
}, Be = [
|
|
403
403
|
"click",
|
|
404
404
|
"submit",
|
|
405
405
|
"keydown"
|
|
406
|
-
],
|
|
406
|
+
], Ve = (e) => e instanceof Element ? e : void 0, He = (e) => {
|
|
407
407
|
var t;
|
|
408
408
|
if (!e) return;
|
|
409
409
|
let n = ((t = e.textContent) == null ? void 0 : t.trim()) || e.getAttribute("aria-label") || e.getAttribute("title") || "";
|
|
410
410
|
return n ? n.slice(0, 32) : void 0;
|
|
411
|
-
},
|
|
411
|
+
}, Ue = (e = {}) => {
|
|
412
412
|
var t;
|
|
413
|
-
let n = [], r = (t = e.eventNames) == null ?
|
|
413
|
+
let n = [], r = (t = e.eventNames) == null ? Be : t;
|
|
414
414
|
return {
|
|
415
415
|
name: "action",
|
|
416
416
|
init(e) {
|
|
@@ -420,14 +420,14 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
420
420
|
passive: !0
|
|
421
421
|
}, i = (t) => {
|
|
422
422
|
var n;
|
|
423
|
-
let r =
|
|
424
|
-
e.startSpan(`action.${t.type}`,
|
|
423
|
+
let r = Ve(t.target), i = He(r), a = r == null ? void 0 : r.tagName.toLowerCase();
|
|
424
|
+
e.startSpan(`action.${t.type}`, E(E(E(E({}, e.config.hooks.getPageAttributes()), F({
|
|
425
425
|
errorType: "none",
|
|
426
426
|
eventLabel: "用户操作",
|
|
427
427
|
spanSubtype: t.type,
|
|
428
|
-
spanType:
|
|
428
|
+
spanType: P.action,
|
|
429
429
|
targetLabel: (n = i == null ? a : i) == null ? t.type : n
|
|
430
|
-
})), {}, { [
|
|
430
|
+
})), {}, { [x.actionType]: t.type }, i ? { [x.targetTextShort]: i } : {}), a ? { [x.targetTag]: a } : {})).end();
|
|
431
431
|
};
|
|
432
432
|
for (let e of r) window.addEventListener(e, i, t), n.push(() => window.removeEventListener(e, i, t));
|
|
433
433
|
},
|
|
@@ -441,7 +441,7 @@ var ye = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
441
441
|
};
|
|
442
442
|
//#endregion
|
|
443
443
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
444
|
-
function
|
|
444
|
+
function We(e, t) {
|
|
445
445
|
if (e == null) return {};
|
|
446
446
|
var n = {};
|
|
447
447
|
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
@@ -452,9 +452,9 @@ function Ke(e, t) {
|
|
|
452
452
|
}
|
|
453
453
|
//#endregion
|
|
454
454
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
455
|
-
function
|
|
455
|
+
function Ge(e, t) {
|
|
456
456
|
if (e == null) return {};
|
|
457
|
-
var n, r, i =
|
|
457
|
+
var n, r, i = We(e, t);
|
|
458
458
|
if (Object.getOwnPropertySymbols) {
|
|
459
459
|
var a = Object.getOwnPropertySymbols(e);
|
|
460
460
|
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
@@ -463,14 +463,14 @@ function qe(e, t) {
|
|
|
463
463
|
}
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/core/telemetry-attributes.ts
|
|
466
|
-
var
|
|
467
|
-
let t =
|
|
468
|
-
return t ? { [
|
|
469
|
-
},
|
|
466
|
+
var Ke = (e) => typeof e == "string" && e.length > 0 ? e : void 0, qe = (e) => {
|
|
467
|
+
let t = Ke(e);
|
|
468
|
+
return t ? { [x.viewUrlPathGroup]: t } : {};
|
|
469
|
+
}, I = (e) => qe(e[x.viewUrlPathGroup]), L = (e, t) => {
|
|
470
470
|
var n;
|
|
471
|
-
let r =
|
|
472
|
-
return
|
|
473
|
-
},
|
|
471
|
+
let r = x.viewUrlPathGroup, { [r]: i } = e;
|
|
472
|
+
return E(E({}, Ge(e, [r].map(C))), qe((n = Ke(i)) == null ? t : n));
|
|
473
|
+
}, Je = "body", Ye = 3e3, Xe = .8, Ze = [
|
|
474
474
|
"[data-loading=\"true\"]",
|
|
475
475
|
"[aria-busy=\"true\"]",
|
|
476
476
|
".loading",
|
|
@@ -478,61 +478,61 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
478
478
|
".spinner",
|
|
479
479
|
".skeleton",
|
|
480
480
|
".bk-loading"
|
|
481
|
-
],
|
|
481
|
+
], R = [
|
|
482
482
|
[.5, .5],
|
|
483
483
|
[.25, .25],
|
|
484
484
|
[.75, .25],
|
|
485
485
|
[.25, .75],
|
|
486
486
|
[.75, .75]
|
|
487
|
-
],
|
|
487
|
+
], Qe = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, $e = (e, t) => typeof e != "number" || !Number.isFinite(e) ? t : Math.max(0, Math.min(1, e)), et = (e) => {
|
|
488
488
|
if (!e) return "";
|
|
489
489
|
let t = e.tagName.toLowerCase();
|
|
490
490
|
return e.id ? `${t}#${e.id}` : t;
|
|
491
|
-
},
|
|
491
|
+
}, tt = (e, t) => e ? t.some((t) => {
|
|
492
492
|
try {
|
|
493
493
|
return e.matches(t) || !!e.closest(t);
|
|
494
494
|
} catch (e) {
|
|
495
495
|
return !1;
|
|
496
496
|
}
|
|
497
|
-
}) : !1,
|
|
497
|
+
}) : !1, nt = (e) => {
|
|
498
498
|
if (typeof document > "u") return () => {};
|
|
499
499
|
if (document.readyState === "complete" || document.readyState === "interactive") return e(), () => {};
|
|
500
500
|
let t = () => {
|
|
501
501
|
document.removeEventListener("DOMContentLoaded", t), e();
|
|
502
502
|
};
|
|
503
503
|
return document.addEventListener("DOMContentLoaded", t), () => document.removeEventListener("DOMContentLoaded", t);
|
|
504
|
-
},
|
|
504
|
+
}, rt = (e = {}) => {
|
|
505
505
|
var t, n;
|
|
506
506
|
let r, i, a = !1, o = {
|
|
507
|
-
checkDelay:
|
|
507
|
+
checkDelay: Qe(e.checkDelay, Ye),
|
|
508
508
|
ignoreSelectors: (t = e.ignoreSelectors) == null ? [] : t,
|
|
509
|
-
rootSelector: (n = e.rootSelector) == null ?
|
|
510
|
-
threshold:
|
|
509
|
+
rootSelector: (n = e.rootSelector) == null ? Je : n,
|
|
510
|
+
threshold: $e(e.threshold, Xe)
|
|
511
511
|
};
|
|
512
512
|
return {
|
|
513
513
|
name: "blank-screen",
|
|
514
514
|
init(e) {
|
|
515
515
|
if (typeof window > "u" || typeof document > "u") return;
|
|
516
|
-
let { checkDelay: t, rootSelector: n, threshold: s } = o, c = [
|
|
516
|
+
let { checkDelay: t, rootSelector: n, threshold: s } = o, c = [...Ze, ...o.ignoreSelectors], l = e.meter.createCounter("browser.blank_screen.count", { description: "Number of suspected blank screen detections" }), u = () => {
|
|
517
517
|
try {
|
|
518
518
|
var t, r;
|
|
519
519
|
let i = document.querySelector(n), a = 0, o = 0;
|
|
520
|
-
for (let [e, t] of
|
|
520
|
+
for (let [e, t] of R) {
|
|
521
521
|
let n = document.elementFromPoint(window.innerWidth * e, window.innerHeight * t);
|
|
522
|
-
if (
|
|
522
|
+
if (tt(n, c)) {
|
|
523
523
|
o += 1;
|
|
524
524
|
continue;
|
|
525
525
|
}
|
|
526
526
|
(n === i || n === document.body || n === document.documentElement) && (a += 1);
|
|
527
527
|
}
|
|
528
|
-
let u =
|
|
528
|
+
let u = R.length - o;
|
|
529
529
|
if (u === 0) return;
|
|
530
|
-
let d = a / u, f = d >= s, p =
|
|
530
|
+
let d = a / u, f = d >= s, p = et(document.elementFromPoint(window.innerWidth / 2, window.innerHeight / 2)), m = E(E({}, F({
|
|
531
531
|
errorType: f ? "blank_screen" : "none",
|
|
532
532
|
eventLabel: "白屏",
|
|
533
|
-
result: f ?
|
|
533
|
+
result: f ? N.error : N.success,
|
|
534
534
|
spanSubtype: "blank_screen",
|
|
535
|
-
spanType:
|
|
535
|
+
spanType: P.error,
|
|
536
536
|
targetLabel: n,
|
|
537
537
|
targetValue: d
|
|
538
538
|
})), {}, {
|
|
@@ -540,13 +540,13 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
540
540
|
"blank_screen.threshold": s,
|
|
541
541
|
"blank_screen.root": n,
|
|
542
542
|
"blank_screen.detected": f,
|
|
543
|
-
"blank_screen.sample_total":
|
|
543
|
+
"blank_screen.sample_total": R.length,
|
|
544
544
|
"blank_screen.sample_valid": u,
|
|
545
545
|
"blank_screen.sample_loading": o,
|
|
546
546
|
"blank_screen.center_element": p,
|
|
547
547
|
"blank_screen.dom_node_count": (t = (r = document.body) == null ? void 0 : r.getElementsByTagName("*").length) == null ? 0 : t
|
|
548
548
|
});
|
|
549
|
-
f && (l.add(1, e.applyRedact(
|
|
549
|
+
f && (l.add(1, e.applyRedact(E(E(E({}, e.config.hooks.getMetricAttributes()), I(e.getRuntimeAttributes())), {}, { "blank_screen.root": n }))), e.startSpan("browser.blank_screen", m).end());
|
|
550
550
|
} catch (t) {
|
|
551
551
|
if (e.config.debug) {
|
|
552
552
|
var i;
|
|
@@ -554,7 +554,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
|
-
i =
|
|
557
|
+
i = nt(() => {
|
|
558
558
|
a || (r = window.setTimeout(u, t));
|
|
559
559
|
});
|
|
560
560
|
},
|
|
@@ -562,11 +562,11 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
562
562
|
a = !0, i == null || i(), i = void 0, r !== void 0 && typeof window < "u" && (window.clearTimeout(r), r = void 0);
|
|
563
563
|
}
|
|
564
564
|
};
|
|
565
|
-
},
|
|
565
|
+
}, it = ["http.url", "url.full"], at = ["http.status_code", "http.response.status_code"], ot = ["http.method", "http.request.method"], st = (e) => ({ test: e }), z = (e) => typeof location > "u" ? void 0 : e.config.hooks.getViewPathGroup(location.href), ct = (e, t, n) => {
|
|
566
566
|
var r;
|
|
567
|
-
t.setAttributes(e.applyRedact(
|
|
567
|
+
t.setAttributes(e.applyRedact(E(E({}, L(e.getRuntimeAttributes(), z(e))), e.config.hooks.getPageAttributes())));
|
|
568
568
|
let i;
|
|
569
|
-
for (let n of
|
|
569
|
+
for (let n of it) {
|
|
570
570
|
var a;
|
|
571
571
|
let r = (a = t.attributes) == null ? void 0 : a[n];
|
|
572
572
|
if (typeof r == "string") {
|
|
@@ -574,36 +574,36 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
574
574
|
typeof a == "string" && (i = a, t.setAttribute(n, a));
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
|
-
let o =
|
|
577
|
+
let o = at.map((e) => {
|
|
578
578
|
var n;
|
|
579
579
|
return (n = t.attributes) == null ? void 0 : n[e];
|
|
580
|
-
}).find((e) => typeof e == "number"), s =
|
|
580
|
+
}).find((e) => typeof e == "number"), s = ot.map((e) => {
|
|
581
581
|
var n;
|
|
582
582
|
return (n = t.attributes) == null ? void 0 : n[e];
|
|
583
|
-
}).find((e) => typeof e == "string"), c = (r = i) == null ?
|
|
583
|
+
}).find((e) => typeof e == "string"), c = (r = i) == null ? it.map((e) => {
|
|
584
584
|
var n;
|
|
585
585
|
return (n = t.attributes) == null ? void 0 : n[e];
|
|
586
586
|
}).find((e) => typeof e == "string") : r;
|
|
587
|
-
t.setAttributes(e.applyRedact(
|
|
587
|
+
t.setAttributes(e.applyRedact(Re({
|
|
588
588
|
method: s,
|
|
589
589
|
statusCode: o,
|
|
590
590
|
subtype: n,
|
|
591
591
|
url: c,
|
|
592
592
|
urlPathTemplate: c ? e.config.hooks.getViewPathGroup(c) : void 0
|
|
593
593
|
})));
|
|
594
|
-
},
|
|
595
|
-
let r =
|
|
596
|
-
t.setAttributes(e.applyRedact(
|
|
594
|
+
}, lt = (e, t, n) => {
|
|
595
|
+
let r = z(e);
|
|
596
|
+
t.setAttributes(e.applyRedact(E(E(E({}, L(e.getRuntimeAttributes(), r)), e.config.hooks.getPageAttributes()), F({
|
|
597
597
|
errorType: "none",
|
|
598
598
|
eventLabel: "文档加载",
|
|
599
599
|
spanSubtype: n,
|
|
600
|
-
spanType:
|
|
600
|
+
spanType: P.document,
|
|
601
601
|
targetLabel: r,
|
|
602
602
|
traceScene: "page_load"
|
|
603
603
|
}))));
|
|
604
|
-
},
|
|
604
|
+
}, ut = (e, t, n) => {
|
|
605
605
|
let r = e.config.hooks.redactUrl(n.name);
|
|
606
|
-
t.setAttributes(e.applyRedact(
|
|
606
|
+
t.setAttributes(e.applyRedact(E(E(E(E({}, L(e.getRuntimeAttributes(), z(e))), e.config.hooks.getPageAttributes()), ze({
|
|
607
607
|
duration: n.duration,
|
|
608
608
|
initiatorType: n.initiatorType || "other",
|
|
609
609
|
responseStatus: n.responseStatus,
|
|
@@ -611,7 +611,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
611
611
|
url: r,
|
|
612
612
|
urlPathTemplate: e.config.hooks.getViewPathGroup(n.name)
|
|
613
613
|
})), {}, { "url.full": r })));
|
|
614
|
-
},
|
|
614
|
+
}, dt = (e = {}) => {
|
|
615
615
|
var t, n, r, i;
|
|
616
616
|
let a = [], o = {
|
|
617
617
|
documentLoad: (t = e.documentLoad) == null ? !0 : t,
|
|
@@ -623,8 +623,8 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
623
623
|
name: "official-instrumentations",
|
|
624
624
|
enabled: !!(o.documentLoad || o.fetch || o.xhr || o.userInteraction),
|
|
625
625
|
init(e) {
|
|
626
|
-
return
|
|
627
|
-
let t = [
|
|
626
|
+
return A(function* () {
|
|
627
|
+
let t = [st((t) => M(e.config, t))], n = [st((t) => De(e.config, t))], [r, i, s, c] = yield Promise.all([
|
|
628
628
|
o.documentLoad ? import("@opentelemetry/instrumentation-document-load") : Promise.resolve(null),
|
|
629
629
|
o.fetch ? import("@opentelemetry/instrumentation-fetch") : Promise.resolve(null),
|
|
630
630
|
o.xhr ? import("@opentelemetry/instrumentation-xml-http-request") : Promise.resolve(null),
|
|
@@ -633,18 +633,18 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
633
633
|
if (r && a.push(new r.DocumentLoadInstrumentation({
|
|
634
634
|
semconvStabilityOptIn: "http",
|
|
635
635
|
applyCustomAttributesOnSpan: {
|
|
636
|
-
documentLoad: (t) =>
|
|
637
|
-
documentFetch: (t) =>
|
|
638
|
-
resourceFetch: (t, n) =>
|
|
636
|
+
documentLoad: (t) => lt(e, t, "navigate"),
|
|
637
|
+
documentFetch: (t) => lt(e, t, "document_fetch"),
|
|
638
|
+
resourceFetch: (t, n) => ut(e, t, n)
|
|
639
639
|
}
|
|
640
640
|
})), i && a.push(new i.FetchInstrumentation({
|
|
641
|
-
applyCustomAttributesOnSpan: (t) =>
|
|
641
|
+
applyCustomAttributesOnSpan: (t) => ct(e, t, "fetch"),
|
|
642
642
|
ignoreUrls: t,
|
|
643
643
|
propagateTraceHeaderCorsUrls: n,
|
|
644
644
|
semconvStabilityOptIn: "http",
|
|
645
645
|
ignoreNetworkEvents: !1
|
|
646
646
|
})), s && a.push(new s.XMLHttpRequestInstrumentation({
|
|
647
|
-
applyCustomAttributesOnSpan: (t) =>
|
|
647
|
+
applyCustomAttributesOnSpan: (t) => ct(e, t, "xhr"),
|
|
648
648
|
ignoreUrls: t,
|
|
649
649
|
propagateTraceHeaderCorsUrls: n,
|
|
650
650
|
semconvStabilityOptIn: "http",
|
|
@@ -663,11 +663,11 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
};
|
|
666
|
-
},
|
|
666
|
+
}, B = (e) => {
|
|
667
667
|
let t = 5381;
|
|
668
668
|
for (let n = 0; n < e.length; n++) t = t * 33 ^ e.charCodeAt(n);
|
|
669
669
|
return (t >>> 0).toString(36);
|
|
670
|
-
},
|
|
670
|
+
}, ft = (e, t) => {
|
|
671
671
|
let n = /* @__PURE__ */ new Map(), r = 0, i = (t) => {
|
|
672
672
|
if (!(t - r < e)) {
|
|
673
673
|
r = t;
|
|
@@ -689,24 +689,24 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
689
689
|
count: o.count
|
|
690
690
|
});
|
|
691
691
|
} };
|
|
692
|
-
},
|
|
693
|
-
if (t) return
|
|
694
|
-
},
|
|
692
|
+
}, pt = 6e4, mt = 5, ht = /^https?:|^\/\//i, gt = (e, t) => {
|
|
693
|
+
if (t) return ht.test(t) ? e(t) : t;
|
|
694
|
+
}, _t = () => {
|
|
695
695
|
let e;
|
|
696
696
|
return {
|
|
697
697
|
name: "csp-violation",
|
|
698
698
|
init(t) {
|
|
699
699
|
if (typeof window > "u" || typeof document > "u") return;
|
|
700
|
-
let n =
|
|
701
|
-
let r =
|
|
700
|
+
let n = ft(pt, mt), r = (e) => {
|
|
701
|
+
let r = B(`${e.violatedDirective}|${e.blockedURI}|${e.sourceFile}|${e.lineNumber}`), i = n.allow(r);
|
|
702
702
|
if (!i.allowed) return;
|
|
703
|
-
let a =
|
|
704
|
-
t.startSpan("csp.violation",
|
|
703
|
+
let a = gt(t.config.hooks.redactUrl, e.blockedURI), o = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0, s = i.count === 1;
|
|
704
|
+
t.startSpan("csp.violation", E(E(E({}, t.config.hooks.getPageAttributes()), F({
|
|
705
705
|
errorType: "csp",
|
|
706
706
|
eventLabel: "CSP 错误",
|
|
707
|
-
result:
|
|
707
|
+
result: N.error,
|
|
708
708
|
spanSubtype: "csp",
|
|
709
|
-
spanType:
|
|
709
|
+
spanType: P.error,
|
|
710
710
|
targetLabel: a == null ? e.effectiveDirective : a,
|
|
711
711
|
targetValue: e.statusCode
|
|
712
712
|
})), {}, {
|
|
@@ -720,7 +720,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
720
720
|
"csp.status_code": e.statusCode,
|
|
721
721
|
"csp.fingerprint": r,
|
|
722
722
|
"csp.window_count": i.count,
|
|
723
|
-
[
|
|
723
|
+
[x.exceptionFingerprint]: r,
|
|
724
724
|
"error.source": "csp"
|
|
725
725
|
}, s ? { "csp.original_policy": e.originalPolicy } : {})).end();
|
|
726
726
|
};
|
|
@@ -730,7 +730,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
730
730
|
e == null || e(), e = void 0;
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
|
-
},
|
|
733
|
+
}, V = (e) => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`, vt = "BK_RUM_DEVICE_ID", yt = 250, bt = () => navigator.connection, xt = () => navigator.userAgentData, St = (e) => {
|
|
734
734
|
for (let [t, n] of [
|
|
735
735
|
["Edge", /Edg\/([\d.]+)/],
|
|
736
736
|
["Chrome", /Chrome\/([\d.]+)/],
|
|
@@ -747,21 +747,21 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
747
747
|
name: "Other",
|
|
748
748
|
version: void 0
|
|
749
749
|
};
|
|
750
|
-
},
|
|
750
|
+
}, Ct = (e, t) => {
|
|
751
751
|
let n = `${t == null ? "" : t} ${e}`;
|
|
752
752
|
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";
|
|
753
|
-
},
|
|
753
|
+
}, wt = (e) => {
|
|
754
754
|
let t = null;
|
|
755
755
|
try {
|
|
756
756
|
t = window.localStorage.getItem(e);
|
|
757
757
|
} catch (e) {}
|
|
758
758
|
if (t) return t;
|
|
759
|
-
let n =
|
|
759
|
+
let n = V("device");
|
|
760
760
|
try {
|
|
761
761
|
window.localStorage.setItem(e, n);
|
|
762
762
|
} catch (e) {}
|
|
763
763
|
return n;
|
|
764
|
-
},
|
|
764
|
+
}, Tt = () => {
|
|
765
765
|
var e, t;
|
|
766
766
|
return typeof window > "u" ? {} : {
|
|
767
767
|
"browser.viewport.width": window.innerWidth,
|
|
@@ -769,8 +769,8 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
769
769
|
"browser.screen.width": (e = window.screen) == null ? void 0 : e.width,
|
|
770
770
|
"browser.screen.height": (t = window.screen) == null ? void 0 : t.height
|
|
771
771
|
};
|
|
772
|
-
},
|
|
773
|
-
let e =
|
|
772
|
+
}, Et = () => {
|
|
773
|
+
let e = bt();
|
|
774
774
|
return e ? {
|
|
775
775
|
"network.effective_type": e.effectiveType,
|
|
776
776
|
"network.connection_type": e.type,
|
|
@@ -778,45 +778,45 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
778
778
|
"network.rtt": e.rtt,
|
|
779
779
|
"network.save_data": e.saveData
|
|
780
780
|
} : {};
|
|
781
|
-
},
|
|
781
|
+
}, Dt = () => {
|
|
782
782
|
if (typeof navigator > "u") return {};
|
|
783
|
-
let e =
|
|
783
|
+
let e = xt(), t = navigator.userAgent, n = St(t), r = Ct(t, e == null ? void 0 : e.platform), i = e != null && e.mobile || /mobi|android|iphone|ipad|ipod/i.test(t) ? "mobile" : "desktop";
|
|
784
784
|
return {
|
|
785
785
|
"device.memory": navigator.deviceMemory,
|
|
786
786
|
"device.cpu_cores": navigator.hardwareConcurrency,
|
|
787
787
|
"device.platform": e == null ? void 0 : e.platform,
|
|
788
788
|
"device.mobile": e == null ? void 0 : e.mobile,
|
|
789
|
-
[
|
|
790
|
-
[
|
|
791
|
-
[
|
|
792
|
-
[
|
|
789
|
+
[x.browserName]: n.name,
|
|
790
|
+
[x.browserVersion]: n.version,
|
|
791
|
+
[x.deviceType]: i,
|
|
792
|
+
[x.osName]: r,
|
|
793
793
|
"user_agent.name": n.name,
|
|
794
794
|
"user_agent.version": n.version,
|
|
795
795
|
"user_agent.os.name": r
|
|
796
796
|
};
|
|
797
|
-
},
|
|
797
|
+
}, Ot = (e, t) => {
|
|
798
798
|
let n;
|
|
799
799
|
return () => {
|
|
800
800
|
n !== void 0 && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
801
801
|
n = void 0, e();
|
|
802
802
|
}, t);
|
|
803
803
|
};
|
|
804
|
-
},
|
|
804
|
+
}, kt = (e = {}) => {
|
|
805
805
|
var t;
|
|
806
|
-
let n = [], r = (t = e.storageKey) == null ?
|
|
806
|
+
let n = [], r = (t = e.storageKey) == null ? vt : t;
|
|
807
807
|
return {
|
|
808
808
|
name: "device",
|
|
809
809
|
init(e) {
|
|
810
|
-
let t = typeof window > "u" ?
|
|
811
|
-
if (e.setRuntimeAttributes(
|
|
812
|
-
let i =
|
|
813
|
-
e.setRuntimeAttributes(
|
|
814
|
-
},
|
|
810
|
+
let t = typeof window > "u" ? V("device") : wt(r);
|
|
811
|
+
if (e.setRuntimeAttributes(E(E(E({ "device.id": t }, Dt()), Tt()), Et())), typeof window > "u") return;
|
|
812
|
+
let i = Ot(() => {
|
|
813
|
+
e.setRuntimeAttributes(Tt());
|
|
814
|
+
}, yt);
|
|
815
815
|
window.addEventListener("resize", i), window.addEventListener("orientationchange", i), n.push(() => window.removeEventListener("resize", i), () => window.removeEventListener("orientationchange", i));
|
|
816
|
-
let a =
|
|
816
|
+
let a = bt();
|
|
817
817
|
if (a && typeof a.addEventListener == "function") {
|
|
818
818
|
let t = () => {
|
|
819
|
-
e.setRuntimeAttributes(
|
|
819
|
+
e.setRuntimeAttributes(Et());
|
|
820
820
|
};
|
|
821
821
|
a.addEventListener("change", t), n.push(() => {
|
|
822
822
|
var e;
|
|
@@ -831,7 +831,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
|
-
},
|
|
834
|
+
}, At = 6e4, jt = 5, Mt = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, Nt = (e) => {
|
|
835
835
|
if (e instanceof Error) return e.message;
|
|
836
836
|
if (typeof e == "string") return e;
|
|
837
837
|
try {
|
|
@@ -839,32 +839,32 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
839
839
|
} catch (t) {
|
|
840
840
|
return String(e);
|
|
841
841
|
}
|
|
842
|
-
},
|
|
842
|
+
}, Pt = (e) => {
|
|
843
843
|
var t;
|
|
844
844
|
return e instanceof Error ? (t = e.stack) == null ? "" : t : "";
|
|
845
|
-
},
|
|
845
|
+
}, Ft = (e) => e.slice(0, 80), It = (e) => {
|
|
846
846
|
var t, n;
|
|
847
847
|
return (t = (n = e.split("\n").find((e) => e.trim().startsWith("at "))) == null ? void 0 : n.trim()) == null ? "" : t;
|
|
848
|
-
},
|
|
849
|
-
let c =
|
|
848
|
+
}, Lt = (e) => e === "unhandledrejection" ? "promise" : e === "resource" ? "resource_load" : "js", Rt = ({ context: e, error: n, exceptionType: r, extra: i = {}, source: a, spanName: o, throttle: s }) => {
|
|
849
|
+
let c = Nt(n), l = Pt(n), u = B(`${a}|${c}|${l.slice(0, 256)}`), d = s.allow(u);
|
|
850
850
|
if (!d.allowed) return;
|
|
851
851
|
let f = n instanceof Error ? n : {
|
|
852
852
|
message: c,
|
|
853
853
|
name: r == null ? a : r
|
|
854
|
-
}, p =
|
|
855
|
-
errorType:
|
|
854
|
+
}, p = E(E(E(E({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), F({
|
|
855
|
+
errorType: Lt(a),
|
|
856
856
|
eventLabel: "错误",
|
|
857
|
-
result:
|
|
858
|
-
spanSubtype:
|
|
859
|
-
spanType:
|
|
857
|
+
result: N.error,
|
|
858
|
+
spanSubtype: Lt(a),
|
|
859
|
+
spanType: P.error,
|
|
860
860
|
targetLabel: n instanceof Error ? n.name : r == null ? a : r
|
|
861
861
|
})), {}, {
|
|
862
862
|
"exception.message": c,
|
|
863
|
-
[
|
|
863
|
+
[x.exceptionMessageShort]: Ft(c),
|
|
864
864
|
"exception.stacktrace": l,
|
|
865
|
-
[
|
|
865
|
+
[x.exceptionStackTopFrame]: It(l),
|
|
866
866
|
"exception.type": n instanceof Error ? n.name : r == null ? a : r,
|
|
867
|
-
[
|
|
867
|
+
[x.exceptionFingerprint]: u,
|
|
868
868
|
"error.handled": !1,
|
|
869
869
|
"error.source": a,
|
|
870
870
|
"error.window_count": d.count
|
|
@@ -874,28 +874,28 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
874
874
|
message: c
|
|
875
875
|
}), m.end();
|
|
876
876
|
}, zt = (e = {}) => {
|
|
877
|
-
let t = [], n =
|
|
877
|
+
let t = [], n = Mt(e.windowMs, At), r = Mt(e.maxPerWindow, jt);
|
|
878
878
|
return {
|
|
879
879
|
name: "error",
|
|
880
880
|
init(e) {
|
|
881
881
|
if (typeof window > "u") return;
|
|
882
|
-
let i =
|
|
882
|
+
let i = ft(n, r), a = (t) => {
|
|
883
883
|
var n;
|
|
884
884
|
let r = !t.error && !t.filename && t.message === "Script error.";
|
|
885
|
-
|
|
885
|
+
Rt({
|
|
886
886
|
context: e,
|
|
887
887
|
throttle: i,
|
|
888
888
|
spanName: "browser.error",
|
|
889
889
|
source: "window.error",
|
|
890
890
|
error: (n = t.error) == null ? t.message : n,
|
|
891
|
-
extra:
|
|
891
|
+
extra: E({
|
|
892
892
|
"code.filepath": t.filename,
|
|
893
893
|
"code.lineno": t.lineno,
|
|
894
894
|
"code.column": t.colno
|
|
895
895
|
}, r ? { "error.cross_origin": !0 } : {})
|
|
896
896
|
});
|
|
897
897
|
}, o = (t) => {
|
|
898
|
-
|
|
898
|
+
Rt({
|
|
899
899
|
context: e,
|
|
900
900
|
throttle: i,
|
|
901
901
|
spanName: "browser.unhandledrejection",
|
|
@@ -908,7 +908,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
908
908
|
let n = t.target;
|
|
909
909
|
if (!(n instanceof Element)) return;
|
|
910
910
|
let r = n, a = r.src || r.href || n.currentSrc || "";
|
|
911
|
-
|
|
911
|
+
Rt({
|
|
912
912
|
context: e,
|
|
913
913
|
throttle: i,
|
|
914
914
|
spanName: "browser.resource_error",
|
|
@@ -930,13 +930,13 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
};
|
|
933
|
-
}, Bt = 10 * 1024, Vt = 10, Ht = (e) => e.body, Ut = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, H = /* @__PURE__ */ new WeakMap(),
|
|
933
|
+
}, Bt = 10 * 1024, Vt = 10, Ht = (e) => e.body, Ut = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, H = /* @__PURE__ */ new WeakMap(), Wt = (e, t) => e.length <= t ? {
|
|
934
934
|
body: e,
|
|
935
935
|
truncated: !1
|
|
936
936
|
} : {
|
|
937
937
|
body: e.slice(0, t),
|
|
938
938
|
truncated: !0
|
|
939
|
-
},
|
|
939
|
+
}, Gt = (e, t) => {
|
|
940
940
|
if (!e) return;
|
|
941
941
|
if (e instanceof Headers) return e.get(t) || void 0;
|
|
942
942
|
let n = t.toLowerCase();
|
|
@@ -946,30 +946,30 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
946
946
|
}
|
|
947
947
|
let i = Object.keys(e).find((e) => e.toLowerCase() === n);
|
|
948
948
|
return i ? e[i] : void 0;
|
|
949
|
-
},
|
|
949
|
+
}, Kt = (e) => {
|
|
950
950
|
let t = {};
|
|
951
951
|
return e.forEach((e, n) => {
|
|
952
952
|
t[n] = e instanceof File ? `[File name=${e.name} type=${e.type || "unknown"} size=${e.size}]` : e;
|
|
953
953
|
}), JSON.stringify(t);
|
|
954
|
-
},
|
|
955
|
-
var e =
|
|
956
|
-
return e == null ? "" : typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : e instanceof FormData ?
|
|
954
|
+
}, qt = function() {
|
|
955
|
+
var e = A(function* (e) {
|
|
956
|
+
return e == null ? "" : typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : e instanceof FormData ? Kt(e) : e instanceof Blob ? e.text() : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? new TextDecoder().decode(e) : e instanceof Document ? new XMLSerializer().serializeToString(e) : String(e);
|
|
957
957
|
});
|
|
958
958
|
return function(t) {
|
|
959
959
|
return e.apply(this, arguments);
|
|
960
960
|
};
|
|
961
|
-
}(),
|
|
962
|
-
var e =
|
|
963
|
-
let r = yield
|
|
964
|
-
if (r) return
|
|
961
|
+
}(), Jt = function() {
|
|
962
|
+
var e = A(function* (e, t, n) {
|
|
963
|
+
let r = yield qt(e);
|
|
964
|
+
if (r) return E(E({}, Wt(r, t)), {}, { contentType: n });
|
|
965
965
|
});
|
|
966
966
|
return function(t, n, r) {
|
|
967
967
|
return e.apply(this, arguments);
|
|
968
968
|
};
|
|
969
|
-
}(),
|
|
970
|
-
var e =
|
|
969
|
+
}(), Yt = function() {
|
|
970
|
+
var e = A(function* (e, t, n) {
|
|
971
971
|
try {
|
|
972
|
-
return yield
|
|
972
|
+
return yield Jt(e, t, n);
|
|
973
973
|
} catch (e) {
|
|
974
974
|
return;
|
|
975
975
|
}
|
|
@@ -977,8 +977,8 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
977
977
|
return function(t, n, r) {
|
|
978
978
|
return e.apply(this, arguments);
|
|
979
979
|
};
|
|
980
|
-
}(),
|
|
981
|
-
var e =
|
|
980
|
+
}(), Xt = (e) => e instanceof Request ? e.url : String(e), Zt = (e, t) => t != null && t.method ? t.method : e instanceof Request ? e.method : "GET", Qt = (e, t, n) => t != null && t.body ? () => Yt(t.body, n, Gt(t.headers, "content-type")) : (e instanceof Request, () => Promise.resolve(void 0)), $t = function() {
|
|
981
|
+
var e = A(function* (e, t) {
|
|
982
982
|
try {
|
|
983
983
|
let n = e.headers.get("content-type") || void 0, r = e.headers.get("content-length");
|
|
984
984
|
if (r) {
|
|
@@ -990,7 +990,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
990
990
|
};
|
|
991
991
|
}
|
|
992
992
|
let i = e.clone();
|
|
993
|
-
return
|
|
993
|
+
return Yt(i.body ? yield i.text() : "", t, n);
|
|
994
994
|
} catch (e) {
|
|
995
995
|
return;
|
|
996
996
|
}
|
|
@@ -998,28 +998,28 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
998
998
|
return function(t, n) {
|
|
999
999
|
return e.apply(this, arguments);
|
|
1000
1000
|
};
|
|
1001
|
-
}(),
|
|
1002
|
-
if (e.responseType === "" || e.responseType === "text") return
|
|
1003
|
-
if (e.responseType === "json") return
|
|
1004
|
-
},
|
|
1005
|
-
if (n) return e.redact(
|
|
1001
|
+
}(), en = (e, t) => {
|
|
1002
|
+
if (e.responseType === "" || e.responseType === "text") return E(E({}, Wt(e.responseText || "", t)), {}, { contentType: e.getResponseHeader("content-type") || void 0 });
|
|
1003
|
+
if (e.responseType === "json") return E(E({}, Wt(JSON.stringify(e.response), t)), {}, { contentType: e.getResponseHeader("content-type") || void 0 });
|
|
1004
|
+
}, tn = (e, t, n) => {
|
|
1005
|
+
if (n) return e.redact(E(E({}, t), {}, {
|
|
1006
1006
|
body: n.body,
|
|
1007
1007
|
truncated: n.truncated
|
|
1008
1008
|
}));
|
|
1009
|
-
},
|
|
1010
|
-
let d = !!r || typeof c == "number" && c >= 400, f = i.toUpperCase(), p = d ?
|
|
1009
|
+
}, U = ({ config: e, context: t, duration: n, error: r, method: i, request: a, response: s, status: c, subtype: l, url: u }) => {
|
|
1010
|
+
let d = !!r || typeof c == "number" && c >= 400, f = i.toUpperCase(), p = d ? tn(e, {
|
|
1011
1011
|
contentType: a == null ? void 0 : a.contentType,
|
|
1012
1012
|
method: f,
|
|
1013
1013
|
status: c,
|
|
1014
1014
|
type: "request",
|
|
1015
1015
|
url: u
|
|
1016
|
-
}, a) : void 0, m = d ?
|
|
1016
|
+
}, a) : void 0, m = d ? tn(e, {
|
|
1017
1017
|
contentType: s == null ? void 0 : s.contentType,
|
|
1018
1018
|
method: f,
|
|
1019
1019
|
status: c,
|
|
1020
1020
|
type: "response",
|
|
1021
1021
|
url: u
|
|
1022
|
-
}, s) : void 0, h =
|
|
1022
|
+
}, s) : void 0, h = E(E(E({}, t.config.hooks.getPageAttributes()), Re({
|
|
1023
1023
|
duration: n,
|
|
1024
1024
|
method: f,
|
|
1025
1025
|
statusCode: c,
|
|
@@ -1045,7 +1045,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1045
1045
|
body: d ? "HTTP request completed with error" : "HTTP request completed",
|
|
1046
1046
|
attributes: h
|
|
1047
1047
|
});
|
|
1048
|
-
},
|
|
1048
|
+
}, nn = (e = {}) => {
|
|
1049
1049
|
var t;
|
|
1050
1050
|
let n = [], r = {
|
|
1051
1051
|
maxBodySize: Ut(e.maxBodySize, Bt),
|
|
@@ -1058,26 +1058,26 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1058
1058
|
let { maxBodySize: t } = r, i = window.fetch;
|
|
1059
1059
|
if (typeof i == "function") {
|
|
1060
1060
|
let a = function() {
|
|
1061
|
-
var n =
|
|
1062
|
-
let o =
|
|
1063
|
-
if (
|
|
1064
|
-
let s =
|
|
1061
|
+
var n = A(function* (n, a) {
|
|
1062
|
+
let o = Xt(n);
|
|
1063
|
+
if (M(e.config, o)) return i(n, a);
|
|
1064
|
+
let s = Zt(n, a), c = Qt(n, a, t), l = performance.now();
|
|
1065
1065
|
try {
|
|
1066
1066
|
let u = yield i(n, a), d = performance.now() - l, f = u.status >= 400;
|
|
1067
|
-
return
|
|
1067
|
+
return U({
|
|
1068
1068
|
config: r,
|
|
1069
1069
|
context: e,
|
|
1070
1070
|
duration: d,
|
|
1071
1071
|
method: s,
|
|
1072
1072
|
request: f ? yield c() : void 0,
|
|
1073
|
-
response: f ? yield
|
|
1073
|
+
response: f ? yield $t(u, t) : void 0,
|
|
1074
1074
|
status: u.status,
|
|
1075
1075
|
subtype: "fetch",
|
|
1076
1076
|
url: o
|
|
1077
1077
|
}), u;
|
|
1078
1078
|
} catch (t) {
|
|
1079
1079
|
let n = yield c();
|
|
1080
|
-
throw
|
|
1080
|
+
throw U({
|
|
1081
1081
|
config: r,
|
|
1082
1082
|
context: e,
|
|
1083
1083
|
duration: performance.now() - l,
|
|
@@ -1126,11 +1126,11 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1126
1126
|
let e = H.get(this);
|
|
1127
1127
|
e && (e.networkError = !0);
|
|
1128
1128
|
}, { once: !0 }), this.addEventListener("loadend", () => {
|
|
1129
|
-
|
|
1129
|
+
A(function* () {
|
|
1130
1130
|
let n = H.get(i);
|
|
1131
|
-
if (!n ||
|
|
1132
|
-
let a = n.networkError || i.status >= 400, o = a ?
|
|
1133
|
-
|
|
1131
|
+
if (!n || M(e.config, n.url) || n.aborted) return;
|
|
1132
|
+
let a = n.networkError || i.status >= 400, o = a ? en(i, t) : void 0, s = a ? yield Yt(n.requestBody, t, n.requestContentType) : void 0;
|
|
1133
|
+
U({
|
|
1134
1134
|
config: r,
|
|
1135
1135
|
context: e,
|
|
1136
1136
|
duration: performance.now() - n.startTime,
|
|
@@ -1156,8 +1156,8 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
};
|
|
1159
|
-
},
|
|
1160
|
-
let t, n =
|
|
1159
|
+
}, rn = 50, an = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, on = (e = {}) => {
|
|
1160
|
+
let t, n = an(e.threshold, rn);
|
|
1161
1161
|
return {
|
|
1162
1162
|
name: "long-task",
|
|
1163
1163
|
init(e) {
|
|
@@ -1169,23 +1169,23 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1169
1169
|
});
|
|
1170
1170
|
try {
|
|
1171
1171
|
t = new PerformanceObserver((t) => {
|
|
1172
|
-
let r = e.applyRedact(
|
|
1172
|
+
let r = e.applyRedact(E(E(E({}, e.config.hooks.getPageAttributes()), e.config.hooks.getMetricAttributes()), I(e.getRuntimeAttributes())));
|
|
1173
1173
|
for (let h of t.getEntries()) {
|
|
1174
1174
|
var o, s, c, l, u, d, f, p, m;
|
|
1175
1175
|
if (h.duration < n) continue;
|
|
1176
|
-
let t = (o = h.attribution) == null ? void 0 : o[0], g =
|
|
1177
|
-
e.startSpan("browser.long_task",
|
|
1176
|
+
let t = (o = h.attribution) == null ? void 0 : o[0], g = E(E({}, r), {}, { [x.longtaskAttributionScript]: (s = (c = t == null ? void 0 : t.containerSrc) == null ? t == null ? void 0 : t.name : c) == null ? "unknown" : s }), _ = h.duration > 100 ? N.warning : N.success;
|
|
1177
|
+
e.startSpan("browser.long_task", E(E(E({}, r), F({
|
|
1178
1178
|
duration: h.duration,
|
|
1179
|
-
errorType: _ ===
|
|
1179
|
+
errorType: _ === N.warning ? "longtask_blocking" : "none",
|
|
1180
1180
|
eventLabel: "长任务",
|
|
1181
1181
|
result: _,
|
|
1182
1182
|
spanSubtype: (l = t == null ? void 0 : t.name) == null ? "unknown" : l,
|
|
1183
|
-
spanType:
|
|
1183
|
+
spanType: P.longtask,
|
|
1184
1184
|
targetLabel: (u = (d = (f = t == null ? void 0 : t.containerSrc) == null ? t == null ? void 0 : t.containerName : f) == null ? t == null ? void 0 : t.name : d) == null ? "unknown" : u,
|
|
1185
1185
|
targetValue: h.duration
|
|
1186
1186
|
})), {}, {
|
|
1187
|
-
[
|
|
1188
|
-
[
|
|
1187
|
+
[x.longtaskBlockingDuration]: h.duration,
|
|
1188
|
+
[x.longtaskAttributionScript]: (p = (m = t == null ? void 0 : t.containerSrc) == null ? t == null ? void 0 : t.name : m) == null ? "unknown" : p
|
|
1189
1189
|
}), { startTime: performance.timeOrigin + h.startTime }).end(performance.timeOrigin + h.startTime + h.duration), i.add(1, g), a.record(h.duration, g);
|
|
1190
1190
|
}
|
|
1191
1191
|
}), t.observe({
|
|
@@ -1200,73 +1200,73 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1200
1200
|
t == null || t.disconnect(), t = void 0;
|
|
1201
1201
|
}
|
|
1202
1202
|
};
|
|
1203
|
-
},
|
|
1204
|
-
let n =
|
|
1205
|
-
|
|
1203
|
+
}, W = /* @__PURE__ */ new Set(), G = "", K, q, J = !1, Y = () => typeof location > "u" ? "" : location.href, X = (e, t) => {
|
|
1204
|
+
let n = Y();
|
|
1205
|
+
G = n;
|
|
1206
1206
|
let r = {
|
|
1207
1207
|
fromUrl: t,
|
|
1208
1208
|
source: e,
|
|
1209
1209
|
toUrl: n
|
|
1210
1210
|
};
|
|
1211
|
-
for (let e of Array.from(
|
|
1212
|
-
}, on = () => {
|
|
1213
|
-
Z("popstate", K || X());
|
|
1211
|
+
for (let e of Array.from(W)) e(r);
|
|
1214
1212
|
}, sn = () => {
|
|
1215
|
-
|
|
1213
|
+
X("popstate", G || Y());
|
|
1216
1214
|
}, cn = () => {
|
|
1217
|
-
|
|
1218
|
-
|
|
1215
|
+
X("hashchange", G || Y());
|
|
1216
|
+
}, ln = () => {
|
|
1217
|
+
J || typeof window > "u" || typeof history > "u" || (J = !0, G = Y(), K = history.pushState, q = history.replaceState, history.pushState = function(e, t, n) {
|
|
1218
|
+
let r = G || Y(), i = K == null ? void 0 : K.apply(this, [
|
|
1219
1219
|
e,
|
|
1220
1220
|
t,
|
|
1221
1221
|
n
|
|
1222
1222
|
]);
|
|
1223
|
-
return
|
|
1223
|
+
return X("pushState", r), i;
|
|
1224
1224
|
}, history.replaceState = function(e, t, n) {
|
|
1225
|
-
let r =
|
|
1225
|
+
let r = G || Y(), i = q == null ? void 0 : q.apply(this, [
|
|
1226
1226
|
e,
|
|
1227
1227
|
t,
|
|
1228
1228
|
n
|
|
1229
1229
|
]);
|
|
1230
|
-
return
|
|
1231
|
-
}, window.addEventListener("popstate",
|
|
1232
|
-
},
|
|
1233
|
-
!
|
|
1234
|
-
},
|
|
1235
|
-
|
|
1236
|
-
}),
|
|
1230
|
+
return X("replaceState", r), i;
|
|
1231
|
+
}, window.addEventListener("popstate", sn), window.addEventListener("hashchange", cn));
|
|
1232
|
+
}, un = () => {
|
|
1233
|
+
!J || typeof window > "u" || typeof history > "u" || (K && (history.pushState = K), q && (history.replaceState = q), window.removeEventListener("popstate", sn), window.removeEventListener("hashchange", cn), K = void 0, q = void 0, J = !1, G = "");
|
|
1234
|
+
}, dn = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (ln(), W.add(e), () => {
|
|
1235
|
+
W.delete(e), W.size === 0 && un();
|
|
1236
|
+
}), fn = () => typeof location > "u" ? "" : location.href, pn = () => {
|
|
1237
1237
|
let e = [];
|
|
1238
1238
|
return {
|
|
1239
1239
|
name: "page-view",
|
|
1240
1240
|
init(t) {
|
|
1241
1241
|
if (typeof window > "u") return;
|
|
1242
1242
|
let n = "", r, i = (e, i = n) => {
|
|
1243
|
-
let a =
|
|
1243
|
+
let a = fn();
|
|
1244
1244
|
if (a === n) return;
|
|
1245
1245
|
r == null || r.setAttribute("view.end_reason", e), r == null || r.end(), n = a;
|
|
1246
|
-
let o =
|
|
1246
|
+
let o = V("view"), s = t.config.hooks.getViewPathGroup(a), c = e === "load" ? "initial_load" : "route_change", l = t.config.hooks.redactUrl(a), u = t.config.hooks.redactUrl(i);
|
|
1247
1247
|
t.setView({
|
|
1248
1248
|
id: o,
|
|
1249
1249
|
loadingType: c,
|
|
1250
1250
|
url: l,
|
|
1251
1251
|
urlPathGroup: s
|
|
1252
1252
|
});
|
|
1253
|
-
let d = e === "load", f =
|
|
1253
|
+
let d = e === "load", f = E(E(E({}, t.config.hooks.getPageAttributes()), F({
|
|
1254
1254
|
errorType: "none",
|
|
1255
1255
|
eventLabel: d ? "文档加载" : "路由切换",
|
|
1256
1256
|
spanSubtype: d ? "navigate" : e,
|
|
1257
|
-
spanType: d ?
|
|
1257
|
+
spanType: d ? P.document : P.route,
|
|
1258
1258
|
targetLabel: s,
|
|
1259
1259
|
traceScene: d ? "page_load" : "route_change"
|
|
1260
1260
|
})), {}, {
|
|
1261
|
-
[
|
|
1262
|
-
[
|
|
1263
|
-
[
|
|
1264
|
-
[
|
|
1261
|
+
[x.viewId]: o,
|
|
1262
|
+
[x.viewUrl]: l,
|
|
1263
|
+
[x.viewUrlPathGroup]: s,
|
|
1264
|
+
[x.viewLoadingType]: c,
|
|
1265
1265
|
"url.previous": u,
|
|
1266
1266
|
"event.source": e
|
|
1267
1267
|
}, d ? { "document.referrer": t.config.hooks.redactUrl(document.referrer || "") } : {});
|
|
1268
|
-
r = t.startSpan("browser.view", f), t.startSpan("browser.page_view",
|
|
1269
|
-
}, a =
|
|
1268
|
+
r = t.startSpan("browser.view", f), t.startSpan("browser.page_view", E({}, f)).end();
|
|
1269
|
+
}, a = dn((e) => {
|
|
1270
1270
|
i(e.source, e.fromUrl);
|
|
1271
1271
|
});
|
|
1272
1272
|
i("load");
|
|
@@ -1282,7 +1282,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
1284
|
};
|
|
1285
|
-
},
|
|
1285
|
+
}, mn = (e) => e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, hn = () => {
|
|
1286
1286
|
let e, t = /* @__PURE__ */ new Set();
|
|
1287
1287
|
return {
|
|
1288
1288
|
name: "resource",
|
|
@@ -1290,12 +1290,12 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1290
1290
|
var r;
|
|
1291
1291
|
if (typeof PerformanceObserver > "u" || !((r = PerformanceObserver.supportedEntryTypes) != null && r.includes("resource"))) return;
|
|
1292
1292
|
let i = (e) => {
|
|
1293
|
-
if (!e.name ||
|
|
1293
|
+
if (!e.name || M(n.config, e.name)) return;
|
|
1294
1294
|
let r = `${e.name}|${e.startTime}`;
|
|
1295
1295
|
if (t.has(r)) return;
|
|
1296
1296
|
t.add(r);
|
|
1297
1297
|
let i = n.config.hooks.redactUrl(e.name), a = e.duration;
|
|
1298
|
-
n.startSpan("browser.resource",
|
|
1298
|
+
n.startSpan("browser.resource", E(E(E({}, n.config.hooks.getPageAttributes()), ze({
|
|
1299
1299
|
duration: a,
|
|
1300
1300
|
initiatorType: e.initiatorType || "other",
|
|
1301
1301
|
responseStatus: e.responseStatus,
|
|
@@ -1304,9 +1304,9 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1304
1304
|
urlPathTemplate: n.config.hooks.getViewPathGroup(e.name)
|
|
1305
1305
|
})), {}, {
|
|
1306
1306
|
"url.full": i,
|
|
1307
|
-
[
|
|
1308
|
-
[
|
|
1309
|
-
[
|
|
1307
|
+
[x.transferSize]: e.transferSize,
|
|
1308
|
+
[x.cacheHit]: mn(e),
|
|
1309
|
+
[x.nextHopProtocol]: e.nextHopProtocol,
|
|
1310
1310
|
initiator_type: e.initiatorType || "other",
|
|
1311
1311
|
"resource.encoded_body_size": e.encodedBodySize,
|
|
1312
1312
|
"resource.decoded_body_size": e.decodedBodySize
|
|
@@ -1327,7 +1327,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1327
1327
|
e == null || e.disconnect(), e = void 0, t.clear();
|
|
1328
1328
|
}
|
|
1329
1329
|
};
|
|
1330
|
-
},
|
|
1330
|
+
}, gn = () => {
|
|
1331
1331
|
let e = [], t = !1;
|
|
1332
1332
|
return {
|
|
1333
1333
|
name: "route-timing",
|
|
@@ -1340,14 +1340,14 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1340
1340
|
if (t) return;
|
|
1341
1341
|
let o = performance.now(), s = performance.timeOrigin + o, c = () => {
|
|
1342
1342
|
if (t || typeof document < "u" && document.visibilityState === "hidden") return;
|
|
1343
|
-
let c = performance.now() - o, l = c > 500 ?
|
|
1344
|
-
r.record(c, u), n.startSpan("browser.route_change",
|
|
1343
|
+
let c = performance.now() - o, l = c > 500 ? N.warning : N.success, u = n.applyRedact(E(E(E(E({}, n.config.hooks.getPageAttributes()), n.config.hooks.getMetricAttributes()), I(n.getRuntimeAttributes())), {}, { "route.change.source": e }));
|
|
1344
|
+
r.record(c, u), n.startSpan("browser.route_change", E(E(E({}, u), F({
|
|
1345
1345
|
duration: c,
|
|
1346
|
-
errorType: l ===
|
|
1346
|
+
errorType: l === N.warning ? "slow" : "none",
|
|
1347
1347
|
eventLabel: "路由切换",
|
|
1348
1348
|
result: l,
|
|
1349
1349
|
spanSubtype: e,
|
|
1350
|
-
spanType:
|
|
1350
|
+
spanType: P.route,
|
|
1351
1351
|
targetLabel: n.config.hooks.getViewPathGroup(a),
|
|
1352
1352
|
targetValue: c,
|
|
1353
1353
|
traceScene: "route_change"
|
|
@@ -1357,7 +1357,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1357
1357
|
}), { startTime: s }).end();
|
|
1358
1358
|
};
|
|
1359
1359
|
requestAnimationFrame(() => requestAnimationFrame(() => setTimeout(c, 0)));
|
|
1360
|
-
}, a =
|
|
1360
|
+
}, a = dn((e) => {
|
|
1361
1361
|
e.fromUrl !== e.toUrl && i(e.source, e.fromUrl, e.toUrl);
|
|
1362
1362
|
});
|
|
1363
1363
|
e.push(a);
|
|
@@ -1369,32 +1369,32 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
1371
|
};
|
|
1372
|
-
},
|
|
1372
|
+
}, _n = 1800 * 1e3, vn = 1440 * 60 * 1e3, yn = 6e4, bn = 5e3, xn = [
|
|
1373
1373
|
"click",
|
|
1374
1374
|
"keydown",
|
|
1375
1375
|
"scroll",
|
|
1376
1376
|
"mousemove",
|
|
1377
1377
|
"touchstart"
|
|
1378
|
-
],
|
|
1378
|
+
], Sn = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, Cn = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= t + bn, wn = (e, t) => {
|
|
1379
1379
|
if (!e) return null;
|
|
1380
1380
|
try {
|
|
1381
1381
|
let n = JSON.parse(e);
|
|
1382
|
-
if (typeof (n == null ? void 0 : n.id) == "string" &&
|
|
1382
|
+
if (typeof (n == null ? void 0 : n.id) == "string" && Cn(n.ts, t) && Cn(n.startedAt, t)) return n;
|
|
1383
1383
|
} catch (e) {}
|
|
1384
1384
|
return null;
|
|
1385
|
-
},
|
|
1385
|
+
}, Tn = (e, t) => {
|
|
1386
1386
|
if (typeof window > "u") return null;
|
|
1387
1387
|
let n = null;
|
|
1388
1388
|
try {
|
|
1389
1389
|
n = window.localStorage.getItem(e);
|
|
1390
1390
|
} catch (e) {}
|
|
1391
|
-
let r =
|
|
1391
|
+
let r = wn(n, t);
|
|
1392
1392
|
if (r) return r;
|
|
1393
1393
|
try {
|
|
1394
1394
|
n = window.sessionStorage.getItem(e);
|
|
1395
1395
|
} catch (e) {}
|
|
1396
|
-
return r =
|
|
1397
|
-
},
|
|
1396
|
+
return r = wn(n, t), r;
|
|
1397
|
+
}, En = (e, t) => {
|
|
1398
1398
|
if (typeof window > "u") return;
|
|
1399
1399
|
let n = JSON.stringify(t);
|
|
1400
1400
|
try {
|
|
@@ -1403,23 +1403,23 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1403
1403
|
try {
|
|
1404
1404
|
window.localStorage.setItem(e, n);
|
|
1405
1405
|
} catch (e) {}
|
|
1406
|
-
},
|
|
1407
|
-
let r = Date.now(), i =
|
|
1406
|
+
}, Dn = (e, t, n) => {
|
|
1407
|
+
let r = Date.now(), i = Tn(e, r);
|
|
1408
1408
|
if (i) {
|
|
1409
1409
|
let a = r - i.ts >= t, o = r - i.startedAt >= n;
|
|
1410
1410
|
if (!a && !o) {
|
|
1411
|
-
let t =
|
|
1412
|
-
return
|
|
1411
|
+
let t = E(E({}, i), {}, { ts: r });
|
|
1412
|
+
return En(e, t), {
|
|
1413
1413
|
id: t.id,
|
|
1414
1414
|
rotated: !1
|
|
1415
1415
|
};
|
|
1416
1416
|
}
|
|
1417
1417
|
let s = a ? "inactivity" : "maxLifetime", c = {
|
|
1418
|
-
id:
|
|
1418
|
+
id: V("session"),
|
|
1419
1419
|
startedAt: r,
|
|
1420
1420
|
ts: r
|
|
1421
1421
|
};
|
|
1422
|
-
return
|
|
1422
|
+
return En(e, c), {
|
|
1423
1423
|
id: c.id,
|
|
1424
1424
|
prevId: i.id,
|
|
1425
1425
|
reason: s,
|
|
@@ -1427,69 +1427,69 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
1429
|
let a = {
|
|
1430
|
-
id:
|
|
1430
|
+
id: V("session"),
|
|
1431
1431
|
startedAt: r,
|
|
1432
1432
|
ts: r
|
|
1433
1433
|
};
|
|
1434
|
-
return
|
|
1434
|
+
return En(e, a), {
|
|
1435
1435
|
id: a.id,
|
|
1436
1436
|
reason: "init",
|
|
1437
1437
|
rotated: !0
|
|
1438
1438
|
};
|
|
1439
|
-
},
|
|
1439
|
+
}, On = (e) => {
|
|
1440
1440
|
let t = "";
|
|
1441
1441
|
try {
|
|
1442
1442
|
t = new URL(e).host;
|
|
1443
1443
|
} catch (n) {
|
|
1444
1444
|
t = e;
|
|
1445
1445
|
}
|
|
1446
|
-
return `bk_ot_session__${
|
|
1447
|
-
},
|
|
1446
|
+
return `bk_ot_session__${B(t || "default")}`;
|
|
1447
|
+
}, kn = (e, t) => {
|
|
1448
1448
|
if (!t.rotated || !t.reason) return;
|
|
1449
1449
|
let n = Date.now();
|
|
1450
1450
|
e.emitLog({
|
|
1451
1451
|
severityNumber: o.INFO,
|
|
1452
1452
|
severityText: "INFO",
|
|
1453
1453
|
body: t.reason === "init" ? "session.start" : "session.rotate",
|
|
1454
|
-
attributes:
|
|
1455
|
-
[
|
|
1456
|
-
[
|
|
1457
|
-
[
|
|
1454
|
+
attributes: E(E({}, e.config.hooks.getPageAttributes()), {}, {
|
|
1455
|
+
[x.sessionHasReplay]: !1,
|
|
1456
|
+
[x.sessionId]: t.id,
|
|
1457
|
+
[x.sessionStartTime]: n,
|
|
1458
1458
|
"session.rotate.reason": t.reason
|
|
1459
1459
|
}, t.prevId ? { "session.previous_id": t.prevId } : {})
|
|
1460
1460
|
});
|
|
1461
|
-
},
|
|
1462
|
-
let t = [], n =
|
|
1461
|
+
}, An = (e = {}) => {
|
|
1462
|
+
let t = [], n = Sn(e.inactivityMs, _n), r = Sn(e.maxLifetimeMs, vn);
|
|
1463
1463
|
return {
|
|
1464
1464
|
name: "session",
|
|
1465
1465
|
init(i) {
|
|
1466
1466
|
var a;
|
|
1467
|
-
let o = (a = e.storageKey) == null ?
|
|
1467
|
+
let o = (a = e.storageKey) == null ? On(i.config.transport.endpoint) : a, s = "", c = () => {
|
|
1468
1468
|
if (typeof window > "u") {
|
|
1469
|
-
s || (s =
|
|
1470
|
-
[
|
|
1471
|
-
[
|
|
1469
|
+
s || (s = V("session"), i.setRuntimeAttributes({
|
|
1470
|
+
[x.sessionHasReplay]: !1,
|
|
1471
|
+
[x.sessionId]: s
|
|
1472
1472
|
}));
|
|
1473
1473
|
return;
|
|
1474
1474
|
}
|
|
1475
|
-
let e =
|
|
1475
|
+
let e = Dn(o, n, r);
|
|
1476
1476
|
i.setRuntimeAttributes({
|
|
1477
|
-
[
|
|
1478
|
-
[
|
|
1479
|
-
}), e.id !== s && (s = e.id,
|
|
1477
|
+
[x.sessionHasReplay]: !1,
|
|
1478
|
+
[x.sessionId]: e.id
|
|
1479
|
+
}), e.id !== s && (s = e.id, kn(i, e));
|
|
1480
1480
|
};
|
|
1481
1481
|
if (c(), typeof window > "u" || typeof document > "u") return;
|
|
1482
1482
|
let l = Date.now(), u = () => {
|
|
1483
1483
|
let e = Date.now();
|
|
1484
|
-
e - l <
|
|
1484
|
+
e - l < yn || (l = e, c());
|
|
1485
1485
|
}, d = {
|
|
1486
1486
|
capture: !0,
|
|
1487
1487
|
passive: !0
|
|
1488
1488
|
};
|
|
1489
|
-
|
|
1489
|
+
xn.forEach((e) => {
|
|
1490
1490
|
window.addEventListener(e, u, d);
|
|
1491
1491
|
}), t.push(() => {
|
|
1492
|
-
|
|
1492
|
+
xn.forEach((e) => {
|
|
1493
1493
|
window.removeEventListener(e, u, d);
|
|
1494
1494
|
});
|
|
1495
1495
|
});
|
|
@@ -1499,13 +1499,13 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1499
1499
|
document.addEventListener("visibilitychange", f), t.push(() => document.removeEventListener("visibilitychange", f));
|
|
1500
1500
|
let p = (e) => {
|
|
1501
1501
|
if (e.storageArea !== window.localStorage || e.key !== o || !e.newValue) return;
|
|
1502
|
-
let t = Date.now(), n =
|
|
1502
|
+
let t = Date.now(), n = wn(e.newValue, t);
|
|
1503
1503
|
if (!(!n || n.id === s)) {
|
|
1504
1504
|
s = n.id;
|
|
1505
1505
|
try {
|
|
1506
1506
|
window.sessionStorage.setItem(o, e.newValue);
|
|
1507
1507
|
} catch (e) {}
|
|
1508
|
-
i.setRuntimeAttributes({ [
|
|
1508
|
+
i.setRuntimeAttributes({ [x.sessionId]: n.id });
|
|
1509
1509
|
}
|
|
1510
1510
|
};
|
|
1511
1511
|
window.addEventListener("storage", p), t.push(() => window.removeEventListener("storage", p));
|
|
@@ -1517,18 +1517,18 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1517
1517
|
}
|
|
1518
1518
|
}
|
|
1519
1519
|
};
|
|
1520
|
-
},
|
|
1521
|
-
if (typeof performance > "u") return
|
|
1520
|
+
}, jn = "unknown", Mn = (e) => e ? e.replace(/_/g, "-") : jn, Nn = () => {
|
|
1521
|
+
if (typeof performance > "u") return jn;
|
|
1522
1522
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1523
|
-
return
|
|
1524
|
-
},
|
|
1523
|
+
return Mn(e == null ? void 0 : e.type);
|
|
1524
|
+
}, Pn = (e, t) => {
|
|
1525
1525
|
var n;
|
|
1526
1526
|
return {
|
|
1527
1527
|
"rum.navigation.type": (n = e.navigationType) == null ? t : n,
|
|
1528
|
-
[
|
|
1529
|
-
[
|
|
1528
|
+
[x.vitalMetric]: e.name.toLowerCase(),
|
|
1529
|
+
[x.vitalRating]: e.rating
|
|
1530
1530
|
};
|
|
1531
|
-
},
|
|
1531
|
+
}, Fn = (e, t) => {
|
|
1532
1532
|
var n;
|
|
1533
1533
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
1534
1534
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -1552,12 +1552,12 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1552
1552
|
default: break;
|
|
1553
1553
|
}
|
|
1554
1554
|
return i;
|
|
1555
|
-
},
|
|
1555
|
+
}, In = () => {
|
|
1556
1556
|
let e = !1;
|
|
1557
1557
|
return {
|
|
1558
1558
|
name: "web-vitals",
|
|
1559
1559
|
init(t) {
|
|
1560
|
-
return
|
|
1560
|
+
return A(function* () {
|
|
1561
1561
|
if (typeof window > "u") return;
|
|
1562
1562
|
let n;
|
|
1563
1563
|
try {
|
|
@@ -1570,7 +1570,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1570
1570
|
return;
|
|
1571
1571
|
}
|
|
1572
1572
|
if (e) return;
|
|
1573
|
-
let { onCLS: i, onFCP: a, onINP: o, onLCP: s, onTTFB: c } = n, l =
|
|
1573
|
+
let { onCLS: i, onFCP: a, onINP: o, onLCP: s, onTTFB: c } = n, l = Nn(), u = t.meter.createHistogram("browser.web_vital.cls", {
|
|
1574
1574
|
unit: "1",
|
|
1575
1575
|
description: "Cumulative Layout Shift"
|
|
1576
1576
|
}), d = t.meter.createHistogram("browser.web_vital.duration", {
|
|
@@ -1578,26 +1578,26 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1578
1578
|
description: "Web Vitals duration metrics, including FCP, INP, LCP and TTFB"
|
|
1579
1579
|
}), f = (e) => {
|
|
1580
1580
|
let n = e.name.toLowerCase();
|
|
1581
|
-
t.startSpan("browser.web_vital",
|
|
1581
|
+
t.startSpan("browser.web_vital", E(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()), Pn(e, l)), F({
|
|
1582
1582
|
duration: e.name === "CLS" ? void 0 : e.value,
|
|
1583
1583
|
errorType: e.rating === "good" ? "none" : "slow",
|
|
1584
1584
|
eventLabel: "Web 指标",
|
|
1585
|
-
result:
|
|
1585
|
+
result: Ie(e.rating),
|
|
1586
1586
|
spanSubtype: n,
|
|
1587
|
-
spanType:
|
|
1587
|
+
spanType: P.vital,
|
|
1588
1588
|
targetLabel: n,
|
|
1589
1589
|
targetValue: e.value
|
|
1590
1590
|
})), {}, {
|
|
1591
|
-
[
|
|
1592
|
-
[
|
|
1593
|
-
[
|
|
1591
|
+
[x.vitalMetric]: n,
|
|
1592
|
+
[x.vitalValue]: e.value,
|
|
1593
|
+
[x.vitalRating]: e.rating,
|
|
1594
1594
|
"vital.id": e.id
|
|
1595
|
-
},
|
|
1595
|
+
}, Fn(e, t.config.hooks.redactUrl))).end();
|
|
1596
1596
|
}, p = (n) => {
|
|
1597
|
-
e || !Number.isFinite(n.value) || (d.record(n.value, t.applyRedact(
|
|
1597
|
+
e || !Number.isFinite(n.value) || (d.record(n.value, t.applyRedact(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()), I(t.getRuntimeAttributes())), Pn(n, l)))), f(n));
|
|
1598
1598
|
};
|
|
1599
1599
|
i((n) => {
|
|
1600
|
-
e || !Number.isFinite(n.value) || (u.record(n.value, t.applyRedact(
|
|
1600
|
+
e || !Number.isFinite(n.value) || (u.record(n.value, t.applyRedact(E(E(E(E({}, t.config.hooks.getPageAttributes()), t.config.hooks.getMetricAttributes()), I(t.getRuntimeAttributes())), Pn(n, l)))), f(n));
|
|
1601
1601
|
}), a(p), o(p), s(p), c(p);
|
|
1602
1602
|
})();
|
|
1603
1603
|
},
|
|
@@ -1605,7 +1605,7 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1605
1605
|
e = !0;
|
|
1606
1606
|
}
|
|
1607
1607
|
};
|
|
1608
|
-
},
|
|
1608
|
+
}, Ln = 64 * 1024, Rn = 6e4, zn = 5, Bn = (e) => e == null ? 0 : typeof e == "string" ? e.length > Ln || 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, Vn = (e, t) => {
|
|
1609
1609
|
let n = {
|
|
1610
1610
|
"network.protocol.name": "websocket",
|
|
1611
1611
|
"url.full": t(e)
|
|
@@ -1618,71 +1618,71 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1618
1618
|
metricAttributes: r,
|
|
1619
1619
|
spanAttributes: n
|
|
1620
1620
|
};
|
|
1621
|
-
},
|
|
1621
|
+
}, Hn = (e, n) => {
|
|
1622
1622
|
var r;
|
|
1623
|
-
let { bytesCounter: i, connectDurationHistogram: a, context: s, errorCounter: c, errorThrottle: l, isDisposed: u, messageCounter: d, url: f } = n, { metricAttributes: p, spanAttributes: m } =
|
|
1623
|
+
let { bytesCounter: i, connectDurationHistogram: a, context: s, errorCounter: c, errorThrottle: l, isDisposed: u, messageCounter: d, url: f } = n, { metricAttributes: p, spanAttributes: m } = Vn(f, s.config.hooks.redactUrl), h = s.applyRedact(E(E({}, s.config.hooks.getMetricAttributes()), p)), g = (r = m["server.address"]) == null ? m["url.full"] : r, _ = s.startSpan("websocket.connect", E(E(E({}, m), F({
|
|
1624
1624
|
errorType: "none",
|
|
1625
1625
|
eventLabel: "WebSocket",
|
|
1626
1626
|
spanSubtype: "websocket",
|
|
1627
|
-
spanType:
|
|
1628
|
-
targetLabel:
|
|
1629
|
-
})), m["server.address"] ? { [
|
|
1630
|
-
if (
|
|
1631
|
-
|
|
1632
|
-
let n = performance.now() -
|
|
1633
|
-
e === "error" &&
|
|
1627
|
+
spanType: P.custom,
|
|
1628
|
+
targetLabel: g
|
|
1629
|
+
})), m["server.address"] ? { [x.targetDomain]: m["server.address"] } : {})), v = performance.now(), y = !1, b = (e) => {
|
|
1630
|
+
if (y) return;
|
|
1631
|
+
y = !0;
|
|
1632
|
+
let n = performance.now() - v;
|
|
1633
|
+
e === "error" && _.setStatus({
|
|
1634
1634
|
code: t.ERROR,
|
|
1635
1635
|
message: "websocket connect failed"
|
|
1636
|
-
}),
|
|
1636
|
+
}), _.setAttributes(F({
|
|
1637
1637
|
duration: n,
|
|
1638
1638
|
errorType: e === "error" ? "network" : "none",
|
|
1639
1639
|
eventLabel: "WebSocket",
|
|
1640
|
-
result: e === "error" ?
|
|
1640
|
+
result: e === "error" ? N.error : N.success,
|
|
1641
1641
|
spanSubtype: "websocket",
|
|
1642
|
-
spanType:
|
|
1643
|
-
targetLabel:
|
|
1642
|
+
spanType: P.custom,
|
|
1643
|
+
targetLabel: g,
|
|
1644
1644
|
targetValue: n
|
|
1645
|
-
})),
|
|
1645
|
+
})), _.end(), e === "opened" && !u() && a.record(n, h);
|
|
1646
1646
|
};
|
|
1647
1647
|
e.addEventListener("open", () => {
|
|
1648
|
-
u() ||
|
|
1648
|
+
u() || b("opened");
|
|
1649
1649
|
}), e.addEventListener("message", (e) => {
|
|
1650
1650
|
if (u()) return;
|
|
1651
|
-
let t =
|
|
1652
|
-
d.add(1, t), i.add(
|
|
1651
|
+
let t = E(E({}, h), {}, { "websocket.direction": "in" });
|
|
1652
|
+
d.add(1, t), i.add(Bn(e.data), t);
|
|
1653
1653
|
}), e.addEventListener("error", () => {
|
|
1654
1654
|
if (u()) return;
|
|
1655
|
-
let e =
|
|
1656
|
-
c.add(1,
|
|
1655
|
+
let e = y ? "runtime" : "connect";
|
|
1656
|
+
c.add(1, E(E({}, h), {}, { "websocket.error.phase": e })), b("error");
|
|
1657
1657
|
let t = l.allow(`ws:error:${f}`);
|
|
1658
1658
|
t.allowed && s.emitLog({
|
|
1659
1659
|
severityNumber: o.ERROR,
|
|
1660
1660
|
severityText: "ERROR",
|
|
1661
1661
|
body: "websocket.error",
|
|
1662
|
-
attributes:
|
|
1662
|
+
attributes: E(E(E({}, m), F({
|
|
1663
1663
|
errorType: "network",
|
|
1664
1664
|
eventLabel: "WebSocket 错误",
|
|
1665
|
-
result:
|
|
1665
|
+
result: N.error,
|
|
1666
1666
|
spanSubtype: "websocket",
|
|
1667
|
-
spanType:
|
|
1668
|
-
targetLabel:
|
|
1667
|
+
spanType: P.custom,
|
|
1668
|
+
targetLabel: g
|
|
1669
1669
|
})), {}, {
|
|
1670
1670
|
"websocket.error.phase": e,
|
|
1671
1671
|
"websocket.error.window_count": t.count
|
|
1672
1672
|
})
|
|
1673
1673
|
});
|
|
1674
1674
|
}), e.addEventListener("close", (e) => {
|
|
1675
|
-
u() || (
|
|
1675
|
+
u() || (y || b("error"), s.emitLog({
|
|
1676
1676
|
severityNumber: o.INFO,
|
|
1677
1677
|
severityText: "INFO",
|
|
1678
1678
|
body: "websocket.close",
|
|
1679
|
-
attributes:
|
|
1679
|
+
attributes: E(E(E({}, m), F({
|
|
1680
1680
|
errorType: e.wasClean ? "none" : "network",
|
|
1681
1681
|
eventLabel: "WebSocket 关闭",
|
|
1682
|
-
result: e.wasClean ?
|
|
1682
|
+
result: e.wasClean ? N.success : N.warning,
|
|
1683
1683
|
spanSubtype: "websocket",
|
|
1684
|
-
spanType:
|
|
1685
|
-
targetLabel:
|
|
1684
|
+
spanType: P.custom,
|
|
1685
|
+
targetLabel: g,
|
|
1686
1686
|
targetValue: e.code
|
|
1687
1687
|
})), {}, {
|
|
1688
1688
|
"websocket.close.code": e.code,
|
|
@@ -1694,12 +1694,12 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1694
1694
|
let ee = e.send.bind(e);
|
|
1695
1695
|
e.send = (e) => {
|
|
1696
1696
|
if (!u()) {
|
|
1697
|
-
let t =
|
|
1698
|
-
d.add(1, t), i.add(
|
|
1697
|
+
let t = E(E({}, h), {}, { "websocket.direction": "out" });
|
|
1698
|
+
d.add(1, t), i.add(Bn(e), t);
|
|
1699
1699
|
}
|
|
1700
1700
|
return ee(e);
|
|
1701
1701
|
};
|
|
1702
|
-
},
|
|
1702
|
+
}, Un = () => {
|
|
1703
1703
|
let e, t, n = !1;
|
|
1704
1704
|
return {
|
|
1705
1705
|
name: "websocket",
|
|
@@ -1713,12 +1713,12 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1713
1713
|
}), s = r.meter.createCounter("browser.websocket.error.count", { description: "Total number of WebSocket error events" }), c = r.meter.createHistogram("browser.websocket.connect.duration", {
|
|
1714
1714
|
unit: "ms",
|
|
1715
1715
|
description: "WebSocket connection establishment duration (only successful connects)"
|
|
1716
|
-
}), l =
|
|
1716
|
+
}), l = ft(Rn, zn), u = () => n;
|
|
1717
1717
|
t = new Proxy(i, { construct(e, t, i) {
|
|
1718
1718
|
let d = Reflect.construct(e, t, i);
|
|
1719
1719
|
if (n) return d;
|
|
1720
1720
|
let f = t[0] == null ? "" : String(t[0]);
|
|
1721
|
-
return !f ||
|
|
1721
|
+
return !f || M(r.config, f) || Hn(d, {
|
|
1722
1722
|
bytesCounter: o,
|
|
1723
1723
|
connectDurationHistogram: c,
|
|
1724
1724
|
context: r,
|
|
@@ -1734,68 +1734,68 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1734
1734
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
1735
1735
|
}
|
|
1736
1736
|
};
|
|
1737
|
-
},
|
|
1737
|
+
}, Z = "BK_RUM_SAMPLING", Wn = /* @__PURE__ */ new Map(), Gn = (e) => Wn.get(e), Kn = (e, t) => (Wn.set(e, t), t), qn = ({ sampling: e }) => {
|
|
1738
1738
|
if (e.rate <= 0) return !1;
|
|
1739
1739
|
if (e.rate >= 1) return !0;
|
|
1740
1740
|
try {
|
|
1741
|
-
let t = sessionStorage.getItem(
|
|
1741
|
+
let t = sessionStorage.getItem(Z);
|
|
1742
1742
|
if (t) return t === "1";
|
|
1743
1743
|
let n = Math.random() < e.rate;
|
|
1744
|
-
return sessionStorage.setItem(
|
|
1744
|
+
return sessionStorage.setItem(Z, n ? "1" : "0"), Kn(Z, n), n;
|
|
1745
1745
|
} catch (t) {
|
|
1746
|
-
let n =
|
|
1747
|
-
return typeof n == "boolean" ? n :
|
|
1746
|
+
let n = Gn(Z);
|
|
1747
|
+
return typeof n == "boolean" ? n : Kn(Z, Math.random() < e.rate);
|
|
1748
1748
|
}
|
|
1749
|
-
},
|
|
1749
|
+
}, Jn = (e) => ({
|
|
1750
1750
|
url: e.endpoint,
|
|
1751
1751
|
headers: e.headers,
|
|
1752
1752
|
concurrencyLimit: e.concurrencyLimit,
|
|
1753
1753
|
timeoutMillis: e.timeoutMillis
|
|
1754
|
-
}),
|
|
1754
|
+
}), Yn = "bk-rum", Q = (e, t, n) => n ? new Proxy(e, { get(e, n, r) {
|
|
1755
1755
|
if (n === "export") return (n, r) => {
|
|
1756
1756
|
var i;
|
|
1757
1757
|
return (i = globalThis.console) == null || i.log(`[bk-ot][${t}]`, n), e.export(n, r);
|
|
1758
1758
|
};
|
|
1759
1759
|
let i = Reflect.get(e, n, r);
|
|
1760
1760
|
return typeof i == "function" ? i.bind(e) : i;
|
|
1761
|
-
} }) : e, Xn = (e) => [
|
|
1762
|
-
...$(e.device, !0,
|
|
1763
|
-
...$(e.session, !0,
|
|
1764
|
-
...$(e.pageView, !0,
|
|
1765
|
-
...$(e.httpBody, !1,
|
|
1761
|
+
} }) : e, Xn = (e) => [dt(e.instrumentations)], Zn = (e, t) => e === void 0 ? t : e !== !1, Qn = (e) => typeof e == "object" && e ? e : void 0, $ = (e, t, n) => Zn(e, t) ? [n(Qn(e))] : [], $n = (e) => [
|
|
1762
|
+
...$(e.device, !0, kt),
|
|
1763
|
+
...$(e.session, !0, An),
|
|
1764
|
+
...$(e.pageView, !0, pn),
|
|
1765
|
+
...$(e.httpBody, !1, nn),
|
|
1766
1766
|
...$(e.error, !0, zt),
|
|
1767
|
-
...$(e.webVitals, !0,
|
|
1768
|
-
...$(e.resource, !0,
|
|
1769
|
-
...$(e.blankScreen, !0,
|
|
1770
|
-
...$(e.action, !1,
|
|
1771
|
-
...$(e.websocket, !1,
|
|
1772
|
-
...$(e.longTask, !1,
|
|
1773
|
-
...$(e.cspViolation, !1,
|
|
1774
|
-
...$(e.routeTiming, !1,
|
|
1767
|
+
...$(e.webVitals, !0, In),
|
|
1768
|
+
...$(e.resource, !0, hn),
|
|
1769
|
+
...$(e.blankScreen, !0, rt),
|
|
1770
|
+
...$(e.action, !1, Ue),
|
|
1771
|
+
...$(e.websocket, !1, Un),
|
|
1772
|
+
...$(e.longTask, !1, on),
|
|
1773
|
+
...$(e.cspViolation, !1, _t),
|
|
1774
|
+
...$(e.routeTiming, !1, gn)
|
|
1775
1775
|
], er = class {
|
|
1776
1776
|
assertBeforeStart(e) {
|
|
1777
1777
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
1778
1778
|
}
|
|
1779
1779
|
constructor(o) {
|
|
1780
|
-
var
|
|
1781
|
-
|
|
1780
|
+
var S = this, re, C;
|
|
1781
|
+
w(this, "loggerProvider", void 0), w(this, "meterProvider", void 0), w(this, "phase", "idle"), w(this, "pluginManager", void 0), w(this, "plugins", void 0), w(this, "registeredInstrumentations", void 0), w(this, "runtimeContext", void 0), w(this, "sampled", void 0), w(this, "teardownCallbacks", []), w(this, "tracerProvider", void 0), w(this, "applyRedact", (e) => this.config.hooks.redactAttributes(e)), w(this, "config", void 0), w(this, "emitLog", (e) => {
|
|
1782
1782
|
var t;
|
|
1783
|
-
let n =
|
|
1783
|
+
let n = E(E({}, e), {}, { attributes: this.applyRedact(E(E({}, this.getRuntimeAttributes()), (t = e.attributes) == null ? {} : t)) });
|
|
1784
1784
|
this.logger.emit(n);
|
|
1785
|
-
}),
|
|
1786
|
-
yield
|
|
1787
|
-
})),
|
|
1785
|
+
}), w(this, "flush", A(function* () {
|
|
1786
|
+
yield S.pluginManager.flush(), yield S.tracerProvider.forceFlush(), yield S.meterProvider.forceFlush(), yield S.loggerProvider.forceFlush();
|
|
1787
|
+
})), w(this, "getRuntimeAttributes", () => this.runtimeContext.getAttributes()), w(this, "logger", void 0), w(this, "meter", void 0), w(this, "reportAction", ({ attributes: e = {}, targetTag: t, targetText: n, type: r }) => {
|
|
1788
1788
|
var i;
|
|
1789
1789
|
if (!this.sampled) return;
|
|
1790
1790
|
let a = n == null ? void 0 : n.slice(0, 32);
|
|
1791
|
-
this.startSpan(`action.${r}`,
|
|
1791
|
+
this.startSpan(`action.${r}`, E(E(E(E(E({}, this.config.hooks.getPageAttributes()), F({
|
|
1792
1792
|
errorType: "none",
|
|
1793
1793
|
eventLabel: "用户操作",
|
|
1794
1794
|
spanSubtype: r,
|
|
1795
|
-
spanType:
|
|
1795
|
+
spanType: P.action,
|
|
1796
1796
|
targetLabel: (i = a == null ? t : a) == null ? r : i
|
|
1797
|
-
})), {}, { [
|
|
1798
|
-
}),
|
|
1797
|
+
})), {}, { [x.actionType]: r }, a ? { [x.targetTextShort]: a } : {}), t ? { [x.targetTag]: t } : {}), e)).end();
|
|
1798
|
+
}), w(this, "reportCustomEvent", ({ attributes: e = {}, error: n, name: r }) => {
|
|
1799
1799
|
if (!this.sampled) {
|
|
1800
1800
|
if (this.config.debug) {
|
|
1801
1801
|
var i;
|
|
@@ -1803,95 +1803,95 @@ var Je = (e) => typeof e == "string" && e.length > 0 ? e : void 0, Ye = (e) => {
|
|
|
1803
1803
|
}
|
|
1804
1804
|
return;
|
|
1805
1805
|
}
|
|
1806
|
-
let a = this.startSpan(`custom.${r}`,
|
|
1806
|
+
let a = this.startSpan(`custom.${r}`, E(E(E(E(E({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), F({
|
|
1807
1807
|
errorType: n ? "custom" : "none",
|
|
1808
1808
|
eventLabel: "自定义事件",
|
|
1809
|
-
result: n ?
|
|
1809
|
+
result: n ? N.error : N.success,
|
|
1810
1810
|
spanSubtype: r,
|
|
1811
|
-
spanType:
|
|
1811
|
+
spanType: P.custom,
|
|
1812
1812
|
targetLabel: r
|
|
1813
1813
|
})), e), {}, { "rum.custom.name": r }));
|
|
1814
1814
|
n && (a.recordException(n), a.setStatus({
|
|
1815
1815
|
code: t.ERROR,
|
|
1816
1816
|
message: n.message
|
|
1817
1817
|
})), a.end();
|
|
1818
|
-
}),
|
|
1818
|
+
}), w(this, "setRuntimeAttributes", (e) => {
|
|
1819
1819
|
this.runtimeContext.setAttributes(e);
|
|
1820
|
-
}),
|
|
1820
|
+
}), w(this, "setUser", (e) => {
|
|
1821
1821
|
this.runtimeContext.setUser(e);
|
|
1822
|
-
}),
|
|
1822
|
+
}), w(this, "setView", (e) => {
|
|
1823
1823
|
this.runtimeContext.setView(e);
|
|
1824
|
-
}),
|
|
1825
|
-
if (
|
|
1826
|
-
for (yield
|
|
1824
|
+
}), w(this, "shutdown", A(function* () {
|
|
1825
|
+
if (S.phase !== "stopped") {
|
|
1826
|
+
for (yield S.flush(); S.teardownCallbacks.length;) {
|
|
1827
1827
|
var e;
|
|
1828
|
-
(e =
|
|
1828
|
+
(e = S.teardownCallbacks.pop()) == null || e();
|
|
1829
1829
|
}
|
|
1830
|
-
for (yield
|
|
1830
|
+
for (yield S.pluginManager.shutdown(); S.registeredInstrumentations.length;) {
|
|
1831
1831
|
var t, i;
|
|
1832
|
-
(t =
|
|
1832
|
+
(t = S.registeredInstrumentations.pop()) == null || (i = t.disable) == null || i.call(t);
|
|
1833
1833
|
}
|
|
1834
|
-
yield
|
|
1834
|
+
yield S.tracerProvider.shutdown(), yield S.meterProvider.shutdown(), yield S.loggerProvider.shutdown(), a.disable(), r.disable(), n.disable(), S.phase = "stopped";
|
|
1835
1835
|
}
|
|
1836
|
-
})),
|
|
1837
|
-
if (!(
|
|
1838
|
-
if (
|
|
1839
|
-
if (!
|
|
1840
|
-
|
|
1836
|
+
})), w(this, "start", A(function* () {
|
|
1837
|
+
if (!(S.phase === "started" || S.phase === "starting")) {
|
|
1838
|
+
if (S.phase === "stopped") throw Error("[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.");
|
|
1839
|
+
if (!S.config.enabled) {
|
|
1840
|
+
S.phase = "started";
|
|
1841
1841
|
return;
|
|
1842
1842
|
}
|
|
1843
|
-
|
|
1843
|
+
S.phase = "starting", i.setGlobalPropagator(new l()), S.tracerProvider.register({ contextManager: new c() }), r.setGlobalMeterProvider(S.meterProvider), s.setGlobalLoggerProvider(S.loggerProvider);
|
|
1844
1844
|
try {
|
|
1845
|
-
if (
|
|
1846
|
-
instrumentations:
|
|
1847
|
-
meterProvider:
|
|
1848
|
-
tracerProvider:
|
|
1849
|
-
}), yield
|
|
1845
|
+
if (S.registeredInstrumentations.length && p({
|
|
1846
|
+
instrumentations: S.registeredInstrumentations,
|
|
1847
|
+
meterProvider: S.meterProvider,
|
|
1848
|
+
tracerProvider: S.tracerProvider
|
|
1849
|
+
}), yield S.pluginManager.start(S), typeof window < "u" && typeof document < "u") {
|
|
1850
1850
|
let e = () => {
|
|
1851
|
-
|
|
1851
|
+
S.flush();
|
|
1852
1852
|
}, t = () => {
|
|
1853
|
-
document.visibilityState === "hidden" &&
|
|
1853
|
+
document.visibilityState === "hidden" && S.flush();
|
|
1854
1854
|
};
|
|
1855
|
-
window.addEventListener("pagehide", e), document.addEventListener("visibilitychange", t),
|
|
1855
|
+
window.addEventListener("pagehide", e), document.addEventListener("visibilitychange", t), S.teardownCallbacks.push(() => window.removeEventListener("pagehide", e), () => document.removeEventListener("visibilitychange", t));
|
|
1856
1856
|
}
|
|
1857
1857
|
} catch (i) {
|
|
1858
|
-
for (;
|
|
1858
|
+
for (; S.teardownCallbacks.length;) {
|
|
1859
1859
|
var e;
|
|
1860
|
-
(e =
|
|
1860
|
+
(e = S.teardownCallbacks.pop()) == null || e();
|
|
1861
1861
|
}
|
|
1862
|
-
yield
|
|
1863
|
-
for (let e of
|
|
1862
|
+
yield S.pluginManager.shutdown();
|
|
1863
|
+
for (let e of S.registeredInstrumentations) {
|
|
1864
1864
|
var t;
|
|
1865
1865
|
(t = e.disable) == null || t.call(e);
|
|
1866
1866
|
}
|
|
1867
|
-
throw a.disable(), r.disable(), n.disable(),
|
|
1867
|
+
throw a.disable(), r.disable(), n.disable(), S.phase = "idle", i;
|
|
1868
1868
|
}
|
|
1869
|
-
|
|
1869
|
+
S.phase = "started";
|
|
1870
1870
|
}
|
|
1871
|
-
})),
|
|
1871
|
+
})), w(this, "startSpan", (t, n = {}, r) => this.tracer.startSpan(t, {
|
|
1872
1872
|
kind: e.INTERNAL,
|
|
1873
1873
|
startTime: r == null ? void 0 : r.startTime,
|
|
1874
|
-
attributes: this.applyRedact(
|
|
1875
|
-
})),
|
|
1876
|
-
let
|
|
1877
|
-
exporter:
|
|
1874
|
+
attributes: this.applyRedact(E(E({}, this.getRuntimeAttributes()), n))
|
|
1875
|
+
})), w(this, "tracer", void 0), w(this, "use", (e) => (this.assertBeforeStart("use"), this.sampled && this.plugins.push(e), this)), w(this, "useInstrumentation", (e) => (this.assertBeforeStart("useInstrumentation"), this.config.enabled && this.registeredInstrumentations.push(e), this)), this.config = ge(o), this.sampled = this.config.enabled && qn(this.config);
|
|
1876
|
+
let T = m(this.config.resourceAttributes), D = Q(new f(Jn(this.config.transport.traces)), "traces", this.config.debug), ie = Q(new d(Jn(this.config.transport.metrics)), "metrics", this.config.debug), ae = Q(new u(Jn(this.config.transport.logs)), "logs", this.config.debug), O = new Ae(this.config.spanProcessor === "simple" ? new ee(D) : new y(D, this.config.spanBatch), this.config), oe = new v({
|
|
1877
|
+
exporter: ie,
|
|
1878
1878
|
exportIntervalMillis: this.config.metricIntervalMillis
|
|
1879
|
-
}),
|
|
1880
|
-
this.tracerProvider = new
|
|
1881
|
-
resource:
|
|
1882
|
-
sampler: new
|
|
1883
|
-
spanProcessors: [
|
|
1879
|
+
}), k = new h(ae);
|
|
1880
|
+
this.tracerProvider = new ne({
|
|
1881
|
+
resource: T,
|
|
1882
|
+
sampler: new b({ root: new te(+!!this.sampled) }),
|
|
1883
|
+
spanProcessors: [O]
|
|
1884
1884
|
}), this.meterProvider = new _({
|
|
1885
|
-
resource:
|
|
1886
|
-
readers: [
|
|
1885
|
+
resource: T,
|
|
1886
|
+
readers: [oe]
|
|
1887
1887
|
}), this.loggerProvider = new g({
|
|
1888
|
-
resource:
|
|
1889
|
-
processors: [
|
|
1890
|
-
}), this.tracer = this.tracerProvider.getTracer(
|
|
1888
|
+
resource: T,
|
|
1889
|
+
processors: [k]
|
|
1890
|
+
}), this.tracer = this.tracerProvider.getTracer(Yn), this.meter = this.meterProvider.getMeter(Yn), this.logger = this.loggerProvider.getLogger(Yn), this.runtimeContext = new je({ "rum.sampled": this.sampled }, this.config.user), this.registeredInstrumentations = this.config.enabled ? [...(re = this.config.instrumentations.custom) == null ? [] : re] : [], this.plugins = [...this.config.enabled ? Xn(this.config) : [], ...this.sampled ? [...$n(this.config.plugins), ...(C = this.config.plugins.custom) == null ? [] : C] : []], this.pluginManager = new be(this.plugins), this.config.autoStart && this.start().catch((e) => {
|
|
1891
1891
|
var t;
|
|
1892
1892
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
1893
1893
|
});
|
|
1894
1894
|
}
|
|
1895
1895
|
};
|
|
1896
1896
|
//#endregion
|
|
1897
|
-
export { er as BkOpenTelemetry,
|
|
1897
|
+
export { er as BkOpenTelemetry, Ae as FilteringSpanProcessor, x as RUM_ATTRIBUTES, N as RUM_SPAN_RESULT, P as RUM_SPAN_TYPE, je as RumRuntimeContext, F as buildRumSpanAttributes, Ue as createActionPlugin, rt as createBlankScreenPlugin, dt as createCommonInstrumentationsPlugin, _t as createCspViolationPlugin, kt as createDevicePlugin, zt as createErrorPlugin, nn as createHttpBodyPlugin, on as createLongTaskPlugin, pn as createPageViewPlugin, ye as createPlugin, hn as createResourcePlugin, gn as createRouteTimingPlugin, An as createSessionPlugin, Un as createWebSocketPlugin, In as createWebVitalsPlugin, Me as getDurationBucket, ge as resolveConfig };
|