we want users can see both job-level metrics and task-level metrics.
So we defined two variables: job and task, the query for job is easy: label_values(task_mem_usage, job). But if task is defined as label_values(task_mem_usage, task_name), it would be hard to select, especially when task_name is user defined and there are too many jobs.
From this, it seems we can use variable in other template’s definition, so I defined task’s query as label_values(query_result('task_mem_usage{"job"="$job"}'), task_name), but grafana gives error of Template variables could not be initialized: parse error at char 13.
Not sure if grafana support this? Maybe label_values(task_mem_usage, task_name, ["job"="$job"]) is more clear.
I was trying to use the below query with labels :
label_dp_language=“eng-USA”
label_dp_topic=“GEN”
I need to get the custom label => label_dp_language + “-” + label_dp_topic
I am expecting output as “eng-USA-GEN” and others values in variable from below query. The issue is same label_values doesnt work with query_result, can someone suggest me how can I append two labels and store in grafana template variable? -
Above query give me all query results with data_value label added to results, now I want this label to be extracted from query so label_values(query_result(…), data_value) should have worked here.