@kong-ui-public/analytics-metric-provider 11.0.2-pr.2637.b25f7e003.0 → 11.0.2
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/types/components/display/MetricsCard.vue.d.ts +1 -1
- package/dist/types/composables/index.d.ts +0 -2
- package/dist/types/composables/index.d.ts.map +1 -1
- package/dist/types/composables/useMetricFetcher.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/vitals-metric-provider.es.js +370 -390
- package/dist/vitals-metric-provider.umd.js +1 -1
- package/package.json +4 -4
- package/dist/types/composables/useTrendRange.d.ts +0 -4
- package/dist/types/composables/useTrendRange.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as Y, watchEffect as ke, computed as
|
|
1
|
+
import { ref as Y, watchEffect as ke, computed as p, getCurrentInstance as Me, reactive as Fe, onMounted as xe, onUnmounted as qe, watch as Ue, isReadonly as Pe, toRefs as $e, defineComponent as W, inject as Ce, toRef as G, provide as ze, renderSlot as Se, resolveComponent as Ie, createElementBlock as S, openBlock as T, normalizeClass as z, createElementVNode as q, createCommentVNode as V, createBlock as U, unref as C, resolveDynamicComponent as re, withCtx as me, createTextVNode as Ae, toDisplayString as w, createVNode as F, Fragment as ge, renderList as Ke, mergeProps as Be, normalizeProps as Xe, guardReactiveProps as Ge } from "vue";
|
|
2
2
|
import { stripUnknownFilters as je, queryableExploreDimensions as He } from "@kong-ui-public/analytics-utilities";
|
|
3
3
|
import { createI18n as Ye, i18nTComponent as Qe } from "@kong-ui-public/i18n";
|
|
4
4
|
import "axios";
|
|
@@ -55,20 +55,20 @@ function cr() {
|
|
|
55
55
|
// Translation component <i18n-t>
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
const dr = 2, B = ["1XX", "2XX", "3XX", "4XX", "5XX"],
|
|
58
|
+
const dr = 2, B = ["1XX", "2XX", "3XX", "4XX", "5XX"], ye = ["4XX", "5XX"], mt = ["1XX", "2XX", "3XX"], fr = 30 * 1e3, vr = "analytics-query-provider";
|
|
59
59
|
var we = /* @__PURE__ */ ((e) => (e.VALIDATING = "VALIDATING", e.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", e.PENDING = "PENDING", e.SUCCESS = "SUCCESS", e.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", e.ERROR = "ERROR", e.STALE_IF_ERROR = "STALE_IF_ERROR", e))(we || {});
|
|
60
60
|
const mr = (e) => {
|
|
61
|
-
var r, t,
|
|
61
|
+
var r, t, o, a, n;
|
|
62
62
|
return e ? !!// TODO: revisit: currently only the first check ever matters?
|
|
63
|
-
((r = Object.keys(e)) != null && r.length || (t = e.data) != null && t.length || (a = (
|
|
63
|
+
((r = Object.keys(e)) != null && r.length || (t = e.data) != null && t.length || (a = (o = e.data) == null ? void 0 : o.data) != null && a.length || !((n = e.data) != null && n.data) && typeof e.data == "object" && Object.keys(e == null ? void 0 : e.data).length) : !1;
|
|
64
64
|
};
|
|
65
|
-
function
|
|
65
|
+
function gr(e = Y({}), r, t, o = mr) {
|
|
66
66
|
const a = Y(
|
|
67
67
|
"PENDING"
|
|
68
68
|
/* PENDING */
|
|
69
69
|
);
|
|
70
70
|
return ke(() => {
|
|
71
|
-
const n =
|
|
71
|
+
const n = o(e.value);
|
|
72
72
|
if (e.value && n && t.value) {
|
|
73
73
|
a.value = "VALIDATING_HAS_DATA";
|
|
74
74
|
return;
|
|
@@ -99,91 +99,98 @@ function yr(e = Y({}), r, t, i = mr) {
|
|
|
99
99
|
swrvState: we
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
const L = Symbol("default"), te = "status_code_grouped", he = (e, r, t,
|
|
103
|
-
e[r][t] || (e[r][t] = {}), e[r][t][
|
|
102
|
+
const L = Symbol("default"), te = "status_code_grouped", he = (e, r, t, o, a) => {
|
|
103
|
+
e[r][t] || (e[r][t] = {}), e[r][t][o] = a;
|
|
104
104
|
};
|
|
105
|
-
function
|
|
106
|
-
var
|
|
107
|
-
const t = ((
|
|
105
|
+
function yr(e, r) {
|
|
106
|
+
var d;
|
|
107
|
+
const t = ((d = e.meta.metric_names) == null ? void 0 : d[0]) || "", o = e.meta.start_ms, a = Object.keys(e.meta.display || {}), n = !!a.find((f) => f === te), u = a.find((f) => f !== te);
|
|
108
108
|
return a.length > 2 || a.length > 1 && !n ? (console.error("Don't know how to work with provided dimensions:", a), {
|
|
109
109
|
previous: { [L]: { [L]: 0 } },
|
|
110
110
|
current: { [L]: { [L]: 0 } }
|
|
111
|
-
}) : e.data.reduce((
|
|
112
|
-
const s =
|
|
113
|
-
return new Date(
|
|
111
|
+
}) : e.data.reduce((f, i) => {
|
|
112
|
+
const s = i.event[t], l = u ? i.event[u] : L, c = n ? i.event[te] : L;
|
|
113
|
+
return new Date(i.timestamp).getTime() === o && r ? he(f, "previous", l, c, s) : he(f, "current", l, c, s), f;
|
|
114
114
|
}, {
|
|
115
115
|
previous: {},
|
|
116
116
|
current: {}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
function hr(e) {
|
|
120
|
-
e.queryReady === void 0 && (e.queryReady =
|
|
121
|
-
const r =
|
|
122
|
-
var
|
|
120
|
+
e.queryReady === void 0 && (e.queryReady = p(() => !0));
|
|
121
|
+
const { i18n: r } = M.useI18n(), t = p(() => {
|
|
122
|
+
var l, c;
|
|
123
123
|
return {
|
|
124
124
|
metrics: e.metrics.value,
|
|
125
125
|
dimensions: [
|
|
126
|
-
...(
|
|
126
|
+
...(l = e.dimensions) != null && l.length ? [...e.dimensions] : [],
|
|
127
127
|
...e.withTrend.value ? ["time"] : []
|
|
128
128
|
],
|
|
129
129
|
granularity: e.withTrend.value ? "trend" : void 0,
|
|
130
|
-
...(
|
|
130
|
+
...(c = e.filter.value) != null && c.length ? { filters: e.filter.value } : {},
|
|
131
131
|
time_range: e.timeRange.value
|
|
132
132
|
};
|
|
133
|
-
}),
|
|
134
|
-
var
|
|
135
|
-
if (!((
|
|
133
|
+
}), o = p(() => {
|
|
134
|
+
var c, v, h, R;
|
|
135
|
+
if (!((c = e.queryReady) != null && c.value))
|
|
136
136
|
return null;
|
|
137
|
-
const
|
|
138
|
-
return `metric-fetcher-${JSON.stringify(e.timeRange.value)}-${(
|
|
139
|
-
}), { response:
|
|
140
|
-
() =>
|
|
137
|
+
const l = (v = e.filter) != null && v.value ? JSON.stringify(e.filter.value) : "";
|
|
138
|
+
return `metric-fetcher-${JSON.stringify(e.timeRange.value)}-${(h = e.dimensions) == null ? void 0 : h.join("-")}-${(R = e.metrics.value) == null ? void 0 : R.join("-")}-${l}-${e.refreshCounter.value}`;
|
|
139
|
+
}), { response: a, error: n, isValidating: u } = M.useRequest(
|
|
140
|
+
() => o.value,
|
|
141
141
|
() => e.queryFn({
|
|
142
142
|
// TODO: Use a type guard to validate that if the datasource is basic,
|
|
143
143
|
// the query is a valid basic explore query.
|
|
144
144
|
datasource: e.datasource.value,
|
|
145
|
-
query:
|
|
145
|
+
query: t.value
|
|
146
146
|
}, e.abortController ?? new AbortController()),
|
|
147
147
|
{
|
|
148
148
|
refreshInterval: e.refreshInterval,
|
|
149
149
|
revalidateOnFocus: !1,
|
|
150
150
|
errorRetryCount: dr
|
|
151
151
|
}
|
|
152
|
-
), { state:
|
|
153
|
-
var
|
|
154
|
-
return !((
|
|
155
|
-
}),
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
), { state: d, swrvState: f } = gr(a, n, u), i = p(() => {
|
|
153
|
+
var l, c, v, h, R, y, _;
|
|
154
|
+
return !((c = (l = a.value) == null ? void 0 : l.data) != null && c.length) || !((h = (v = a.value) == null ? void 0 : v.meta) != null && h.display) || !((_ = (y = (R = a.value) == null ? void 0 : R.meta) == null ? void 0 : y.metric_names) != null && _.length) ? { current: {}, previous: {} } : yr(a.value, e.withTrend.value);
|
|
155
|
+
}), s = p(() => {
|
|
156
|
+
var l, c;
|
|
157
|
+
if (e.timeRange.value.type === "absolute") {
|
|
158
|
+
if (!((c = (l = a.value) == null ? void 0 : l.meta) != null && c.start_ms))
|
|
159
|
+
return "";
|
|
160
|
+
const { start_ms: v, end_ms: h } = a.value.meta;
|
|
161
|
+
let R = (h - v) / (1e3 * 60 * 60 * 24), y = (h - v) / (1e3 * 60 * 60), _ = (h - v) / (1e3 * 60);
|
|
162
|
+
return e.withTrend.value && (R /= 2, y /= 2, _ /= 2), R >= 1 ? r.t("trendRange.custom_days", { numDays: Math.round(R) }) : y >= 1 ? r.t("trendRange.custom_hours", { numHours: Math.round(y) }) : _ >= 1 ? r.t("trendRange.custom_minutes", { numMinutes: Math.round(_) }) : r.t("trendRange.custom_days", { numDays: Math.round(R) });
|
|
163
|
+
} else
|
|
164
|
+
return e.withTrend.value ? r.t(`trendRange.${e.timeRange.value.time_range}`) : "";
|
|
165
|
+
});
|
|
159
166
|
return {
|
|
160
|
-
isLoading:
|
|
161
|
-
hasError:
|
|
162
|
-
raw:
|
|
163
|
-
mapped:
|
|
164
|
-
trendRange:
|
|
167
|
+
isLoading: p(() => f.PENDING === d.value),
|
|
168
|
+
hasError: p(() => f.ERROR === d.value),
|
|
169
|
+
raw: a,
|
|
170
|
+
mapped: i,
|
|
171
|
+
trendRange: s
|
|
165
172
|
};
|
|
166
173
|
}
|
|
167
|
-
const K = (e, r, t = L,
|
|
168
|
-
const
|
|
169
|
-
return
|
|
174
|
+
const K = (e, r, t = L, o) => (o ?? [L]).reduce((n, u) => {
|
|
175
|
+
const d = e[r][t];
|
|
176
|
+
return d ? n + (d[u] || 0) : n;
|
|
170
177
|
}, 0);
|
|
171
178
|
function pr(e) {
|
|
172
179
|
const {
|
|
173
180
|
cardType: r,
|
|
174
181
|
title: t,
|
|
175
|
-
description:
|
|
182
|
+
description: o,
|
|
176
183
|
record: a,
|
|
177
184
|
hasError: n,
|
|
178
185
|
increaseIsBad: u,
|
|
179
|
-
formatValueFn:
|
|
180
|
-
trendRange:
|
|
186
|
+
formatValueFn: d,
|
|
187
|
+
trendRange: f
|
|
181
188
|
} = e;
|
|
182
|
-
return
|
|
183
|
-
let
|
|
189
|
+
return p(() => {
|
|
190
|
+
let i = 0, s = 0;
|
|
184
191
|
if (a != null && a.value)
|
|
185
192
|
try {
|
|
186
|
-
|
|
193
|
+
i = K(a.value, "current", e.lookupKey, e.sumGroupedValues), s = K(a.value, "previous", e.lookupKey, e.sumGroupedValues);
|
|
187
194
|
} catch (l) {
|
|
188
195
|
console.error(
|
|
189
196
|
"Metric card data doesn't have the expected structure:",
|
|
@@ -193,54 +200,35 @@ function pr(e) {
|
|
|
193
200
|
return {
|
|
194
201
|
cardType: r,
|
|
195
202
|
hasError: n.value,
|
|
196
|
-
currentValue:
|
|
203
|
+
currentValue: i,
|
|
197
204
|
previousValue: s,
|
|
198
205
|
title: t.value,
|
|
199
|
-
description:
|
|
206
|
+
description: o,
|
|
200
207
|
increaseIsBad: !!u,
|
|
201
208
|
// Coerce undefined to false
|
|
202
|
-
formatValueFn:
|
|
203
|
-
trendRange:
|
|
209
|
+
formatValueFn: d,
|
|
210
|
+
trendRange: f == null ? void 0 : f.value
|
|
204
211
|
};
|
|
205
212
|
});
|
|
206
213
|
}
|
|
207
|
-
function Rr(e, r, t) {
|
|
208
|
-
const { i18n: i } = N.useI18n();
|
|
209
|
-
return g(() => {
|
|
210
|
-
var o, s, l;
|
|
211
|
-
if (!e.value)
|
|
212
|
-
return "";
|
|
213
|
-
if (((o = r == null ? void 0 : r.value) == null ? void 0 : o.type) === "relative")
|
|
214
|
-
return i.t(`trendRange.${r.value.time_range}`);
|
|
215
|
-
let a, n;
|
|
216
|
-
if ((s = t == null ? void 0 : t.value) != null && s.start_ms && t.value.end_ms)
|
|
217
|
-
a = t.value.start_ms, n = t.value.end_ms;
|
|
218
|
-
else if (((l = r == null ? void 0 : r.value) == null ? void 0 : l.type) === "absolute" && r.value.start && r.value.end)
|
|
219
|
-
a = new Date(r.value.start).getTime(), n = new Date(r.value.end).getTime();
|
|
220
|
-
else
|
|
221
|
-
return "";
|
|
222
|
-
let u = (n - a) / (1e3 * 60 * 60 * 24), c = (n - a) / (1e3 * 60 * 60), d = (n - a) / (1e3 * 60);
|
|
223
|
-
return e.value && (u /= 2, c /= 2, d /= 2), u >= 1 ? i.t("trendRange.custom_days", { numDays: Math.round(u) }) : c >= 1 ? i.t("trendRange.custom_hours", { numHours: Math.round(c) }) : d >= 1 ? i.t("trendRange.custom_minutes", { numMinutes: Math.round(d) }) : i.t("trendRange.custom_days", { numDays: Math.round(u) });
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
214
|
var ne = /* @__PURE__ */ new WeakMap(), pe = 0;
|
|
227
|
-
function
|
|
215
|
+
function Rr(e) {
|
|
228
216
|
if (!e.length)
|
|
229
217
|
return "";
|
|
230
218
|
for (var r = "arg", t = 0; t < e.length; ++t) {
|
|
231
|
-
var
|
|
232
|
-
e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ?
|
|
219
|
+
var o = void 0;
|
|
220
|
+
e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ? o = '"' + e[t] + '"' : o = String(e[t]) : ne.has(e[t]) ? o = ne.get(e[t]) : (o = pe, ne.set(e[t], pe++)), r += "@" + o;
|
|
233
221
|
}
|
|
234
222
|
return r;
|
|
235
223
|
}
|
|
236
|
-
function
|
|
224
|
+
function Tr(e) {
|
|
237
225
|
if (typeof e == "function")
|
|
238
226
|
try {
|
|
239
227
|
e = e();
|
|
240
228
|
} catch {
|
|
241
229
|
e = "";
|
|
242
230
|
}
|
|
243
|
-
return Array.isArray(e) ? e =
|
|
231
|
+
return Array.isArray(e) ? e = Rr(e) : e = String(e || ""), e;
|
|
244
232
|
}
|
|
245
233
|
var se = (
|
|
246
234
|
/** @class */
|
|
@@ -249,156 +237,156 @@ var se = (
|
|
|
249
237
|
r === void 0 && (r = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = r;
|
|
250
238
|
}
|
|
251
239
|
return e.prototype.serializeKey = function(r) {
|
|
252
|
-
return
|
|
240
|
+
return Tr(r);
|
|
253
241
|
}, e.prototype.get = function(r) {
|
|
254
242
|
var t = this.serializeKey(r);
|
|
255
243
|
return this.items.get(t);
|
|
256
|
-
}, e.prototype.set = function(r, t,
|
|
257
|
-
var a = this.serializeKey(r), n =
|
|
244
|
+
}, e.prototype.set = function(r, t, o) {
|
|
245
|
+
var a = this.serializeKey(r), n = o || this.ttl, u = Date.now(), d = {
|
|
258
246
|
data: t,
|
|
259
247
|
createdAt: u,
|
|
260
248
|
expiresAt: n ? u + n : 1 / 0
|
|
261
249
|
};
|
|
262
|
-
this.dispatchExpire(n,
|
|
263
|
-
}, e.prototype.dispatchExpire = function(r, t,
|
|
250
|
+
this.dispatchExpire(n, d, a), this.items.set(a, d);
|
|
251
|
+
}, e.prototype.dispatchExpire = function(r, t, o) {
|
|
264
252
|
var a = this;
|
|
265
253
|
r && setTimeout(function() {
|
|
266
254
|
var n = Date.now(), u = n >= t.expiresAt;
|
|
267
|
-
u && a.delete(
|
|
255
|
+
u && a.delete(o);
|
|
268
256
|
}, r);
|
|
269
257
|
}, e.prototype.delete = function(r) {
|
|
270
258
|
this.items.delete(r);
|
|
271
259
|
}, e;
|
|
272
260
|
}()
|
|
273
261
|
);
|
|
274
|
-
function
|
|
262
|
+
function Er() {
|
|
275
263
|
return typeof navigator.onLine < "u" ? navigator.onLine : !0;
|
|
276
264
|
}
|
|
277
|
-
function
|
|
265
|
+
function _r() {
|
|
278
266
|
return typeof document < "u" && typeof document.visibilityState < "u" ? document.visibilityState !== "hidden" : !0;
|
|
279
267
|
}
|
|
280
|
-
var
|
|
268
|
+
var Cr = function(e) {
|
|
281
269
|
return fetch(e).then(function(r) {
|
|
282
270
|
return r.json();
|
|
283
271
|
});
|
|
284
272
|
};
|
|
285
273
|
const ae = {
|
|
286
|
-
isOnline:
|
|
287
|
-
isDocumentVisible:
|
|
288
|
-
fetcher:
|
|
274
|
+
isOnline: Er,
|
|
275
|
+
isDocumentVisible: _r,
|
|
276
|
+
fetcher: Cr
|
|
289
277
|
};
|
|
290
278
|
var b = function() {
|
|
291
279
|
return b = Object.assign || function(e) {
|
|
292
|
-
for (var r, t = 1,
|
|
280
|
+
for (var r, t = 1, o = arguments.length; t < o; t++) {
|
|
293
281
|
r = arguments[t];
|
|
294
282
|
for (var a in r) Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
|
|
295
283
|
}
|
|
296
284
|
return e;
|
|
297
285
|
}, b.apply(this, arguments);
|
|
298
|
-
}, P = function(e, r, t,
|
|
286
|
+
}, P = function(e, r, t, o) {
|
|
299
287
|
function a(n) {
|
|
300
288
|
return n instanceof t ? n : new t(function(u) {
|
|
301
289
|
u(n);
|
|
302
290
|
});
|
|
303
291
|
}
|
|
304
292
|
return new (t || (t = Promise))(function(n, u) {
|
|
305
|
-
function
|
|
293
|
+
function d(s) {
|
|
306
294
|
try {
|
|
307
|
-
o
|
|
295
|
+
i(o.next(s));
|
|
308
296
|
} catch (l) {
|
|
309
297
|
u(l);
|
|
310
298
|
}
|
|
311
299
|
}
|
|
312
|
-
function
|
|
300
|
+
function f(s) {
|
|
313
301
|
try {
|
|
314
|
-
o
|
|
302
|
+
i(o.throw(s));
|
|
315
303
|
} catch (l) {
|
|
316
304
|
u(l);
|
|
317
305
|
}
|
|
318
306
|
}
|
|
319
|
-
function
|
|
320
|
-
s.done ? n(s.value) : a(s.value).then(
|
|
307
|
+
function i(s) {
|
|
308
|
+
s.done ? n(s.value) : a(s.value).then(d, f);
|
|
321
309
|
}
|
|
322
|
-
|
|
310
|
+
i((o = o.apply(e, r || [])).next());
|
|
323
311
|
});
|
|
324
312
|
}, $ = function(e, r) {
|
|
325
313
|
var t = { label: 0, sent: function() {
|
|
326
314
|
if (n[0] & 1) throw n[1];
|
|
327
315
|
return n[1];
|
|
328
|
-
}, trys: [], ops: [] },
|
|
329
|
-
return u = { next:
|
|
316
|
+
}, trys: [], ops: [] }, o, a, n, u;
|
|
317
|
+
return u = { next: d(0), throw: d(1), return: d(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
|
|
330
318
|
return this;
|
|
331
319
|
}), u;
|
|
332
|
-
function
|
|
320
|
+
function d(i) {
|
|
333
321
|
return function(s) {
|
|
334
|
-
return
|
|
322
|
+
return f([i, s]);
|
|
335
323
|
};
|
|
336
324
|
}
|
|
337
|
-
function
|
|
338
|
-
if (
|
|
325
|
+
function f(i) {
|
|
326
|
+
if (o) throw new TypeError("Generator is already executing.");
|
|
339
327
|
for (; t; ) try {
|
|
340
|
-
if (
|
|
341
|
-
switch (a = 0, n && (
|
|
328
|
+
if (o = 1, a && (n = i[0] & 2 ? a.return : i[0] ? a.throw || ((n = a.return) && n.call(a), 0) : a.next) && !(n = n.call(a, i[1])).done) return n;
|
|
329
|
+
switch (a = 0, n && (i = [i[0] & 2, n.value]), i[0]) {
|
|
342
330
|
case 0:
|
|
343
331
|
case 1:
|
|
344
|
-
n =
|
|
332
|
+
n = i;
|
|
345
333
|
break;
|
|
346
334
|
case 4:
|
|
347
|
-
return t.label++, { value:
|
|
335
|
+
return t.label++, { value: i[1], done: !1 };
|
|
348
336
|
case 5:
|
|
349
|
-
t.label++, a =
|
|
337
|
+
t.label++, a = i[1], i = [0];
|
|
350
338
|
continue;
|
|
351
339
|
case 7:
|
|
352
|
-
|
|
340
|
+
i = t.ops.pop(), t.trys.pop();
|
|
353
341
|
continue;
|
|
354
342
|
default:
|
|
355
|
-
if (n = t.trys, !(n = n.length > 0 && n[n.length - 1]) && (
|
|
343
|
+
if (n = t.trys, !(n = n.length > 0 && n[n.length - 1]) && (i[0] === 6 || i[0] === 2)) {
|
|
356
344
|
t = 0;
|
|
357
345
|
continue;
|
|
358
346
|
}
|
|
359
|
-
if (
|
|
360
|
-
t.label =
|
|
347
|
+
if (i[0] === 3 && (!n || i[1] > n[0] && i[1] < n[3])) {
|
|
348
|
+
t.label = i[1];
|
|
361
349
|
break;
|
|
362
350
|
}
|
|
363
|
-
if (
|
|
364
|
-
t.label = n[1], n =
|
|
351
|
+
if (i[0] === 6 && t.label < n[1]) {
|
|
352
|
+
t.label = n[1], n = i;
|
|
365
353
|
break;
|
|
366
354
|
}
|
|
367
355
|
if (n && t.label < n[2]) {
|
|
368
|
-
t.label = n[2], t.ops.push(
|
|
356
|
+
t.label = n[2], t.ops.push(i);
|
|
369
357
|
break;
|
|
370
358
|
}
|
|
371
359
|
n[2] && t.ops.pop(), t.trys.pop();
|
|
372
360
|
continue;
|
|
373
361
|
}
|
|
374
|
-
|
|
362
|
+
i = r.call(e, t);
|
|
375
363
|
} catch (s) {
|
|
376
|
-
|
|
364
|
+
i = [6, s], a = 0;
|
|
377
365
|
} finally {
|
|
378
|
-
|
|
366
|
+
o = n = 0;
|
|
379
367
|
}
|
|
380
|
-
if (
|
|
381
|
-
return { value:
|
|
368
|
+
if (i[0] & 5) throw i[1];
|
|
369
|
+
return { value: i[0] ? i[1] : void 0, done: !0 };
|
|
382
370
|
}
|
|
383
|
-
},
|
|
371
|
+
}, Sr = function(e, r) {
|
|
384
372
|
var t = typeof Symbol == "function" && e[Symbol.iterator];
|
|
385
373
|
if (!t) return e;
|
|
386
|
-
var
|
|
374
|
+
var o = t.call(e), a, n = [], u;
|
|
387
375
|
try {
|
|
388
|
-
for (; (r === void 0 || r-- > 0) && !(a =
|
|
389
|
-
} catch (
|
|
390
|
-
u = { error:
|
|
376
|
+
for (; (r === void 0 || r-- > 0) && !(a = o.next()).done; ) n.push(a.value);
|
|
377
|
+
} catch (d) {
|
|
378
|
+
u = { error: d };
|
|
391
379
|
} finally {
|
|
392
380
|
try {
|
|
393
|
-
a && !a.done && (t =
|
|
381
|
+
a && !a.done && (t = o.return) && t.call(o);
|
|
394
382
|
} finally {
|
|
395
383
|
if (u) throw u.error;
|
|
396
384
|
}
|
|
397
385
|
}
|
|
398
386
|
return n;
|
|
399
|
-
},
|
|
400
|
-
if (t || arguments.length === 2) for (var
|
|
401
|
-
(n || !(
|
|
387
|
+
}, Ir = function(e, r, t) {
|
|
388
|
+
if (t || arguments.length === 2) for (var o = 0, a = r.length, n; o < a; o++)
|
|
389
|
+
(n || !(o in r)) && (n || (n = Array.prototype.slice.call(r, 0, o)), n[o] = r[o]);
|
|
402
390
|
return e.concat(n || Array.prototype.slice.call(r));
|
|
403
391
|
}, Oe = new se(), Q = new se(), ie = new se(), Le = {
|
|
404
392
|
cache: Oe,
|
|
@@ -415,68 +403,68 @@ var b = function() {
|
|
|
415
403
|
isOnline: ae.isOnline,
|
|
416
404
|
isDocumentVisible: ae.isDocumentVisible
|
|
417
405
|
};
|
|
418
|
-
function
|
|
419
|
-
var
|
|
420
|
-
if (
|
|
421
|
-
|
|
406
|
+
function Ar(e, r, t) {
|
|
407
|
+
var o = Q.get(e);
|
|
408
|
+
if (o)
|
|
409
|
+
o.data.push(r);
|
|
422
410
|
else {
|
|
423
411
|
var a = 5e3;
|
|
424
412
|
Q.set(e, [r], t > 0 ? t + a : t);
|
|
425
413
|
}
|
|
426
414
|
}
|
|
427
|
-
function
|
|
415
|
+
function Dr(e, r, t) {
|
|
428
416
|
if (t.isDocumentVisible() && !(t.errorRetryCount !== void 0 && r > t.errorRetryCount)) {
|
|
429
|
-
var
|
|
417
|
+
var o = Math.min(r || 0, t.errorRetryCount), a = o * t.errorRetryInterval;
|
|
430
418
|
setTimeout(function() {
|
|
431
|
-
e(null, { errorRetryCount:
|
|
419
|
+
e(null, { errorRetryCount: o + 1, shouldRetryOnError: !0 });
|
|
432
420
|
}, a);
|
|
433
421
|
}
|
|
434
422
|
}
|
|
435
|
-
var Re = function(e, r, t,
|
|
436
|
-
return t === void 0 && (t = Oe),
|
|
437
|
-
var a, n, u,
|
|
423
|
+
var Re = function(e, r, t, o) {
|
|
424
|
+
return t === void 0 && (t = Oe), o === void 0 && (o = Le.ttl), P(void 0, void 0, void 0, function() {
|
|
425
|
+
var a, n, u, d, f, i, s;
|
|
438
426
|
return $(this, function(l) {
|
|
439
427
|
switch (l.label) {
|
|
440
428
|
case 0:
|
|
441
|
-
if (!
|
|
429
|
+
if (!wr(r)) return [3, 5];
|
|
442
430
|
l.label = 1;
|
|
443
431
|
case 1:
|
|
444
432
|
return l.trys.push([1, 3, , 4]), [4, r];
|
|
445
433
|
case 2:
|
|
446
434
|
return a = l.sent(), [3, 4];
|
|
447
435
|
case 3:
|
|
448
|
-
return
|
|
436
|
+
return d = l.sent(), n = d, [3, 4];
|
|
449
437
|
case 4:
|
|
450
438
|
return [3, 6];
|
|
451
439
|
case 5:
|
|
452
440
|
a = r, l.label = 6;
|
|
453
441
|
case 6:
|
|
454
|
-
if (u = !1,
|
|
442
|
+
if (u = !1, f = { data: a, error: n, isValidating: u }, typeof a < "u")
|
|
455
443
|
try {
|
|
456
|
-
t.set(e,
|
|
457
|
-
} catch (
|
|
458
|
-
console.error("swrv(mutate): failed to set cache",
|
|
444
|
+
t.set(e, f, o);
|
|
445
|
+
} catch (c) {
|
|
446
|
+
console.error("swrv(mutate): failed to set cache", c);
|
|
459
447
|
}
|
|
460
|
-
return
|
|
461
|
-
return
|
|
462
|
-
}), s.forEach(function(
|
|
463
|
-
typeof
|
|
464
|
-
var
|
|
465
|
-
|
|
466
|
-
}), s = s.filter(Boolean)), [2,
|
|
448
|
+
return i = Q.get(e), i && i.data.length && (s = i.data.filter(function(c) {
|
|
449
|
+
return c.key === e;
|
|
450
|
+
}), s.forEach(function(c, v) {
|
|
451
|
+
typeof f.data < "u" && (c.data = f.data), c.error = f.error, c.isValidating = f.isValidating, c.isLoading = f.isValidating;
|
|
452
|
+
var h = v === s.length - 1;
|
|
453
|
+
h || delete s[v];
|
|
454
|
+
}), s = s.filter(Boolean)), [2, f];
|
|
467
455
|
}
|
|
468
456
|
});
|
|
469
457
|
});
|
|
470
458
|
};
|
|
471
|
-
function
|
|
459
|
+
function br() {
|
|
472
460
|
for (var e = this, r = [], t = 0; t < arguments.length; t++)
|
|
473
461
|
r[t] = arguments[t];
|
|
474
|
-
var
|
|
475
|
-
if (!
|
|
462
|
+
var o, a, n = b({}, Le), u = !1, d = !1, f = Me(), i = (f == null ? void 0 : f.proxy) || f;
|
|
463
|
+
if (!i)
|
|
476
464
|
return console.error("Could not get current instance, check to make sure that `useSwrv` is declared in the top level of the setup function."), null;
|
|
477
|
-
var s = (
|
|
478
|
-
r.length >= 1 && (
|
|
479
|
-
var l = s ? n.serverTTL : n.ttl,
|
|
465
|
+
var s = (i == null ? void 0 : i.$isServer) || !1;
|
|
466
|
+
r.length >= 1 && (o = r[0]), r.length >= 2 && (a = r[1]), r.length > 2 && (n = b(b({}, n), r[2]));
|
|
467
|
+
var l = s ? n.serverTTL : n.ttl, c = typeof o == "function" ? o : Y(o);
|
|
480
468
|
typeof a > "u" && (a = n.fetcher);
|
|
481
469
|
var v = null;
|
|
482
470
|
v || (v = Fe({
|
|
@@ -486,33 +474,33 @@ function wr() {
|
|
|
486
474
|
isLoading: !0,
|
|
487
475
|
key: null
|
|
488
476
|
}));
|
|
489
|
-
var
|
|
477
|
+
var h = function(m, g) {
|
|
490
478
|
return P(e, void 0, void 0, function() {
|
|
491
|
-
var
|
|
479
|
+
var N, E, I, A, x, ce, J, de = this;
|
|
492
480
|
return $(this, function(Z) {
|
|
493
481
|
switch (Z.label) {
|
|
494
482
|
case 0:
|
|
495
|
-
return
|
|
483
|
+
return N = v.data === void 0, E = c.value, E ? (I = n.cache.get(E), A = I && I.data, v.isValidating = !0, v.isLoading = !A, A && (v.data = A.data, v.error = A.error), x = m || a, !x || !n.isDocumentVisible() && !N || (g == null ? void 0 : g.forceRevalidate) !== void 0 && !(g != null && g.forceRevalidate) ? (v.isValidating = !1, v.isLoading = !1, [
|
|
496
484
|
2
|
|
497
485
|
/*return*/
|
|
498
|
-
]) :
|
|
486
|
+
]) : I && (ce = !!(Date.now() - I.createdAt >= n.dedupingInterval || g != null && g.forceRevalidate), !ce) ? (v.isValidating = !1, v.isLoading = !1, [
|
|
499
487
|
2
|
|
500
488
|
/*return*/
|
|
501
489
|
]) : (J = function() {
|
|
502
490
|
return P(de, void 0, void 0, function() {
|
|
503
|
-
var
|
|
491
|
+
var k, fe, ee, ve;
|
|
504
492
|
return $(this, function(X) {
|
|
505
493
|
switch (X.label) {
|
|
506
494
|
case 0:
|
|
507
|
-
return
|
|
495
|
+
return k = ie.get(E), k ? [3, 2] : (fe = Array.isArray(E) ? E : [E], ee = x.apply(void 0, Ir([], Sr(fe), !1)), ie.set(E, ee, n.dedupingInterval), [4, Re(E, ee, n.cache, l)]);
|
|
508
496
|
case 1:
|
|
509
497
|
return X.sent(), [3, 4];
|
|
510
498
|
case 2:
|
|
511
|
-
return [4, Re(
|
|
499
|
+
return [4, Re(E, k.data, n.cache, l)];
|
|
512
500
|
case 3:
|
|
513
501
|
X.sent(), X.label = 4;
|
|
514
502
|
case 4:
|
|
515
|
-
return v.isValidating = !1, v.isLoading = !1, ie.delete(
|
|
503
|
+
return v.isValidating = !1, v.isLoading = !1, ie.delete(E), v.error !== void 0 && (ve = !u && n.shouldRetryOnError && (g ? g.shouldRetryOnError : !0), ve && Dr(h, g ? g.errorRetryCount : 1, n)), [
|
|
516
504
|
2
|
|
517
505
|
/*return*/
|
|
518
506
|
];
|
|
@@ -521,12 +509,12 @@ function wr() {
|
|
|
521
509
|
});
|
|
522
510
|
}, A && n.revalidateDebounce ? (setTimeout(function() {
|
|
523
511
|
return P(de, void 0, void 0, function() {
|
|
524
|
-
return $(this, function(
|
|
525
|
-
switch (
|
|
512
|
+
return $(this, function(k) {
|
|
513
|
+
switch (k.label) {
|
|
526
514
|
case 0:
|
|
527
515
|
return u ? [3, 2] : [4, J()];
|
|
528
516
|
case 1:
|
|
529
|
-
|
|
517
|
+
k.sent(), k.label = 2;
|
|
530
518
|
case 2:
|
|
531
519
|
return [
|
|
532
520
|
2
|
|
@@ -551,26 +539,26 @@ function wr() {
|
|
|
551
539
|
}
|
|
552
540
|
});
|
|
553
541
|
});
|
|
554
|
-
},
|
|
542
|
+
}, R = function() {
|
|
555
543
|
return P(e, void 0, void 0, function() {
|
|
556
544
|
return $(this, function(m) {
|
|
557
|
-
return [2,
|
|
545
|
+
return [2, h(null, { shouldRetryOnError: !1 })];
|
|
558
546
|
});
|
|
559
547
|
});
|
|
560
|
-
},
|
|
548
|
+
}, y = null;
|
|
561
549
|
xe(function() {
|
|
562
550
|
var m = function() {
|
|
563
551
|
return P(e, void 0, void 0, function() {
|
|
564
|
-
return $(this, function(
|
|
565
|
-
switch (
|
|
552
|
+
return $(this, function(g) {
|
|
553
|
+
switch (g.label) {
|
|
566
554
|
case 0:
|
|
567
|
-
return !v.error && n.isOnline() ? [4,
|
|
555
|
+
return !v.error && n.isOnline() ? [4, h()] : [3, 2];
|
|
568
556
|
case 1:
|
|
569
|
-
return
|
|
557
|
+
return g.sent(), [3, 3];
|
|
570
558
|
case 2:
|
|
571
|
-
|
|
559
|
+
y && clearTimeout(y), g.label = 3;
|
|
572
560
|
case 3:
|
|
573
|
-
return n.refreshInterval && !u && (
|
|
561
|
+
return n.refreshInterval && !u && (y = setTimeout(m, n.refreshInterval)), [
|
|
574
562
|
2
|
|
575
563
|
/*return*/
|
|
576
564
|
];
|
|
@@ -578,80 +566,79 @@ function wr() {
|
|
|
578
566
|
});
|
|
579
567
|
});
|
|
580
568
|
};
|
|
581
|
-
n.refreshInterval && (
|
|
569
|
+
n.refreshInterval && (y = setTimeout(m, n.refreshInterval)), n.revalidateOnFocus && (document.addEventListener("visibilitychange", R, !1), window.addEventListener("focus", R, !1));
|
|
582
570
|
}), qe(function() {
|
|
583
|
-
u = !0,
|
|
584
|
-
var m = Q.get(
|
|
585
|
-
m && (m.data = m.data.filter(function(
|
|
586
|
-
return
|
|
571
|
+
u = !0, y && clearTimeout(y), n.revalidateOnFocus && (document.removeEventListener("visibilitychange", R, !1), window.removeEventListener("focus", R, !1));
|
|
572
|
+
var m = Q.get(c.value);
|
|
573
|
+
m && (m.data = m.data.filter(function(g) {
|
|
574
|
+
return g !== v;
|
|
587
575
|
}));
|
|
588
576
|
});
|
|
589
577
|
try {
|
|
590
|
-
Ue(
|
|
591
|
-
Pe(
|
|
578
|
+
Ue(c, function(m) {
|
|
579
|
+
Pe(c) || (c.value = m), v.key = m, v.isValidating = !!m, Ar(c.value, v, l), !s && !d && c.value && h(), d = !1;
|
|
592
580
|
}, {
|
|
593
581
|
immediate: !0
|
|
594
582
|
});
|
|
595
583
|
} catch {
|
|
596
584
|
}
|
|
597
|
-
var
|
|
598
|
-
return
|
|
585
|
+
var _ = b(b({}, $e(v)), { mutate: function(m, g) {
|
|
586
|
+
return h(m, b(b({}, g), { forceRevalidate: !0 }));
|
|
599
587
|
} });
|
|
600
|
-
return
|
|
588
|
+
return _;
|
|
601
589
|
}
|
|
602
|
-
function
|
|
590
|
+
function wr(e) {
|
|
603
591
|
return e !== null && typeof e == "object" && typeof e.then == "function";
|
|
604
592
|
}
|
|
605
|
-
function
|
|
593
|
+
function Or(e, r, t) {
|
|
606
594
|
const {
|
|
607
|
-
data:
|
|
595
|
+
data: o,
|
|
608
596
|
error: a,
|
|
609
597
|
isValidating: n,
|
|
610
598
|
mutate: u
|
|
611
|
-
} =
|
|
599
|
+
} = br(e, r, {
|
|
612
600
|
revalidateDebounce: 500,
|
|
613
601
|
revalidateOnFocus: !1,
|
|
614
602
|
dedupingInterval: 100,
|
|
615
603
|
...t
|
|
616
604
|
});
|
|
617
605
|
return {
|
|
618
|
-
data:
|
|
619
|
-
response:
|
|
606
|
+
data: p(() => o.value),
|
|
607
|
+
response: o,
|
|
620
608
|
error: a,
|
|
621
609
|
isValidating: n,
|
|
622
610
|
revalidate: u
|
|
623
611
|
};
|
|
624
612
|
}
|
|
625
|
-
const
|
|
613
|
+
const M = {
|
|
626
614
|
useI18n: cr,
|
|
627
615
|
useMetricCardBuilder: pr,
|
|
628
616
|
useMetricFetcher: hr,
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}, Ve = Symbol("METRICS_PROVIDER_KEY"), Vr = (e) => {
|
|
617
|
+
useRequest: Or
|
|
618
|
+
}, Ve = Symbol("METRICS_PROVIDER_KEY"), Lr = (e) => {
|
|
632
619
|
const {
|
|
633
620
|
datasource: r,
|
|
634
621
|
dimension: t,
|
|
635
|
-
dimensionFilterValue:
|
|
622
|
+
dimensionFilterValue: o,
|
|
636
623
|
additionalFilter: a,
|
|
637
624
|
queryReady: n,
|
|
638
625
|
timeRange: u,
|
|
639
|
-
hasTrendAccess:
|
|
640
|
-
refreshInterval:
|
|
641
|
-
abortController:
|
|
626
|
+
hasTrendAccess: d,
|
|
627
|
+
refreshInterval: f,
|
|
628
|
+
abortController: i,
|
|
642
629
|
queryFn: s,
|
|
643
630
|
averageLatencies: l
|
|
644
631
|
} = e;
|
|
645
|
-
if (
|
|
632
|
+
if (o && !t)
|
|
646
633
|
throw new Error("Must provide a dimension if filtering by a value");
|
|
647
|
-
const
|
|
648
|
-
const
|
|
649
|
-
return
|
|
634
|
+
const c = !!(t && o), v = !!(t && !o), h = p(() => {
|
|
635
|
+
const g = [];
|
|
636
|
+
return c && g.push({
|
|
650
637
|
field: t,
|
|
651
638
|
operator: "in",
|
|
652
|
-
value: [
|
|
653
|
-
}), a.value &&
|
|
654
|
-
}),
|
|
639
|
+
value: [o]
|
|
640
|
+
}), a.value && g.push(...je(r.value, a.value)), g;
|
|
641
|
+
}), R = {
|
|
655
642
|
datasource: r,
|
|
656
643
|
metrics: Y([
|
|
657
644
|
"request_count"
|
|
@@ -659,38 +646,38 @@ const N = {
|
|
|
659
646
|
// Traffic and error rate cards should only try to query for the dimension if it's going to be used.
|
|
660
647
|
// It isn't used for single entity queries.
|
|
661
648
|
dimensions: [
|
|
662
|
-
...t && !
|
|
649
|
+
...t && !c ? [t] : [],
|
|
663
650
|
"status_code_grouped"
|
|
664
651
|
],
|
|
665
|
-
filter:
|
|
652
|
+
filter: h,
|
|
666
653
|
queryReady: n,
|
|
667
654
|
timeRange: u,
|
|
668
655
|
// Traffic and error rate cards can't query trend if multiple entities are expected.
|
|
669
|
-
withTrend:
|
|
670
|
-
refreshInterval:
|
|
656
|
+
withTrend: p(() => d.value && !v),
|
|
657
|
+
refreshInterval: f,
|
|
671
658
|
queryFn: s,
|
|
672
|
-
abortController:
|
|
659
|
+
abortController: i,
|
|
673
660
|
refreshCounter: e.refreshCounter
|
|
674
|
-
},
|
|
661
|
+
}, y = {
|
|
675
662
|
datasource: r,
|
|
676
|
-
metrics:
|
|
663
|
+
metrics: p(() => [
|
|
677
664
|
l.value ? "response_latency_average" : "response_latency_p99"
|
|
678
665
|
]),
|
|
679
666
|
// To keep single-entity queries consistent, don't bother querying the dimension for latency
|
|
680
667
|
// in the single-entity case, even though it's possible.
|
|
681
|
-
...t && !
|
|
682
|
-
filter:
|
|
668
|
+
...t && !c ? { dimensions: [t] } : {},
|
|
669
|
+
filter: h,
|
|
683
670
|
queryReady: n,
|
|
684
671
|
timeRange: u,
|
|
685
672
|
// Don't query latency trends in the multi-entity case: it's possible, but wasteful.
|
|
686
|
-
withTrend:
|
|
687
|
-
refreshInterval:
|
|
673
|
+
withTrend: p(() => d.value && !v),
|
|
674
|
+
refreshInterval: f,
|
|
688
675
|
queryFn: s,
|
|
689
|
-
abortController:
|
|
676
|
+
abortController: i,
|
|
690
677
|
refreshCounter: e.refreshCounter
|
|
691
|
-
},
|
|
678
|
+
}, _ = M.useMetricFetcher(R), m = M.useMetricFetcher(y);
|
|
692
679
|
return {
|
|
693
|
-
trafficData:
|
|
680
|
+
trafficData: _,
|
|
694
681
|
latencyData: m
|
|
695
682
|
};
|
|
696
683
|
}, gt = /* @__PURE__ */ W({
|
|
@@ -713,32 +700,32 @@ const N = {
|
|
|
713
700
|
},
|
|
714
701
|
setup(e) {
|
|
715
702
|
const r = e;
|
|
716
|
-
if (r.dimension && He.findIndex((
|
|
703
|
+
if (r.dimension && He.findIndex((c) => c === r.dimension) === -1)
|
|
717
704
|
throw new Error(`Attempted to use MetricsProvider with an invalid dimension: ${r.dimension}`);
|
|
718
705
|
const t = Ce(vr);
|
|
719
|
-
let
|
|
720
|
-
t ?
|
|
721
|
-
const a = We(), n =
|
|
722
|
-
const
|
|
723
|
-
return
|
|
706
|
+
let o;
|
|
707
|
+
t ? o = t.queryFn : (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/analytics-metric-provider/README.md#requirements"), o = () => Promise.reject(new Error("Query bridge required")));
|
|
708
|
+
const a = We(), n = p(() => !0), u = p(() => !a.loading && r.queryReady), d = p(() => r.datasource ? r.datasource : "basic"), f = p(() => {
|
|
709
|
+
const c = r.overrideTimeRange;
|
|
710
|
+
return c && !c.tz && (c.tz = new Intl.DateTimeFormat().resolvedOptions().timeZone), c || {
|
|
724
711
|
type: "relative",
|
|
725
712
|
time_range: "7d",
|
|
726
713
|
tz: new Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
727
714
|
};
|
|
728
|
-
}),
|
|
715
|
+
}), i = p(() => !r.percentileLatency), {
|
|
729
716
|
trafficData: s,
|
|
730
717
|
latencyData: l
|
|
731
|
-
} =
|
|
732
|
-
datasource:
|
|
718
|
+
} = Lr({
|
|
719
|
+
datasource: d,
|
|
733
720
|
dimension: r.dimension,
|
|
734
721
|
dimensionFilterValue: r.filterValue,
|
|
735
722
|
additionalFilter: G(r, "additionalFilter"),
|
|
736
723
|
queryReady: u,
|
|
737
|
-
timeRange:
|
|
724
|
+
timeRange: f,
|
|
738
725
|
hasTrendAccess: n,
|
|
739
726
|
refreshInterval: r.refreshInterval,
|
|
740
|
-
queryFn:
|
|
741
|
-
averageLatencies:
|
|
727
|
+
queryFn: o,
|
|
728
|
+
averageLatencies: i,
|
|
742
729
|
abortController: r.abortController,
|
|
743
730
|
refreshCounter: G(r, "refreshCounter")
|
|
744
731
|
});
|
|
@@ -751,62 +738,62 @@ const N = {
|
|
|
751
738
|
containerTitle: G(() => r.containerTitle),
|
|
752
739
|
hasTrendAccess: n,
|
|
753
740
|
longCardTitles: r.longCardTitles,
|
|
754
|
-
averageLatencies:
|
|
755
|
-
}), (
|
|
741
|
+
averageLatencies: i
|
|
742
|
+
}), (c, v) => Se(c.$slots, "default", {
|
|
756
743
|
hasTrendAccess: n.value,
|
|
757
|
-
timeRange:
|
|
744
|
+
timeRange: f.value
|
|
758
745
|
});
|
|
759
746
|
}
|
|
760
747
|
});
|
|
761
|
-
function
|
|
748
|
+
function Vr(e) {
|
|
762
749
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
763
750
|
}
|
|
764
751
|
var Ne = { exports: {} };
|
|
765
752
|
(function(e) {
|
|
766
753
|
(function() {
|
|
767
|
-
function r(
|
|
768
|
-
if (s.separator === !1 ||
|
|
769
|
-
return
|
|
770
|
-
var l = typeof s.separator == "string" ? s.separator : ",",
|
|
771
|
-
return v.reverse().forEach(function(
|
|
772
|
-
|
|
773
|
-
}),
|
|
754
|
+
function r(i, s) {
|
|
755
|
+
if (s.separator === !1 || i < 1e3)
|
|
756
|
+
return i.toString();
|
|
757
|
+
var l = typeof s.separator == "string" ? s.separator : ",", c = [], v = Math.round(i).toString().split("");
|
|
758
|
+
return v.reverse().forEach(function(h, R) {
|
|
759
|
+
R && R % 3 === 0 && c.push(l), c.push(h);
|
|
760
|
+
}), c.reverse().join("");
|
|
774
761
|
}
|
|
775
|
-
function t(
|
|
776
|
-
var
|
|
777
|
-
return l.decimal === !1 ? (
|
|
762
|
+
function t(i, s, l) {
|
|
763
|
+
var c = i / s, v = l.round ? "round" : "floor";
|
|
764
|
+
return l.decimal === !1 ? (i = Math[v](c), i.toString()) : (l.precision ? i = c : i = c < 10 ? Math[v](c * 10) / 10 : Math[v](c), i = i.toString(), typeof l.decimal == "string" && (i = i.replace(".", l.decimal)), i);
|
|
778
765
|
}
|
|
779
|
-
var
|
|
780
|
-
function
|
|
766
|
+
var o = 1e3, a = 1e4, n = 1e6, u = 1e9, d = 1e12;
|
|
767
|
+
function f(i, s) {
|
|
781
768
|
var l;
|
|
782
769
|
s = s || {};
|
|
783
|
-
var
|
|
784
|
-
|
|
785
|
-
var v = s.min10k ? a :
|
|
786
|
-
return
|
|
770
|
+
var c = i < 0;
|
|
771
|
+
c && (i = Math.abs(i)), s.precision && (i = parseFloat(i.toPrecision(s.precision)));
|
|
772
|
+
var v = s.min10k ? a : o;
|
|
773
|
+
return i < v || s.precision && s.precision > Math.log10(i) ? l = r(t(i, 1, s), s) : i < n ? l = t(i, o, s) + "k" : i < u ? l = t(i, n, s) + "m" : i < d ? l = r(t(i, u, s), s) + "b" : l = r(t(i, d, s), s) + "t", c && (l = "-" + l), s.capital && (l = l.toUpperCase()), s.prefix && (l = s.prefix + l), s.suffix && (l = l + s.suffix), l;
|
|
787
774
|
}
|
|
788
|
-
|
|
775
|
+
f.addCommas = r, e.exports = f;
|
|
789
776
|
})();
|
|
790
777
|
})(Ne);
|
|
791
|
-
var
|
|
792
|
-
const
|
|
778
|
+
var Nr = Ne.exports;
|
|
779
|
+
const kr = /* @__PURE__ */ Vr(Nr);
|
|
793
780
|
var O = /* @__PURE__ */ ((e) => (e.GENERIC_COUNT = "GenericCount", e.TRAFFIC = "Traffic", e.ERROR_RATE = "ErrorRate", e.LATENCY = "Latency", e))(O || {}), D = /* @__PURE__ */ ((e) => (e.Small = "sm", e.Medium = "md", e.Large = "lg", e.ExtraLarge = "xl", e))(D || {});
|
|
794
|
-
const ue = 2, Te = ue + 2,
|
|
795
|
-
let
|
|
796
|
-
return t && (
|
|
797
|
-
},
|
|
781
|
+
const ue = 2, Te = ue + 2, Mr = (e, r, t = !1) => {
|
|
782
|
+
let o = !r || Number(e.toFixed(Te)) === 0 ? 0 : Number(e.toFixed(Te)) > 0 ? 1 : -1;
|
|
783
|
+
return t && (o *= -1), o;
|
|
784
|
+
}, Fr = (e, r, t) => r ? `${Math.abs(e * 100).toFixed(ue)}%` : t, xr = (e, r) => r === 0 ? 0 : e / r - 1, qr = (e, r = !1) => (r && (e *= -1), e > 0 ? Je : e < 0 ? Ze : De), Ur = "#ad000e", oe = "#6c7489", Ee = "#52596e", Pr = "#007d60", j = "16px", $r = "20px", zr = {
|
|
798
785
|
key: 0,
|
|
799
786
|
class: "metricscard-description"
|
|
800
|
-
},
|
|
787
|
+
}, Kr = { class: "metricscard-valuetrend" }, Br = {
|
|
801
788
|
key: 0,
|
|
802
789
|
class: "metricscard-error"
|
|
803
|
-
},
|
|
790
|
+
}, Xr = {
|
|
804
791
|
key: 2,
|
|
805
792
|
class: "metricscard-trend"
|
|
806
|
-
},
|
|
793
|
+
}, Gr = { "data-testid": "metric-trend-change" }, jr = {
|
|
807
794
|
key: 0,
|
|
808
795
|
class: "metricscard-trend-range"
|
|
809
|
-
},
|
|
796
|
+
}, Hr = /* @__PURE__ */ W({
|
|
810
797
|
__name: "MetricsCard",
|
|
811
798
|
props: {
|
|
812
799
|
cardType: {
|
|
@@ -883,81 +870,81 @@ const ue = 2, Te = ue + 2, Fr = (e, r, t = !1) => {
|
|
|
883
870
|
[O.TRAFFIC, rr],
|
|
884
871
|
[O.ERROR_RATE, tr],
|
|
885
872
|
[O.LATENCY, nr]
|
|
886
|
-
]), t = e,
|
|
887
|
-
const
|
|
888
|
-
red: `var(--kui-color-text-danger-strong, ${
|
|
889
|
-
green: `var(--kui-color-text-success, ${
|
|
873
|
+
]), t = e, o = (d) => {
|
|
874
|
+
const f = {
|
|
875
|
+
red: `var(--kui-color-text-danger-strong, ${Ur})`,
|
|
876
|
+
green: `var(--kui-color-text-success, ${Pr})`,
|
|
890
877
|
grey: `var(--kui-color-text-neutral-strong, ${Ee})`
|
|
891
878
|
};
|
|
892
|
-
return
|
|
893
|
-
}, a = (
|
|
894
|
-
return (
|
|
895
|
-
const
|
|
896
|
-
return
|
|
879
|
+
return d > 0 ? f.green : d < 0 ? f.red : f.grey;
|
|
880
|
+
}, a = (d) => d > 0 ? "positive" : d < 0 ? "negative" : "neutral", n = [D.Medium, D.Large].includes(t.cardSize), u = [D.Small].includes(t.cardSize);
|
|
881
|
+
return (d, f) => {
|
|
882
|
+
const i = Ie("KTooltip");
|
|
883
|
+
return T(), S("div", {
|
|
897
884
|
class: z(["metricscard", e.cardSize])
|
|
898
885
|
}, [
|
|
899
886
|
q("div", {
|
|
900
887
|
class: z(["metricscard-title", e.cardSize])
|
|
901
888
|
}, [
|
|
902
|
-
|
|
889
|
+
C(u) ? V("", !0) : (T(), U(re(C(r).get(e.cardType)), {
|
|
903
890
|
key: 0,
|
|
904
891
|
class: "metricscard-icon",
|
|
905
|
-
color: `var(--kui-color-text-neutral, ${
|
|
906
|
-
size:
|
|
892
|
+
color: `var(--kui-color-text-neutral, ${C(oe)})`,
|
|
893
|
+
size: C(j)
|
|
907
894
|
}, null, 8, ["color", "size"])),
|
|
908
|
-
(
|
|
895
|
+
(T(), U(re(e.titleTag), null, {
|
|
909
896
|
default: me(() => [
|
|
910
897
|
Ae(w(e.title), 1)
|
|
911
898
|
]),
|
|
912
899
|
_: 1
|
|
913
900
|
})),
|
|
914
|
-
e.tooltip ? (
|
|
901
|
+
e.tooltip ? (T(), U(i, {
|
|
915
902
|
key: 1,
|
|
916
903
|
class: "metricscard-tooltip",
|
|
917
904
|
placement: "right",
|
|
918
905
|
text: e.tooltip
|
|
919
906
|
}, {
|
|
920
907
|
default: me(() => [
|
|
921
|
-
F(
|
|
922
|
-
color: `var(--kui-color-text-neutral, ${
|
|
923
|
-
size:
|
|
908
|
+
F(C(ar), {
|
|
909
|
+
color: `var(--kui-color-text-neutral, ${C(oe)})`,
|
|
910
|
+
size: C(j)
|
|
924
911
|
}, null, 8, ["color", "size"])
|
|
925
912
|
]),
|
|
926
913
|
_: 1
|
|
927
914
|
}, 8, ["text"])) : V("", !0)
|
|
928
915
|
], 2),
|
|
929
|
-
e.description &&
|
|
916
|
+
e.description && C(n) ? (T(), S("div", zr, [
|
|
930
917
|
q("span", null, w(e.description), 1)
|
|
931
918
|
])) : V("", !0),
|
|
932
|
-
q("div",
|
|
933
|
-
e.hasError ? (
|
|
934
|
-
F(
|
|
935
|
-
color: `var(--kui-color-text-neutral, ${
|
|
936
|
-
size:
|
|
919
|
+
q("div", Kr, [
|
|
920
|
+
e.hasError ? (T(), S("div", Br, [
|
|
921
|
+
F(C(be), {
|
|
922
|
+
color: `var(--kui-color-text-neutral, ${C(oe)})`,
|
|
923
|
+
size: C($r)
|
|
937
924
|
}, null, 8, ["color", "size"]),
|
|
938
925
|
q("div", null, " " + w(e.errorMessage), 1)
|
|
939
|
-
])) : (
|
|
926
|
+
])) : (T(), S("div", {
|
|
940
927
|
key: 1,
|
|
941
928
|
class: z(["metricscard-value", e.cardSize]),
|
|
942
929
|
"data-testid": "metric-value"
|
|
943
930
|
}, w(e.metricValue), 3)),
|
|
944
|
-
|
|
931
|
+
C(n) ? (T(), S("div", Xr, [
|
|
945
932
|
q("div", {
|
|
946
933
|
class: z(["metricscard-trend-change", a(e.changePolarity)]),
|
|
947
934
|
"data-testid": "metric-trend-parent"
|
|
948
935
|
}, [
|
|
949
|
-
e.changePolarity !== 0 ? (
|
|
936
|
+
e.changePolarity !== 0 ? (T(), U(re(e.trendIcon), {
|
|
950
937
|
key: 0,
|
|
951
|
-
color:
|
|
952
|
-
size:
|
|
953
|
-
}, null, 8, ["color", "size"])) : (
|
|
938
|
+
color: o(e.changePolarity),
|
|
939
|
+
size: C(j)
|
|
940
|
+
}, null, 8, ["color", "size"])) : (T(), U(C(ir), {
|
|
954
941
|
key: 1,
|
|
955
|
-
color: `var(--kui-color-text-neutral-strong, ${
|
|
956
|
-
size:
|
|
942
|
+
color: `var(--kui-color-text-neutral-strong, ${C(Ee)})`,
|
|
943
|
+
size: C(j)
|
|
957
944
|
}, null, 8, ["color", "size"])),
|
|
958
|
-
q("div",
|
|
945
|
+
q("div", Gr, w(e.metricChange), 1)
|
|
959
946
|
], 2),
|
|
960
|
-
e.trendRange ? (
|
|
947
|
+
e.trendRange ? (T(), S("div", jr, w(e.trendRange), 1)) : V("", !0)
|
|
961
948
|
])) : V("", !0)
|
|
962
949
|
])
|
|
963
950
|
], 2);
|
|
@@ -965,33 +952,33 @@ const ue = 2, Te = ue + 2, Fr = (e, r, t = !1) => {
|
|
|
965
952
|
}
|
|
966
953
|
}), le = (e, r) => {
|
|
967
954
|
const t = e.__vccOpts || e;
|
|
968
|
-
for (const [
|
|
969
|
-
t[
|
|
955
|
+
for (const [o, a] of r)
|
|
956
|
+
t[o] = a;
|
|
970
957
|
return t;
|
|
971
|
-
},
|
|
972
|
-
function
|
|
958
|
+
}, Yr = /* @__PURE__ */ le(Hr, [["__scopeId", "data-v-b1513f6f"]]), Qr = {}, Wr = { class: "loading-tabs" };
|
|
959
|
+
function Jr(e, r) {
|
|
973
960
|
const t = Ie("KSkeletonBox");
|
|
974
|
-
return
|
|
961
|
+
return T(), S("div", Wr, [
|
|
975
962
|
F(t, { width: "100" }),
|
|
976
963
|
F(t, { width: "75" })
|
|
977
964
|
]);
|
|
978
965
|
}
|
|
979
|
-
const
|
|
966
|
+
const Zr = /* @__PURE__ */ le(Qr, [["render", Jr], ["__scopeId", "data-v-9c7113d7"]]), et = {
|
|
980
967
|
key: 0,
|
|
981
968
|
class: "container-title"
|
|
982
|
-
},
|
|
969
|
+
}, rt = {
|
|
983
970
|
key: 0,
|
|
984
971
|
class: "container-description"
|
|
985
|
-
},
|
|
972
|
+
}, tt = {
|
|
986
973
|
key: 1,
|
|
987
974
|
class: "error-display"
|
|
988
|
-
},
|
|
975
|
+
}, nt = {
|
|
989
976
|
key: 0,
|
|
990
977
|
class: "error-display-message"
|
|
991
|
-
},
|
|
978
|
+
}, at = {
|
|
992
979
|
key: 2,
|
|
993
980
|
class: "cards-wrapper"
|
|
994
|
-
},
|
|
981
|
+
}, it = /* @__PURE__ */ W({
|
|
995
982
|
__name: "MetricCardContainer",
|
|
996
983
|
props: {
|
|
997
984
|
fallbackDisplayText: {
|
|
@@ -1034,37 +1021,37 @@ const et = /* @__PURE__ */ le(Wr, [["render", Zr], ["__scopeId", "data-v-9c7113d
|
|
|
1034
1021
|
}
|
|
1035
1022
|
},
|
|
1036
1023
|
setup(e) {
|
|
1037
|
-
const r = e, t =
|
|
1038
|
-
const n =
|
|
1024
|
+
const r = e, t = p(() => r.cards.every((a) => (a == null ? void 0 : a.hasError) === !0)), o = (a) => {
|
|
1025
|
+
const n = xr(a.currentValue, a.previousValue) || 0, u = Mr(n, r.hasTrendAccess, a.increaseIsBad);
|
|
1039
1026
|
return {
|
|
1040
|
-
metricValue: a.formatValueFn ? a.formatValueFn(a.currentValue) :
|
|
1041
|
-
metricChange: a.formatChangeFn ? a.formatChangeFn(n) :
|
|
1027
|
+
metricValue: a.formatValueFn ? a.formatValueFn(a.currentValue) : kr(a.currentValue, { capital: !0, round: !0 }) || "0",
|
|
1028
|
+
metricChange: a.formatChangeFn ? a.formatChangeFn(n) : Fr(n, r.hasTrendAccess, r.fallbackDisplayText),
|
|
1042
1029
|
changePolarity: u,
|
|
1043
|
-
trendIcon:
|
|
1030
|
+
trendIcon: qr(u, a.increaseIsBad),
|
|
1044
1031
|
cardSize: r.cardSize,
|
|
1045
1032
|
hasContainerTitle: !!r.containerTitle
|
|
1046
1033
|
};
|
|
1047
1034
|
};
|
|
1048
|
-
return (a, n) => (
|
|
1035
|
+
return (a, n) => (T(), S("div", {
|
|
1049
1036
|
class: z(["kong-ui-public-metric-card-container", e.cardSize])
|
|
1050
1037
|
}, [
|
|
1051
|
-
r.containerTitle || r.containerDescription ? (
|
|
1038
|
+
r.containerTitle || r.containerDescription ? (T(), S("div", et, [
|
|
1052
1039
|
Ae(w(r.containerTitle) + " ", 1),
|
|
1053
|
-
r.containerDescription ? (
|
|
1040
|
+
r.containerDescription ? (T(), S("div", rt, w(r.containerDescription), 1)) : V("", !0)
|
|
1054
1041
|
])) : V("", !0),
|
|
1055
|
-
t.value ? (
|
|
1056
|
-
F(
|
|
1057
|
-
e.errorMessage ? (
|
|
1058
|
-
])) : (
|
|
1059
|
-
(
|
|
1060
|
-
e.loading ? (
|
|
1061
|
-
key: `skeleton-${
|
|
1042
|
+
t.value ? (T(), S("div", tt, [
|
|
1043
|
+
F(C(be), { class: "error-display-icon" }),
|
|
1044
|
+
e.errorMessage ? (T(), S("div", nt, w(e.errorMessage), 1)) : V("", !0)
|
|
1045
|
+
])) : (T(), S("div", at, [
|
|
1046
|
+
(T(!0), S(ge, null, Ke(e.cards, (u, d) => (T(), S(ge, null, [
|
|
1047
|
+
e.loading ? (T(), S("div", {
|
|
1048
|
+
key: `skeleton-${d}`,
|
|
1062
1049
|
class: "loading-tab"
|
|
1063
1050
|
}, [
|
|
1064
|
-
F(
|
|
1065
|
-
class: z(e.cardSize ===
|
|
1051
|
+
F(Zr, {
|
|
1052
|
+
class: z(e.cardSize === C(D).Small ? "loading-tabs-small" : "loading-tabs-large")
|
|
1066
1053
|
}, null, 8, ["class"])
|
|
1067
|
-
])) : (
|
|
1054
|
+
])) : (T(), U(Yr, Be({ key: d }, { ref_for: !0 }, o(u), {
|
|
1068
1055
|
"card-size": e.cardSize,
|
|
1069
1056
|
"card-type": u.cardType,
|
|
1070
1057
|
description: u.description,
|
|
@@ -1079,7 +1066,7 @@ const et = /* @__PURE__ */ le(Wr, [["render", Zr], ["__scopeId", "data-v-9c7113d
|
|
|
1079
1066
|
]))
|
|
1080
1067
|
], 2));
|
|
1081
1068
|
}
|
|
1082
|
-
}),
|
|
1069
|
+
}), ot = /* @__PURE__ */ le(it, [["__scopeId", "data-v-7080ba56"]]), yt = /* @__PURE__ */ W({
|
|
1083
1070
|
__name: "MetricsConsumer",
|
|
1084
1071
|
props: {
|
|
1085
1072
|
lookupKey: { default: void 0 },
|
|
@@ -1090,31 +1077,31 @@ const et = /* @__PURE__ */ le(Wr, [["render", Zr], ["__scopeId", "data-v-9c7113d
|
|
|
1090
1077
|
const r = e, t = Ce(Ve);
|
|
1091
1078
|
if (!t)
|
|
1092
1079
|
throw new Error("MetricsConsumer must be nested inside a MetricsProvider instance.");
|
|
1093
|
-
const { traffic:
|
|
1080
|
+
const { traffic: o, latency: a } = t.data, { i18n: n } = M.useI18n(), u = p(() => t.containerTitle.value ? D.Medium : r.cardSize), d = M.useMetricCardBuilder({
|
|
1094
1081
|
cardType: O.TRAFFIC,
|
|
1095
|
-
title:
|
|
1096
|
-
record:
|
|
1097
|
-
hasError:
|
|
1082
|
+
title: p(() => t.longCardTitles ? n.t("metricCard.long.traffic") : n.t("metricCard.short.traffic")),
|
|
1083
|
+
record: o.mapped,
|
|
1084
|
+
hasError: o.hasError,
|
|
1098
1085
|
lookupKey: r.lookupKey,
|
|
1099
1086
|
sumGroupedValues: B,
|
|
1100
|
-
trendRange:
|
|
1101
|
-
}),
|
|
1102
|
-
const
|
|
1087
|
+
trendRange: o.trendRange
|
|
1088
|
+
}), f = (y) => `${y.toFixed(ue)}%`, i = p(() => {
|
|
1089
|
+
const y = o.mapped.value, _ = K(y, "current", r.lookupKey, ye), m = K(y, "current", r.lookupKey, B), g = _ / m * 100 || 0, N = K(y, "previous", r.lookupKey, ye), E = K(y, "previous", r.lookupKey, B), I = N / E * 100 || 0;
|
|
1103
1090
|
return {
|
|
1104
1091
|
cardType: O.ERROR_RATE,
|
|
1105
|
-
hasError:
|
|
1106
|
-
currentValue:
|
|
1107
|
-
previousValue:
|
|
1108
|
-
formatValueFn:
|
|
1092
|
+
hasError: o.hasError.value,
|
|
1093
|
+
currentValue: g,
|
|
1094
|
+
previousValue: I,
|
|
1095
|
+
formatValueFn: f,
|
|
1109
1096
|
title: t.longCardTitles ? n.t("metricCard.long.errorRate") : n.t("metricCard.short.errorRate"),
|
|
1110
1097
|
increaseIsBad: !0,
|
|
1111
|
-
trendRange:
|
|
1098
|
+
trendRange: o.trendRange.value
|
|
1112
1099
|
};
|
|
1113
|
-
}), s = (
|
|
1100
|
+
}), s = (y) => `${y}ms`, l = M.useMetricCardBuilder({
|
|
1114
1101
|
cardType: O.LATENCY,
|
|
1115
|
-
title:
|
|
1116
|
-
const { longCardTitles:
|
|
1117
|
-
return
|
|
1102
|
+
title: p(() => {
|
|
1103
|
+
const { longCardTitles: y, averageLatencies: _ } = t, m = _.value ? "averageLatency" : "p99Latency";
|
|
1104
|
+
return y ? n.t(`metricCard.long.${m}`) : u.value === D.Small ? n.t(`metricCard.small.${m}`) : n.t(`metricCard.short.${m}`);
|
|
1118
1105
|
}),
|
|
1119
1106
|
hasError: a.hasError,
|
|
1120
1107
|
record: a.mapped,
|
|
@@ -1122,8 +1109,8 @@ const et = /* @__PURE__ */ le(Wr, [["render", Zr], ["__scopeId", "data-v-9c7113d
|
|
|
1122
1109
|
increaseIsBad: !0,
|
|
1123
1110
|
formatValueFn: s,
|
|
1124
1111
|
trendRange: a.trendRange
|
|
1125
|
-
}),
|
|
1126
|
-
cards:
|
|
1112
|
+
}), c = p(() => r.cardToDisplay === "TRAFFIC" ? [d.value] : r.cardToDisplay === "ERROR_RATE" ? [i.value] : r.cardToDisplay === "LATENCY" ? [l.value] : [d.value, i.value, l.value]), v = p(() => r.cardToDisplay === "TRAFFIC" || r.cardToDisplay === "ERROR_RATE" ? o.isLoading.value : r.cardToDisplay === "LATENCY" ? a.isLoading.value : o.isLoading.value || a.isLoading.value), h = p(() => ({
|
|
1113
|
+
cards: c.value,
|
|
1127
1114
|
containerTitle: t.containerTitle.value,
|
|
1128
1115
|
containerDescription: t.description.value,
|
|
1129
1116
|
loading: v.value,
|
|
@@ -1131,30 +1118,30 @@ const et = /* @__PURE__ */ le(Wr, [["render", Zr], ["__scopeId", "data-v-9c7113d
|
|
|
1131
1118
|
fallbackDisplayText: n.t("general.notAvailable"),
|
|
1132
1119
|
cardSize: u.value,
|
|
1133
1120
|
hideTitle: !0
|
|
1134
|
-
})),
|
|
1135
|
-
loading:
|
|
1136
|
-
trafficCard:
|
|
1137
|
-
errorRateCard:
|
|
1121
|
+
})), R = p(() => ({
|
|
1122
|
+
loading: h.value.loading,
|
|
1123
|
+
trafficCard: d.value,
|
|
1124
|
+
errorRateCard: i.value,
|
|
1138
1125
|
latencyCard: l.value,
|
|
1139
|
-
errorRateFormatted:
|
|
1126
|
+
errorRateFormatted: f(i.value.currentValue),
|
|
1140
1127
|
latencyFormatted: s(l.value.currentValue)
|
|
1141
1128
|
}));
|
|
1142
|
-
return (
|
|
1143
|
-
F(
|
|
1129
|
+
return (y, _) => Se(y.$slots, "default", { cardValues: R.value }, () => [
|
|
1130
|
+
F(ot, Xe(Ge(h.value)), null, 16)
|
|
1144
1131
|
]);
|
|
1145
1132
|
}
|
|
1146
|
-
}), H = (e) => new Date(e),
|
|
1133
|
+
}), H = (e) => new Date(e), ht = (e, r) => {
|
|
1147
1134
|
const t = e.body;
|
|
1148
1135
|
e.reply({
|
|
1149
1136
|
statusCode: 200,
|
|
1150
|
-
body:
|
|
1137
|
+
body: st(t, r)
|
|
1151
1138
|
});
|
|
1152
|
-
}, _e = (e) => e.reduce((r, t) => (r[t] = { name: t }, r), {}),
|
|
1153
|
-
var
|
|
1139
|
+
}, _e = (e) => e.reduce((r, t) => (r[t] = { name: t }, r), {}), st = (e, r) => {
|
|
1140
|
+
var R, y, _;
|
|
1154
1141
|
const t = r != null && r.timeRange && {
|
|
1155
1142
|
start: r.timeRange.start,
|
|
1156
1143
|
end: r.timeRange.end
|
|
1157
|
-
} || ((
|
|
1144
|
+
} || ((R = e.time_range) == null ? void 0 : R.type) === "absolute" ? {
|
|
1158
1145
|
// @ts-ignore - already asserted time range is absolute above
|
|
1159
1146
|
start: new Date(e.time_range.start),
|
|
1160
1147
|
// @ts-ignore - already asserted time range is absolute above
|
|
@@ -1162,70 +1149,63 @@ const et = /* @__PURE__ */ le(Wr, [["render", Zr], ["__scopeId", "data-v-9c7113d
|
|
|
1162
1149
|
} : {
|
|
1163
1150
|
start: new Date(Date.now() - 864e5),
|
|
1164
1151
|
end: /* @__PURE__ */ new Date()
|
|
1165
|
-
},
|
|
1166
|
-
start: new Date(t.start.getTime() -
|
|
1152
|
+
}, o = t.end.getTime() - t.start.getTime(), a = e.granularity === "trend" ? {
|
|
1153
|
+
start: new Date(t.start.getTime() - o),
|
|
1167
1154
|
end: t.end,
|
|
1168
1155
|
granularity: t.end.getTime() - t.start.getTime()
|
|
1169
1156
|
} : {
|
|
1170
1157
|
start: t.start,
|
|
1171
1158
|
end: t.end,
|
|
1172
1159
|
granularity: t.end.getTime() - t.start.getTime()
|
|
1173
|
-
}, n = a.end.getTime(), u = a.start.getTime(),
|
|
1160
|
+
}, n = a.end.getTime(), u = a.start.getTime(), d = a.granularity, f = e.granularity === "trend" ? 2 : 1;
|
|
1174
1161
|
if ((e.dimensions ?? []).length > 2)
|
|
1175
1162
|
throw new Error(`Explore only supports 0-2 dimensions; got: ${JSON.stringify(e.dimensions)}`);
|
|
1176
|
-
const
|
|
1177
|
-
for (let m = 0; m <
|
|
1178
|
-
for (let
|
|
1179
|
-
const
|
|
1180
|
-
(
|
|
1181
|
-
const
|
|
1163
|
+
const i = (e.dimensions ?? []).find((m) => m !== "time"), s = (r == null ? void 0 : r.dimensionNames) ?? [], l = Math.max(s.length, 1), c = e.metrics || [], v = [];
|
|
1164
|
+
for (let m = 0; m < f; m++)
|
|
1165
|
+
for (let g = 0; g < l; g++) {
|
|
1166
|
+
const N = i ? { [i]: s[g] } : {};
|
|
1167
|
+
(y = e.dimensions) != null && y.includes("status_code_grouped") ? B.forEach((E) => {
|
|
1168
|
+
const I = c.reduce((A, x) => ((r == null ? void 0 : r.deterministic) ?? !0 ? A[x] = (f - m) * 1e3 + 100 * g + 1 : A[x] = Math.round(Math.random() * 1e3), A), { ...N, status_code_grouped: E });
|
|
1182
1169
|
v.push({
|
|
1183
1170
|
version: "v1",
|
|
1184
|
-
timestamp: m === 0 ? H(u).toISOString() : H(u +
|
|
1185
|
-
event:
|
|
1171
|
+
timestamp: m === 0 ? H(u).toISOString() : H(u + d).toISOString(),
|
|
1172
|
+
event: I
|
|
1186
1173
|
});
|
|
1187
1174
|
}) : v.push({
|
|
1188
1175
|
version: "v1",
|
|
1189
|
-
timestamp: m === 0 ? H(u).toISOString() : H(u +
|
|
1190
|
-
event:
|
|
1176
|
+
timestamp: m === 0 ? H(u).toISOString() : H(u + d).toISOString(),
|
|
1177
|
+
event: c.reduce((E, I) => ((r == null ? void 0 : r.deterministic) ?? !0 ? E[I] = (f - m) * 1e3 + 100 * g + 1 : E[I] = Math.round(Math.random() * 1e3), E), { ...N })
|
|
1191
1178
|
});
|
|
1192
1179
|
}
|
|
1193
|
-
const
|
|
1180
|
+
const h = {
|
|
1194
1181
|
start_ms: u,
|
|
1195
1182
|
end_ms: n,
|
|
1196
1183
|
start: new Date(u).toISOString(),
|
|
1197
1184
|
end: new Date(n).toISOString(),
|
|
1198
|
-
granularity_ms:
|
|
1199
|
-
display:
|
|
1200
|
-
[
|
|
1201
|
-
...(
|
|
1185
|
+
granularity_ms: d,
|
|
1186
|
+
display: i ? {
|
|
1187
|
+
[i]: _e(s),
|
|
1188
|
+
...(_ = e.dimensions) != null && _.includes("status_code_grouped") ? { status_code_grouped: _e(B) } : {}
|
|
1202
1189
|
} : {},
|
|
1203
1190
|
metric_names: e.metrics,
|
|
1204
1191
|
query_id: "test"
|
|
1205
1192
|
};
|
|
1206
1193
|
return {
|
|
1207
1194
|
data: v,
|
|
1208
|
-
meta:
|
|
1195
|
+
meta: h
|
|
1209
1196
|
};
|
|
1210
1197
|
};
|
|
1211
1198
|
export {
|
|
1212
1199
|
B as ALL_STATUS_CODE_GROUPS,
|
|
1213
|
-
ue as DECIMAL_DISPLAY,
|
|
1214
|
-
Te as DECIMAL_ROUNDING_PRECISION,
|
|
1215
1200
|
fr as DEFAULT_REFRESH_INTERVAL,
|
|
1216
1201
|
vr as INJECT_QUERY_PROVIDER,
|
|
1217
1202
|
dr as MAX_ANALYTICS_REQUEST_RETRIES,
|
|
1218
1203
|
D as MetricCardSize,
|
|
1219
1204
|
O as MetricCardType,
|
|
1220
|
-
|
|
1205
|
+
yt as MetricsConsumer,
|
|
1221
1206
|
gt as MetricsProvider,
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
Ur as defineIcon,
|
|
1227
|
-
xr as metricChange,
|
|
1228
|
-
ut as mockExploreResponse,
|
|
1229
|
-
pt as mockExploreResponseFromCypress,
|
|
1230
|
-
Rr as useTrendRange
|
|
1207
|
+
ye as STATUS_CODES_FAILED,
|
|
1208
|
+
mt as STATUS_CODES_SUCCESS,
|
|
1209
|
+
st as mockExploreResponse,
|
|
1210
|
+
ht as mockExploreResponseFromCypress
|
|
1231
1211
|
};
|