Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow feature flags to be for time limited #1903

Closed
weyert opened this issue Oct 16, 2020 · 6 comments
Closed

Allow feature flags to be for time limited #1903

weyert opened this issue Oct 16, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request feature/feature-flags Feature Tag: Feature flags

Comments

@weyert
Copy link
Contributor

weyert commented Oct 16, 2020

Is your feature request related to a problem?

I would like to be able to automatically disable a feature flag after a specific time. For example, Halloween and Sinterklaas are coming up. I think it would be nice to be able add feature flags which are only active for like 25-31 October and after 31 October it automatically disable.

Describe the solution you'd like

I think we could add Start and End/Expiry Date to a feature flag which is taken into account when calling /decide-endpoint

Describe alternatives you've considered

Manually enable and disable the feature flag

Thank you for your feature request – we love each and every one!

@weyert weyert added the enhancement New feature or request label Oct 16, 2020
@macobo macobo added the feature/feature-flags Feature Tag: Feature flags label Dec 1, 2021
@paolodamico
Copy link
Contributor

This sounds like a super helpful feature, go for it @weyert! Let us know if you need any guidance here. CC @neilkakkar

@weyert
Copy link
Contributor Author

weyert commented Dec 20, 2021

Thank you @paolodamico :)

@neilkakkar I was thinking to add a column to the FeatureFlag-model named like expires_at, / until / ends_at or similar and then adapt the queries so feature flags aren't getting returned in the decide-endpoint.

I am wondering if it makes sense to also introduce a start-date so you could schedule a feature flag only for the Holidays season or something. Might be useful for the A/B experiments work?

@neilkakkar
Copy link
Contributor

I think having a start and end time in the model is reasonable. Then you'd modify the query building here to make it work.

The part that requires a bit of thinking is: We also have a "active" field in the model, which determines which FFs are active. This now needs to respect these new fields as well. As otherwise, these two fields clash: if the end_date is in the past, how can the FF be active?

I'm not quite sure yet what's the best way around this. One option is to have an "active" property, which takes into account the logic for start/end dates, as well as the value of the active field, and then every code path using active now uses the property active.

Another option might be to set active to false once the end_date passes, but at first glance this seems problematic and messy: how & when is this triggered, such that there's no long term delays & things stay consistent?

@weyert
Copy link
Contributor Author

weyert commented Dec 7, 2022

I will try to work on this during my vacation

@neilkakkar
Copy link
Contributor

Given we have local evaluation as well now, I don't think this feature should touch query building / what /decide does at all, but control the active parameter on the flag.

i.e. a celery task that runs every hour (maybe less) & checks if a flag is inactive but start_time has arrived & then turns it on; and conversely if flag is active & end_time has arrived & then turns it off.

@jurajmajerik
Copy link
Contributor

Hey @weyert, this has now become possible with scheduling flag changes: https://posthog.com/docs/feature-flags/scheduled-flag-changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature/feature-flags Feature Tag: Feature flags
Projects
None yet
Development

No branches or pull requests

5 participants