Metrics Schema

Schema

metricId: string
name: string
description?: string
metricQueries:
  - expression: string                # promql query
    alias: string                     # name in legend
    componentIdentifierTemplate?: string    # URN template for linking
chart:
  _type: 'TimeSeriesChart' | 'BarChart' | 'GaugeChart' | 'StatChart'
  ...
  • metricId The id of the metric, used for overriding/referencing when used in any of the charts

  • name: The name for the metric binding

  • description: Optional description, displayed on-hover of the name

  • metricQueries: A list of queries to show in the chart for the metric (see Writing PromQL queries)

    • expression: The (templated) promql query

    • alias: Name for the query in the legend

    • componentIdentifierTemplate: Template for identifier of related component, populated with labels of timeseries resulting from the query

  • chart: see below

Chart Types

The chart field defines how the metric will be rendered in the UI. Four different kinds of chart are supported * TimeSeriesChart * BarChart * GaugeChart * StatChart

_type: 'TimeSeriesChart'
unit?: string
decimals?: integer
min?: double
max?: double
connectNulls?: boolean
thresholds?:
  mode?: "absolute" | "percentage"
  defaultColor: string (hex color)
  steps:
    - value: double
    - color?: string (hex color)
    - name?: string
_type: 'BarChart'
unit?: string
decimals?: integer
min?: double
max?: double
thresholds?:
  mode?: "absolute" | "percentage"
  defaultColor: string (hex color)
  steps:
    - value: double
    - color?: string (hex color)
    - name?: string
_type: 'GaugeChart'
unit?: string
decimals?: integer
max?: double
calculation?: "mean" | "sum" | "min" | "max" | "first" | "first-number" | "last" | "last-number"
thresholds?:
  mode?: "absolute" | "percentage"
  defaultColor: string (hex color)
  steps:
    - value: double
    - color?: string (hex color)
    - name?: string
_type: 'StatChart'
unit?: string
decimals?: integer
sparkline?: boolean
calculation?: "mean" | "sum" | "min" | "max" | "first" | "first-number" | "last" | "last-number"
thresholds?:
  defaultColor: string (hex color)
  steps:
    - value: double
    - color?: string (hex color)
    - name?: string
  • unit: The unit of the values in the time series returned by the query or queries, used to render the Y-axis of the chart. See the supported units reference for all units

  • decimals: Number of decimal places to show for values - when rendered directly or when shown on hover

  • min: lowest value that the metric value can take.

  • max: highest value that the metric value can take.

  • sparkline: should a mini-chart be shown (small, no axis, no legend)

  • calculation: how to select or calculate a single value out of a timeseries. The first-number and last-number variants select the first, respectively last, non-null values from a timeseries

  • connectNulls: when a timeseries is missing values, should the rendered graph interpolate

  • thresholds:

    • mode: are values in the steps absolute, or relative to the max

    • defaultColor: color for a step when it is not specified. Specified in HEX, e.g. #33A02C

    • steps: different threshold values and the color used to display the metric value