xenthik
1
I am trying to create a template variable from a Prometheus data source using label_join function like
label_values(label_join(app:healthcheck:gauge{application=“collectHealthies”}, “full_name”, " ", “first_name”, “last_name”) ,full_name)
but I am getting
Template variables could not be initialized: parse error at char 11: could not parse remaining input “(app:healthchec”…
https://prometheus.io/docs/prometheus/latest/querying/functions/#label_join
1 Like
Same issue. The goal is to aggregate multiple label names into single one and pass them to a variable. Does anyone know how to achieve this?
I just hit this problem too and solved it, sharing the solution to my specific use case might help others:
The query uses query_result()
:
query_result(
max by (nodepool) (
label_join(
kube_node_labels{cluster=~"$cluster"}
, "nodepool", "", "label_cloud_google_com_gke_nodepool", "label_agentpool")
)
)
This results in values like {nodepool="some-node-pool"} 1 1623140151000
To solve this, add a regex to grab the right value:
/nodepool="(.*)".*/