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

View File

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

View File

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

View File

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

View File

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