Skip to main content
Monitoring & Collection/Monitoring Query & Overview

BuildQuery

Build a structured monitoring query from field-level parameters and return the rendered PromQL and SQL-like forms

POST/api/v1/monitoring/query-builder/build

Operation ID

BuildQuery

Since

1.0.0

Execution Mode

Synchronous

Auth Context

Auth Required

Auth Context

Send these values as request headers when calling this API.

AuthorizationstringRequired

Bearer Token

X-Tenant-IDstring

X-Tenant-ID

Request Inputs

application/json

Body Fields

  • metric
    StringRequired

    Metric name to query

    Example: cpu_usage_percent

  • filters
    LinkedHashMapRequired

    Filter criteria to narrow down results

    Example: (nested object)

  • condition
    StringRequired

    Filter condition expression

    Example: resource_type='vm'

  • timeRange
    StringRequired

    Query time range (e.g. 1h, 24h)

    Example: 1h

  • aggregation
    StringRequired

    Aggregation function to apply

    Example: avg

Responses

200 OK
200 OK

On success, this API returns the following response structure.

  • sqlLike
    String

    SQL-like representation of the built query

    Example: SELECT avg(cpu_usage_percent) FROM metrics WHERE resource_type='vm'

  • promql
    String

    PromQL representation of the built query

    Example: avg(cpu_usage_percent{resource_type="vm"})

  • valid
    Boolean

    Whether the query passed validation

    Example: true

  • error
    String

    Validation error message if the query is invalid

    Example: connection refused