mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
[Gitar] Cleaning up stale flag: onboardingMetrics with value true (#8550)
This commit is contained in:
parent
cb6b776154
commit
0ff0b2dbd0
@ -240,7 +240,6 @@ class UserStore implements IUserStore {
|
||||
|
||||
let firstLoginOrder = 0;
|
||||
|
||||
if (this.flagResolver.isEnabled('onboardingMetrics')) {
|
||||
const existingUser =
|
||||
await this.buildSelectUser(user).first('first_seen_at');
|
||||
|
||||
@ -257,7 +256,6 @@ class UserStore implements IUserStore {
|
||||
first_seen_at: currentDate,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await updateQuery;
|
||||
return firstLoginOrder;
|
||||
|
@ -24,7 +24,7 @@ let app: IUnleashTest;
|
||||
|
||||
beforeAll(async () => {
|
||||
db = await dbInit('onboarding_read_model', getLogger, {
|
||||
experimental: { flags: { onboardingMetrics: true } },
|
||||
experimental: { flags: {} },
|
||||
});
|
||||
|
||||
app = await setupAppWithCustomConfig(
|
||||
|
@ -17,7 +17,7 @@ let onboardingReadModel: IOnboardingReadModel;
|
||||
beforeAll(async () => {
|
||||
db = await dbInit('onboarding_store', getLogger);
|
||||
const config = createTestConfig({
|
||||
experimental: { flags: { onboardingMetrics: true } },
|
||||
experimental: { flags: {} },
|
||||
});
|
||||
stores = db.stores;
|
||||
eventBus = config.eventBus;
|
||||
@ -41,8 +41,7 @@ beforeEach(async () => {
|
||||
test('Default project should take first user created instead of project created as start time', async () => {
|
||||
jest.useFakeTimers();
|
||||
jest.setSystemTime(new Date());
|
||||
const { userStore, featureToggleStore, projectStore, projectReadModel } =
|
||||
stores;
|
||||
const { userStore, featureToggleStore, projectStore } = stores;
|
||||
|
||||
// default projects are created in advance and should be ignored
|
||||
await projectStore.create({ id: 'default', name: 'irrelevant' });
|
||||
@ -106,8 +105,7 @@ test('Ignore system user in onboarding events', async () => {
|
||||
test('Storing onboarding events', async () => {
|
||||
jest.useFakeTimers();
|
||||
jest.setSystemTime(new Date());
|
||||
const { userStore, featureToggleStore, projectStore, projectReadModel } =
|
||||
stores;
|
||||
const { userStore, featureToggleStore, projectStore } = stores;
|
||||
const user = await userStore.insert({});
|
||||
await projectStore.create({ id: 'test_project', name: 'irrelevant' });
|
||||
await featureToggleStore.create('test_project', {
|
||||
@ -172,8 +170,7 @@ const reachedOnboardingEvents = (count: number) => {
|
||||
test('Reacting to events', async () => {
|
||||
jest.useFakeTimers();
|
||||
jest.setSystemTime(new Date());
|
||||
const { userStore, featureToggleStore, projectStore, projectReadModel } =
|
||||
stores;
|
||||
const { userStore, featureToggleStore, projectStore } = stores;
|
||||
const user = await userStore.insert({});
|
||||
await projectStore.create({ id: 'test_project', name: 'irrelevant' });
|
||||
await featureToggleStore.create('test_project', {
|
||||
|
@ -56,8 +56,6 @@ export class OnboardingService {
|
||||
|
||||
listen() {
|
||||
this.eventBus.on(USER_LOGIN, async (event: { loginOrder: number }) => {
|
||||
if (!this.flagResolver.isEnabled('onboardingMetrics')) return;
|
||||
|
||||
if (event.loginOrder === 0) {
|
||||
await this.insert({ type: 'first-user-login' });
|
||||
}
|
||||
@ -68,8 +66,6 @@ export class OnboardingService {
|
||||
}
|
||||
});
|
||||
this.eventBus.on(STAGE_ENTERED, async (stage: NewStage) => {
|
||||
if (!this.flagResolver.isEnabled('onboardingMetrics')) return;
|
||||
|
||||
if (stage.stage === 'initial') {
|
||||
await this.insert({
|
||||
type: 'flag-created',
|
||||
|
@ -110,7 +110,7 @@ export function registerPrometheusMetrics(
|
||||
};
|
||||
|
||||
const { eventStore, environmentStore } = stores;
|
||||
const { flagResolver, db } = config;
|
||||
const { flagResolver } = config;
|
||||
const dbMetrics = new DbMetricsMonitor(config);
|
||||
|
||||
const cachedEnvironments: () => Promise<IEnvironment[]> = memoizee(
|
||||
@ -530,10 +530,7 @@ export function registerPrometheusMetrics(
|
||||
name: 'onboarding_duration',
|
||||
labelNames: ['event'],
|
||||
help: 'firstLogin, secondLogin, firstFeatureFlag, firstPreLive, firstLive from first user creation',
|
||||
query: () =>
|
||||
flagResolver.isEnabled('onboardingMetrics')
|
||||
? stores.onboardingReadModel.getInstanceOnboardingMetrics()
|
||||
: Promise.resolve({}),
|
||||
query: () => stores.onboardingReadModel.getInstanceOnboardingMetrics(),
|
||||
map: (result) =>
|
||||
Object.keys(result)
|
||||
.filter((key) => Number.isInteger(result[key]))
|
||||
@ -549,10 +546,7 @@ export function registerPrometheusMetrics(
|
||||
name: 'project_onboarding_duration',
|
||||
labelNames: ['event', 'project'],
|
||||
help: 'firstFeatureFlag, firstPreLive, firstLive from project creation',
|
||||
query: () =>
|
||||
flagResolver.isEnabled('onboardingMetrics')
|
||||
? stores.onboardingReadModel.getProjectsOnboardingMetrics()
|
||||
: Promise.resolve([]),
|
||||
query: () => stores.onboardingReadModel.getProjectsOnboardingMetrics(),
|
||||
map: (projectsOnboardingMetrics) =>
|
||||
projectsOnboardingMetrics.flatMap(
|
||||
({ project, ...projectMetrics }) =>
|
||||
|
@ -49,7 +49,6 @@ export type IFlagKey =
|
||||
| 'enableLegacyVariants'
|
||||
| 'extendedMetrics'
|
||||
| 'removeUnsafeInlineStyleSrc'
|
||||
| 'onboardingMetrics'
|
||||
| 'onboardingUI'
|
||||
| 'projectRoleAssignment'
|
||||
| 'eventTimeline'
|
||||
@ -255,10 +254,6 @@ const flags: IFlags = {
|
||||
process.env.UNLEASH_EXPERIMENTAL_REMOVE_UNSAFE_INLINE_STYLE_SRC,
|
||||
false,
|
||||
),
|
||||
onboardingMetrics: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_ONBOARDING_METRICS,
|
||||
false,
|
||||
),
|
||||
onboardingUI: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_ONBOARDING_UI,
|
||||
false,
|
||||
|
@ -49,7 +49,6 @@ process.nextTick(async () => {
|
||||
manyStrategiesPagination: true,
|
||||
enableLegacyVariants: false,
|
||||
extendedMetrics: true,
|
||||
onboardingMetrics: true,
|
||||
onboardingUI: true,
|
||||
personalDashboardUI: true,
|
||||
purchaseAdditionalEnvironments: true,
|
||||
|
@ -8,7 +8,7 @@ let db: ITestDb;
|
||||
|
||||
beforeAll(async () => {
|
||||
db = await dbInit('user_store_serial', getLogger, {
|
||||
experimental: { flags: { onboardingMetrics: true } },
|
||||
experimental: { flags: {} },
|
||||
});
|
||||
stores = db.stores;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user