Skip to main content

Evaluates a range query in a metrics account by ID using POST

POST 

/v1/metrics/prometheus/:accountId/api/v1/query_range

Runs against the metrics account given by accountId instead of the API token's own account, so it can be called with the API token of a logs account. The token's account must be one of the metrics account's authorized accounts, otherwise the request returns 401. To list the metrics accounts and their authorizedAccountsIds, use Get a list of all metrics accounts.

Submit query data in the request body using URL-encoded form parameters. Please ensure to change the region in the URL to match your account's region.

Request​

Path Parameters

    accountId integerrequired

    ID of the metrics account to query.

Body

required
    query stringrequired

    Prometheus expression query string.

    start stringrequired

    Start timestamp, inclusive, as an RFC3339 or Unix timestamp.

    end stringrequired

    End timestamp, inclusive, as an RFC3339 or Unix timestamp.

    step stringrequired

    Query resolution step width in seconds.

    timeout string

    Evaluation timeout. Optional, defaults to the value of the -query.timeout flag.

Responses​

Successful range query evaluation.

Schema
    status string

    Status of the query (e.g., success, fail).

    data object
    resultType string

    Possible values: [matrix]

    Type of the result.

    result object[]
  • Array [
  • metric objectrequired

    Labels identifying the metric.

    property name* string
    values array[]required

    Possible values: >= 2, <= 2

    A list of [timestamp, value] pairs returned by the query.

  • ]
Loading...