diff --git a/src/lib/features/feature-lifecycle/feature-lifecycle-service.ts b/src/lib/features/feature-lifecycle/feature-lifecycle-service.ts index dd0f8d886571..2d05c58089f0 100644 --- a/src/lib/features/feature-lifecycle/feature-lifecycle-service.ts +++ b/src/lib/features/feature-lifecycle/feature-lifecycle-service.ts @@ -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 }); + } }); } diff --git a/src/lib/metrics.ts b/src/lib/metrics.ts index d724fb44ab7b..25c1ab8557a3 100644 --- a/src/lib/metrics.ts +++ b/src/lib/metrics.ts @@ -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, }); diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 9df11056bc8d..ad6994d28a11 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -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 = {