Skip to content

Commit

Permalink
Add feature flag for skipping forecasting
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield committed Dec 6, 2024
1 parent c581eb2 commit 14778a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
9 changes: 8 additions & 1 deletion frontend/src/scenes/billing/billingLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -211,7 +212,13 @@ export const billingLogic = kea<billingLogicType>([
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)
},
Expand Down

0 comments on commit 14778a9

Please sign in to comment.