v1

latestOpenAPI 3.0.32026-07-26191565482.4 KB
DerivedMetric

post/api/v1/config/derived-metrics

Request body

dry_runboolean

If true, validates the specified configuration without creating the DerivedMetric. If the specified configuration is valid, the endpoint returns a partial response without the DerivedMetric. If the specified configuration is invalid, the endpoint returns an error.

Example request

{
  "derived_metric": {
    "metric_name": "cpu_usage:instance",
    "queries": [
      {
        "query": {
          "prometheus_expr": "cpu_usage{$service, $instance} / sum(cpu_usage{$service})",
          "variables": [
            {
              "default_prometheus_selector": "service=~\".*\"",
              "name": "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": [
            {
              "default_prometheus_selector": "service=~\".*\"",
              "name": "service"
            }
          ]
        }
      }
    ]
  }
}