google cloud platform – GCP dashboard can’t use variables that have dash in values
In GCP dashboard I have a variable defined like this:
cluster_name="anthos-ooo"
When I run this PromQL query
sum(increase(logging_googleapis_com:user_my_metriv{monitored_resource="k8s_container", cluster_name="${cluster_name}"}[${__interval}]))
I am getting this error:
An error occurred requesting data. bad_data: invalid parameter “query”: substitute queries failed: 2:160: parse error: unexpected identifier “anthos” in label matching, expected “,” or “}”
The problem is that the variable cluster_name (defined in GCP Dashoboard) has a dash inside, and when reaching the dash, the grammar fails. Not sure if there is a way to escape.
In the expression I tried the following things:
- cluster_name=”$cluster_name”
- cluster_name=~”${cluster_name}”
- cluster_name=”\”${cluster_name}\””
- cluster_name=”$cluster_name”
even - cluster_name=”{{cluster_name}}”
If in my query I put cluster_name=”anthos-ooo” all is good, but I want to be able to select from the Dashboard’s filter, rather then hardcode it.
Any idea how to fix this?
Read more here: Source link
