Trey Kane Logo

Trey Kane

Best practices for feature flagging

February 14, 2024

Back to home

Types of Tags

Short Term Flags

Permanent Flags

Limited Lifespan

Entitlements

Clear Purpose

Circuit Breakers

A/B Testing Segments

Load Shedding

New Services Rollout

White labeling

Release Kill Switch

Accessibility

Operational Flags — “An operational interaction flag is controlled by the ops team to protect the systems”

Release Flag — “A release flag is controlled by the product or business owner to control how user adoption progresses.”

White-labeling Flag — “Configuring the look and feel of an application for each client.”

Circuit breakers/Load-shedding — “Having the ability to quickly turn a feature off or terminate a connection when problems arise prevents problems from impacting all users.”

So what are some of the best practices for usage?

  1. Standardized Naming
    1. Be Descriptive
    2. Its good to be Verbose
    3. Is the flag TEMP or PERM?
    4. Release Flags get a date stamp for the date of release/toggle 02232020
    5. Tag the business name who owns the flag, more important in a shared codebase like CB
  2. Minimize the flag footprint
    1. Flag should not control more than one feature or action
    2. If multiple features depend on each other you can flag each and then also a master flag for all features
  3. Permanent Flags
    1. Use user permissions and groups to control access to types of flags based on user and tag
    2. Proper naming will help take pressure off the clean-up process
    3. Can use tags to assign user permissions to specific types of flags
    4. Tag your permanent flags as such
  4. Short-term Flags
    1. Use user permissions and groups to control access to types of flags based on user and tag
    2. Have a plan to clean up the flag before you create it
    3. Use user permissions and groups to control access to types of flags based on user
    4. Add date of toggle to the name, so we know the flag can be removed after that date
    5. Clearly naming the feature in common language
  5. Clean-up Event
    1. Capture the Flag Day — All teams work to remove feature flags safely at the same time. Person with the most removals, wins.
    2. Schedule a monthly/bi-weekly cleanup
  6. Review list of Flags regularly
    1. Has the same variation been served for a long time?
    2. Is the flag permanent, and if so, does its purpose still make sense?
    3. Is the flag temporary, and has the event date passed?

General Guidelines

  1. Keep the number of flags as low as possible in the system at any given time (more flags = more complexity)
  2. Keep the flags as short lived as possible
  3. Be descriptive and Verbose with your Flag Names\

Some further reading…

https://launchdarkly.com/blog/best-practices-short-term-permanent-flags/

https://medium.com/@thysniu/coding-with-feature-flags-how-to-guide-and-best-practices-3f9637f51265

https://martinfowler.com/articles/feature-toggles.html