@kong-ui-public/analytics-metric-provider 7.0.1 → 7.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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ref as te, watchEffect as Be, computed as g, getCurrentInstance as $e, reactive as Pe, onMounted as Ke, onUnmounted as Ze, watch as Ue, isReadonly as Ge, toRefs as je, defineComponent as k, inject as ke, toRef as J, provide as
|
|
1
|
+
import { ref as te, watchEffect as Be, computed as g, getCurrentInstance as $e, reactive as Pe, onMounted as Ke, onUnmounted as Ze, watch as Ue, isReadonly as Ge, toRefs as je, defineComponent as k, inject as ke, toRef as J, provide as Xe, renderSlot as qe, resolveComponent as ze, openBlock as p, createElementBlock as y, createElementVNode as x, normalizeClass as G, unref as _, createCommentVNode as T, createBlock as E, resolveDynamicComponent as z, withCtx as L, createTextVNode as Le, toDisplayString as R, createVNode as X, normalizeStyle as A, Fragment as _e, renderList as Ye, mergeProps as Qe, pushScopeId as V, popScopeId as D, normalizeProps as We, guardReactiveProps as Je } from "vue";
|
|
2
2
|
import { TimePeriods as ie, TimeframeKeys as ne, queryableExploreDimensions as er, DeltaQueryTime as rr, UnaryQueryTime as tr } from "@kong-ui-public/analytics-utilities";
|
|
3
3
|
import { createI18n as ir, i18nTComponent as nr } from "@kong-ui-public/i18n";
|
|
4
4
|
import { useAnalyticsConfigStore as ar } from "@kong-ui-public/analytics-config-store";
|
|
5
5
|
const or = {
|
|
6
6
|
notAvailable: "N/A"
|
|
7
|
-
},
|
|
7
|
+
}, sr = {
|
|
8
8
|
short: {
|
|
9
9
|
traffic: "Requests",
|
|
10
10
|
errorRate: "Error Rate",
|
|
@@ -17,7 +17,7 @@ const or = {
|
|
|
17
17
|
averageLatency: "Average Latency",
|
|
18
18
|
p99Latency: "P99 Latency"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, ur = {
|
|
21
21
|
custom: "vs previous {numDays, plural, =1 {day} other {# days}}",
|
|
22
22
|
"15m": "vs previous 15 minutes",
|
|
23
23
|
"1h": "vs previous hour",
|
|
@@ -32,13 +32,13 @@ const or = {
|
|
|
32
32
|
previous_week: "vs previous time period",
|
|
33
33
|
previous_month: "vs previous time period",
|
|
34
34
|
previous_quarter: "vs previous quarter"
|
|
35
|
-
},
|
|
35
|
+
}, lr = {
|
|
36
36
|
general: or,
|
|
37
|
-
metricCard:
|
|
38
|
-
trendRange:
|
|
37
|
+
metricCard: sr,
|
|
38
|
+
trendRange: ur
|
|
39
39
|
};
|
|
40
40
|
function dr() {
|
|
41
|
-
const e = ir("en-us",
|
|
41
|
+
const e = ir("en-us", lr);
|
|
42
42
|
return {
|
|
43
43
|
i18n: e,
|
|
44
44
|
i18nT: nr(e)
|
|
@@ -94,13 +94,13 @@ const B = Symbol("default"), de = "status_code_grouped", Re = (e, r, t, a, n) =>
|
|
|
94
94
|
};
|
|
95
95
|
function yr(e, r) {
|
|
96
96
|
var v;
|
|
97
|
-
const t = ((v = e.meta.metric_names) == null ? void 0 : v[0]) || "", a = e.meta.start_ms, n = Object.keys(e.meta.display || {}), i = !!n.find((d) => d === de),
|
|
97
|
+
const t = ((v = e.meta.metric_names) == null ? void 0 : v[0]) || "", a = e.meta.start_ms, n = Object.keys(e.meta.display || {}), i = !!n.find((d) => d === de), u = n.find((d) => d !== de);
|
|
98
98
|
return n.length > 2 || n.length > 1 && !i ? (console.error("Don't know how to work with provided dimensions:", n), {
|
|
99
99
|
previous: { [B]: { [B]: 0 } },
|
|
100
100
|
current: { [B]: { [B]: 0 } }
|
|
101
101
|
}) : e.data.reduce((d, o) => {
|
|
102
|
-
const
|
|
103
|
-
return new Date(o.timestamp).getTime() === a && r ? Re(d, "previous",
|
|
102
|
+
const s = o.event[t], l = u ? o.event[u] : B, c = i ? o.event[de] : B;
|
|
103
|
+
return new Date(o.timestamp).getTime() === a && r ? Re(d, "previous", l, c, s) : Re(d, "current", l, c, s), d;
|
|
104
104
|
}, {
|
|
105
105
|
previous: {},
|
|
106
106
|
current: {}
|
|
@@ -109,11 +109,11 @@ function yr(e, r) {
|
|
|
109
109
|
function mr(e) {
|
|
110
110
|
e.queryReady === void 0 && (e.queryReady = g(() => !0));
|
|
111
111
|
const { i18n: r } = K.useI18n(), t = g(() => {
|
|
112
|
-
var
|
|
112
|
+
var l, c;
|
|
113
113
|
return {
|
|
114
114
|
metrics: e.metrics.value,
|
|
115
115
|
dimensions: [
|
|
116
|
-
...(
|
|
116
|
+
...(l = e.dimensions) != null && l.length ? [...e.dimensions] : [],
|
|
117
117
|
...e.withTrend.value ? ["time"] : []
|
|
118
118
|
],
|
|
119
119
|
granularity: e.withTrend.value ? "trend" : void 0,
|
|
@@ -124,9 +124,9 @@ function mr(e) {
|
|
|
124
124
|
var c, f, C, m;
|
|
125
125
|
if (!((c = e.queryReady) != null && c.value))
|
|
126
126
|
return null;
|
|
127
|
-
const
|
|
128
|
-
return `metric-fetcher-${e.timeframe.value.cacheKey()}-${(C = e.dimensions) == null ? void 0 : C.join("-")}-${(m = e.metrics.value) == null ? void 0 : m.join("-")}-${
|
|
129
|
-
}), { response: n, error: i, isValidating:
|
|
127
|
+
const l = (f = e.filter) != null && f.value ? JSON.stringify(e.filter.value) : "";
|
|
128
|
+
return `metric-fetcher-${e.timeframe.value.cacheKey()}-${(C = e.dimensions) == null ? void 0 : C.join("-")}-${(m = e.metrics.value) == null ? void 0 : m.join("-")}-${l}`;
|
|
129
|
+
}), { response: n, error: i, isValidating: u } = K.useRequest(
|
|
130
130
|
() => a.value,
|
|
131
131
|
() => e.queryFn(t.value, e.abortController ?? new AbortController()),
|
|
132
132
|
{
|
|
@@ -134,13 +134,13 @@ function mr(e) {
|
|
|
134
134
|
revalidateOnFocus: !1,
|
|
135
135
|
errorRetryCount: cr
|
|
136
136
|
}
|
|
137
|
-
), { state: v, swrvState: d } = gr(n, i,
|
|
138
|
-
var
|
|
139
|
-
return !((c = (
|
|
140
|
-
}),
|
|
141
|
-
var
|
|
137
|
+
), { state: v, swrvState: d } = gr(n, i, u), o = g(() => {
|
|
138
|
+
var l, c, f, C, m, b, N;
|
|
139
|
+
return !((c = (l = n.value) == null ? void 0 : l.data) != null && c.length) || !((C = (f = n.value) == null ? void 0 : f.meta) != null && C.display) || !((N = (b = (m = n.value) == null ? void 0 : m.meta) == null ? void 0 : b.metric_names) != null && N.length) ? { current: {}, previous: {} } : yr(n.value, e.withTrend.value);
|
|
140
|
+
}), s = g(() => {
|
|
141
|
+
var l, c, f;
|
|
142
142
|
if (e.timeframe.value.key === "custom") {
|
|
143
|
-
if (!((c = (
|
|
143
|
+
if (!((c = (l = n.value) == null ? void 0 : l.meta) != null && c.start_ms))
|
|
144
144
|
return "";
|
|
145
145
|
const { start_ms: C, end_ms: m } = n.value.meta;
|
|
146
146
|
let b = (m - C) / (1e3 * 60 * 60 * 24);
|
|
@@ -153,12 +153,12 @@ function mr(e) {
|
|
|
153
153
|
hasError: g(() => d.ERROR === v.value),
|
|
154
154
|
raw: n,
|
|
155
155
|
mapped: o,
|
|
156
|
-
trendRange:
|
|
156
|
+
trendRange: s
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
const j = (e, r, t = B, a) => (a ?? [B]).reduce((i,
|
|
159
|
+
const j = (e, r, t = B, a) => (a ?? [B]).reduce((i, u) => {
|
|
160
160
|
const v = e[r][t];
|
|
161
|
-
return v ? i + (v[
|
|
161
|
+
return v ? i + (v[u] || 0) : i;
|
|
162
162
|
}, 0);
|
|
163
163
|
function hr(e) {
|
|
164
164
|
const {
|
|
@@ -167,29 +167,29 @@ function hr(e) {
|
|
|
167
167
|
description: a,
|
|
168
168
|
record: n,
|
|
169
169
|
hasError: i,
|
|
170
|
-
increaseIsBad:
|
|
170
|
+
increaseIsBad: u,
|
|
171
171
|
formatValueFn: v,
|
|
172
172
|
trendRange: d
|
|
173
173
|
} = e;
|
|
174
174
|
return g(() => {
|
|
175
|
-
let o = 0,
|
|
175
|
+
let o = 0, s = 0;
|
|
176
176
|
if (n != null && n.value)
|
|
177
177
|
try {
|
|
178
|
-
o = j(n.value, "current", e.lookupKey, e.sumGroupedValues),
|
|
179
|
-
} catch (
|
|
178
|
+
o = j(n.value, "current", e.lookupKey, e.sumGroupedValues), s = j(n.value, "previous", e.lookupKey, e.sumGroupedValues);
|
|
179
|
+
} catch (l) {
|
|
180
180
|
console.error(
|
|
181
181
|
"Metric card data doesn't have the expected structure:",
|
|
182
|
-
|
|
182
|
+
l
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
185
|
return {
|
|
186
186
|
cardType: r,
|
|
187
187
|
hasError: i.value,
|
|
188
188
|
currentValue: o,
|
|
189
|
-
previousValue:
|
|
189
|
+
previousValue: s,
|
|
190
190
|
title: t.value,
|
|
191
191
|
description: a,
|
|
192
|
-
increaseIsBad: !!
|
|
192
|
+
increaseIsBad: !!u,
|
|
193
193
|
// Coerce undefined to false
|
|
194
194
|
formatValueFn: v,
|
|
195
195
|
trendRange: d == null ? void 0 : d.value
|
|
@@ -227,17 +227,17 @@ var ge = (
|
|
|
227
227
|
var t = this.serializeKey(r);
|
|
228
228
|
return this.items.get(t);
|
|
229
229
|
}, e.prototype.set = function(r, t, a) {
|
|
230
|
-
var n = this.serializeKey(r), i = a || this.ttl,
|
|
230
|
+
var n = this.serializeKey(r), i = a || this.ttl, u = Date.now(), v = {
|
|
231
231
|
data: t,
|
|
232
|
-
createdAt:
|
|
233
|
-
expiresAt: i ?
|
|
232
|
+
createdAt: u,
|
|
233
|
+
expiresAt: i ? u + i : 1 / 0
|
|
234
234
|
};
|
|
235
235
|
this.dispatchExpire(i, v, n), this.items.set(n, v);
|
|
236
236
|
}, e.prototype.dispatchExpire = function(r, t, a) {
|
|
237
237
|
var n = this;
|
|
238
238
|
r && setTimeout(function() {
|
|
239
|
-
var i = Date.now(),
|
|
240
|
-
|
|
239
|
+
var i = Date.now(), u = i >= t.expiresAt;
|
|
240
|
+
u && n.delete(a);
|
|
241
241
|
}, r);
|
|
242
242
|
}, e.prototype.delete = function(r) {
|
|
243
243
|
this.items.delete(r);
|
|
@@ -271,27 +271,27 @@ var F = function() {
|
|
|
271
271
|
}, F.apply(this, arguments);
|
|
272
272
|
}, Z = function(e, r, t, a) {
|
|
273
273
|
function n(i) {
|
|
274
|
-
return i instanceof t ? i : new t(function(
|
|
275
|
-
|
|
274
|
+
return i instanceof t ? i : new t(function(u) {
|
|
275
|
+
u(i);
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
|
-
return new (t || (t = Promise))(function(i,
|
|
279
|
-
function v(
|
|
278
|
+
return new (t || (t = Promise))(function(i, u) {
|
|
279
|
+
function v(s) {
|
|
280
280
|
try {
|
|
281
|
-
o(a.next(
|
|
282
|
-
} catch (
|
|
283
|
-
|
|
281
|
+
o(a.next(s));
|
|
282
|
+
} catch (l) {
|
|
283
|
+
u(l);
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function d(
|
|
286
|
+
function d(s) {
|
|
287
287
|
try {
|
|
288
|
-
o(a.throw(
|
|
289
|
-
} catch (
|
|
290
|
-
|
|
288
|
+
o(a.throw(s));
|
|
289
|
+
} catch (l) {
|
|
290
|
+
u(l);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
function o(
|
|
294
|
-
|
|
293
|
+
function o(s) {
|
|
294
|
+
s.done ? i(s.value) : n(s.value).then(v, d);
|
|
295
295
|
}
|
|
296
296
|
o((a = a.apply(e, r || [])).next());
|
|
297
297
|
});
|
|
@@ -300,13 +300,13 @@ var F = function() {
|
|
|
300
300
|
if (i[0] & 1)
|
|
301
301
|
throw i[1];
|
|
302
302
|
return i[1];
|
|
303
|
-
}, trys: [], ops: [] }, a, n, i,
|
|
304
|
-
return
|
|
303
|
+
}, trys: [], ops: [] }, a, n, i, u;
|
|
304
|
+
return u = { next: v(0), throw: v(1), return: v(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
|
|
305
305
|
return this;
|
|
306
|
-
}),
|
|
306
|
+
}), u;
|
|
307
307
|
function v(o) {
|
|
308
|
-
return function(
|
|
309
|
-
return d([o,
|
|
308
|
+
return function(s) {
|
|
309
|
+
return d([o, s]);
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
function d(o) {
|
|
@@ -350,8 +350,8 @@ var F = function() {
|
|
|
350
350
|
continue;
|
|
351
351
|
}
|
|
352
352
|
o = r.call(e, t);
|
|
353
|
-
} catch (
|
|
354
|
-
o = [6,
|
|
353
|
+
} catch (s) {
|
|
354
|
+
o = [6, s], n = 0;
|
|
355
355
|
} finally {
|
|
356
356
|
a = i = 0;
|
|
357
357
|
}
|
|
@@ -363,18 +363,18 @@ var F = function() {
|
|
|
363
363
|
var t = typeof Symbol == "function" && e[Symbol.iterator];
|
|
364
364
|
if (!t)
|
|
365
365
|
return e;
|
|
366
|
-
var a = t.call(e), n, i = [],
|
|
366
|
+
var a = t.call(e), n, i = [], u;
|
|
367
367
|
try {
|
|
368
368
|
for (; (r === void 0 || r-- > 0) && !(n = a.next()).done; )
|
|
369
369
|
i.push(n.value);
|
|
370
370
|
} catch (v) {
|
|
371
|
-
|
|
371
|
+
u = { error: v };
|
|
372
372
|
} finally {
|
|
373
373
|
try {
|
|
374
374
|
n && !n.done && (t = a.return) && t.call(a);
|
|
375
375
|
} finally {
|
|
376
|
-
if (
|
|
377
|
-
throw
|
|
376
|
+
if (u)
|
|
377
|
+
throw u.error;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
return i;
|
|
@@ -417,37 +417,37 @@ function Er(e, r, t) {
|
|
|
417
417
|
}
|
|
418
418
|
var Ne = function(e, r, t, a) {
|
|
419
419
|
return t === void 0 && (t = Ve), a === void 0 && (a = De.ttl), Z(void 0, void 0, void 0, function() {
|
|
420
|
-
var n, i,
|
|
421
|
-
return U(this, function(
|
|
422
|
-
switch (
|
|
420
|
+
var n, i, u, v, d, o, s;
|
|
421
|
+
return U(this, function(l) {
|
|
422
|
+
switch (l.label) {
|
|
423
423
|
case 0:
|
|
424
424
|
if (!xr(r))
|
|
425
425
|
return [3, 5];
|
|
426
|
-
|
|
426
|
+
l.label = 1;
|
|
427
427
|
case 1:
|
|
428
|
-
return
|
|
428
|
+
return l.trys.push([1, 3, , 4]), [4, r];
|
|
429
429
|
case 2:
|
|
430
|
-
return n =
|
|
430
|
+
return n = l.sent(), [3, 4];
|
|
431
431
|
case 3:
|
|
432
|
-
return v =
|
|
432
|
+
return v = l.sent(), i = v, [3, 4];
|
|
433
433
|
case 4:
|
|
434
434
|
return [3, 6];
|
|
435
435
|
case 5:
|
|
436
|
-
n = r,
|
|
436
|
+
n = r, l.label = 6;
|
|
437
437
|
case 6:
|
|
438
|
-
if (
|
|
438
|
+
if (u = !1, d = { data: n, error: i, isValidating: u }, typeof n < "u")
|
|
439
439
|
try {
|
|
440
440
|
t.set(e, d, a);
|
|
441
441
|
} catch (c) {
|
|
442
442
|
console.error("swrv(mutate): failed to set cache", c);
|
|
443
443
|
}
|
|
444
|
-
return o = ae.get(e), o && o.data.length && (
|
|
444
|
+
return o = ae.get(e), o && o.data.length && (s = o.data.filter(function(c) {
|
|
445
445
|
return c.key === e;
|
|
446
|
-
}),
|
|
446
|
+
}), s.forEach(function(c, f) {
|
|
447
447
|
typeof d.data < "u" && (c.data = d.data), c.error = d.error, c.isValidating = d.isValidating;
|
|
448
|
-
var C = f ===
|
|
449
|
-
C || delete
|
|
450
|
-
}),
|
|
448
|
+
var C = f === s.length - 1;
|
|
449
|
+
C || delete s[f];
|
|
450
|
+
}), s = s.filter(Boolean)), [2, d];
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
453
|
});
|
|
@@ -455,12 +455,12 @@ var Ne = function(e, r, t, a) {
|
|
|
455
455
|
function Ir() {
|
|
456
456
|
for (var e = this, r = [], t = 0; t < arguments.length; t++)
|
|
457
457
|
r[t] = arguments[t];
|
|
458
|
-
var a, n, i = F({}, De),
|
|
458
|
+
var a, n, i = F({}, De), u = !1, v = !1, d = $e(), o = (d == null ? void 0 : d.proxy) || d;
|
|
459
459
|
if (!o)
|
|
460
460
|
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;
|
|
461
|
-
var
|
|
461
|
+
var s = (o == null ? void 0 : o.$isServer) || !1;
|
|
462
462
|
r.length >= 1 && (a = r[0]), r.length >= 2 && (n = r[1]), r.length > 2 && (i = F(F({}, i), r[2]));
|
|
463
|
-
var
|
|
463
|
+
var l = s ? i.serverTTL : i.ttl, c = typeof a == "function" ? a : te(a);
|
|
464
464
|
typeof n > "u" && (n = i.fetcher);
|
|
465
465
|
var f = null;
|
|
466
466
|
f || (f = Pe({
|
|
@@ -471,43 +471,43 @@ function Ir() {
|
|
|
471
471
|
}));
|
|
472
472
|
var C = function(S, h) {
|
|
473
473
|
return Z(e, void 0, void 0, function() {
|
|
474
|
-
var H, I, $,
|
|
475
|
-
return U(this, function(
|
|
476
|
-
switch (
|
|
474
|
+
var H, I, $, Y, oe, he, se, Ce = this;
|
|
475
|
+
return U(this, function(ue) {
|
|
476
|
+
switch (ue.label) {
|
|
477
477
|
case 0:
|
|
478
|
-
return H = f.data === void 0, I = c.value, I ? ($ = i.cache.get(I),
|
|
478
|
+
return H = f.data === void 0, I = c.value, I ? ($ = i.cache.get(I), Y = $ && $.data, f.isValidating = !0, Y && (f.data = Y.data, f.error = Y.error), oe = S || n, !oe || !i.isDocumentVisible() && !H || (h == null ? void 0 : h.forceRevalidate) !== void 0 && !(h != null && h.forceRevalidate) ? (f.isValidating = !1, [
|
|
479
479
|
2
|
|
480
480
|
/*return*/
|
|
481
481
|
]) : $ && (he = !!(Date.now() - $.createdAt >= i.dedupingInterval || h != null && h.forceRevalidate), !he) ? (f.isValidating = !1, [
|
|
482
482
|
2
|
|
483
483
|
/*return*/
|
|
484
|
-
]) : (
|
|
484
|
+
]) : (se = function() {
|
|
485
485
|
return Z(Ce, void 0, void 0, function() {
|
|
486
|
-
var P, be,
|
|
486
|
+
var P, be, le, Se;
|
|
487
487
|
return U(this, function(W) {
|
|
488
488
|
switch (W.label) {
|
|
489
489
|
case 0:
|
|
490
|
-
return P = pe.get(I), P ? [3, 2] : (be = Array.isArray(I) ? I : [I],
|
|
490
|
+
return P = pe.get(I), P ? [3, 2] : (be = Array.isArray(I) ? I : [I], le = oe.apply(void 0, Tr([], Rr(be), !1)), pe.set(I, le, i.dedupingInterval), [4, Ne(I, le, i.cache, l)]);
|
|
491
491
|
case 1:
|
|
492
492
|
return W.sent(), [3, 4];
|
|
493
493
|
case 2:
|
|
494
|
-
return [4, Ne(I, P.data, i.cache,
|
|
494
|
+
return [4, Ne(I, P.data, i.cache, l)];
|
|
495
495
|
case 3:
|
|
496
496
|
W.sent(), W.label = 4;
|
|
497
497
|
case 4:
|
|
498
|
-
return f.isValidating = !1, pe.delete(I), f.error !== void 0 && (Se = !
|
|
498
|
+
return f.isValidating = !1, pe.delete(I), f.error !== void 0 && (Se = !u && i.shouldRetryOnError && (h ? h.shouldRetryOnError : !0), Se && Er(C, h ? h.errorRetryCount : 1, i)), [
|
|
499
499
|
2
|
|
500
500
|
/*return*/
|
|
501
501
|
];
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
504
|
});
|
|
505
|
-
},
|
|
505
|
+
}, Y && i.revalidateDebounce ? (setTimeout(function() {
|
|
506
506
|
return Z(Ce, void 0, void 0, function() {
|
|
507
507
|
return U(this, function(P) {
|
|
508
508
|
switch (P.label) {
|
|
509
509
|
case 0:
|
|
510
|
-
return
|
|
510
|
+
return u ? [3, 2] : [4, se()];
|
|
511
511
|
case 1:
|
|
512
512
|
P.sent(), P.label = 2;
|
|
513
513
|
case 2:
|
|
@@ -523,9 +523,9 @@ function Ir() {
|
|
|
523
523
|
/*return*/
|
|
524
524
|
];
|
|
525
525
|
case 1:
|
|
526
|
-
return [4,
|
|
526
|
+
return [4, se()];
|
|
527
527
|
case 2:
|
|
528
|
-
|
|
528
|
+
ue.sent(), ue.label = 3;
|
|
529
529
|
case 3:
|
|
530
530
|
return [
|
|
531
531
|
2
|
|
@@ -553,7 +553,7 @@ function Ir() {
|
|
|
553
553
|
case 2:
|
|
554
554
|
b && clearTimeout(b), h.label = 3;
|
|
555
555
|
case 3:
|
|
556
|
-
return i.refreshInterval && !
|
|
556
|
+
return i.refreshInterval && !u && (b = setTimeout(S, i.refreshInterval)), [
|
|
557
557
|
2
|
|
558
558
|
/*return*/
|
|
559
559
|
];
|
|
@@ -563,7 +563,7 @@ function Ir() {
|
|
|
563
563
|
};
|
|
564
564
|
i.refreshInterval && (b = setTimeout(S, i.refreshInterval)), i.revalidateOnFocus && (document.addEventListener("visibilitychange", m, !1), window.addEventListener("focus", m, !1));
|
|
565
565
|
}), Ze(function() {
|
|
566
|
-
|
|
566
|
+
u = !0, b && clearTimeout(b), i.revalidateOnFocus && (document.removeEventListener("visibilitychange", m, !1), window.removeEventListener("focus", m, !1));
|
|
567
567
|
var S = ae.get(c.value);
|
|
568
568
|
S && (S.data = S.data.filter(function(h) {
|
|
569
569
|
return h !== f;
|
|
@@ -571,7 +571,7 @@ function Ir() {
|
|
|
571
571
|
});
|
|
572
572
|
try {
|
|
573
573
|
Ue(c, function(S) {
|
|
574
|
-
Ge(c) || (c.value = S), f.key = S, f.isValidating = !!S, Nr(c.value, f,
|
|
574
|
+
Ge(c) || (c.value = S), f.key = S, f.isValidating = !!S, Nr(c.value, f, l), !s && !v && c.value && C(), v = !1;
|
|
575
575
|
}, {
|
|
576
576
|
immediate: !0
|
|
577
577
|
});
|
|
@@ -590,7 +590,7 @@ function kr(e, r, t) {
|
|
|
590
590
|
data: a,
|
|
591
591
|
error: n,
|
|
592
592
|
isValidating: i,
|
|
593
|
-
mutate:
|
|
593
|
+
mutate: u
|
|
594
594
|
} = Ir(e, r, {
|
|
595
595
|
revalidateDebounce: 500,
|
|
596
596
|
revalidateOnFocus: !1,
|
|
@@ -602,7 +602,7 @@ function kr(e, r, t) {
|
|
|
602
602
|
response: a,
|
|
603
603
|
error: n,
|
|
604
604
|
isValidating: i,
|
|
605
|
-
revalidate:
|
|
605
|
+
revalidate: u
|
|
606
606
|
};
|
|
607
607
|
}
|
|
608
608
|
const K = {
|
|
@@ -617,12 +617,12 @@ const K = {
|
|
|
617
617
|
additionalFilter: a,
|
|
618
618
|
queryReady: n,
|
|
619
619
|
timeframe: i,
|
|
620
|
-
tz:
|
|
620
|
+
tz: u,
|
|
621
621
|
hasTrendAccess: v,
|
|
622
622
|
refreshInterval: d,
|
|
623
623
|
abortController: o,
|
|
624
|
-
queryFn:
|
|
625
|
-
averageLatencies:
|
|
624
|
+
queryFn: s,
|
|
625
|
+
averageLatencies: l
|
|
626
626
|
} = e;
|
|
627
627
|
if (t && !r)
|
|
628
628
|
throw new Error("Must provide a dimension if filtering by a value");
|
|
@@ -646,15 +646,15 @@ const K = {
|
|
|
646
646
|
filter: C,
|
|
647
647
|
queryReady: n,
|
|
648
648
|
timeframe: i,
|
|
649
|
-
tz:
|
|
649
|
+
tz: u,
|
|
650
650
|
// Traffic and error rate cards can't query trend if multiple entities are expected.
|
|
651
651
|
withTrend: g(() => v.value && !f),
|
|
652
652
|
refreshInterval: d,
|
|
653
|
-
queryFn:
|
|
653
|
+
queryFn: s,
|
|
654
654
|
abortController: o
|
|
655
655
|
}, b = {
|
|
656
656
|
metrics: g(() => [
|
|
657
|
-
|
|
657
|
+
l.value ? "response_latency_average" : "response_latency_p99"
|
|
658
658
|
]),
|
|
659
659
|
// To keep single-entity queries consistent, don't bother querying the dimension for latency
|
|
660
660
|
// in the single-entity case, even though it's possible.
|
|
@@ -662,11 +662,11 @@ const K = {
|
|
|
662
662
|
filter: C,
|
|
663
663
|
queryReady: n,
|
|
664
664
|
timeframe: i,
|
|
665
|
-
tz:
|
|
665
|
+
tz: u,
|
|
666
666
|
// Don't query latency trends in the multi-entity case: it's possible, but wasteful.
|
|
667
667
|
withTrend: g(() => v.value && !f),
|
|
668
668
|
refreshInterval: d,
|
|
669
|
-
queryFn:
|
|
669
|
+
queryFn: s,
|
|
670
670
|
abortController: o
|
|
671
671
|
}, N = K.useMetricFetcher(m), S = K.useMetricFetcher(b);
|
|
672
672
|
return {
|
|
@@ -697,15 +697,15 @@ const K = {
|
|
|
697
697
|
const t = ke(pr);
|
|
698
698
|
let a, n;
|
|
699
699
|
t ? (a = t.queryFn, n = t.evaluateFeatureFlagFn) : (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"), a = () => Promise.reject(new Error("Query bridge required")), n = (f, C) => C);
|
|
700
|
-
const i = ar(),
|
|
700
|
+
const i = ar(), u = J(() => i.longRetention), v = g(() => !i.loading && r.queryReady), d = g(() => r.tz ? r.tz : new Intl.DateTimeFormat().resolvedOptions().timeZone), o = g(() => {
|
|
701
701
|
if (r.overrideTimeframe)
|
|
702
702
|
return r.overrideTimeframe;
|
|
703
|
-
const f =
|
|
703
|
+
const f = u.value ? ie.get(r.maxTimeframe) : ie.get(ne.ONE_DAY);
|
|
704
704
|
if (!f)
|
|
705
705
|
throw new Error("Metrics provider failed to resolve fallback timeframe.");
|
|
706
706
|
return f;
|
|
707
|
-
}),
|
|
708
|
-
trafficData:
|
|
707
|
+
}), s = g(() => r.percentileLatency ? !1 : n("MA-2527-analytics-sku-config-endpoint", !1)), {
|
|
708
|
+
trafficData: l,
|
|
709
709
|
latencyData: c
|
|
710
710
|
} = qr({
|
|
711
711
|
dimension: r.dimension,
|
|
@@ -714,24 +714,24 @@ const K = {
|
|
|
714
714
|
queryReady: v,
|
|
715
715
|
timeframe: o,
|
|
716
716
|
tz: d,
|
|
717
|
-
hasTrendAccess:
|
|
717
|
+
hasTrendAccess: u,
|
|
718
718
|
refreshInterval: r.refreshInterval,
|
|
719
719
|
queryFn: a,
|
|
720
|
-
averageLatencies:
|
|
720
|
+
averageLatencies: s,
|
|
721
721
|
abortController: r.abortController
|
|
722
722
|
});
|
|
723
|
-
return
|
|
723
|
+
return Xe(Me, {
|
|
724
724
|
data: {
|
|
725
|
-
traffic:
|
|
725
|
+
traffic: l,
|
|
726
726
|
latency: c
|
|
727
727
|
},
|
|
728
728
|
description: J(() => r.description),
|
|
729
729
|
containerTitle: J(() => r.containerTitle),
|
|
730
|
-
hasTrendAccess:
|
|
730
|
+
hasTrendAccess: u,
|
|
731
731
|
longCardTitles: r.longCardTitles,
|
|
732
|
-
averageLatencies:
|
|
732
|
+
averageLatencies: s
|
|
733
733
|
}), (f, C) => qe(f.$slots, "default", {
|
|
734
|
-
hasTrendAccess:
|
|
734
|
+
hasTrendAccess: u.value,
|
|
735
735
|
timeframe: o.value
|
|
736
736
|
});
|
|
737
737
|
}
|
|
@@ -742,26 +742,26 @@ function zr(e) {
|
|
|
742
742
|
var Fe = { exports: {} };
|
|
743
743
|
(function(e) {
|
|
744
744
|
(function() {
|
|
745
|
-
function r(o,
|
|
746
|
-
if (
|
|
745
|
+
function r(o, s) {
|
|
746
|
+
if (s.separator === !1 || o < 1e3)
|
|
747
747
|
return o.toString();
|
|
748
|
-
var
|
|
748
|
+
var l = typeof s.separator == "string" ? s.separator : ",", c = [], f = Math.round(o).toString().split("");
|
|
749
749
|
return f.reverse().forEach(function(C, m) {
|
|
750
|
-
m && m % 3 === 0 && c.push(
|
|
750
|
+
m && m % 3 === 0 && c.push(l), c.push(C);
|
|
751
751
|
}), c.reverse().join("");
|
|
752
752
|
}
|
|
753
|
-
function t(o,
|
|
754
|
-
var c = o /
|
|
755
|
-
return
|
|
753
|
+
function t(o, s, l) {
|
|
754
|
+
var c = o / s, f = l.round ? "round" : "floor";
|
|
755
|
+
return l.decimal === !1 ? (o = Math[f](c), o.toString()) : (l.precision ? o = c : o = c < 10 ? Math[f](c * 10) / 10 : Math[f](c), o = o.toString(), typeof l.decimal == "string" && (o = o.replace(".", l.decimal)), o);
|
|
756
756
|
}
|
|
757
|
-
var a = 1e3, n = 1e4, i = 1e6,
|
|
758
|
-
function d(o,
|
|
759
|
-
var
|
|
760
|
-
|
|
757
|
+
var a = 1e3, n = 1e4, i = 1e6, u = 1e9, v = 1e12;
|
|
758
|
+
function d(o, s) {
|
|
759
|
+
var l;
|
|
760
|
+
s = s || {};
|
|
761
761
|
var c = o < 0;
|
|
762
|
-
c && (o = Math.abs(o)),
|
|
763
|
-
var f =
|
|
764
|
-
return o < f ||
|
|
762
|
+
c && (o = Math.abs(o)), s.precision && (o = parseFloat(o.toPrecision(s.precision)));
|
|
763
|
+
var f = s.min10k ? n : a;
|
|
764
|
+
return o < f || s.precision && s.precision > Math.log10(o) ? l = r(t(o, 1, s), s) : o < i ? l = t(o, a, s) + "k" : o < u ? l = t(o, i, s) + "m" : o < v ? l = r(t(o, u, s), s) + "b" : l = r(t(o, v, s), s) + "t", c && (l = "-" + l), s.capital && (l = l.toUpperCase()), s.prefix && (l = s.prefix + l), s.suffix && (l = l + s.suffix), l;
|
|
765
765
|
}
|
|
766
766
|
d.addCommas = r, e.exports = d;
|
|
767
767
|
})();
|
|
@@ -774,7 +774,7 @@ const w = "24px", M = (e, r) => {
|
|
|
774
774
|
for (const [a, n] of r)
|
|
775
775
|
t[a] = n;
|
|
776
776
|
return t;
|
|
777
|
-
}, Vr = (e) => (V("data-v-
|
|
777
|
+
}, Vr = (e) => (V("data-v-80a84c23"), e = e(), D(), e), Dr = ["aria-hidden"], Mr = {
|
|
778
778
|
key: 0,
|
|
779
779
|
"data-testid": "kui-icon-svg-title"
|
|
780
780
|
}, Fr = /* @__PURE__ */ Vr(() => /* @__PURE__ */ x("path", {
|
|
@@ -873,7 +873,7 @@ const w = "24px", M = (e, r) => {
|
|
|
873
873
|
_: 1
|
|
874
874
|
}, 8, ["aria-hidden", "style"]));
|
|
875
875
|
}
|
|
876
|
-
}), Hr = /* @__PURE__ */ M(Or, [["__scopeId", "data-v-
|
|
876
|
+
}), Hr = /* @__PURE__ */ M(Or, [["__scopeId", "data-v-80a84c23"]]), Br = (e) => (V("data-v-51fd13af"), e = e(), D(), e), $r = ["aria-hidden"], Pr = {
|
|
877
877
|
key: 0,
|
|
878
878
|
"data-testid": "kui-icon-svg-title"
|
|
879
879
|
}, Kr = /* @__PURE__ */ Br(() => /* @__PURE__ */ x("path", {
|
|
@@ -972,10 +972,10 @@ const w = "24px", M = (e, r) => {
|
|
|
972
972
|
_: 1
|
|
973
973
|
}, 8, ["aria-hidden", "style"]));
|
|
974
974
|
}
|
|
975
|
-
}), Ur = /* @__PURE__ */ M(Zr, [["__scopeId", "data-v-
|
|
975
|
+
}), Ur = /* @__PURE__ */ M(Zr, [["__scopeId", "data-v-51fd13af"]]), Gr = (e) => (V("data-v-c5283a2c"), e = e(), D(), e), jr = ["aria-hidden"], Xr = {
|
|
976
976
|
key: 0,
|
|
977
977
|
"data-testid": "kui-icon-svg-title"
|
|
978
|
-
},
|
|
978
|
+
}, Yr = /* @__PURE__ */ Gr(() => /* @__PURE__ */ x("path", {
|
|
979
979
|
d: "M5 11V9H15V11H5Z",
|
|
980
980
|
fill: "currentColor"
|
|
981
981
|
}, null, -1)), Qr = /* @__PURE__ */ k({
|
|
@@ -1064,14 +1064,14 @@ const w = "24px", M = (e, r) => {
|
|
|
1064
1064
|
width: "100%",
|
|
1065
1065
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1066
1066
|
}, [
|
|
1067
|
-
e.title ? (p(), y("title",
|
|
1068
|
-
|
|
1067
|
+
e.title ? (p(), y("title", Xr, R(e.title), 1)) : T("", !0),
|
|
1068
|
+
Yr
|
|
1069
1069
|
], 8, jr))
|
|
1070
1070
|
]),
|
|
1071
1071
|
_: 1
|
|
1072
1072
|
}, 8, ["aria-hidden", "style"]));
|
|
1073
1073
|
}
|
|
1074
|
-
}), Oe = /* @__PURE__ */ M(Qr, [["__scopeId", "data-v-
|
|
1074
|
+
}), Oe = /* @__PURE__ */ M(Qr, [["__scopeId", "data-v-c5283a2c"]]), Wr = (e) => (V("data-v-7958c198"), e = e(), D(), e), Jr = ["aria-hidden"], et = {
|
|
1075
1075
|
key: 0,
|
|
1076
1076
|
"data-testid": "kui-icon-svg-title"
|
|
1077
1077
|
}, rt = /* @__PURE__ */ Wr(() => /* @__PURE__ */ x("path", {
|
|
@@ -1170,13 +1170,13 @@ const w = "24px", M = (e, r) => {
|
|
|
1170
1170
|
_: 1
|
|
1171
1171
|
}, 8, ["aria-hidden", "style"]));
|
|
1172
1172
|
}
|
|
1173
|
-
}), it = /* @__PURE__ */ M(tt, [["__scopeId", "data-v-
|
|
1173
|
+
}), it = /* @__PURE__ */ M(tt, [["__scopeId", "data-v-7958c198"]]), nt = (e) => (V("data-v-d0ffb1de"), e = e(), D(), e), at = ["aria-hidden"], ot = {
|
|
1174
1174
|
key: 0,
|
|
1175
1175
|
"data-testid": "kui-icon-svg-title"
|
|
1176
|
-
},
|
|
1176
|
+
}, st = /* @__PURE__ */ nt(() => /* @__PURE__ */ x("path", {
|
|
1177
1177
|
d: "M15.25 5C14.9 5 14.6042 4.87917 14.3625 4.6375C14.1208 4.39583 14 4.1 14 3.75C14 3.4 14.1208 3.10417 14.3625 2.8625C14.6042 2.62083 14.9 2.5 15.25 2.5C15.6 2.5 15.8958 2.62083 16.1375 2.8625C16.3792 3.10417 16.5 3.4 16.5 3.75C16.5 4.1 16.3792 4.39583 16.1375 4.6375C15.8958 4.87917 15.6 5 15.25 5ZM15.25 21.5C14.9 21.5 14.6042 21.3792 14.3625 21.1375C14.1208 20.8958 14 20.6 14 20.25C14 19.9 14.1208 19.6042 14.3625 19.3625C14.6042 19.1208 14.9 19 15.25 19C15.6 19 15.8958 19.1208 16.1375 19.3625C16.3792 19.6042 16.5 19.9 16.5 20.25C16.5 20.6 16.3792 20.8958 16.1375 21.1375C15.8958 21.3792 15.6 21.5 15.25 21.5ZM19.25 8.5C18.9 8.5 18.6042 8.37917 18.3625 8.1375C18.1208 7.89583 18 7.6 18 7.25C18 6.9 18.1208 6.60417 18.3625 6.3625C18.6042 6.12083 18.9 6 19.25 6C19.6 6 19.8958 6.12083 20.1375 6.3625C20.3792 6.60417 20.5 6.9 20.5 7.25C20.5 7.6 20.3792 7.89583 20.1375 8.1375C19.8958 8.37917 19.6 8.5 19.25 8.5ZM19.25 18C18.9 18 18.6042 17.8792 18.3625 17.6375C18.1208 17.3958 18 17.1 18 16.75C18 16.4 18.1208 16.1042 18.3625 15.8625C18.6042 15.6208 18.9 15.5 19.25 15.5C19.6 15.5 19.8958 15.6208 20.1375 15.8625C20.3792 16.1042 20.5 16.4 20.5 16.75C20.5 17.1 20.3792 17.3958 20.1375 17.6375C19.8958 17.8792 19.6 18 19.25 18ZM20.75 13.25C20.4 13.25 20.1042 13.1292 19.8625 12.8875C19.6208 12.6458 19.5 12.35 19.5 12C19.5 11.65 19.6208 11.3542 19.8625 11.1125C20.1042 10.8708 20.4 10.75 20.75 10.75C21.1 10.75 21.3958 10.8708 21.6375 11.1125C21.8792 11.3542 22 11.65 22 12C22 12.35 21.8792 12.6458 21.6375 12.8875C21.3958 13.1292 21.1 13.25 20.75 13.25ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2V4C9.76667 4 7.875 4.775 6.325 6.325C4.775 7.875 4 9.76667 4 12C4 14.2333 4.775 16.125 6.325 17.675C7.875 19.225 9.76667 20 12 20V22ZM12 14C11.45 14 10.9792 13.8042 10.5875 13.4125C10.1958 13.0208 10 12.55 10 12C10 11.9167 10.0042 11.8292 10.0125 11.7375C10.0208 11.6458 10.0417 11.5583 10.075 11.475L8 9.4L9.4 8L11.475 10.075C11.5417 10.0583 11.7167 10.0333 12 10C12.55 10 13.0208 10.1958 13.4125 10.5875C13.8042 10.9792 14 11.45 14 12C14 12.55 13.8042 13.0208 13.4125 13.4125C13.0208 13.8042 12.55 14 12 14Z",
|
|
1178
1178
|
fill: "currentColor"
|
|
1179
|
-
}, null, -1)),
|
|
1179
|
+
}, null, -1)), ut = /* @__PURE__ */ k({
|
|
1180
1180
|
__name: "ResponseIcon",
|
|
1181
1181
|
props: {
|
|
1182
1182
|
/** The accessibility text provided to screen readers */
|
|
@@ -1263,13 +1263,13 @@ const w = "24px", M = (e, r) => {
|
|
|
1263
1263
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1264
1264
|
}, [
|
|
1265
1265
|
e.title ? (p(), y("title", ot, R(e.title), 1)) : T("", !0),
|
|
1266
|
-
|
|
1266
|
+
st
|
|
1267
1267
|
], 8, at))
|
|
1268
1268
|
]),
|
|
1269
1269
|
_: 1
|
|
1270
1270
|
}, 8, ["aria-hidden", "style"]));
|
|
1271
1271
|
}
|
|
1272
|
-
}),
|
|
1272
|
+
}), lt = /* @__PURE__ */ M(ut, [["__scopeId", "data-v-d0ffb1de"]]), dt = (e) => (V("data-v-7939cf04"), e = e(), D(), e), ct = ["aria-hidden"], ft = {
|
|
1273
1273
|
key: 0,
|
|
1274
1274
|
"data-testid": "kui-icon-svg-title"
|
|
1275
1275
|
}, pt = /* @__PURE__ */ dt(() => /* @__PURE__ */ x("path", {
|
|
@@ -1368,7 +1368,7 @@ const w = "24px", M = (e, r) => {
|
|
|
1368
1368
|
_: 1
|
|
1369
1369
|
}, 8, ["aria-hidden", "style"]));
|
|
1370
1370
|
}
|
|
1371
|
-
}), gt = /* @__PURE__ */ M(vt, [["__scopeId", "data-v-
|
|
1371
|
+
}), gt = /* @__PURE__ */ M(vt, [["__scopeId", "data-v-7939cf04"]]), yt = (e) => (V("data-v-c6ab90e9"), e = e(), D(), e), mt = ["aria-hidden"], ht = {
|
|
1372
1372
|
key: 0,
|
|
1373
1373
|
"data-testid": "kui-icon-svg-title"
|
|
1374
1374
|
}, Ct = /* @__PURE__ */ yt(() => /* @__PURE__ */ x("path", {
|
|
@@ -1467,7 +1467,7 @@ const w = "24px", M = (e, r) => {
|
|
|
1467
1467
|
_: 1
|
|
1468
1468
|
}, 8, ["aria-hidden", "style"]));
|
|
1469
1469
|
}
|
|
1470
|
-
}), St = /* @__PURE__ */ M(bt, [["__scopeId", "data-v-
|
|
1470
|
+
}), St = /* @__PURE__ */ M(bt, [["__scopeId", "data-v-c6ab90e9"]]), _t = (e) => (V("data-v-989e7f51"), e = e(), D(), e), wt = ["aria-hidden"], Rt = {
|
|
1471
1471
|
key: 0,
|
|
1472
1472
|
"data-testid": "kui-icon-svg-title"
|
|
1473
1473
|
}, Tt = /* @__PURE__ */ _t(() => /* @__PURE__ */ x("path", {
|
|
@@ -1566,7 +1566,7 @@ const w = "24px", M = (e, r) => {
|
|
|
1566
1566
|
_: 1
|
|
1567
1567
|
}, 8, ["aria-hidden", "style"]));
|
|
1568
1568
|
}
|
|
1569
|
-
}), Et = /* @__PURE__ */ M(Nt, [["__scopeId", "data-v-
|
|
1569
|
+
}), Et = /* @__PURE__ */ M(Nt, [["__scopeId", "data-v-989e7f51"]]), It = (e) => (V("data-v-5fc3c6c8"), e = e(), D(), e), xt = ["aria-hidden"], kt = {
|
|
1570
1570
|
key: 0,
|
|
1571
1571
|
"data-testid": "kui-icon-svg-title"
|
|
1572
1572
|
}, qt = /* @__PURE__ */ It(() => /* @__PURE__ */ x("path", {
|
|
@@ -1665,7 +1665,7 @@ const w = "24px", M = (e, r) => {
|
|
|
1665
1665
|
_: 1
|
|
1666
1666
|
}, 8, ["aria-hidden", "style"]));
|
|
1667
1667
|
}
|
|
1668
|
-
}), Lt = /* @__PURE__ */ M(zt, [["__scopeId", "data-v-
|
|
1668
|
+
}), Lt = /* @__PURE__ */ M(zt, [["__scopeId", "data-v-5fc3c6c8"]]), At = (e) => (V("data-v-9f0a015f"), e = e(), D(), e), Vt = ["aria-hidden"], Dt = {
|
|
1669
1669
|
key: 0,
|
|
1670
1670
|
"data-testid": "kui-icon-svg-title"
|
|
1671
1671
|
}, Mt = /* @__PURE__ */ At(() => /* @__PURE__ */ x("path", {
|
|
@@ -1764,7 +1764,7 @@ const w = "24px", M = (e, r) => {
|
|
|
1764
1764
|
_: 1
|
|
1765
1765
|
}, 8, ["aria-hidden", "style"]));
|
|
1766
1766
|
}
|
|
1767
|
-
}), He = /* @__PURE__ */ M(Ft, [["__scopeId", "data-v-
|
|
1767
|
+
}), He = /* @__PURE__ */ M(Ft, [["__scopeId", "data-v-9f0a015f"]]), ye = 2, Ee = ye + 2, Ot = (e, r, t = !1) => {
|
|
1768
1768
|
let a = !r || Number(e.toFixed(Ee)) === 0 ? 0 : Number(e.toFixed(Ee)) > 0 ? 1 : -1;
|
|
1769
1769
|
return t && (a *= -1), a;
|
|
1770
1770
|
}, Ht = (e, r, t) => r ? `${Math.abs(e * 100).toFixed(ye)}%` : t, Bt = (e, r) => r === 0 ? 0 : e / r - 1, $t = (e, r = !1) => (r && (e *= -1), e > 0 ? St : e < 0 ? gt : Oe), Pt = "#ad000e", ve = "#6c7489", Ie = "#52596e", Kt = "#007d60", ee = "16px", Zt = "20px";
|
|
@@ -1775,10 +1775,10 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1775
1775
|
}, jt = {
|
|
1776
1776
|
key: 0,
|
|
1777
1777
|
class: "metricscard-error"
|
|
1778
|
-
},
|
|
1778
|
+
}, Xt = {
|
|
1779
1779
|
key: 2,
|
|
1780
1780
|
class: "metricscard-trend"
|
|
1781
|
-
},
|
|
1781
|
+
}, Yt = { "data-testid": "metric-trend-change" }, Qt = {
|
|
1782
1782
|
key: 0,
|
|
1783
1783
|
class: "metricscard-trend-range"
|
|
1784
1784
|
}, Wt = /* @__PURE__ */ k({
|
|
@@ -1857,7 +1857,7 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1857
1857
|
[O.GENERIC_COUNT, Et],
|
|
1858
1858
|
[O.TRAFFIC, Hr],
|
|
1859
1859
|
[O.ERROR_RATE, Lt],
|
|
1860
|
-
[O.LATENCY,
|
|
1860
|
+
[O.LATENCY, lt]
|
|
1861
1861
|
]), t = e, a = (d) => {
|
|
1862
1862
|
const o = {
|
|
1863
1863
|
red: `var(--kong-ui-metric-card-trend-negative, ${Pt})`,
|
|
@@ -1865,9 +1865,9 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1865
1865
|
grey: `var(--kong-ui-metric-card-trend-neutral, ${Ie})`
|
|
1866
1866
|
};
|
|
1867
1867
|
return d > 0 ? o.green : d < 0 ? o.red : o.grey;
|
|
1868
|
-
}, n = (d) => d > 0 ? "positive" : d < 0 ? "negative" : "neutral", i = [q.Medium, q.Large, q.LargeCompact].includes(t.cardSize),
|
|
1868
|
+
}, n = (d) => d > 0 ? "positive" : d < 0 ? "negative" : "neutral", i = [q.Medium, q.Large, q.LargeCompact].includes(t.cardSize), u = g(() => t.cardSize === q.LargeCompact), v = [q.Small, q.LargeCompact].includes(t.cardSize);
|
|
1869
1869
|
return (d, o) => {
|
|
1870
|
-
const
|
|
1870
|
+
const s = ze("KTooltip");
|
|
1871
1871
|
return p(), y("div", Ut, [
|
|
1872
1872
|
x("div", {
|
|
1873
1873
|
class: G(["metricscard-title", e.cardSize])
|
|
@@ -1884,14 +1884,14 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1884
1884
|
]),
|
|
1885
1885
|
_: 1
|
|
1886
1886
|
})),
|
|
1887
|
-
e.tooltip ? (p(), E(
|
|
1887
|
+
e.tooltip ? (p(), E(s, {
|
|
1888
1888
|
key: 1,
|
|
1889
1889
|
class: "metricscard-tooltip",
|
|
1890
1890
|
placement: "right",
|
|
1891
1891
|
text: e.tooltip
|
|
1892
1892
|
}, {
|
|
1893
1893
|
default: L(() => [
|
|
1894
|
-
|
|
1894
|
+
X(_(it), {
|
|
1895
1895
|
color: _(ve),
|
|
1896
1896
|
size: _(ee)
|
|
1897
1897
|
}, null, 8, ["color", "size"])
|
|
@@ -1899,14 +1899,14 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1899
1899
|
_: 1
|
|
1900
1900
|
}, 8, ["text"])) : T("", !0)
|
|
1901
1901
|
], 2),
|
|
1902
|
-
e.description && _(i) && !
|
|
1902
|
+
e.description && _(i) && !u.value ? (p(), y("div", Gt, [
|
|
1903
1903
|
x("span", null, R(e.description), 1)
|
|
1904
1904
|
])) : T("", !0),
|
|
1905
1905
|
x("div", {
|
|
1906
|
-
class: G(["metricscard-valuetrend", { "is-compact":
|
|
1906
|
+
class: G(["metricscard-valuetrend", { "is-compact": u.value }])
|
|
1907
1907
|
}, [
|
|
1908
1908
|
e.hasError ? (p(), y("div", jt, [
|
|
1909
|
-
|
|
1909
|
+
X(_(He), {
|
|
1910
1910
|
color: _(ve),
|
|
1911
1911
|
size: _(Zt)
|
|
1912
1912
|
}, null, 8, ["color", "size"]),
|
|
@@ -1916,7 +1916,7 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1916
1916
|
class: G(["metricscard-value", e.cardSize]),
|
|
1917
1917
|
"data-testid": "metric-value"
|
|
1918
1918
|
}, R(e.metricValue), 3)),
|
|
1919
|
-
_(i) ? (p(), y("div",
|
|
1919
|
+
_(i) ? (p(), y("div", Xt, [
|
|
1920
1920
|
x("div", {
|
|
1921
1921
|
class: G(["metricscard-trend-change", n(e.changePolarity)]),
|
|
1922
1922
|
"data-testid": "metric-trend-parent"
|
|
@@ -1930,7 +1930,7 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1930
1930
|
color: _(Ie),
|
|
1931
1931
|
size: _(ee)
|
|
1932
1932
|
}, null, 8, ["color", "size"])),
|
|
1933
|
-
x("div",
|
|
1933
|
+
x("div", Yt, R(e.metricChange), 1)
|
|
1934
1934
|
], 2),
|
|
1935
1935
|
e.trendRange && e.cardSize !== _(q).LargeCompact ? (p(), y("div", Qt, R(e.trendRange), 1)) : T("", !0)
|
|
1936
1936
|
])) : T("", !0)
|
|
@@ -1947,8 +1947,8 @@ const Ut = { class: "metricscard" }, Gt = {
|
|
|
1947
1947
|
function ti(e, r) {
|
|
1948
1948
|
const t = ze("KSkeletonBox");
|
|
1949
1949
|
return p(), y("div", ri, [
|
|
1950
|
-
|
|
1951
|
-
|
|
1950
|
+
X(t, { width: "100" }),
|
|
1951
|
+
X(t, { width: "75" })
|
|
1952
1952
|
]);
|
|
1953
1953
|
}
|
|
1954
1954
|
const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c40"]]), ni = {
|
|
@@ -1960,13 +1960,13 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
1960
1960
|
}, oi = {
|
|
1961
1961
|
key: 1,
|
|
1962
1962
|
class: "error-display"
|
|
1963
|
-
},
|
|
1963
|
+
}, si = {
|
|
1964
1964
|
key: 0,
|
|
1965
1965
|
class: "error-display-message"
|
|
1966
|
-
},
|
|
1966
|
+
}, ui = {
|
|
1967
1967
|
key: 2,
|
|
1968
1968
|
class: "cards-wrapper"
|
|
1969
|
-
},
|
|
1969
|
+
}, li = /* @__PURE__ */ k({
|
|
1970
1970
|
__name: "MetricCardContainer",
|
|
1971
1971
|
props: {
|
|
1972
1972
|
fallbackDisplayText: {
|
|
@@ -2010,12 +2010,12 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2010
2010
|
},
|
|
2011
2011
|
setup(e) {
|
|
2012
2012
|
const r = e, t = g(() => r.cards.every((n) => (n == null ? void 0 : n.hasError) === !0)), a = (n) => {
|
|
2013
|
-
const i = Bt(n.currentValue, n.previousValue) || 0,
|
|
2013
|
+
const i = Bt(n.currentValue, n.previousValue) || 0, u = Ot(i, r.hasTrendAccess, n.increaseIsBad);
|
|
2014
2014
|
return {
|
|
2015
2015
|
metricValue: n.formatValueFn ? n.formatValueFn(n.currentValue) : Ar(n.currentValue, { capital: !0, round: !0 }) || "0",
|
|
2016
2016
|
metricChange: n.formatChangeFn ? n.formatChangeFn(i) : Ht(i, r.hasTrendAccess, r.fallbackDisplayText),
|
|
2017
|
-
changePolarity:
|
|
2018
|
-
trendIcon: $t(
|
|
2017
|
+
changePolarity: u,
|
|
2018
|
+
trendIcon: $t(u, n.increaseIsBad),
|
|
2019
2019
|
cardSize: r.cardSize,
|
|
2020
2020
|
hasContainerTitle: !!r.containerTitle
|
|
2021
2021
|
};
|
|
@@ -2028,29 +2028,29 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2028
2028
|
r.containerDescription ? (p(), y("div", ai, R(r.containerDescription), 1)) : T("", !0)
|
|
2029
2029
|
])) : T("", !0),
|
|
2030
2030
|
t.value ? (p(), y("div", oi, [
|
|
2031
|
-
|
|
2032
|
-
e.errorMessage ? (p(), y("div",
|
|
2033
|
-
])) : (p(), y("div",
|
|
2034
|
-
(p(!0), y(_e, null,
|
|
2031
|
+
X(_(He), { class: "error-display-icon" }),
|
|
2032
|
+
e.errorMessage ? (p(), y("div", si, R(e.errorMessage), 1)) : T("", !0)
|
|
2033
|
+
])) : (p(), y("div", ui, [
|
|
2034
|
+
(p(!0), y(_e, null, Ye(e.cards, (u, v) => (p(), y(_e, null, [
|
|
2035
2035
|
e.loading ? (p(), E(ii, {
|
|
2036
2036
|
key: `skeleton-${v}`,
|
|
2037
2037
|
class: G(e.cardSize === _(q).Small ? "loading-tabs-small" : "loading-tabs-large")
|
|
2038
|
-
}, null, 8, ["class"])) : (p(), E(Jt, Qe({ key: v }, a(
|
|
2038
|
+
}, null, 8, ["class"])) : (p(), E(Jt, Qe({ key: v }, a(u), {
|
|
2039
2039
|
"card-size": e.cardSize,
|
|
2040
|
-
"card-type":
|
|
2041
|
-
description:
|
|
2040
|
+
"card-type": u.cardType,
|
|
2041
|
+
description: u.description,
|
|
2042
2042
|
"error-message": e.errorMessage,
|
|
2043
|
-
"has-error":
|
|
2044
|
-
title:
|
|
2045
|
-
"title-tag":
|
|
2046
|
-
tooltip:
|
|
2047
|
-
"trend-range":
|
|
2043
|
+
"has-error": u.hasError,
|
|
2044
|
+
title: u.title,
|
|
2045
|
+
"title-tag": u.titleTag,
|
|
2046
|
+
tooltip: u.tooltip,
|
|
2047
|
+
"trend-range": u.trendRange
|
|
2048
2048
|
}), null, 16, ["card-size", "card-type", "description", "error-message", "has-error", "title", "title-tag", "tooltip", "trend-range"]))
|
|
2049
2049
|
], 64))), 256))
|
|
2050
2050
|
]))
|
|
2051
2051
|
], 2));
|
|
2052
2052
|
}
|
|
2053
|
-
}), di = /* @__PURE__ */ me(
|
|
2053
|
+
}), di = /* @__PURE__ */ me(li, [["__scopeId", "data-v-1bb4a6a4"]]), mi = /* @__PURE__ */ k({
|
|
2054
2054
|
__name: "MetricsConsumer",
|
|
2055
2055
|
props: {
|
|
2056
2056
|
lookupKey: { default: void 0 },
|
|
@@ -2061,7 +2061,7 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2061
2061
|
const r = e, t = ke(Me);
|
|
2062
2062
|
if (!t)
|
|
2063
2063
|
throw new Error("MetricsConsumer must be nested inside a MetricsProvider instance.");
|
|
2064
|
-
const { traffic: a, latency: n } = t.data, { i18n: i } = K.useI18n(),
|
|
2064
|
+
const { traffic: a, latency: n } = t.data, { i18n: i } = K.useI18n(), u = K.useMetricCardBuilder({
|
|
2065
2065
|
cardType: O.TRAFFIC,
|
|
2066
2066
|
title: g(() => t.longCardTitles ? i.t("metricCard.long.traffic") : i.t("metricCard.short.traffic")),
|
|
2067
2067
|
record: a.mapped,
|
|
@@ -2081,7 +2081,7 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2081
2081
|
increaseIsBad: !0,
|
|
2082
2082
|
trendRange: a.trendRange.value
|
|
2083
2083
|
};
|
|
2084
|
-
}), o = (m) => `${m}ms`,
|
|
2084
|
+
}), o = (m) => `${m}ms`, s = K.useMetricCardBuilder({
|
|
2085
2085
|
cardType: O.LATENCY,
|
|
2086
2086
|
title: g(() => {
|
|
2087
2087
|
const { longCardTitles: m, averageLatencies: b } = t, N = b.value ? "averageLatency" : "p99Latency";
|
|
@@ -2093,8 +2093,8 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2093
2093
|
increaseIsBad: !0,
|
|
2094
2094
|
formatValueFn: o,
|
|
2095
2095
|
trendRange: n.trendRange
|
|
2096
|
-
}),
|
|
2097
|
-
cards:
|
|
2096
|
+
}), l = g(() => r.cardToDisplay === "TRAFFIC" ? [u.value] : r.cardToDisplay === "ERROR_RATE" ? [d.value] : r.cardToDisplay === "LATENCY" ? [s.value] : [u.value, d.value, s.value]), c = g(() => r.cardToDisplay === "TRAFFIC" || r.cardToDisplay === "ERROR_RATE" ? a.isLoading.value : r.cardToDisplay === "LATENCY" ? n.isLoading.value : a.isLoading.value || n.isLoading.value), f = g(() => ({
|
|
2097
|
+
cards: l.value,
|
|
2098
2098
|
containerTitle: t.containerTitle.value,
|
|
2099
2099
|
containerDescription: t.description.value,
|
|
2100
2100
|
loading: c.value,
|
|
@@ -2105,14 +2105,14 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2105
2105
|
hideTitle: !0
|
|
2106
2106
|
})), C = g(() => ({
|
|
2107
2107
|
loading: f.value.loading,
|
|
2108
|
-
trafficCard:
|
|
2108
|
+
trafficCard: u.value,
|
|
2109
2109
|
errorRateCard: d.value,
|
|
2110
|
-
latencyCard:
|
|
2110
|
+
latencyCard: s.value,
|
|
2111
2111
|
errorRateFormatted: v(d.value.currentValue),
|
|
2112
|
-
latencyFormatted: o(
|
|
2112
|
+
latencyFormatted: o(s.value.currentValue)
|
|
2113
2113
|
}));
|
|
2114
2114
|
return (m, b) => qe(m.$slots, "default", { cardValues: C.value }, () => [
|
|
2115
|
-
|
|
2115
|
+
X(_(di), We(Je(f.value)), null, 16)
|
|
2116
2116
|
]);
|
|
2117
2117
|
}
|
|
2118
2118
|
}), re = (e) => new Date(e), hi = (e, r) => {
|
|
@@ -2123,30 +2123,30 @@ const ii = /* @__PURE__ */ me(ei, [["render", ti], ["__scopeId", "data-v-f7eb9c4
|
|
|
2123
2123
|
});
|
|
2124
2124
|
}, xe = (e) => e.reduce((r, t) => (r[t] = { name: t }, r), {}), ci = (e, r) => {
|
|
2125
2125
|
var C, m;
|
|
2126
|
-
const t = ie.get(ne.ONE_DAY), a = e.granularity === "trend" ? new rr(t) : new tr(t), n = a.endMs(), i = a.startMs(),
|
|
2126
|
+
const t = ie.get(ne.ONE_DAY), a = e.granularity === "trend" ? new rr(t) : new tr(t), n = a.endMs(), i = a.startMs(), u = a.granularityMs(), v = e.granularity === "trend" ? 2 : 1;
|
|
2127
2127
|
if ((e.dimensions ?? []).length > 2)
|
|
2128
2128
|
throw new Error(`Explore only supports 0-2 dimensions; got: ${JSON.stringify(e.dimensions)}`);
|
|
2129
|
-
const d = (e.dimensions ?? []).find((b) => b !== "time"), o = (r == null ? void 0 : r.dimensionNames) ?? [],
|
|
2129
|
+
const d = (e.dimensions ?? []).find((b) => b !== "time"), o = (r == null ? void 0 : r.dimensionNames) ?? [], s = Math.max(o.length, 1), l = e.metrics || [], c = [];
|
|
2130
2130
|
for (let b = 0; b < v; b++)
|
|
2131
|
-
for (let N = 0; N <
|
|
2131
|
+
for (let N = 0; N < s; N++) {
|
|
2132
2132
|
const S = d ? { [d]: o[N] } : {};
|
|
2133
2133
|
(C = e.dimensions) != null && C.includes("status_code_grouped") ? Q.forEach((h) => {
|
|
2134
|
-
const H =
|
|
2134
|
+
const H = l.reduce((I, $) => (I[$] = (v - b) * 1e3 + 100 * N + 1, I), { ...S, status_code_grouped: h });
|
|
2135
2135
|
c.push({
|
|
2136
2136
|
version: "v1",
|
|
2137
|
-
timestamp: b === 0 ? re(i).toISOString() : re(i +
|
|
2137
|
+
timestamp: b === 0 ? re(i).toISOString() : re(i + u).toISOString(),
|
|
2138
2138
|
event: H
|
|
2139
2139
|
});
|
|
2140
2140
|
}) : c.push({
|
|
2141
2141
|
version: "v1",
|
|
2142
|
-
timestamp: b === 0 ? re(i).toISOString() : re(i +
|
|
2143
|
-
event:
|
|
2142
|
+
timestamp: b === 0 ? re(i).toISOString() : re(i + u).toISOString(),
|
|
2143
|
+
event: l.reduce((h, H) => (h[H] = (v - b) * 1e3 + 100 * N + 1, h), { ...S })
|
|
2144
2144
|
});
|
|
2145
2145
|
}
|
|
2146
2146
|
const f = {
|
|
2147
2147
|
start_ms: i,
|
|
2148
2148
|
end_ms: n,
|
|
2149
|
-
granularity_ms:
|
|
2149
|
+
granularity_ms: u,
|
|
2150
2150
|
display: d ? {
|
|
2151
2151
|
[d]: xe(o),
|
|
2152
2152
|
...(m = e.dimensions) != null && m.includes("status_code_grouped") ? { status_code_grouped: xe(Q) } : {}
|