Add an "All" value to label_values?

I have a dashboard that displays data for a few databases. I set it up to be able to choose a db and display data for a single db. Now, in addition, I want to be able to display data for all of the databases at once.

To display a single db, I use a variable $database:

label_values(aws_rds_cpuutilization_average, dbinstance_identifier)

My metrics are like:

aws_rds_write_latency_maximum{dbinstance_identifier=~"$database"}

Is there a way to append a “.+” value to label_values() and have it display as “All” in my list?

There is a Custom all value setting on variables. You have not said what your data source is, but if it supports wildcards then you can use the wildcard as a Custom all value.

So for example with Prometheus data source the wildcard is .* if I put that in Custom all value then when selecting your metric it would be:

aws_rds_write_latency_maximum{dbinstance_identifier=~".*"}

Which would return all metrics whatever the dbinstance_identifier

Genius! Exactly what I was looking for and the “auto” worked perfect for Prometheus.

image