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