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