-
What Grafana version and what operating system are you using? Running v8.0.1 on linux
-
What are you trying to achieve?
We are receiving metrics from SonarQube and I wish to display “worst X projects” code-coverage. Code coverage is represented as percentage of lines covered, and 100.0 is best, while zero is worst. Promql is “topk(10, min_over_time(sonarqube_coverage[${__range_s}s]))” -
How are you trying to achieve it?
-
What happened?
Result is giving me values around 96.0 - 100.0 -
What did you expect to happen?
-
Can you copy/paste the configuration(s) that you are having problems with?
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
-
Did you follow any online instructions? If so, what is the URL?
welcome to the forum, @jaff
sorry, but not sure exactly what the problem is here. Maybe you can share a screenshot or a sample of your data? It sounds like your getting data into the panel and now you want to visualize it, yes?
A single query to our sonarqube server produced 155 rows, of which this is a sample:
sonarqube_coverage{key="devicebindingservice",name="DBS",} 60.8
sonarqube_coverage{key="drm-ppv-cooker",name="drm-ppv-cooker",} 86.5
sonarqube_coverage{key="drm-ppv-prov",name="drm-ppv-prov",} 89.1
sonarqube_coverage{key="drm-vod-cooker_master",name="drm-vod-cooker",} 22.2
sonarqube_coverage{key="drm-vod-prov_master",name="drm-vod-prov",} 81.0
sonarqube_coverage{key="drmAccountAndDevicesCooker",name="drm-accountanddevices-cooker",} 76.0
sonarqube_coverage{key="drmAccountAndDevicesProv",name="drm-accountanddevices-prov",} 84.1
sonarqube_coverage{key="drmAuditAndSync",name="drm-audit-and-sync",} 86.0
sonarqube_coverage{key="drmConfiguration",name="drm-configuration",} 87.2
sonarqube_coverage{key="drmHouseKeeper",name="drm-house-keeper",} 64.0
sonarqube_coverage{key="drmLinearCooker",name="drm-linear-cooker",} 88.6
sonarqube_coverage{key="drmLinearProv",name="drm-linear-prov",} 84.1
sonarqube_coverage{key="excitement-rating-api_master",name="excitement-rating-api_master",} 59.2
sonarqube_coverage{key="feaccountstreamprocessor",name="feaccountstreamprocessor-container",} 41.7
sonarqube_coverage{key="fedevicestreamprocessor",name="fedevicestreamprocessor-container",} 38.0
sonarqube_coverage{key="hideItem",name="hideitem-service",} 68.8
sonarqube_coverage{key="idserver-dynamo",name="idserver-dynamo",} 54.1
sonarqube_coverage{key="idserver-local",name="idserver-local",} 46.1
Here’s a metrics query for the panel, and attached screen-shot for that query:
topk(5, min_over_time(sonarqube_coverage[${__range_s}s]))