1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

feat: expose project time to production for project flag trends (#6068)

This commit is contained in:
Mateusz Kwasniewski 2024-01-30 13:28:20 +01:00 committed by GitHub
parent 82e84ec14d
commit 55b2bb4813
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 0 deletions

View File

@ -133,6 +133,7 @@ class ProjectStore implements IProjectStore {
'project_settings.project', 'project_settings.project',
'projects.id', 'projects.id',
) )
.leftJoin('project_stats', 'project_stats.project', 'projects.id')
.orderBy('projects.name', 'asc'); .orderBy('projects.name', 'asc');
if (query) { if (query) {
@ -148,12 +149,14 @@ class ProjectStore implements IProjectStore {
), ),
'project_settings.default_stickiness', 'project_settings.default_stickiness',
'project_settings.project_mode', 'project_settings.project_mode',
'project_stats.avg_time_to_prod_current_window',
] as (string | Raw<any>)[]; ] as (string | Raw<any>)[];
let groupByColumns = [ let groupByColumns = [
'projects.id', 'projects.id',
'project_settings.default_stickiness', 'project_settings.default_stickiness',
'project_settings.project_mode', 'project_settings.project_mode',
'project_stats.avg_time_to_prod_current_window',
]; ];
if (userId) { if (userId) {
@ -214,6 +217,7 @@ class ProjectStore implements IProjectStore {
createdAt: row.created_at, createdAt: row.created_at,
mode: row.project_mode || 'open', mode: row.project_mode || 'open',
defaultStickiness: row.default_stickiness || 'default', defaultStickiness: row.default_stickiness || 'default',
avgTimeToProduction: row.avg_time_to_prod_current_window || 0,
}; };
} }

View File

@ -83,6 +83,12 @@ export const projectSchema = {
description: description:
'A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy', 'A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy',
}, },
avgTimeToProduction: {
type: 'number',
example: 10,
description:
'The average time from when a feature was created to when it was enabled in the "production" environment during the current window',
},
}, },
components: {}, components: {},
} as const; } as const;

View File

@ -501,6 +501,7 @@ export interface IProjectWithCount extends IProject {
potentiallyStaleFeatureCount: number; potentiallyStaleFeatureCount: number;
memberCount: number; memberCount: number;
favorite?: boolean; favorite?: boolean;
avgTimeToProduction: number;
} }
export interface IClientSegment { export interface IClientSegment {

View File

@ -48,6 +48,7 @@ export default class FakeProjectStore implements IProjectStore {
featureCount: 0, featureCount: 0,
staleFeatureCount: 0, staleFeatureCount: 0,
potentiallyStaleFeatureCount: 0, potentiallyStaleFeatureCount: 0,
avgTimeToProduction: 0,
}; };
}); });
} }