1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: remove 'fixHourMetrics' flag

This commit is contained in:
Ivar Conradi Østhus 2022-11-09 22:45:07 +01:00
parent 0c2a67f1dc
commit 325cd34c0c
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09
5 changed files with 30 additions and 45 deletions

View File

@ -73,7 +73,6 @@ exports[`should create default config 1`] = `
"cloneEnvironment": false,
"embedProxy": false,
"embedProxyFrontend": false,
"fixHourMetrics": false,
"publicSignup": false,
"responseTimeWithAppName": false,
"syncSSOGroups": false,
@ -88,7 +87,6 @@ exports[`should create default config 1`] = `
"cloneEnvironment": false,
"embedProxy": false,
"embedProxyFrontend": false,
"fixHourMetrics": false,
"publicSignup": false,
"responseTimeWithAppName": false,
"syncSSOGroups": false,

View File

@ -167,47 +167,40 @@ export default class ClientMetricsServiceV2 {
hoursBack,
);
if (this.flagResolver.isEnabled('fixHourMetrics')) {
const hours = generateHourBuckets(hoursBack);
const hours = generateHourBuckets(hoursBack);
const environments = [
...new Set(metrics.map((x) => x.environment)),
];
const environments = [...new Set(metrics.map((x) => x.environment))];
const applications = [
...new Set(metrics.map((x) => x.appName)),
].slice(0, 100);
const applications = [...new Set(metrics.map((x) => x.appName))].slice(
0,
100,
);
const result = environments.flatMap((environment) =>
applications.flatMap((appName) =>
hours.flatMap((hourBucket) => {
const metric = metrics.find(
(item) =>
compareAsc(
hourBucket.timestamp,
item.timestamp,
) === 0 &&
item.appName === appName &&
item.environment === environment,
);
return (
metric || {
timestamp: hourBucket.timestamp,
no: 0,
yes: 0,
appName,
environment,
featureName,
}
);
}),
),
);
const result = environments.flatMap((environment) =>
applications.flatMap((appName) =>
hours.flatMap((hourBucket) => {
const metric = metrics.find(
(item) =>
compareAsc(hourBucket.timestamp, item.timestamp) ===
0 &&
item.appName === appName &&
item.environment === environment,
);
return (
metric || {
timestamp: hourBucket.timestamp,
no: 0,
yes: 0,
appName,
environment,
featureName,
}
);
}),
),
);
return result.sort((a, b) => compareAsc(a.timestamp, b.timestamp));
} else {
return metrics;
}
return result.sort((a, b) => compareAsc(a.timestamp, b.timestamp));
}
resolveMetricsEnvironment(user: User | ApiUser, data: IClientApp): string {

View File

@ -38,10 +38,6 @@ export const defaultExperimentalOptions = {
process.env.UNLEASH_EXPERIMENTAL_CLONE_ENVIRONMENT,
false,
),
fixHourMetrics: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_FIX_HOUR_METRICS,
false,
),
},
externalResolver: { isEnabled: (): boolean => false },
};

View File

@ -41,7 +41,6 @@ process.nextTick(async () => {
syncSSOGroups: true,
changeRequests: true,
cloneEnvironment: true,
fixHourMetrics: true,
},
},
authentication: {

View File

@ -30,7 +30,6 @@ export function createTestConfig(config?: IUnleashOptions): IUnleashConfig {
syncSSOGroups: true,
changeRequests: true,
cloneEnvironment: true,
fixHourMetrics: true,
},
},
};