Prometheus 2: Replacing count_scalar (unknown function)

Prometheus 2 has been released a few weeks ago and did affect quite some parts. One of which is replacing existing functions thus breaking existing Grafana dashboards in some circumstances:

parse error at char 96: unknown function with name "count_scalar"

Scanning through Pull Requests dealing with this change, it seems as if scalar(count()) is a suitable replacement. See e.g. what Percona did in one of their Pull Requests: PMM-1676 Parse error in Grafana dashboards due to removed count_scalar

Just replace your broken dashboard queries using count_scalar (don’t get confused with the parens):

count_scalar(...) -> scalar(count(...))

Further references