Metrics

Query scalar data across multiple products

Query scalar values (as seen on Query Value, Table, and Toplist widgets). Multiple data sources are supported with the ability to process the data using formulas and functions.

post/api/v2/query/scalar

Request

  • Base URL
    https://api.datadoghq.com
  • URL
    https://api.datadoghq.com/api/v2/query/scalar
  • Auth
    • API key in header DD-API-KEY and API key in header DD-APPLICATION-KEY
    • or OAuth 2
      Authorization code: /oauth2/v1/authorize
      Token URL: /oauth2/v1/token scopes: timeseries_query

Request body

Example request

{
  "data": {
    "attributes": {
      "formulas": [
        {
          "formula": "a+b",
          "limit": {
            "count": 10
          }
        }
      ],
      "from": 1568899800000,
      "queries": [
        {
          "aggregator": "avg",
          "data_source": "metrics",
          "query": "avg:system.cpu.user{*} by {env}"
        }
      ],
      "to": 1568923200000
    },
    "type": "scalar_request"
  }
}

Response

OK

errorsstring

An error generated when processing a request.

Example response

{
  "data": {
    "attributes": {
      "columns": [
        {
          "name": "env",
          "type": "group",
          "values": [
            [
              "production"
            ],
            [
              "staging"
            ]
          ]
        }
      ]
    },
    "type": "scalar_response"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.