1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: add logging for lifecycle prom metrics (#8341)

This commit is contained in:
Jaanus Sellin 2024-10-02 15:49:15 +03:00 committed by sjaanus
parent c58d4830eb
commit e512739571
No known key found for this signature in database
GPG Key ID: 20E007C0248BA7FF
3 changed files with 18 additions and 1 deletions

View File

@ -132,8 +132,17 @@ export class FeatureLifecycleService {
}
private recordStagesEntered(newlyEnteredStages: NewStage[]) {
if (this.flagResolver.isEnabled('trackLifecycleMetrics')) {
this.logger.info(
'recordStagesEntered parameter',
newlyEnteredStages,
);
}
newlyEnteredStages.forEach(({ stage, feature }) => {
this.eventBus.emit(STAGE_ENTERED, { stage, feature });
if (this.flagResolver.isEnabled('trackLifecycleMetrics')) {
this.logger.info('STAGE_ENTERED emitted', { stage, feature });
}
});
}

View File

@ -453,6 +453,9 @@ export default class MetricsMonitor {
eventBus.on(
events.STAGE_ENTERED,
(entered: { stage: string; feature: string }) => {
if (flagResolver.isEnabled('trackLifecycleMetrics')) {
logger.info('STAGE_ENTERED listened', entered);
}
featureLifecycleStageEnteredCounter.increment({
stage: entered.stage,
});

View File

@ -60,7 +60,8 @@ export type IFlagKey =
| 'onboardingUI'
| 'projectRoleAssignment'
| 'eventTimeline'
| 'personalDashboardUI';
| 'personalDashboardUI'
| 'trackLifecycleMetrics';
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
@ -297,6 +298,10 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_PERSONAL_DASHBOARD_UI,
false,
),
trackLifecycleMetrics: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_TRACK_LIFECYCLE_METRICS,
false,
),
};
export const defaultExperimentalOptions: IExperimentalOptions = {