v1

latestOpenAPI 3.0.12026-07-13149396412.1 KB
DerivedMetric

post/api/v1/config/derived-metrics

Request body

dry_runboolean

If true, the DerivedMetric isn't created, and no response DerivedMetric will be returned. The response will return an error if the given DerivedMetric is invalid.

Example request

{
  "derived_metric": {
    "metric_name": "cpu_usage:instance",
    "queries": [
      {
        "query": {
          "prometheus_expr": "cpu_usage{$service, $instance} / sum(cpu_usage{$service})",
          "variables": [
            {
              "name": "service",
              "default_prometheus_selector": "service=~\".*\""
            }
          ]
        }
      }
    ]
  }
}

Response

A successful response containing the created DerivedMetric.

Example response

{
  "derived_metric": {
    "metric_name": "cpu_usage:instance",
    "queries": [
      {
        "query": {
          "prometheus_expr": "cpu_usage{$service, $instance} / sum(cpu_usage{$service})",
          "variables": [
            {
              "name": "service",
              "default_prometheus_selector": "service=~\".*\""
            }
          ]
        }
      }
    ]
  }
}