mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
chore: remove variant metrics flag (#4042)
This commit is contained in:
parent
3763e1b24d
commit
71d242a299
@ -48,7 +48,6 @@ export interface IFlags {
|
||||
demo?: boolean;
|
||||
groupRootRoles?: boolean;
|
||||
googleAuthEnabled?: boolean;
|
||||
variantMetrics?: boolean;
|
||||
strategyImprovements?: boolean;
|
||||
disableBulkToggle?: boolean;
|
||||
segmentContextFieldUsage?: boolean;
|
||||
|
@ -97,7 +97,6 @@ exports[`should create default config 1`] = `
|
||||
"segmentContextFieldUsage": false,
|
||||
"strategyImprovements": false,
|
||||
"strictSchemaValidation": false,
|
||||
"variantMetrics": false,
|
||||
},
|
||||
},
|
||||
"flagResolver": FlagResolver {
|
||||
@ -132,7 +131,6 @@ exports[`should create default config 1`] = `
|
||||
"segmentContextFieldUsage": false,
|
||||
"strategyImprovements": false,
|
||||
"strictSchemaValidation": false,
|
||||
"variantMetrics": false,
|
||||
},
|
||||
"externalResolver": {
|
||||
"getVariant": [Function],
|
||||
|
@ -178,7 +178,6 @@ export class ClientMetricsStoreV2 implements IClientMetricsStoreV2 {
|
||||
const query = `${insert.toString()} ON CONFLICT (feature_name, app_name, environment, timestamp) DO UPDATE SET "yes" = "client_metrics_env"."yes" + EXCLUDED.yes, "no" = "client_metrics_env"."no" + EXCLUDED.no`;
|
||||
await this.db.raw(query);
|
||||
|
||||
if (this.flagResolver.isEnabled('variantMetrics')) {
|
||||
const variantRows = spreadVariants(metrics).map(toVariantRow);
|
||||
if (variantRows.length > 0) {
|
||||
const insertVariants = this.db<ClientMetricsEnvVariantTable>(
|
||||
@ -190,13 +189,11 @@ export class ClientMetricsStoreV2 implements IClientMetricsStoreV2 {
|
||||
await this.db.raw(variantsQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getMetricsForFeatureToggle(
|
||||
featureName: string,
|
||||
hoursBack: number = 24,
|
||||
): Promise<IClientMetricsEnv[]> {
|
||||
if (this.flagResolver.isEnabled('variantMetrics')) {
|
||||
const rows = await this.db<ClientMetricsEnvTable>(TABLE)
|
||||
.select([`${TABLE}.*`, 'variant', 'count'])
|
||||
.leftJoin(TABLE_VARIANTS, function () {
|
||||
@ -205,14 +202,8 @@ export class ClientMetricsStoreV2 implements IClientMetricsStoreV2 {
|
||||
`${TABLE}.feature_name`,
|
||||
)
|
||||
.on(`${TABLE_VARIANTS}.app_name`, `${TABLE}.app_name`)
|
||||
.on(
|
||||
`${TABLE_VARIANTS}.environment`,
|
||||
`${TABLE}.environment`,
|
||||
)
|
||||
.on(
|
||||
`${TABLE_VARIANTS}.timestamp`,
|
||||
`${TABLE}.timestamp`,
|
||||
);
|
||||
.on(`${TABLE_VARIANTS}.environment`, `${TABLE}.environment`)
|
||||
.on(`${TABLE_VARIANTS}.timestamp`, `${TABLE}.timestamp`);
|
||||
})
|
||||
.where(`${TABLE}.feature_name`, featureName)
|
||||
.andWhereRaw(
|
||||
@ -221,15 +212,6 @@ export class ClientMetricsStoreV2 implements IClientMetricsStoreV2 {
|
||||
|
||||
const tokens = rows.reduce(variantRowReducer, {});
|
||||
return Object.values(tokens);
|
||||
} else {
|
||||
const rows = await this.db<ClientMetricsEnvTable>(TABLE)
|
||||
.select('*')
|
||||
.where({ feature_name: featureName })
|
||||
.andWhereRaw(
|
||||
`timestamp >= NOW() - INTERVAL '${hoursBack} hours'`,
|
||||
);
|
||||
return rows.map(fromRow);
|
||||
}
|
||||
}
|
||||
|
||||
async getSeenAppsForFeatureToggle(
|
||||
|
@ -20,7 +20,6 @@ export type IFlagKey =
|
||||
| 'demo'
|
||||
| 'strategyImprovements'
|
||||
| 'googleAuthEnabled'
|
||||
| 'variantMetrics'
|
||||
| 'disableBulkToggle'
|
||||
| 'experimentalExtendedTelemetry'
|
||||
| 'segmentContextFieldUsage'
|
||||
@ -95,10 +94,6 @@ const flags: IFlags = {
|
||||
process.env.GOOGLE_AUTH_ENABLED,
|
||||
false,
|
||||
),
|
||||
variantMetrics: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_VARIANT_METRICS,
|
||||
false,
|
||||
),
|
||||
experimentalExtendedTelemetry: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_EXTENDED_TELEMETRY,
|
||||
false,
|
||||
|
@ -37,7 +37,6 @@ process.nextTick(async () => {
|
||||
embedProxyFrontend: true,
|
||||
anonymiseEventLog: false,
|
||||
responseTimeWithAppNameKillSwitch: false,
|
||||
variantMetrics: true,
|
||||
strategyImprovements: true,
|
||||
segmentContextFieldUsage: true,
|
||||
advancedPlayground: true,
|
||||
|
@ -18,19 +18,12 @@ const fetchHoursBack = (hoursBack: number, feature: string = 'demo') => {
|
||||
};
|
||||
|
||||
beforeAll(async () => {
|
||||
db = await dbInit('client_metrics_serial', getLogger, {
|
||||
experimental: {
|
||||
flags: {
|
||||
variantMetrics: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
db = await dbInit('client_metrics_serial', getLogger);
|
||||
app = await setupAppWithCustomConfig(
|
||||
db.stores,
|
||||
{
|
||||
experimental: {
|
||||
flags: {
|
||||
variantMetrics: true,
|
||||
strictSchemaValidation: true,
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user