mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: unknown in network view (#3069)
This commit is contained in:
parent
7e46f0fb7a
commit
0f78c17adc
@ -32,12 +32,14 @@ interface INetworkApp {
|
|||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const asNetworkAppData = (result: RequestsPerSecondSchemaDataResultItem) => {
|
const asNetworkAppData = (
|
||||||
|
result: RequestsPerSecondSchemaDataResultItem & { label: string }
|
||||||
|
) => {
|
||||||
const values = (result.values || []) as ResultValue[];
|
const values = (result.values || []) as ResultValue[];
|
||||||
const data = values.filter(value => isRecent(value));
|
const data = values.filter(value => isRecent(value));
|
||||||
const reqs = data.length ? parseFloat(data[data.length - 1][1]) : 0;
|
const reqs = data.length ? parseFloat(data[data.length - 1][1]) : 0;
|
||||||
return {
|
return {
|
||||||
label: unknownify(result.metric?.appName),
|
label: result.label,
|
||||||
reqs,
|
reqs,
|
||||||
type: unknownify(result.metric?.endpoint?.split('/')[2]),
|
type: unknownify(result.metric?.endpoint?.split('/')[2]),
|
||||||
};
|
};
|
||||||
@ -59,7 +61,12 @@ const summingReqsByLabelAndType = (
|
|||||||
|
|
||||||
const toGraphData = (metrics?: RequestsPerSecondSchema) => {
|
const toGraphData = (metrics?: RequestsPerSecondSchema) => {
|
||||||
const results =
|
const results =
|
||||||
metrics?.data?.result?.filter(result => result?.metric?.appName) || [];
|
metrics?.data?.result
|
||||||
|
?.map(result => ({
|
||||||
|
...result,
|
||||||
|
label: unknownify(result.metric?.appName),
|
||||||
|
}))
|
||||||
|
.filter(result => result.label !== 'unknown') || [];
|
||||||
const aggregated = results
|
const aggregated = results
|
||||||
.map(asNetworkAppData)
|
.map(asNetworkAppData)
|
||||||
.reduce(summingReqsByLabelAndType, {});
|
.reduce(summingReqsByLabelAndType, {});
|
||||||
|
Loading…
Reference in New Issue
Block a user