Skip to content

Adds new properties to the dashboard definition to customize format

Miguel Rincon requested to merge 201999-define-formatter-dashboard-yml into master

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:
- title: "Memory Usage (Total)"
  weight: 4
  type: "area-chart"
  y_label: "Total Memory Used (GB)" # TO BE DEPRECATED
  metrics:
  - id: system_metrics_kubernetes_container_memory_total
    query_range: 'avg(....) by (job)) without (job) /1024/1024/1024'
    label: Total (GB)
    unit: GB
After:
- title: "Memory Usage (Total)"
  weight: 4
  type: "area-chart"
  y_axis: # NEW PROPERTY y_axis
    name: "Total Memory Used" # NEW PROPERTY
    format: "bytes" # NEW PROPERTY, one of formats (*)
  metrics:
  - id: system_metrics_kubernetes_container_memory_total
    query_range: 'avg(....) by (job)) without (job)' # `/1024/1024/1024` IS REMOVED**
    label: Total

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

Availability and Testing

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)

Edited by 🤖 GitLab Bot 🤖

Merge request reports