Display metric label value in single stat panel
What does this MR do?
Single stat charts in the metrics dashboard display the actual metric value. This MR adds support for a new property called field
in the YML file so that a particular metric label value can be displayed instead of the actual value. These labels are present in the result set of the PromQL along with the actual value.
Result set for above dashboard
field
?
Why We're trying to make it easy for Grafana users to migrate to metrics dashboard. Grafana uses field
as well. Check the screenshot.
Sample dashboard YML
dashboard: 'Metrics Dev'
panel_groups:
- group: 'Stat'
panels:
- title: "🐤 Before"
type: "single-stat"
field: prom_version # <-------- This is the new property
metrics:
- id: 1110
query: 'label_replace(topk(1, count(prometheus_build_info) by (version)), "prom_version", "@$1", "version", "(.*)")'
label: "Prom version"
unit: ' '
- title: "🚀 After"
type: "single-stat"
metrics:
- id: 1111
query: 'label_replace(topk(1, count(prometheus_build_info) by (version)), "prom_version", "@$1", "version", "(.*)")'
label: "Prom version"
unit: ' '
Screenshots
- | Before | After |
---|---|---|
If field is present |
||
If field is not present |
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #220361 (closed)
Edited by Dhiraj Bodicherla