adonisjs-server-stats 1.6.5 → 1.6.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/README.md +1 -0
- package/dist/core/api-client.d.ts.map +1 -1
- package/dist/core/dashboard-api.d.ts +2 -1
- package/dist/core/dashboard-api.d.ts.map +1 -1
- package/dist/core/dashboard-data-controller.d.ts +2 -0
- package/dist/core/dashboard-data-controller.d.ts.map +1 -1
- package/dist/core/debug-data-controller.d.ts +1 -0
- package/dist/core/debug-data-controller.d.ts.map +1 -1
- package/dist/core/history-buffer.d.ts.map +1 -1
- package/dist/core/index.js +405 -362
- package/dist/core/server-stats-controller.d.ts +1 -0
- package/dist/core/server-stats-controller.d.ts.map +1 -1
- package/dist/core/sparkline.d.ts.map +1 -1
- package/dist/core/trace-utils.d.ts +1 -1
- package/dist/react/core/api-client.d.ts.map +1 -1
- package/dist/react/core/dashboard-api.d.ts +2 -1
- package/dist/react/core/dashboard-api.d.ts.map +1 -1
- package/dist/react/core/dashboard-data-controller.d.ts +2 -0
- package/dist/react/core/dashboard-data-controller.d.ts.map +1 -1
- package/dist/react/core/debug-data-controller.d.ts +1 -0
- package/dist/react/core/debug-data-controller.d.ts.map +1 -1
- package/dist/react/core/history-buffer.d.ts.map +1 -1
- package/dist/react/core/server-stats-controller.d.ts +1 -0
- package/dist/react/core/server-stats-controller.d.ts.map +1 -1
- package/dist/react/core/sparkline.d.ts.map +1 -1
- package/dist/react/core/trace-utils.d.ts +1 -1
- package/dist/src/collectors/app_collector.d.ts.map +1 -1
- package/dist/src/collectors/db_pool_collector.d.ts.map +1 -1
- package/dist/src/collectors/http_collector.d.ts.map +1 -1
- package/dist/src/collectors/http_collector.js +3 -0
- package/dist/src/collectors/log_collector.d.ts.map +1 -1
- package/dist/src/collectors/log_collector.js +4 -0
- package/dist/src/collectors/redis_collector.d.ts.map +1 -1
- package/dist/src/controller/debug_controller.d.ts +3 -1
- package/dist/src/controller/debug_controller.d.ts.map +1 -1
- package/dist/src/controller/debug_controller.js +25 -20
- package/dist/src/dashboard/chart_aggregator.js +42 -41
- package/dist/src/dashboard/dashboard_controller.d.ts.map +1 -1
- package/dist/src/dashboard/dashboard_controller.js +7 -5
- package/dist/src/dashboard/dashboard_store.d.ts +61 -19
- package/dist/src/dashboard/dashboard_store.d.ts.map +1 -1
- package/dist/src/dashboard/dashboard_store.js +677 -474
- package/dist/src/dashboard/integrations/config_inspector.d.ts +4 -0
- package/dist/src/dashboard/integrations/config_inspector.d.ts.map +1 -1
- package/dist/src/dashboard/integrations/config_inspector.js +16 -2
- package/dist/src/dashboard/migrator.d.ts.map +1 -1
- package/dist/src/dashboard/migrator.js +27 -4
- package/dist/src/data/data_access.d.ts.map +1 -1
- package/dist/src/data/data_access.js +26 -6
- package/dist/src/debug/debug_store.d.ts.map +1 -1
- package/dist/src/debug/debug_store.js +17 -7
- package/dist/src/debug/email_collector.d.ts +2 -0
- package/dist/src/debug/email_collector.d.ts.map +1 -1
- package/dist/src/debug/email_collector.js +17 -13
- package/dist/src/debug/event_collector.d.ts +7 -1
- package/dist/src/debug/event_collector.d.ts.map +1 -1
- package/dist/src/debug/event_collector.js +46 -17
- package/dist/src/debug/query_collector.d.ts +12 -0
- package/dist/src/debug/query_collector.d.ts.map +1 -1
- package/dist/src/debug/query_collector.js +35 -5
- package/dist/src/debug/ring_buffer.d.ts +14 -0
- package/dist/src/debug/ring_buffer.d.ts.map +1 -1
- package/dist/src/debug/ring_buffer.js +48 -2
- package/dist/src/debug/trace_collector.d.ts +1 -0
- package/dist/src/debug/trace_collector.d.ts.map +1 -1
- package/dist/src/debug/trace_collector.js +4 -1
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +5 -1
- package/dist/src/edge/client/dashboard.js +2 -2
- package/dist/src/edge/client/debug-panel-deferred.js +1 -1
- package/dist/src/edge/client/debug-panel.js +1 -1
- package/dist/src/edge/client/stats-bar.js +1 -1
- package/dist/src/edge/client-vue/dashboard.js +5 -5
- package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
- package/dist/src/edge/client-vue/debug-panel.js +2 -2
- package/dist/src/edge/client-vue/stats-bar.js +3 -3
- package/dist/src/engine/request_metrics.d.ts.map +1 -1
- package/dist/src/engine/request_metrics.js +33 -3
- package/dist/src/engine/stats_engine.d.ts.map +1 -1
- package/dist/src/engine/stats_engine.js +12 -2
- package/dist/src/log_stream/log_stream_provider.js +1 -1
- package/dist/src/log_stream/log_stream_service.d.ts +1 -0
- package/dist/src/log_stream/log_stream_service.d.ts.map +1 -1
- package/dist/src/log_stream/log_stream_service.js +13 -3
- package/dist/src/prometheus/prometheus_collector.d.ts +1 -1
- package/dist/src/prometheus/prometheus_collector.d.ts.map +1 -1
- package/dist/src/provider/server_stats_provider.d.ts.map +1 -1
- package/dist/src/provider/server_stats_provider.js +17 -31
- package/dist/src/stubs/config.stub +3 -0
- package/dist/src/types.d.ts +12 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts +7 -5
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/logger.js +27 -5
- package/package.json +6 -2
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class w extends Error {
|
|
2
2
|
status;
|
|
3
3
|
constructor(t = 403) {
|
|
4
4
|
super(`Unauthorized (HTTP ${t})`), this.name = "UnauthorizedError", this.status = t;
|
|
@@ -11,7 +11,7 @@ class I extends Error {
|
|
|
11
11
|
super(`API error (HTTP ${t})`), this.name = "ApiError", this.status = t, this.body = r;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class T {
|
|
15
15
|
baseUrl;
|
|
16
16
|
authToken;
|
|
17
17
|
constructor(t) {
|
|
@@ -36,8 +36,10 @@ class w {
|
|
|
36
36
|
headers: i,
|
|
37
37
|
credentials: this.authToken ? "omit" : "include"
|
|
38
38
|
});
|
|
39
|
+
if (r?.signal?.aborted)
|
|
40
|
+
throw new DOMException("The operation was aborted.", "AbortError");
|
|
39
41
|
if (s.status === 401 || s.status === 403)
|
|
40
|
-
throw new
|
|
42
|
+
throw new w(s.status);
|
|
41
43
|
if (!s.ok) {
|
|
42
44
|
const o = await s.text().catch(() => "");
|
|
43
45
|
throw new I(s.status, o);
|
|
@@ -82,7 +84,7 @@ class w {
|
|
|
82
84
|
return this.fetch(t, { method: "DELETE" });
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
|
-
async function
|
|
87
|
+
async function _() {
|
|
86
88
|
if (typeof window < "u" && window.Transmit && typeof window.Transmit == "function")
|
|
87
89
|
return window.Transmit;
|
|
88
90
|
try {
|
|
@@ -92,11 +94,11 @@ async function O() {
|
|
|
92
94
|
return null;
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
|
-
function
|
|
97
|
+
function B(e) {
|
|
96
98
|
let t = null, r = null, n = !1;
|
|
97
99
|
return { subscribe: async () => {
|
|
98
100
|
try {
|
|
99
|
-
const o = await
|
|
101
|
+
const o = await _();
|
|
100
102
|
if (!o)
|
|
101
103
|
throw new Error(
|
|
102
104
|
"Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)"
|
|
@@ -105,14 +107,14 @@ function _(e) {
|
|
|
105
107
|
t = new o({
|
|
106
108
|
baseUrl: e.baseUrl || window.location.origin,
|
|
107
109
|
...e.authToken ? {
|
|
108
|
-
beforeSubscribe(
|
|
110
|
+
beforeSubscribe(l) {
|
|
109
111
|
return {
|
|
110
112
|
headers: {
|
|
111
113
|
Authorization: `Bearer ${e.authToken}`
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
116
|
},
|
|
115
|
-
beforeUnsubscribe(
|
|
117
|
+
beforeUnsubscribe(l) {
|
|
116
118
|
return {
|
|
117
119
|
headers: {
|
|
118
120
|
Authorization: `Bearer ${e.authToken}`
|
|
@@ -120,8 +122,8 @@ function _(e) {
|
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
} : {}
|
|
123
|
-
}), r = t.subscription(e.channelName), r.onMessage((
|
|
124
|
-
n || e.onMessage(
|
|
125
|
+
}), r = t.subscription(e.channelName), r.onMessage((l) => {
|
|
126
|
+
n || e.onMessage(l);
|
|
125
127
|
}), await r.create();
|
|
126
128
|
} catch (o) {
|
|
127
129
|
e.onError && e.onError(o);
|
|
@@ -134,9 +136,9 @@ function _(e) {
|
|
|
134
136
|
}
|
|
135
137
|
} };
|
|
136
138
|
}
|
|
137
|
-
function
|
|
139
|
+
function H(e) {
|
|
138
140
|
let t = !1;
|
|
139
|
-
const r =
|
|
141
|
+
const r = B({
|
|
140
142
|
baseUrl: e.baseUrl,
|
|
141
143
|
channelName: e.channelName,
|
|
142
144
|
authToken: e.authToken,
|
|
@@ -156,38 +158,38 @@ function B(e) {
|
|
|
156
158
|
}
|
|
157
159
|
};
|
|
158
160
|
}
|
|
159
|
-
const
|
|
160
|
-
function
|
|
161
|
+
const v = "ss-dash-theme", M = "ss-theme-change";
|
|
162
|
+
function U() {
|
|
161
163
|
if (typeof window > "u") return "light";
|
|
162
|
-
const e = localStorage.getItem(
|
|
164
|
+
const e = localStorage.getItem(v);
|
|
163
165
|
return e === "dark" || e === "light" ? e : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
164
166
|
}
|
|
165
|
-
function
|
|
166
|
-
typeof window > "u" || (localStorage.setItem(
|
|
167
|
+
function N(e) {
|
|
168
|
+
typeof window > "u" || (localStorage.setItem(v, e), window.dispatchEvent(new CustomEvent(M, { detail: e })));
|
|
167
169
|
}
|
|
168
|
-
function
|
|
169
|
-
const t =
|
|
170
|
-
return
|
|
170
|
+
function $e() {
|
|
171
|
+
const t = U() === "dark" ? "light" : "dark";
|
|
172
|
+
return N(t), t;
|
|
171
173
|
}
|
|
172
|
-
function
|
|
174
|
+
function Ae(e) {
|
|
173
175
|
if (typeof window > "u") return () => {
|
|
174
176
|
};
|
|
175
177
|
const t = (s) => {
|
|
176
178
|
const o = s.detail;
|
|
177
179
|
(o === "dark" || o === "light") && e(o);
|
|
178
180
|
}, r = (s) => {
|
|
179
|
-
if (s.key ===
|
|
181
|
+
if (s.key === v) {
|
|
180
182
|
const o = s.newValue;
|
|
181
|
-
e(o === "dark" || o === "light" ? o :
|
|
183
|
+
e(o === "dark" || o === "light" ? o : U());
|
|
182
184
|
}
|
|
183
185
|
}, n = window.matchMedia("(prefers-color-scheme: dark)"), i = (s) => {
|
|
184
|
-
localStorage.getItem(
|
|
186
|
+
localStorage.getItem(v) || e(s.matches ? "dark" : "light");
|
|
185
187
|
};
|
|
186
|
-
return window.addEventListener(
|
|
187
|
-
window.removeEventListener(
|
|
188
|
+
return window.addEventListener(M, t), window.addEventListener("storage", r), n.addEventListener("change", i), () => {
|
|
189
|
+
window.removeEventListener(M, t), window.removeEventListener("storage", r), n.removeEventListener("change", i);
|
|
188
190
|
};
|
|
189
191
|
}
|
|
190
|
-
const
|
|
192
|
+
const y = {
|
|
191
193
|
color: "#34d399",
|
|
192
194
|
fillOpacityTop: 0.25,
|
|
193
195
|
fillOpacityBottom: 0.02,
|
|
@@ -196,64 +198,74 @@ const f = {
|
|
|
196
198
|
height: 32,
|
|
197
199
|
padding: 2
|
|
198
200
|
};
|
|
199
|
-
function
|
|
200
|
-
return { ...
|
|
201
|
+
function q(e) {
|
|
202
|
+
return { ...y, ...e };
|
|
201
203
|
}
|
|
202
|
-
function
|
|
204
|
+
function Le(e, t = y.width, r = y.height, n = y.padding) {
|
|
203
205
|
if (e.length < 2) return null;
|
|
204
|
-
const i = t - n * 2, s = r - n * 2, o = Math.min(...e),
|
|
205
|
-
return e.map((
|
|
206
|
-
const
|
|
207
|
-
return `${
|
|
206
|
+
const i = t - n * 2, s = r - n * 2, o = Math.min(...e), a = Math.max(...e) - o || 1;
|
|
207
|
+
return e.map((m, d) => {
|
|
208
|
+
const f = n + d / (e.length - 1) * i, p = n + s - (m - o) / a * s;
|
|
209
|
+
return `${f.toFixed(1)},${p.toFixed(1)}`;
|
|
208
210
|
}).join(" ");
|
|
209
211
|
}
|
|
210
|
-
function
|
|
212
|
+
function Re(e, t = y.width, r = y.height, n = y.padding) {
|
|
211
213
|
if (e.length < 2) return null;
|
|
212
|
-
const i = t - n * 2, s = r - n * 2, o = Math.min(...e),
|
|
213
|
-
const
|
|
214
|
-
return `${
|
|
215
|
-
}),
|
|
216
|
-
return `M${
|
|
214
|
+
const i = t - n * 2, s = r - n * 2, o = Math.min(...e), a = Math.max(...e) - o || 1, h = e.map((p, x) => {
|
|
215
|
+
const u = n + x / (e.length - 1) * i, E = n + s - (p - o) / a * s;
|
|
216
|
+
return `${u.toFixed(1)},${E.toFixed(1)}`;
|
|
217
|
+
}), m = (n + i).toFixed(1), d = (n + s).toFixed(1), f = n.toFixed(1);
|
|
218
|
+
return `M${h[0]} ` + h.slice(1).map((p) => `L${p}`).join(" ") + ` L${m},${d} L${f},${d} Z`;
|
|
217
219
|
}
|
|
218
|
-
let
|
|
219
|
-
function
|
|
220
|
-
return `ss-grad-${
|
|
220
|
+
let K = 0;
|
|
221
|
+
function z() {
|
|
222
|
+
return `ss-grad-${K++}`;
|
|
221
223
|
}
|
|
222
|
-
function
|
|
224
|
+
function W(e) {
|
|
223
225
|
if (e.length === 0) return null;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
226
|
+
let t = e[0], r = e[0], n = e[0];
|
|
227
|
+
for (let i = 1; i < e.length; i++) {
|
|
228
|
+
const s = e[i];
|
|
229
|
+
s < t && (t = s), s > r && (r = s), n += s;
|
|
230
|
+
}
|
|
231
|
+
return { min: t, max: r, avg: n / e.length };
|
|
232
|
+
}
|
|
233
|
+
function Ue(e, t) {
|
|
234
|
+
if (e.length < 2) return null;
|
|
235
|
+
const r = q(t), n = W(e), i = n.max - n.min || 1, s = r.width - r.padding * 2, o = r.height - r.padding * 2, l = r.padding, a = e.length, h = Array.from({ length: a });
|
|
236
|
+
for (let u = 0; u < a; u++) {
|
|
237
|
+
const E = l + u / (a - 1) * s, O = l + o - (e[u] - n.min) / i * o;
|
|
238
|
+
h[u] = `${E.toFixed(1)},${O.toFixed(1)}`;
|
|
239
|
+
}
|
|
240
|
+
const m = h.join(" "), d = (l + s).toFixed(1), f = (l + o).toFixed(1), p = l.toFixed(1), x = `M${h[0]} ` + h.slice(1).map((u) => `L${u}`).join(" ") + ` L${d},${f} L${p},${f} Z`;
|
|
241
|
+
return {
|
|
242
|
+
points: m,
|
|
243
|
+
areaPath: x,
|
|
244
|
+
gradientId: z(),
|
|
233
245
|
options: r,
|
|
234
|
-
stats:
|
|
246
|
+
stats: n
|
|
235
247
|
};
|
|
236
248
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
249
|
+
const V = 5e3, j = 1e4, G = 3e3, J = 100, Q = 500;
|
|
250
|
+
function X(e) {
|
|
239
251
|
if (!e && e !== 0) return "-";
|
|
240
252
|
const t = Math.floor(e), r = Math.floor(t / 86400), n = Math.floor(t % 86400 / 3600), i = Math.floor(t % 3600 / 60);
|
|
241
253
|
return r > 0 ? `${r}d ${n}h` : n > 0 ? `${n}h ${i}m` : i > 0 ? `${i}m ${t % 60}s` : `${t}s`;
|
|
242
254
|
}
|
|
243
|
-
function
|
|
255
|
+
function P(e) {
|
|
244
256
|
const t = e / 1048576;
|
|
245
257
|
return t >= 1024 ? `${(t / 1024).toFixed(1)}G` : `${t.toFixed(0)}M`;
|
|
246
258
|
}
|
|
247
|
-
function
|
|
259
|
+
function $(e) {
|
|
248
260
|
return e >= 1024 ? `${(e / 1024).toFixed(1)}G` : `${e.toFixed(1)}M`;
|
|
249
261
|
}
|
|
250
|
-
function
|
|
262
|
+
function Y(e) {
|
|
251
263
|
return e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}K` : `${e}`;
|
|
252
264
|
}
|
|
253
|
-
function
|
|
265
|
+
function De(e) {
|
|
254
266
|
return e >= 1e3 ? `${(e / 1e3).toFixed(2)}s` : e >= 1 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`;
|
|
255
267
|
}
|
|
256
|
-
function
|
|
268
|
+
function Fe(e) {
|
|
257
269
|
if (!e) return "-";
|
|
258
270
|
const t = typeof e == "string" ? new Date(e) : new Date(e);
|
|
259
271
|
return Number.isNaN(t.getTime()) ? "-" : t.toLocaleTimeString("en-US", {
|
|
@@ -263,7 +275,7 @@ function De(e) {
|
|
|
263
275
|
second: "2-digit"
|
|
264
276
|
}) + "." + String(t.getMilliseconds()).padStart(3, "0");
|
|
265
277
|
}
|
|
266
|
-
function
|
|
278
|
+
function Oe(e) {
|
|
267
279
|
if (!e) return "-";
|
|
268
280
|
const t = typeof e == "string" ? new Date(e).getTime() : e, r = Math.floor((Date.now() - t) / 1e3);
|
|
269
281
|
return r < 0 ? "just now" : r < 60 ? `${r}s ago` : r < 3600 ? `${Math.floor(r / 60)}m ago` : r < 86400 ? `${Math.floor(r / 3600)}h ago` : `${Math.floor(r / 86400)}d ago`;
|
|
@@ -277,7 +289,7 @@ function Ie(e, t) {
|
|
|
277
289
|
case "MB":
|
|
278
290
|
return `${e.toFixed(1)}M`;
|
|
279
291
|
case "bytes":
|
|
280
|
-
return
|
|
292
|
+
return P(e);
|
|
281
293
|
case "/s":
|
|
282
294
|
case "/m":
|
|
283
295
|
return e.toFixed(1);
|
|
@@ -285,40 +297,40 @@ function Ie(e, t) {
|
|
|
285
297
|
return e.toFixed(1);
|
|
286
298
|
}
|
|
287
299
|
}
|
|
288
|
-
function
|
|
300
|
+
function S(e, t, r) {
|
|
289
301
|
return e > r ? "red" : e > t ? "amber" : "green";
|
|
290
302
|
}
|
|
291
|
-
function
|
|
303
|
+
function Z(e, t, r) {
|
|
292
304
|
return e < r ? "red" : e < t ? "amber" : "green";
|
|
293
305
|
}
|
|
294
|
-
function
|
|
306
|
+
function A(e, t) {
|
|
295
307
|
if (t === 0) return "green";
|
|
296
308
|
const r = e / t;
|
|
297
309
|
return r > 0.8 ? "red" : r > 0.5 ? "amber" : "green";
|
|
298
310
|
}
|
|
299
|
-
const
|
|
311
|
+
const ee = {
|
|
300
312
|
green: "ss-green",
|
|
301
313
|
amber: "ss-amber",
|
|
302
314
|
red: "ss-red"
|
|
303
|
-
},
|
|
315
|
+
}, _e = {
|
|
304
316
|
green: "#34d399",
|
|
305
317
|
amber: "#fbbf24",
|
|
306
318
|
red: "#f87171"
|
|
307
|
-
},
|
|
319
|
+
}, Be = {
|
|
308
320
|
green: "--ss-accent",
|
|
309
321
|
amber: "--ss-amber-fg",
|
|
310
322
|
red: "--ss-red-fg"
|
|
311
323
|
};
|
|
312
|
-
function Be(e) {
|
|
313
|
-
return e >= 500 ? "red" : e >= 400 ? "amber" : "green";
|
|
314
|
-
}
|
|
315
324
|
function He(e) {
|
|
316
|
-
return e
|
|
325
|
+
return e >= 500 ? "red" : e >= 400 ? "amber" : "green";
|
|
317
326
|
}
|
|
318
327
|
function Ne(e) {
|
|
328
|
+
return e > Q ? "very-slow" : e > J ? "slow" : "normal";
|
|
329
|
+
}
|
|
330
|
+
function qe(e) {
|
|
319
331
|
return e ? e.length <= 8 ? e : e.slice(0, 8) + "…" : "--";
|
|
320
332
|
}
|
|
321
|
-
function
|
|
333
|
+
function L(e, t = 100) {
|
|
322
334
|
if (e === null) return "null";
|
|
323
335
|
if (e === void 0) return "-";
|
|
324
336
|
if (typeof e == "string")
|
|
@@ -326,7 +338,7 @@ function A(e, t = 100) {
|
|
|
326
338
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
327
339
|
if (Array.isArray(e)) {
|
|
328
340
|
if (e.length === 0) return "[]";
|
|
329
|
-
const n = "[" + e.slice(0, 3).map((i) =>
|
|
341
|
+
const n = "[" + e.slice(0, 3).map((i) => L(i, 30)).join(", ") + (e.length > 3 ? ", ..." + e.length + " items" : "") + "]";
|
|
330
342
|
return n.length > t ? "[" + e.length + " items]" : n;
|
|
331
343
|
}
|
|
332
344
|
if (typeof e == "object") {
|
|
@@ -334,20 +346,20 @@ function A(e, t = 100) {
|
|
|
334
346
|
if (r.length === 0) return "{}";
|
|
335
347
|
const n = [];
|
|
336
348
|
for (let s = 0; s < Math.min(r.length, 4); s++)
|
|
337
|
-
n.push(r[s] + ": " +
|
|
349
|
+
n.push(r[s] + ": " + L(e[r[s]], 30));
|
|
338
350
|
const i = "{ " + n.join(", ") + (r.length > 4 ? ", ...+" + (r.length - 4) : "") + " }";
|
|
339
351
|
return i.length > t ? "{ " + r.slice(0, 6).join(", ") + (r.length > 6 ? ", ..." : "") + " }" : i;
|
|
340
352
|
}
|
|
341
353
|
return String(e);
|
|
342
354
|
}
|
|
343
|
-
function
|
|
355
|
+
function Ke(e) {
|
|
344
356
|
return e < 0 ? "no expiry" : e < 60 ? `${e}s` : e < 3600 ? `${Math.floor(e / 60)}m` : e < 86400 ? `${Math.floor(e / 3600)}h` : `${Math.floor(e / 86400)}d`;
|
|
345
357
|
}
|
|
346
|
-
function
|
|
358
|
+
function ze(e) {
|
|
347
359
|
return e < 1024 ? `${e}B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)}KB` : `${(e / (1024 * 1024)).toFixed(1)}MB`;
|
|
348
360
|
}
|
|
349
|
-
const
|
|
350
|
-
function
|
|
361
|
+
const D = 50;
|
|
362
|
+
function We(e, t, r) {
|
|
351
363
|
const n = new URLSearchParams();
|
|
352
364
|
if (n.set("page", String(e.page)), n.set("perPage", String(e.perPage)), t) {
|
|
353
365
|
t.search && n.set("search", t.search);
|
|
@@ -356,7 +368,7 @@ function ze(e, t, r) {
|
|
|
356
368
|
}
|
|
357
369
|
return r && (n.set("sort", r.field), n.set("direction", r.direction)), n.toString();
|
|
358
370
|
}
|
|
359
|
-
function
|
|
371
|
+
function Ve(e, t = D) {
|
|
360
372
|
const r = e.data ?? e.items ?? [], n = e.total ?? 0, i = e.page ?? 1, s = e.perPage ?? e.limit ?? t, o = e.totalPages ?? (Math.ceil(n / s) || 1);
|
|
361
373
|
return {
|
|
362
374
|
data: r,
|
|
@@ -368,7 +380,7 @@ function We(e, t = U) {
|
|
|
368
380
|
}
|
|
369
381
|
};
|
|
370
382
|
}
|
|
371
|
-
function
|
|
383
|
+
function je(e = D) {
|
|
372
384
|
return {
|
|
373
385
|
page: 1,
|
|
374
386
|
perPage: e,
|
|
@@ -376,23 +388,23 @@ function Ve(e = U) {
|
|
|
376
388
|
totalPages: 1
|
|
377
389
|
};
|
|
378
390
|
}
|
|
379
|
-
function
|
|
391
|
+
function Ge() {
|
|
380
392
|
return {
|
|
381
393
|
search: "",
|
|
382
394
|
filters: {}
|
|
383
395
|
};
|
|
384
396
|
}
|
|
385
|
-
function
|
|
397
|
+
function Je(e = "id", t = "desc") {
|
|
386
398
|
return { field: e, direction: t };
|
|
387
399
|
}
|
|
388
|
-
function
|
|
400
|
+
function te(e) {
|
|
389
401
|
const t = new URLSearchParams();
|
|
390
402
|
if (e.page !== null && e.page !== void 0 && t.set("page", String(e.page)), e.perPage !== null && e.perPage !== void 0 && t.set("perPage", String(e.perPage)), e.search && t.set("search", e.search), e.sort && t.set("sort", e.sort), e.sortDir && t.set("direction", e.sortDir), e.timeRange && t.set("range", e.timeRange), e.filters)
|
|
391
403
|
for (const [r, n] of Object.entries(e.filters))
|
|
392
404
|
n && t.set(r, n);
|
|
393
405
|
return t.toString();
|
|
394
406
|
}
|
|
395
|
-
function
|
|
407
|
+
function Qe(e) {
|
|
396
408
|
const t = Math.max(1, Math.ceil(e.total / e.perPage)), r = Math.min(e.page, t), n = e.total === 0 ? 0 : (r - 1) * e.perPage + 1, i = Math.min(r * e.perPage, e.total);
|
|
397
409
|
return {
|
|
398
410
|
page: r,
|
|
@@ -405,7 +417,7 @@ function Je(e) {
|
|
|
405
417
|
hasNext: r < t
|
|
406
418
|
};
|
|
407
419
|
}
|
|
408
|
-
function
|
|
420
|
+
function Xe(e, t, r = 2) {
|
|
409
421
|
if (t <= 1) return [1];
|
|
410
422
|
const n = [], i = Math.max(2, e - r), s = Math.min(t - 1, e + r);
|
|
411
423
|
n.push(1), i > 2 && n.push("...");
|
|
@@ -413,7 +425,7 @@ function Qe(e, t, r = 2) {
|
|
|
413
425
|
n.push(o);
|
|
414
426
|
return s < t - 1 && n.push("..."), t > 1 && n.push(t), n;
|
|
415
427
|
}
|
|
416
|
-
const
|
|
428
|
+
const F = "/admin/api/debug", re = {
|
|
417
429
|
tracing: !1,
|
|
418
430
|
process: !1,
|
|
419
431
|
system: !1,
|
|
@@ -428,7 +440,7 @@ const D = "/admin/api/debug", ne = {
|
|
|
428
440
|
dashboard: !1,
|
|
429
441
|
customPanes: []
|
|
430
442
|
};
|
|
431
|
-
function
|
|
443
|
+
function ne(e) {
|
|
432
444
|
return {
|
|
433
445
|
tracing: e.features?.tracing ?? !1,
|
|
434
446
|
process: e.features?.process ?? !1,
|
|
@@ -445,37 +457,37 @@ function se(e) {
|
|
|
445
457
|
customPanes: e.customPanes ?? []
|
|
446
458
|
};
|
|
447
459
|
}
|
|
448
|
-
async function
|
|
460
|
+
async function se(e, t = F) {
|
|
449
461
|
const r = `${t.replace(/\/+$/, "")}/config`;
|
|
450
462
|
return e.fetch(r);
|
|
451
463
|
}
|
|
452
|
-
async function
|
|
453
|
-
const { baseUrl: t = "", debugEndpoint: r =
|
|
464
|
+
async function Ye(e) {
|
|
465
|
+
const { baseUrl: t = "", debugEndpoint: r = F, authToken: n } = e, i = new T({ baseUrl: t, authToken: n });
|
|
454
466
|
try {
|
|
455
|
-
const s = await
|
|
456
|
-
return
|
|
467
|
+
const s = await se(i, r);
|
|
468
|
+
return ne(s);
|
|
457
469
|
} catch {
|
|
458
|
-
return
|
|
470
|
+
return re;
|
|
459
471
|
}
|
|
460
472
|
}
|
|
461
|
-
function
|
|
473
|
+
function Ze(e) {
|
|
462
474
|
const t = /* @__PURE__ */ new Set(), r = "features" in e && typeof e.features == "object" && e.features !== null ? e.features : e;
|
|
463
475
|
return "process" in r && r.process && t.add("process"), ("process" in r && r.process || "system" in r && r.system) && t.add("memory"), "http" in r && r.http && t.add("http"), "db" in r && r.db && t.add("db"), "redis" in r && r.redis && t.add("redis"), "queues" in r && r.queues && t.add("queue"), "app" in r && r.app && t.add("app"), "log" in r && r.log && t.add("log"), t;
|
|
464
476
|
}
|
|
465
|
-
function
|
|
477
|
+
function et(e) {
|
|
466
478
|
const t = /* @__PURE__ */ new Set();
|
|
467
|
-
return (c(e.cpuPercent) || c(e.uptime) ||
|
|
479
|
+
return (c(e.cpuPercent) || c(e.uptime) || ie(e.nodeVersion)) && t.add("process"), (c(e.memHeapUsed) || c(e.memRss)) && t.add("memory"), (c(e.systemMemoryTotalMb) || c(e.systemMemoryFreeMb)) && t.add("memory"), (c(e.requestsPerSecond) || c(e.avgResponseTimeMs) || c(e.errorRate) || c(e.activeHttpConnections)) && t.add("http"), (c(e.dbPoolMax) || c(e.dbPoolUsed) || c(e.dbPoolFree) || c(e.dbPoolPending)) && t.add("db"), e.redisOk !== void 0 && e.redisOk !== null && t.add("redis"), (c(e.queueActive) || c(e.queueWaiting) || c(e.queueWorkerCount)) && t.add("queue"), (c(e.onlineUsers) || c(e.pendingWebhooks) || c(e.pendingEmails)) && t.add("app"), (c(e.logErrorsLast5m) || c(e.logEntriesPerMinute)) && t.add("log"), t;
|
|
468
480
|
}
|
|
469
481
|
function c(e) {
|
|
470
482
|
return typeof e == "number" && !Number.isNaN(e);
|
|
471
483
|
}
|
|
472
|
-
function
|
|
484
|
+
function ie(e) {
|
|
473
485
|
return typeof e == "string" && e.length > 0;
|
|
474
486
|
}
|
|
475
|
-
function
|
|
476
|
-
return
|
|
487
|
+
function g(e) {
|
|
488
|
+
return ee[e] || "";
|
|
477
489
|
}
|
|
478
|
-
const
|
|
490
|
+
const k = [
|
|
479
491
|
// ── Process group ─────────────────────────────────────────────────────────
|
|
480
492
|
// -- Node version ---------------------------------------------------------
|
|
481
493
|
{
|
|
@@ -496,7 +508,7 @@ const P = [
|
|
|
496
508
|
unit: "",
|
|
497
509
|
group: "process",
|
|
498
510
|
extract: (e) => e.uptime,
|
|
499
|
-
format: (e) =>
|
|
511
|
+
format: (e) => X(e.uptime),
|
|
500
512
|
color: () => ""
|
|
501
513
|
},
|
|
502
514
|
// -- CPU ------------------------------------------------------------------
|
|
@@ -510,7 +522,7 @@ const P = [
|
|
|
510
522
|
critThreshold: 80,
|
|
511
523
|
extract: (e) => e.cpuPercent,
|
|
512
524
|
format: (e) => `${e.cpuPercent.toFixed(1)}%`,
|
|
513
|
-
color: (e) =>
|
|
525
|
+
color: (e) => g(S(e.cpuPercent, 50, 80)),
|
|
514
526
|
historyKey: "cpuPercent"
|
|
515
527
|
},
|
|
516
528
|
// -- Event loop -----------------------------------------------------------
|
|
@@ -524,7 +536,7 @@ const P = [
|
|
|
524
536
|
critThreshold: 50,
|
|
525
537
|
extract: (e) => e.eventLoopLag,
|
|
526
538
|
format: (e) => `${e.eventLoopLag.toFixed(1)}ms`,
|
|
527
|
-
color: (e) =>
|
|
539
|
+
color: (e) => g(S(e.eventLoopLag, 20, 50)),
|
|
528
540
|
historyKey: "eventLoopLag"
|
|
529
541
|
},
|
|
530
542
|
// ── Memory group ──────────────────────────────────────────────────────────
|
|
@@ -536,7 +548,7 @@ const P = [
|
|
|
536
548
|
unit: "bytes",
|
|
537
549
|
group: "memory",
|
|
538
550
|
extract: (e) => e.memHeapUsed,
|
|
539
|
-
format: (e) =>
|
|
551
|
+
format: (e) => P(e.memHeapUsed),
|
|
540
552
|
color: () => "",
|
|
541
553
|
historyKey: "memHeapUsed"
|
|
542
554
|
},
|
|
@@ -548,7 +560,7 @@ const P = [
|
|
|
548
560
|
unit: "bytes",
|
|
549
561
|
group: "memory",
|
|
550
562
|
extract: (e) => e.memRss,
|
|
551
|
-
format: (e) =>
|
|
563
|
+
format: (e) => P(e.memRss),
|
|
552
564
|
color: () => "",
|
|
553
565
|
historyKey: "memRss"
|
|
554
566
|
},
|
|
@@ -560,12 +572,12 @@ const P = [
|
|
|
560
572
|
unit: "MB",
|
|
561
573
|
group: "memory",
|
|
562
574
|
extract: (e) => e.systemMemoryTotalMb - e.systemMemoryFreeMb,
|
|
563
|
-
format: (e) => `${
|
|
575
|
+
format: (e) => `${$(e.systemMemoryTotalMb - e.systemMemoryFreeMb)}/${$(e.systemMemoryTotalMb)}`,
|
|
564
576
|
color: (e) => {
|
|
565
577
|
const t = e.systemMemoryTotalMb;
|
|
566
578
|
if (t === 0) return "";
|
|
567
579
|
const r = t - e.systemMemoryFreeMb;
|
|
568
|
-
return
|
|
580
|
+
return g(A(r, t));
|
|
569
581
|
},
|
|
570
582
|
historyKey: "_sysMemUsed",
|
|
571
583
|
show: (e) => e.systemMemoryTotalMb !== null && e.systemMemoryTotalMb !== void 0
|
|
@@ -594,7 +606,7 @@ const P = [
|
|
|
594
606
|
critThreshold: 500,
|
|
595
607
|
extract: (e) => e.avgResponseTimeMs,
|
|
596
608
|
format: (e) => `${e.avgResponseTimeMs.toFixed(0)}ms`,
|
|
597
|
-
color: (e) =>
|
|
609
|
+
color: (e) => g(S(e.avgResponseTimeMs, 200, 500)),
|
|
598
610
|
historyKey: "avgResponseTimeMs"
|
|
599
611
|
},
|
|
600
612
|
// -- Error rate -----------------------------------------------------------
|
|
@@ -608,7 +620,7 @@ const P = [
|
|
|
608
620
|
critThreshold: 5,
|
|
609
621
|
extract: (e) => e.errorRate,
|
|
610
622
|
format: (e) => `${e.errorRate.toFixed(1)}%`,
|
|
611
|
-
color: (e) =>
|
|
623
|
+
color: (e) => g(S(e.errorRate, 1, 5)),
|
|
612
624
|
historyKey: "errorRate"
|
|
613
625
|
},
|
|
614
626
|
// -- Active connections ---------------------------------------------------
|
|
@@ -633,7 +645,7 @@ const P = [
|
|
|
633
645
|
group: "db",
|
|
634
646
|
extract: (e) => e.dbPoolUsed,
|
|
635
647
|
format: (e) => `${e.dbPoolUsed}/${e.dbPoolFree}/${e.dbPoolMax}`,
|
|
636
|
-
color: (e) =>
|
|
648
|
+
color: (e) => g(A(e.dbPoolUsed, e.dbPoolMax)),
|
|
637
649
|
historyKey: "dbPoolUsed"
|
|
638
650
|
},
|
|
639
651
|
// ── Redis group ───────────────────────────────────────────────────────────
|
|
@@ -669,7 +681,7 @@ const P = [
|
|
|
669
681
|
unit: "",
|
|
670
682
|
group: "redis",
|
|
671
683
|
extract: (e) => e.redisKeysCount,
|
|
672
|
-
format: (e) =>
|
|
684
|
+
format: (e) => Y(e.redisKeysCount),
|
|
673
685
|
color: () => "",
|
|
674
686
|
historyKey: "redisKeysCount",
|
|
675
687
|
show: (e) => e.redisOk
|
|
@@ -686,7 +698,7 @@ const P = [
|
|
|
686
698
|
inverseThreshold: !0,
|
|
687
699
|
extract: (e) => e.redisHitRate,
|
|
688
700
|
format: (e) => `${e.redisHitRate.toFixed(0)}%`,
|
|
689
|
-
color: (e) =>
|
|
701
|
+
color: (e) => g(Z(e.redisHitRate, 90, 70)),
|
|
690
702
|
historyKey: "redisHitRate",
|
|
691
703
|
show: (e) => e.redisOk
|
|
692
704
|
},
|
|
@@ -777,18 +789,18 @@ const P = [
|
|
|
777
789
|
historyKey: "logEntriesPerMinute"
|
|
778
790
|
}
|
|
779
791
|
];
|
|
780
|
-
function
|
|
781
|
-
return
|
|
792
|
+
function tt(e) {
|
|
793
|
+
return k.find((t) => t.id === e);
|
|
782
794
|
}
|
|
783
|
-
function
|
|
795
|
+
function rt() {
|
|
784
796
|
const e = /* @__PURE__ */ new Map();
|
|
785
|
-
for (const t of
|
|
797
|
+
for (const t of k) {
|
|
786
798
|
const r = t.group || "core";
|
|
787
799
|
e.has(r) || e.set(r, []), e.get(r).push(t);
|
|
788
800
|
}
|
|
789
801
|
return e;
|
|
790
802
|
}
|
|
791
|
-
const
|
|
803
|
+
const oe = 60, ae = 1e4, le = {
|
|
792
804
|
queries: "/queries",
|
|
793
805
|
events: "/events",
|
|
794
806
|
emails: "/emails",
|
|
@@ -800,10 +812,10 @@ const ae = 60, ce = 1e4, le = {
|
|
|
800
812
|
config: "/config",
|
|
801
813
|
internals: "/diagnostics"
|
|
802
814
|
};
|
|
803
|
-
function
|
|
815
|
+
function ce(e) {
|
|
804
816
|
return le[e] || `/${e}`;
|
|
805
817
|
}
|
|
806
|
-
const
|
|
818
|
+
const he = {
|
|
807
819
|
overview: "/overview",
|
|
808
820
|
requests: "/requests",
|
|
809
821
|
queries: "/queries",
|
|
@@ -816,29 +828,45 @@ const ue = {
|
|
|
816
828
|
jobs: "/jobs",
|
|
817
829
|
config: "/config"
|
|
818
830
|
};
|
|
819
|
-
function
|
|
820
|
-
return
|
|
831
|
+
function ue(e) {
|
|
832
|
+
return he[e] || `/${e}`;
|
|
821
833
|
}
|
|
822
|
-
function
|
|
823
|
-
const t = {};
|
|
834
|
+
function de(e = oe) {
|
|
835
|
+
const t = {}, r = {};
|
|
836
|
+
let n = !1;
|
|
837
|
+
function i(s) {
|
|
838
|
+
if (s.count === 0) return [];
|
|
839
|
+
const o = Array.from({ length: s.count }), l = s.count < e ? 0 : s.head;
|
|
840
|
+
for (let a = 0; a < s.count; a++)
|
|
841
|
+
o[a] = s.data[(l + a) % e];
|
|
842
|
+
return o;
|
|
843
|
+
}
|
|
824
844
|
return {
|
|
825
|
-
push(
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
845
|
+
push(s) {
|
|
846
|
+
n = !1;
|
|
847
|
+
for (const o of k) {
|
|
848
|
+
const l = o.historyKey;
|
|
849
|
+
if (!l) continue;
|
|
850
|
+
const a = o.extract(s);
|
|
851
|
+
if (typeof a != "number") continue;
|
|
852
|
+
t[l] || (t[l] = { data: Array.from({ length: e }), head: 0, count: 0 });
|
|
853
|
+
const h = t[l];
|
|
854
|
+
h.data[h.head] = a, h.head = (h.head + 1) % e, h.count < e && h.count++;
|
|
831
855
|
}
|
|
832
856
|
},
|
|
833
|
-
get(
|
|
834
|
-
|
|
857
|
+
get(s) {
|
|
858
|
+
const o = t[s];
|
|
859
|
+
return o ? i(o) : [];
|
|
835
860
|
},
|
|
836
861
|
getAll() {
|
|
837
|
-
return
|
|
862
|
+
if (n) return r;
|
|
863
|
+
for (const s of Object.keys(t))
|
|
864
|
+
r[s] = i(t[s]);
|
|
865
|
+
return n = !0, r;
|
|
838
866
|
}
|
|
839
867
|
};
|
|
840
868
|
}
|
|
841
|
-
class
|
|
869
|
+
class nt {
|
|
842
870
|
// -- Configuration --------------------------------------------------------
|
|
843
871
|
baseUrl;
|
|
844
872
|
endpoint;
|
|
@@ -862,11 +890,12 @@ class rt {
|
|
|
862
890
|
staleTimer = null;
|
|
863
891
|
lastSuccess = 0;
|
|
864
892
|
unauthorized = !1;
|
|
893
|
+
stopped = !1;
|
|
865
894
|
sseActive = !1;
|
|
866
895
|
isConnected = !1;
|
|
867
896
|
isStale = !1;
|
|
868
897
|
constructor(t = {}) {
|
|
869
|
-
this.baseUrl = t.baseUrl ?? "", this.endpoint = t.endpoint ?? "/admin/api/server-stats", this.channelName = t.channelName ?? "admin/server-stats", this.authToken = t.authToken, this.pollInterval = t.pollInterval ?? 3e3, this.onStatsUpdate = t.onStatsUpdate, this.onConnectionChange = t.onConnectionChange, this.onStaleChange = t.onStaleChange, this.onError = t.onError, this.onUnauthorizedChange = t.onUnauthorizedChange, this.onHistoryChange = t.onHistoryChange, this.onSseActiveChange = t.onSseActiveChange, this.onPollActiveChange = t.onPollActiveChange, this.historyBuffer =
|
|
898
|
+
this.baseUrl = t.baseUrl ?? "", this.endpoint = t.endpoint ?? "/admin/api/server-stats", this.channelName = t.channelName ?? "admin/server-stats", this.authToken = t.authToken, this.pollInterval = t.pollInterval ?? 3e3, this.onStatsUpdate = t.onStatsUpdate, this.onConnectionChange = t.onConnectionChange, this.onStaleChange = t.onStaleChange, this.onError = t.onError, this.onUnauthorizedChange = t.onUnauthorizedChange, this.onHistoryChange = t.onHistoryChange, this.onSseActiveChange = t.onSseActiveChange, this.onPollActiveChange = t.onPollActiveChange, this.historyBuffer = de();
|
|
870
899
|
}
|
|
871
900
|
// -- Public API -----------------------------------------------------------
|
|
872
901
|
/**
|
|
@@ -876,9 +905,10 @@ class rt {
|
|
|
876
905
|
*/
|
|
877
906
|
start() {
|
|
878
907
|
if (this.unauthorized) return;
|
|
908
|
+
this.stopped = !1;
|
|
879
909
|
let t = !1;
|
|
880
910
|
try {
|
|
881
|
-
const r =
|
|
911
|
+
const r = H({
|
|
882
912
|
baseUrl: this.baseUrl,
|
|
883
913
|
channelName: this.channelName,
|
|
884
914
|
authToken: this.authToken,
|
|
@@ -889,7 +919,7 @@ class rt {
|
|
|
889
919
|
this.setSseActive(!0), this.setConnected(!0), this.stopPolling();
|
|
890
920
|
},
|
|
891
921
|
onDisconnect: () => {
|
|
892
|
-
this.setSseActive(!1), this.setConnected(!1), !this.pollTimer && !this.unauthorized && this.startPollInterval();
|
|
922
|
+
this.setSseActive(!1), this.setConnected(!1), !this.pollTimer && !this.unauthorized && !this.stopped && this.startPollInterval();
|
|
893
923
|
},
|
|
894
924
|
onError: () => {
|
|
895
925
|
t = !0;
|
|
@@ -903,21 +933,21 @@ class rt {
|
|
|
903
933
|
this.startPollInterval();
|
|
904
934
|
else {
|
|
905
935
|
const r = setTimeout(() => {
|
|
906
|
-
!this.isConnected && !this.pollTimer && this.startPollInterval();
|
|
936
|
+
!this.isConnected && !this.pollTimer && !this.stopped && this.startPollInterval();
|
|
907
937
|
}, 3e3), n = this.sseHandle?.unsubscribe;
|
|
908
938
|
this.sseHandle && (this.sseHandle.unsubscribe = () => {
|
|
909
939
|
clearTimeout(r), n?.();
|
|
910
940
|
});
|
|
911
941
|
}
|
|
912
942
|
this.staleTimer = setInterval(() => {
|
|
913
|
-
this.lastSuccess > 0 && Date.now() - this.lastSuccess >
|
|
943
|
+
this.lastSuccess > 0 && Date.now() - this.lastSuccess > ae && this.setStale(!0);
|
|
914
944
|
}, 2e3);
|
|
915
945
|
}
|
|
916
946
|
/**
|
|
917
947
|
* Stop all timers and subscriptions. Call on unmount.
|
|
918
948
|
*/
|
|
919
949
|
stop() {
|
|
920
|
-
this.sseHandle?.unsubscribe(), this.sseHandle = null, this.stopPolling(), this.staleTimer && (clearInterval(this.staleTimer), this.staleTimer = null);
|
|
950
|
+
this.stopped = !0, this.sseHandle?.unsubscribe(), this.sseHandle = null, this.stopPolling(), this.staleTimer && (clearInterval(this.staleTimer), this.staleTimer = null);
|
|
921
951
|
}
|
|
922
952
|
/**
|
|
923
953
|
* Get the history array for a single metric key.
|
|
@@ -945,18 +975,18 @@ class rt {
|
|
|
945
975
|
/** Poll the HTTP endpoint once. */
|
|
946
976
|
async poll() {
|
|
947
977
|
if (!this.unauthorized) {
|
|
948
|
-
this.client || (this.client = new
|
|
978
|
+
this.client || (this.client = new T({ baseUrl: this.baseUrl, authToken: this.authToken }));
|
|
949
979
|
try {
|
|
950
980
|
const t = await this.client.get(this.endpoint);
|
|
951
981
|
this.processStats(t);
|
|
952
982
|
} catch (t) {
|
|
953
|
-
t instanceof
|
|
983
|
+
t instanceof w && (this.unauthorized = !0, this.onUnauthorizedChange?.(!0), this.onError?.(t), this.stopPolling());
|
|
954
984
|
}
|
|
955
985
|
}
|
|
956
986
|
}
|
|
957
987
|
/** Start the poll interval timer. */
|
|
958
988
|
startPollInterval() {
|
|
959
|
-
this.pollTimer || (this.pollTimer = setInterval(() => this.poll(), this.pollInterval), this.onPollActiveChange?.(!0));
|
|
989
|
+
this.pollTimer || this.stopped || (this.pollTimer = setInterval(() => this.poll(), this.pollInterval), this.onPollActiveChange?.(!0));
|
|
960
990
|
}
|
|
961
991
|
/** Stop the poll interval timer. */
|
|
962
992
|
stopPolling() {
|
|
@@ -975,7 +1005,7 @@ class rt {
|
|
|
975
1005
|
this.isStale !== t && (this.isStale = t, this.onStaleChange?.(t));
|
|
976
1006
|
}
|
|
977
1007
|
}
|
|
978
|
-
class
|
|
1008
|
+
class fe {
|
|
979
1009
|
constructor(t, r) {
|
|
980
1010
|
this.client = t, this.basePath = r;
|
|
981
1011
|
}
|
|
@@ -984,10 +1014,11 @@ class pe {
|
|
|
984
1014
|
*
|
|
985
1015
|
* @param section - Section identifier (e.g. `'overview'`, `'queries'`).
|
|
986
1016
|
* @param queryString - Optional query string (without leading `?`).
|
|
1017
|
+
* @param init - Optional `RequestInit` overrides (e.g. `{ signal }`).
|
|
987
1018
|
*/
|
|
988
|
-
async fetchSection(t, r) {
|
|
989
|
-
const
|
|
990
|
-
return this.client.fetch(
|
|
1019
|
+
async fetchSection(t, r, n) {
|
|
1020
|
+
const i = ue(t), s = r ? `${this.basePath}${i}?${r}` : `${this.basePath}${i}`;
|
|
1021
|
+
return this.client.fetch(s, n);
|
|
991
1022
|
}
|
|
992
1023
|
/**
|
|
993
1024
|
* Fetch chart time-series data for the overview section.
|
|
@@ -1055,7 +1086,7 @@ class pe {
|
|
|
1055
1086
|
return this.client.fetch(`${this.basePath}/emails/${t}/preview`);
|
|
1056
1087
|
}
|
|
1057
1088
|
}
|
|
1058
|
-
class
|
|
1089
|
+
class st {
|
|
1059
1090
|
// -- Dependencies ---------------------------------------------------------
|
|
1060
1091
|
client;
|
|
1061
1092
|
api;
|
|
@@ -1081,8 +1112,10 @@ class nt {
|
|
|
1081
1112
|
hasFetched = !1;
|
|
1082
1113
|
/** Whether the controller has been stopped (disposed). */
|
|
1083
1114
|
stopped = !1;
|
|
1115
|
+
/** AbortController for the current in-flight fetch. */
|
|
1116
|
+
abortController = null;
|
|
1084
1117
|
constructor(t) {
|
|
1085
|
-
this.client = new
|
|
1118
|
+
this.client = new T({ baseUrl: t.baseUrl, authToken: t.authToken }), this.api = new fe(this.client, t.endpoint), this.endpoint = t.endpoint, this.section = t.section, this.perPage = t.perPage, this.callbacks = t.callbacks;
|
|
1086
1119
|
}
|
|
1087
1120
|
// -- Public API -----------------------------------------------------------
|
|
1088
1121
|
/**
|
|
@@ -1096,7 +1129,7 @@ class nt {
|
|
|
1096
1129
|
* Outstanding in-flight responses will be discarded via fetchId.
|
|
1097
1130
|
*/
|
|
1098
1131
|
stop() {
|
|
1099
|
-
this.stopped = !0, this.stopRefreshTimer();
|
|
1132
|
+
this.stopped = !0, this.stopRefreshTimer(), this.abortController?.abort(), this.abortController = null;
|
|
1100
1133
|
}
|
|
1101
1134
|
/**
|
|
1102
1135
|
* Perform a data fetch.
|
|
@@ -1106,30 +1139,35 @@ class nt {
|
|
|
1106
1139
|
*/
|
|
1107
1140
|
async fetch(t = !0) {
|
|
1108
1141
|
if (t && this.explicitFetchPending) return;
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1142
|
+
this.abortController?.abort();
|
|
1143
|
+
const r = new AbortController();
|
|
1144
|
+
this.abortController = r;
|
|
1145
|
+
const n = ++this.fetchId, i = this.section;
|
|
1146
|
+
if (!i) return;
|
|
1147
|
+
const s = this.filters, o = this.sort ? this.sort.replace(/[A-Z]/g, (a) => "_" + a.toLowerCase()) : void 0, l = te({
|
|
1112
1148
|
page: this.page,
|
|
1113
1149
|
perPage: this.perPage,
|
|
1114
1150
|
search: this.search,
|
|
1115
|
-
sort:
|
|
1151
|
+
sort: o,
|
|
1116
1152
|
sortDir: this.sort ? this.sortDir : void 0,
|
|
1117
|
-
filters:
|
|
1118
|
-
timeRange:
|
|
1153
|
+
filters: s && Object.keys(s).length > 0 ? s : void 0,
|
|
1154
|
+
timeRange: i.startsWith("overview") ? this.timeRange : void 0
|
|
1119
1155
|
});
|
|
1120
1156
|
t || (this.callbacks.onLoading(!0), this.explicitFetchPending = !0);
|
|
1121
1157
|
try {
|
|
1122
|
-
const a = await this.api.fetchSection(
|
|
1123
|
-
|
|
1158
|
+
const a = await this.api.fetchSection(i, l || void 0, {
|
|
1159
|
+
signal: r.signal
|
|
1160
|
+
});
|
|
1161
|
+
if (n !== this.fetchId || this.stopped) return;
|
|
1124
1162
|
if (a && typeof a == "object" && a.data !== void 0 && a.meta !== void 0) {
|
|
1125
|
-
const
|
|
1126
|
-
this.callbacks.onData(
|
|
1163
|
+
const h = a;
|
|
1164
|
+
this.callbacks.onData(h.data), this.callbacks.onPagination(h.meta);
|
|
1127
1165
|
} else
|
|
1128
1166
|
this.callbacks.onData(a), this.callbacks.onPagination(null);
|
|
1129
1167
|
this.callbacks.onError(null), this.callbacks.onLoading(!1), this.hasFetched = !0;
|
|
1130
1168
|
} catch (a) {
|
|
1131
|
-
if (r !== this.fetchId || this.stopped) return;
|
|
1132
|
-
if (a instanceof
|
|
1169
|
+
if (a instanceof DOMException && a.name === "AbortError" || r.signal.aborted || n !== this.fetchId || this.stopped) return;
|
|
1170
|
+
if (a instanceof w) {
|
|
1133
1171
|
this.callbacks.onError(a), this.callbacks.onLoading(!1), this.stopRefreshTimer(), this.callbacks.onUnauthorized();
|
|
1134
1172
|
return;
|
|
1135
1173
|
}
|
|
@@ -1228,14 +1266,14 @@ class nt {
|
|
|
1228
1266
|
// -- Timer management (private) -------------------------------------------
|
|
1229
1267
|
startRefreshTimer() {
|
|
1230
1268
|
this.stopRefreshTimer();
|
|
1231
|
-
const t = this.section === "overview" ?
|
|
1269
|
+
const t = this.section === "overview" ? V : j;
|
|
1232
1270
|
this.timer = setInterval(() => this.fetch(!0), t);
|
|
1233
1271
|
}
|
|
1234
1272
|
stopRefreshTimer() {
|
|
1235
1273
|
this.timer && (clearInterval(this.timer), this.timer = null);
|
|
1236
1274
|
}
|
|
1237
1275
|
}
|
|
1238
|
-
const
|
|
1276
|
+
const it = {
|
|
1239
1277
|
// ---------------------------------------------------------------------------
|
|
1240
1278
|
// Debug-panel tabs / Dashboard sidebar sections (shared)
|
|
1241
1279
|
// ---------------------------------------------------------------------------
|
|
@@ -1427,8 +1465,8 @@ const st = {
|
|
|
1427
1465
|
viewBox: "0 0 16 16",
|
|
1428
1466
|
elements: ['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']
|
|
1429
1467
|
}
|
|
1430
|
-
},
|
|
1431
|
-
function
|
|
1468
|
+
}, pe = "ss-col-resize", R = "ss-resizing";
|
|
1469
|
+
function ot(e) {
|
|
1432
1470
|
const t = Array.from(e.querySelectorAll("thead th"));
|
|
1433
1471
|
if (t.length === 0) return () => {
|
|
1434
1472
|
};
|
|
@@ -1443,30 +1481,30 @@ function it(e) {
|
|
|
1443
1481
|
}
|
|
1444
1482
|
}
|
|
1445
1483
|
for (const s of t) {
|
|
1446
|
-
let o = function(
|
|
1447
|
-
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
function
|
|
1451
|
-
const
|
|
1452
|
-
s.style.width =
|
|
1484
|
+
let o = function(a) {
|
|
1485
|
+
a.preventDefault(), a.stopPropagation(), i();
|
|
1486
|
+
const h = a.clientX, m = s.offsetWidth;
|
|
1487
|
+
l.classList.add(R), l.setPointerCapture(a.pointerId);
|
|
1488
|
+
function d(p) {
|
|
1489
|
+
const x = p.clientX - h, u = Math.max(30, m + x);
|
|
1490
|
+
s.style.width = u + "px";
|
|
1453
1491
|
}
|
|
1454
|
-
function
|
|
1455
|
-
|
|
1492
|
+
function f() {
|
|
1493
|
+
l.classList.remove(R), l.removeEventListener("pointermove", d), l.removeEventListener("pointerup", f);
|
|
1456
1494
|
}
|
|
1457
|
-
|
|
1495
|
+
l.addEventListener("pointermove", d), l.addEventListener("pointerup", f);
|
|
1458
1496
|
};
|
|
1459
1497
|
if (!s.textContent?.trim()) continue;
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1462
|
-
|
|
1498
|
+
const l = document.createElement("div");
|
|
1499
|
+
l.className = pe, s.appendChild(l), l.addEventListener("pointerdown", o), r.push(() => {
|
|
1500
|
+
l.removeEventListener("pointerdown", o), l.remove();
|
|
1463
1501
|
});
|
|
1464
1502
|
}
|
|
1465
1503
|
return () => {
|
|
1466
1504
|
for (const s of r) s();
|
|
1467
1505
|
};
|
|
1468
1506
|
}
|
|
1469
|
-
class
|
|
1507
|
+
class at {
|
|
1470
1508
|
client;
|
|
1471
1509
|
endpoint;
|
|
1472
1510
|
refreshInterval;
|
|
@@ -1474,11 +1512,12 @@ class ot {
|
|
|
1474
1512
|
timer = null;
|
|
1475
1513
|
currentTab = null;
|
|
1476
1514
|
fetchOnceCache = {};
|
|
1515
|
+
abortController = null;
|
|
1477
1516
|
constructor(t) {
|
|
1478
|
-
this.client = new
|
|
1517
|
+
this.client = new T({
|
|
1479
1518
|
baseUrl: t.baseUrl,
|
|
1480
1519
|
authToken: t.authToken
|
|
1481
|
-
}), this.endpoint = t.endpoint ?? "/admin/api/debug", this.refreshInterval = t.refreshInterval ??
|
|
1520
|
+
}), this.endpoint = t.endpoint ?? "/admin/api/debug", this.refreshInterval = t.refreshInterval ?? G, this.callbacks = {
|
|
1482
1521
|
onData: t.onData,
|
|
1483
1522
|
onLoading: t.onLoading,
|
|
1484
1523
|
onError: t.onError,
|
|
@@ -1500,7 +1539,7 @@ class ot {
|
|
|
1500
1539
|
* Stop the auto-refresh timer.
|
|
1501
1540
|
*/
|
|
1502
1541
|
stop() {
|
|
1503
|
-
this.timer && (clearInterval(this.timer), this.timer = null);
|
|
1542
|
+
this.timer && (clearInterval(this.timer), this.timer = null), this.abortController?.abort(), this.abortController = null;
|
|
1504
1543
|
}
|
|
1505
1544
|
/**
|
|
1506
1545
|
* Switch to a different tab.
|
|
@@ -1532,7 +1571,7 @@ class ot {
|
|
|
1532
1571
|
const n = await this.client.fetch(t);
|
|
1533
1572
|
this.callbacks.onData(n), this.callbacks.onError(null), r && (this.fetchOnceCache[t] = n);
|
|
1534
1573
|
} catch (n) {
|
|
1535
|
-
if (n instanceof
|
|
1574
|
+
if (n instanceof w) {
|
|
1536
1575
|
this.callbacks.onUnauthorized(n);
|
|
1537
1576
|
return;
|
|
1538
1577
|
}
|
|
@@ -1560,39 +1599,43 @@ class ot {
|
|
|
1560
1599
|
// -------------------------------------------------------------------------
|
|
1561
1600
|
async fetchData() {
|
|
1562
1601
|
const t = this.currentTab;
|
|
1563
|
-
if (t)
|
|
1564
|
-
|
|
1565
|
-
|
|
1602
|
+
if (!t) return;
|
|
1603
|
+
if (this.fetchOnceCache[t] !== void 0) {
|
|
1604
|
+
this.callbacks.onData(this.fetchOnceCache[t]), this.callbacks.onLoading(!1);
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
this.abortController?.abort();
|
|
1608
|
+
const r = new AbortController();
|
|
1609
|
+
this.abortController = r;
|
|
1610
|
+
try {
|
|
1611
|
+
const n = `${this.endpoint}${ce(t)}`, i = await this.client.fetch(n, { signal: r.signal });
|
|
1612
|
+
if (r.signal.aborted) return;
|
|
1613
|
+
this.callbacks.onData(i), this.callbacks.onError(null), this.callbacks.onLoading(!1);
|
|
1614
|
+
} catch (n) {
|
|
1615
|
+
if (n instanceof DOMException && n.name === "AbortError" || r.signal.aborted) return;
|
|
1616
|
+
if (n instanceof w) {
|
|
1617
|
+
this.callbacks.onError(n), this.callbacks.onLoading(!1), this.stop(), this.callbacks.onUnauthorized(n);
|
|
1566
1618
|
return;
|
|
1567
1619
|
}
|
|
1568
|
-
|
|
1569
|
-
const r = `${this.endpoint}${he(t)}`, n = await this.client.fetch(r);
|
|
1570
|
-
this.callbacks.onData(n), this.callbacks.onError(null), this.callbacks.onLoading(!1);
|
|
1571
|
-
} catch (r) {
|
|
1572
|
-
if (r instanceof b) {
|
|
1573
|
-
this.callbacks.onError(r), this.callbacks.onLoading(!1), this.stop(), this.callbacks.onUnauthorized(r);
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
this.callbacks.onError(r instanceof Error ? r : new Error(String(r))), this.callbacks.onLoading(!1);
|
|
1577
|
-
}
|
|
1620
|
+
this.callbacks.onError(n instanceof Error ? n : new Error(String(n))), this.callbacks.onLoading(!1);
|
|
1578
1621
|
}
|
|
1579
1622
|
}
|
|
1580
1623
|
}
|
|
1581
|
-
const
|
|
1582
|
-
function
|
|
1624
|
+
const lt = ["all", "error", "warn", "info", "debug"];
|
|
1625
|
+
function me(e) {
|
|
1583
1626
|
return (e.levelName || e.level_name || (typeof e.level == "string" ? e.level : "") || "info").toLowerCase();
|
|
1584
1627
|
}
|
|
1585
1628
|
function ct(e) {
|
|
1586
1629
|
return e.msg || e.message || JSON.stringify(e);
|
|
1587
1630
|
}
|
|
1588
|
-
function
|
|
1631
|
+
function ht(e) {
|
|
1589
1632
|
return e.createdAt || e.created_at || e.time || e.timestamp || 0;
|
|
1590
1633
|
}
|
|
1591
|
-
function
|
|
1634
|
+
function ut(e) {
|
|
1592
1635
|
const t = e.data || {};
|
|
1593
1636
|
return e.requestId || e.request_id || e["x-request-id"] || t.requestId || t.request_id || t["x-request-id"] || "";
|
|
1594
1637
|
}
|
|
1595
|
-
function
|
|
1638
|
+
function dt(e, t = "ss-dbg-log-level") {
|
|
1596
1639
|
switch (e) {
|
|
1597
1640
|
case "error":
|
|
1598
1641
|
case "fatal":
|
|
@@ -1609,30 +1652,30 @@ function ut(e, t = "ss-dbg-log-level") {
|
|
|
1609
1652
|
return `${t}-info`;
|
|
1610
1653
|
}
|
|
1611
1654
|
}
|
|
1612
|
-
function
|
|
1655
|
+
function ft(e, t) {
|
|
1613
1656
|
return t === "all" ? e : e.filter((r) => {
|
|
1614
|
-
const n =
|
|
1657
|
+
const n = me(r);
|
|
1615
1658
|
return t === "error" ? n === "error" || n === "fatal" : n === t;
|
|
1616
1659
|
});
|
|
1617
1660
|
}
|
|
1618
|
-
function
|
|
1661
|
+
function pt(e, t) {
|
|
1619
1662
|
if (!t) return e;
|
|
1620
1663
|
const r = t.toLowerCase();
|
|
1621
1664
|
return e.filter(
|
|
1622
1665
|
(n) => n.sql.toLowerCase().includes(r) || n.model && n.model.toLowerCase().includes(r) || n.method.toLowerCase().includes(r)
|
|
1623
1666
|
);
|
|
1624
1667
|
}
|
|
1625
|
-
function
|
|
1668
|
+
function mt(e) {
|
|
1626
1669
|
const t = {};
|
|
1627
1670
|
for (const r of e)
|
|
1628
1671
|
t[r.sql] = (t[r.sql] || 0) + 1;
|
|
1629
1672
|
return t;
|
|
1630
1673
|
}
|
|
1631
|
-
function
|
|
1674
|
+
function gt(e, t) {
|
|
1632
1675
|
const r = e.filter((s) => s.duration > 100).length, n = Object.values(t).filter((s) => s > 1).length, i = e.length > 0 ? e.reduce((s, o) => s + o.duration, 0) / e.length : 0;
|
|
1633
1676
|
return { slowCount: r, dupCount: n, avgDuration: i, totalCount: e.length };
|
|
1634
1677
|
}
|
|
1635
|
-
const
|
|
1678
|
+
const yt = [
|
|
1636
1679
|
"all",
|
|
1637
1680
|
"active",
|
|
1638
1681
|
"waiting",
|
|
@@ -1640,7 +1683,7 @@ const gt = [
|
|
|
1640
1683
|
"completed",
|
|
1641
1684
|
"failed"
|
|
1642
1685
|
];
|
|
1643
|
-
function
|
|
1686
|
+
function bt(e, t = "ss-dbg-job-status") {
|
|
1644
1687
|
switch (e) {
|
|
1645
1688
|
case "completed":
|
|
1646
1689
|
case "failed":
|
|
@@ -1652,7 +1695,7 @@ function yt(e, t = "ss-dbg-job-status") {
|
|
|
1652
1695
|
return "ss-dbg-badge-muted";
|
|
1653
1696
|
}
|
|
1654
1697
|
}
|
|
1655
|
-
function
|
|
1698
|
+
function xt(e) {
|
|
1656
1699
|
switch (e) {
|
|
1657
1700
|
case "active":
|
|
1658
1701
|
return "blue";
|
|
@@ -1668,7 +1711,7 @@ function bt(e) {
|
|
|
1668
1711
|
return "muted";
|
|
1669
1712
|
}
|
|
1670
1713
|
}
|
|
1671
|
-
function
|
|
1714
|
+
function wt(e) {
|
|
1672
1715
|
if (!e) return [];
|
|
1673
1716
|
if (Array.isArray(e)) return e;
|
|
1674
1717
|
const t = e;
|
|
@@ -1679,7 +1722,7 @@ function St(e) {
|
|
|
1679
1722
|
const t = e;
|
|
1680
1723
|
return t.stats || t.overview || null;
|
|
1681
1724
|
}
|
|
1682
|
-
function
|
|
1725
|
+
function ge(e) {
|
|
1683
1726
|
if (!e) return [];
|
|
1684
1727
|
if (typeof e == "string")
|
|
1685
1728
|
try {
|
|
@@ -1689,7 +1732,7 @@ function ye(e) {
|
|
|
1689
1732
|
}
|
|
1690
1733
|
return Array.isArray(e) ? e : [];
|
|
1691
1734
|
}
|
|
1692
|
-
function
|
|
1735
|
+
function ye(e) {
|
|
1693
1736
|
if (!e) return [];
|
|
1694
1737
|
if (typeof e == "string")
|
|
1695
1738
|
try {
|
|
@@ -1699,24 +1742,24 @@ function be(e) {
|
|
|
1699
1742
|
}
|
|
1700
1743
|
return Array.isArray(e) ? e : [];
|
|
1701
1744
|
}
|
|
1702
|
-
function
|
|
1703
|
-
return e[t]
|
|
1745
|
+
function C(e, t, r, n = 0) {
|
|
1746
|
+
return e[t] ?? e[r] ?? n;
|
|
1704
1747
|
}
|
|
1705
|
-
function
|
|
1748
|
+
function vt(e) {
|
|
1706
1749
|
return {
|
|
1707
1750
|
method: e.method || "",
|
|
1708
1751
|
url: e.url || "",
|
|
1709
|
-
statusCode:
|
|
1710
|
-
totalDuration:
|
|
1711
|
-
spanCount:
|
|
1712
|
-
spans:
|
|
1713
|
-
warnings:
|
|
1752
|
+
statusCode: C(e, "status_code", "statusCode"),
|
|
1753
|
+
totalDuration: C(e, "total_duration", "totalDuration") || e.duration || 0,
|
|
1754
|
+
spanCount: C(e, "span_count", "spanCount"),
|
|
1755
|
+
spans: ge(e.spans),
|
|
1756
|
+
warnings: ye(e.warnings)
|
|
1714
1757
|
};
|
|
1715
1758
|
}
|
|
1716
|
-
const
|
|
1717
|
-
function
|
|
1759
|
+
const be = ["password", "secret", "token", "key", "credential", "auth"];
|
|
1760
|
+
function xe(e) {
|
|
1718
1761
|
const t = e.toLowerCase();
|
|
1719
|
-
return
|
|
1762
|
+
return be.some((r) => t.includes(r));
|
|
1720
1763
|
}
|
|
1721
1764
|
function we(e) {
|
|
1722
1765
|
if (e == null) return "-";
|
|
@@ -1729,89 +1772,89 @@ function we(e) {
|
|
|
1729
1772
|
return String(e);
|
|
1730
1773
|
}
|
|
1731
1774
|
}
|
|
1732
|
-
const
|
|
1775
|
+
const Se = {
|
|
1733
1776
|
collectionInterval: "Stats Collection",
|
|
1734
1777
|
dashboardBroadcast: "Dashboard Broadcast",
|
|
1735
1778
|
debugBroadcast: "Debug Broadcast",
|
|
1736
1779
|
persistFlush: "Persist Flush",
|
|
1737
1780
|
retentionCleanup: "Retention Cleanup"
|
|
1738
1781
|
};
|
|
1739
|
-
function
|
|
1740
|
-
return
|
|
1782
|
+
function Tt(e) {
|
|
1783
|
+
return Se[e] || e;
|
|
1741
1784
|
}
|
|
1742
|
-
const
|
|
1785
|
+
const ve = {
|
|
1743
1786
|
prometheus: "Prometheus",
|
|
1744
1787
|
pinoHook: "Pino Log Hook",
|
|
1745
1788
|
edgePlugin: "Edge Plugin",
|
|
1746
1789
|
cacheInspector: "Cache Inspector",
|
|
1747
1790
|
queueInspector: "Queue Inspector"
|
|
1748
1791
|
};
|
|
1749
|
-
function Tt(e) {
|
|
1750
|
-
return Te[e] || e;
|
|
1751
|
-
}
|
|
1752
1792
|
function Et(e) {
|
|
1793
|
+
return ve[e] || e;
|
|
1794
|
+
}
|
|
1795
|
+
function Ct(e) {
|
|
1753
1796
|
return "active" in e ? e.active ? "active" : "inactive" : "available" in e ? e.available ? "available" : "unavailable" : "unknown";
|
|
1754
1797
|
}
|
|
1755
|
-
function
|
|
1798
|
+
function Mt(e, t) {
|
|
1756
1799
|
return t.mode ? `Mode: ${t.mode}` : e === "edgePlugin" && t.active ? "@serverStats() tag registered" : e === "cacheInspector" ? t.available ? "Redis dependency detected" : "Redis not installed" : e === "queueInspector" ? t.available ? "Queue dependency detected" : "@rlanz/bull-queue not installed" : "-";
|
|
1757
1800
|
}
|
|
1758
|
-
function
|
|
1801
|
+
function Pt(e) {
|
|
1759
1802
|
return Object.entries(e).map(([t, r]) => ({
|
|
1760
1803
|
key: t,
|
|
1761
1804
|
value: we(r),
|
|
1762
|
-
secret:
|
|
1805
|
+
secret: xe(t)
|
|
1763
1806
|
}));
|
|
1764
1807
|
}
|
|
1765
|
-
function
|
|
1808
|
+
function kt(e, t) {
|
|
1766
1809
|
return t ? Math.min(100, Math.round(e / t * 100)) : 0;
|
|
1767
1810
|
}
|
|
1768
|
-
const
|
|
1769
|
-
function
|
|
1770
|
-
return
|
|
1811
|
+
const Te = ["healthy", "active", "connected", "available", "ready"], Ee = ["errored", "unavailable"];
|
|
1812
|
+
function $t(e) {
|
|
1813
|
+
return Te.includes(e) ? "ok" : Ee.includes(e) ? "err" : "";
|
|
1771
1814
|
}
|
|
1772
|
-
function
|
|
1815
|
+
function b(e) {
|
|
1773
1816
|
return e !== null && typeof e == "object" && !Array.isArray(e) && e.__redacted === !0;
|
|
1774
1817
|
}
|
|
1775
|
-
function
|
|
1818
|
+
function Ce(e, t = "") {
|
|
1776
1819
|
if (typeof e != "object" || e === null || e === void 0)
|
|
1777
1820
|
return [{ path: t, value: e }];
|
|
1778
|
-
if (Array.isArray(e) ||
|
|
1821
|
+
if (Array.isArray(e) || b(e))
|
|
1779
1822
|
return [{ path: t, value: e }];
|
|
1780
1823
|
const r = [];
|
|
1781
1824
|
for (const n of Object.keys(e)) {
|
|
1782
1825
|
const i = t ? `${t}.${n}` : n, s = e[n];
|
|
1783
|
-
typeof s == "object" && s !== null && !Array.isArray(s) && !
|
|
1826
|
+
typeof s == "object" && s !== null && !Array.isArray(s) && !b(s) ? r.push(...Ce(s, i)) : r.push({ path: i, value: s });
|
|
1784
1827
|
}
|
|
1785
1828
|
return r;
|
|
1786
1829
|
}
|
|
1787
|
-
function
|
|
1830
|
+
function At(e) {
|
|
1788
1831
|
return e == null ? { text: "null", color: "var(--ss-dim)" } : typeof e == "boolean" ? {
|
|
1789
1832
|
text: String(e),
|
|
1790
1833
|
color: e ? "var(--ss-green-fg)" : "var(--ss-red-fg)"
|
|
1791
1834
|
} : typeof e == "number" ? { text: String(e), color: "var(--ss-amber-fg)" } : Array.isArray(e) ? { text: `[${e.map((r) => r == null ? "null" : typeof r == "object" ? JSON.stringify(r) : String(r)).join(", ")}]`, color: "var(--ss-purple-fg)" } : typeof e == "object" ? { text: JSON.stringify(e), color: "var(--ss-dim)" } : { text: String(e) };
|
|
1792
1835
|
}
|
|
1793
|
-
function
|
|
1794
|
-
if (e == null || typeof e != "object" || Array.isArray(e) ||
|
|
1836
|
+
function Me(e) {
|
|
1837
|
+
if (e == null || typeof e != "object" || Array.isArray(e) || b(e))
|
|
1795
1838
|
return 1;
|
|
1796
1839
|
let t = 0;
|
|
1797
1840
|
for (const r of Object.keys(e))
|
|
1798
|
-
t +=
|
|
1841
|
+
t += Me(e[r]);
|
|
1799
1842
|
return t;
|
|
1800
1843
|
}
|
|
1801
|
-
function
|
|
1802
|
-
if (e == null || typeof e != "object" || Array.isArray(e) ||
|
|
1844
|
+
function Lt(e) {
|
|
1845
|
+
if (e == null || typeof e != "object" || Array.isArray(e) || b(e))
|
|
1803
1846
|
return [];
|
|
1804
1847
|
const t = [];
|
|
1805
1848
|
for (const r of Object.keys(e)) {
|
|
1806
1849
|
const n = e[r];
|
|
1807
|
-
n !== null && typeof n == "object" && !Array.isArray(n) && !
|
|
1850
|
+
n !== null && typeof n == "object" && !Array.isArray(n) && !b(n) && t.push(r);
|
|
1808
1851
|
}
|
|
1809
1852
|
return t;
|
|
1810
1853
|
}
|
|
1811
|
-
function Lt(e, t, r) {
|
|
1812
|
-
return !r || e.toLowerCase().includes(r) ? !0 : (m(t) ? t.display : t == null ? "" : String(t)).toLowerCase().includes(r);
|
|
1813
|
-
}
|
|
1814
1854
|
function Rt(e, t, r) {
|
|
1855
|
+
return !r || e.toLowerCase().includes(r) ? !0 : (b(t) ? t.display : t == null ? "" : String(t)).toLowerCase().includes(r);
|
|
1856
|
+
}
|
|
1857
|
+
function Ut(e, t, r) {
|
|
1815
1858
|
t && navigator.clipboard.writeText(e).then(() => {
|
|
1816
1859
|
const n = t.textContent;
|
|
1817
1860
|
t.textContent = "✓", t.classList.add(`${r}-copy-row-ok`), setTimeout(() => {
|
|
@@ -1820,7 +1863,7 @@ function Rt(e, t, r) {
|
|
|
1820
1863
|
}).catch(() => {
|
|
1821
1864
|
});
|
|
1822
1865
|
}
|
|
1823
|
-
const
|
|
1866
|
+
const Pe = /* @__PURE__ */ new Set([
|
|
1824
1867
|
"secret",
|
|
1825
1868
|
"key",
|
|
1826
1869
|
"token",
|
|
@@ -1834,7 +1877,7 @@ const ke = /* @__PURE__ */ new Set([
|
|
|
1834
1877
|
"private",
|
|
1835
1878
|
"encryption"
|
|
1836
1879
|
]);
|
|
1837
|
-
function
|
|
1880
|
+
function ke(e) {
|
|
1838
1881
|
const t = e.split(/[._-]/), r = [];
|
|
1839
1882
|
for (const n of t) {
|
|
1840
1883
|
const i = n.split(new RegExp("(?<=[a-z])(?=[A-Z])"));
|
|
@@ -1843,119 +1886,119 @@ function $e(e) {
|
|
|
1843
1886
|
}
|
|
1844
1887
|
return r;
|
|
1845
1888
|
}
|
|
1846
|
-
function
|
|
1847
|
-
return
|
|
1889
|
+
function Dt(e) {
|
|
1890
|
+
return ke(e).some((r) => Pe.has(r.toLowerCase()));
|
|
1848
1891
|
}
|
|
1849
|
-
const
|
|
1892
|
+
const Ft = new RegExp("secret|password|pass(?:word)?|pwd|token|(?:^|[._-])key(?:[._-]|$)|(?<=[a-z])Key|apikey|api_key|auth|credential|private|encryption", "i");
|
|
1850
1893
|
export {
|
|
1851
|
-
|
|
1894
|
+
T as ApiClient,
|
|
1852
1895
|
I as ApiError,
|
|
1853
|
-
|
|
1854
|
-
|
|
1896
|
+
he as DASHBOARD_SECTION_PATHS,
|
|
1897
|
+
G as DEBUG_REFRESH_MS,
|
|
1855
1898
|
le as DEBUG_TAB_PATHS,
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1899
|
+
re as DEFAULT_FEATURES,
|
|
1900
|
+
D as DEFAULT_PER_PAGE,
|
|
1901
|
+
fe as DashboardApi,
|
|
1902
|
+
st as DashboardDataController,
|
|
1903
|
+
at as DebugDataController,
|
|
1904
|
+
Ee as ERROR_STATUSES,
|
|
1905
|
+
ve as INTEGRATION_LABELS,
|
|
1906
|
+
yt as JOB_STATUS_FILTERS,
|
|
1907
|
+
lt as LOG_LEVELS,
|
|
1908
|
+
oe as MAX_HISTORY,
|
|
1909
|
+
k as METRIC_DEFINITIONS,
|
|
1910
|
+
Te as OK_STATUSES,
|
|
1911
|
+
V as OVERVIEW_REFRESH_MS,
|
|
1912
|
+
Ft as REDACT_PATTERN,
|
|
1913
|
+
j as SECTION_REFRESH_MS,
|
|
1914
|
+
J as SLOW_DURATION_MS,
|
|
1915
|
+
ae as STALE_MS,
|
|
1916
|
+
nt as ServerStatsController,
|
|
1917
|
+
it as TAB_ICONS,
|
|
1918
|
+
ee as THRESHOLD_CSS_CLASS,
|
|
1919
|
+
Be as THRESHOLD_CSS_VAR,
|
|
1920
|
+
_e as THRESHOLD_HEX_FALLBACK,
|
|
1921
|
+
Se as TIMER_LABELS,
|
|
1922
|
+
w as UnauthorizedError,
|
|
1923
|
+
Q as VERY_SLOW_DURATION_MS,
|
|
1924
|
+
te as buildQueryParams,
|
|
1925
|
+
We as buildQueryString,
|
|
1926
|
+
Ue as buildSparklineData,
|
|
1927
|
+
$t as classifyStatus,
|
|
1928
|
+
Lt as collectTopLevelObjectKeys,
|
|
1929
|
+
L as compactPreview,
|
|
1930
|
+
Qe as computePagination,
|
|
1931
|
+
gt as computeQuerySummary,
|
|
1932
|
+
W as computeStats,
|
|
1933
|
+
Ut as copyWithFeedback,
|
|
1934
|
+
mt as countDuplicateQueries,
|
|
1935
|
+
Me as countLeaves,
|
|
1936
|
+
Ge as createFilterState,
|
|
1937
|
+
de as createHistoryBuffer,
|
|
1938
|
+
je as createPaginationState,
|
|
1939
|
+
Je as createSortState,
|
|
1940
|
+
B as createTransmitSubscription,
|
|
1941
|
+
Ye as detectFeatures,
|
|
1942
|
+
et as detectMetricGroupsFromStats,
|
|
1943
|
+
Ne as durationSeverity,
|
|
1901
1944
|
St as extractJobStats,
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1945
|
+
wt as extractJobs,
|
|
1946
|
+
se as fetchFeatures,
|
|
1947
|
+
kt as fillPercent,
|
|
1948
|
+
ft as filterLogsByLevel,
|
|
1949
|
+
pt as filterQueries,
|
|
1950
|
+
Ce as flattenConfig,
|
|
1951
|
+
P as formatBytes,
|
|
1952
|
+
ze as formatCacheSize,
|
|
1953
|
+
Pt as formatCollectorConfig,
|
|
1911
1954
|
we as formatConfigVal,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1955
|
+
Y as formatCount,
|
|
1956
|
+
De as formatDuration,
|
|
1957
|
+
At as formatFlatValue,
|
|
1958
|
+
$ as formatMb,
|
|
1916
1959
|
Ie as formatStatNum,
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1960
|
+
Fe as formatTime,
|
|
1961
|
+
Ke as formatTtl,
|
|
1962
|
+
X as formatUptime,
|
|
1963
|
+
z as generateGradientId,
|
|
1964
|
+
Re as generateSparklinePath,
|
|
1965
|
+
Le as generateSparklinePoints,
|
|
1966
|
+
ue as getDashboardSectionPath,
|
|
1967
|
+
ce as getDebugTabPath,
|
|
1968
|
+
Mt as getIntegrationDetails,
|
|
1969
|
+
Et as getIntegrationLabel,
|
|
1970
|
+
Ct as getIntegrationStatus,
|
|
1971
|
+
xt as getJobStatusBadgeColor,
|
|
1972
|
+
bt as getJobStatusCssClass,
|
|
1973
|
+
dt as getLogLevelCssClass,
|
|
1974
|
+
tt as getMetricById,
|
|
1975
|
+
rt as getMetricsByGroup,
|
|
1976
|
+
Xe as getPageNumbers,
|
|
1977
|
+
A as getRatioColor,
|
|
1978
|
+
U as getTheme,
|
|
1979
|
+
S as getThresholdColor,
|
|
1980
|
+
Z as getThresholdColorInverse,
|
|
1981
|
+
Tt as getTimerLabel,
|
|
1982
|
+
Ze as getVisibleMetricGroups,
|
|
1983
|
+
ot as initResizableColumns,
|
|
1984
|
+
b as isRedactedValue,
|
|
1985
|
+
xe as isSecretKey,
|
|
1986
|
+
Rt as matchesConfigSearch,
|
|
1987
|
+
vt as normalizeTraceFields,
|
|
1988
|
+
Ae as onThemeChange,
|
|
1989
|
+
Ve as parsePaginatedResponse,
|
|
1990
|
+
ge as parseTraceSpans,
|
|
1991
|
+
ye as parseTraceWarnings,
|
|
1992
|
+
me as resolveLogLevel,
|
|
1950
1993
|
ct as resolveLogMessage,
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1994
|
+
ut as resolveLogRequestId,
|
|
1995
|
+
ht as resolveLogTimestamp,
|
|
1996
|
+
C as resolveTraceField,
|
|
1997
|
+
N as setTheme,
|
|
1998
|
+
qe as shortReqId,
|
|
1999
|
+
Dt as shouldRedact,
|
|
2000
|
+
He as statusColor,
|
|
2001
|
+
H as subscribeToChannel,
|
|
2002
|
+
Oe as timeAgo,
|
|
2003
|
+
$e as toggleTheme
|
|
1961
2004
|
};
|