What are dashboard variables and what types exist?

IntermediateConceptGrafana
Answer

Variables make one dashboard reusable across environments, clusters and services. Types: Query (from the datasource), Custom (static list), Constant, Text box, Interval, Datasource (switch between datasources), and Ad hoc filters.

label_values(up{job="api"}, namespace)          # query variable
sum by (pod) (rate(http_requests_total{namespace="$namespace"}[$__rate_interval]))

Variables can chain: $pod depends on $namespace.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Grafana