Using grafana v7.5.15 (the docker image), I’m looking for a way to escape a $
so it doesn’t get interpreted as a template variable.
I’ve tried:
-
\$
← gets passed through as is -
$$
← gets passed through as is -
\\$
← gets passed through as is
but they don’t do what I want (pass through the string $1
but without grafana attempting to interpolate it).
Here’s an example prometheus query:
label_replace(
rate(container_cpu_usage_seconds_total{name=~"${cluster}"}[5m]),
"alloc",
"$1",
"name",
".*"
)
Right now grafana treats $1
as a variable replacement, but fortunately does nothing since the 1
variable doesn’t exist. But we have more complex use cases and I’d like to try and avoid this in the future.