mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
fix: metrics performance patch (#4108)
This commit is contained in:
parent
65995b238a
commit
19770fc33c
@ -162,15 +162,19 @@ export default class ClientMetricsServiceV2 {
|
||||
100,
|
||||
);
|
||||
|
||||
const result = environments.flatMap((environment) =>
|
||||
applications.flatMap((appName) =>
|
||||
hours.flatMap((hourBucket) => {
|
||||
const metric = metrics.find(
|
||||
const result = environments.flatMap((environment) => {
|
||||
const environmentMetrics = metrics.filter(
|
||||
(metric) => metric.environment === environment,
|
||||
);
|
||||
return applications.flatMap((appName) => {
|
||||
const applicationMetrics = environmentMetrics.filter(
|
||||
(metric) => metric.appName === appName,
|
||||
);
|
||||
return hours.flatMap((hourBucket) => {
|
||||
const metric = applicationMetrics.find(
|
||||
(item) =>
|
||||
compareAsc(hourBucket.timestamp, item.timestamp) ===
|
||||
0 &&
|
||||
item.appName === appName &&
|
||||
item.environment === environment,
|
||||
0,
|
||||
);
|
||||
return (
|
||||
metric || {
|
||||
@ -182,10 +186,9 @@ export default class ClientMetricsServiceV2 {
|
||||
featureName,
|
||||
}
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
return result.sort((a, b) => compareAsc(a.timestamp, b.timestamp));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user