Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query to show label values in Grafana (using prometheus)

I've a metric in below format:

code_smells_count{BLOCKER="176",CRITICAL="52",MAJOR="3784",instance="localhost:8080",job="my-metrics",domainId="65",domain="Sales",product="EmployeeSales",project_key="employee-sales"} 5000

I'm trying to write a query that will only display the value of BLOCKER in a gauge.

I tried:

sum(code_smells_count{product="[[product]]"})by (BLOCKER)

But this doesn't work, as it returns value of code_smells_count{product="[[product]]", whereas I want only BLOCKER="176"

Any suggestions?

Thank you

like image 476
reiley Avatar asked May 27 '19 18:05

reiley


1 Answers

In Grafana, you can display the value of a tag with:

  1. visualization: single stat
  2. query: format should be table
  3. visualization: should then display a drop-down menu of the tag to show (the name by default)
like image 57
Michael Doubez Avatar answered Sep 30 '22 00:09

Michael Doubez