The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/contribute/feature-toggles.md

1.4 KiB

Feature toggle guide

This guide helps you to add your feature behind a feature flag, code that lets you enable or disable a feature without redeploying Grafana.

Steps to adding a feature toggle

  1. Define the feature toggle in registry.go. To see what each feature stage means, look at the related comments. If you are a community member, use the CODEOWNERS file to determine which team owns the package you are updating.
  2. Run the Go tests mentioned at the top of this file. This generates all the additional files needed: toggles_gen for the backend, grafana-data for the frontend, and docs. To run the test, run make gen-feature-toggles.

How to use the toggle in your code

Once your feature toggle is defined, you can then wrap your feature around a check if the feature flag is enabled on that Grafana instance.

Examples:

  • Backend: Use the IsEnabled function and pass in your feature toggle.
  • Frontend: Check the config for your feature toggle.