Adds new properties to the dashboard definition to customize format
Background
As part of our dogfooding effort, we found users want more flexibility to select the format of their values: #201999 (closed)
!25687 (merged) defines formats that now could become available to users.
What does this MR do?
This MR adds support for defining formats (units) in dashboards .yml
.
Three new properties are added y_axis.name
, y_axis.format
, y_axis.precision
to a panel definition:
- panels:
- title:
# ...
y_axis:
name: "Axis Name" # NEW
format: "bytes" # NEW, one of SUPPORTED_FORMATS
precision: 2 # NEW, fractional decimals (0.00), defaults to 2
Also y_label
gets deprecated in favor of y_axis.name
.
For example, in common_metrics.yml
, we modify a panel like this:
Before:
|
After:
|
-
*
SeeSUPPORTED_FORMATS
https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/lib/utils/unit_format/index.js#L8 -
**
Operations like/1000/1000/1000
to adjust units scales can be removed in favor of bytes.
Screenshots
before | after |
---|---|
- GB units are removed in favor of being calculated dynamically
- There is more space to display the axis name (left)
- Tooltip formatting is taken from axis (but not the precision)
What does this MR does not do?
Change our current dashboards!
This MR is backwards compatible, documentation and other changes will be addressed at: #208258 (closed)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -> #208258 (closed) -
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 #201999 (closed)