From 14778a9bcd3a50d11e0aee6c76f1c23644ce7265 Mon Sep 17 00:00:00 2001 From: Zach Waterfield Date: Fri, 6 Dec 2024 06:17:00 -0500 Subject: [PATCH] Add feature flag for skipping forecasting --- frontend/src/lib/constants.tsx | 1 + frontend/src/scenes/billing/billingLogic.tsx | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index a184257cca70d..288d5058f7bbc 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -237,6 +237,7 @@ export const FEATURE_FLAGS = { SITE_APP_FUNCTIONS: 'site-app-functions', // owner: @mariusandra #team-cdp REPLAY_HOGQL_FILTERS: 'replay-hogql-filters', // owner: @pauldambra #team-replay REPLAY_LIST_RECORDINGS_AS_QUERY: 'replay-list-recordings-as-query', // owner: @pauldambra #team-replay + BILLING_SKIP_FORECASTING: 'billing-skip-forecasting', // owner: @zach } as const export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS] diff --git a/frontend/src/scenes/billing/billingLogic.tsx b/frontend/src/scenes/billing/billingLogic.tsx index ac78f13424b72..d6f0fa86493a1 100644 --- a/frontend/src/scenes/billing/billingLogic.tsx +++ b/frontend/src/scenes/billing/billingLogic.tsx @@ -4,6 +4,7 @@ import { FieldNamePath, forms } from 'kea-forms' import { loaders } from 'kea-loaders' import { router, urlToAction } from 'kea-router' import api, { getJSONOrNull } from 'lib/api' +import { FEATURE_FLAGS } from 'lib/constants' import { dayjs } from 'lib/dayjs' import { LemonBannerAction } from 'lib/lemon-ui/LemonBanner/LemonBanner' import { lemonBannerLogic } from 'lib/lemon-ui/LemonBanner/lemonBannerLogic' @@ -211,7 +212,13 @@ export const billingLogic = kea([ null as BillingType | null, { loadBilling: async () => { - const response = await api.get('api/billing') + // Note: this is a temporary flag to skip forecasting in the billing page + // for customers running into performance issues until we have a more permanent fix + // of splitting the billing and forecasting data. + const skipForecasting = values.featureFlags[FEATURE_FLAGS.BILLING_SKIP_FORECASTING] + const response = await api.get( + 'api/billing' + (skipForecasting ? '?include_forecasting=false' : '') + ) return parseBillingResponse(response) },