> This page is for version Latest (default).
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/fleet-intel/latest/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/fleet-intel/llms.txt.

# Query metric range

GET /v1/metrics/query_range

Query data for a particular metric for a node, node group, or compute zone over a range of time

Reference: https://docs.nvidia.com/fleet-intel/api-explorer/metrics/get-v-1-metrics-query-range

## Request

### Query parameters

- `start` (string, optional) — Start time in RFC3339 format (required for absolute mode, e.g., 2024-01-01T01:00:00Z). Cannot be more than 1 year in the past.
- `end` (string, optional) — End time in RFC3339 format (required for absolute mode, e.g., 2024-01-01T01:00:00Z)
- `timeMode` (enum, optional) — Time mode for range selection. Defaults to absolute.
  - Allowed values: `absolute`, `relative`
- `window` (string, optional) — Relative duration window (required for relative mode). Valid units: h, m, s (e.g. 24h, 1h30m, 90m). 'd' is not supported; use hours instead (e.g. 168h for 7 days)
- `step` (string, required) — Query resolution step width in duration format (e.g. 1h, 1m). Minimum step width is 1 minute.
- `component` (string, required) — Component name (e.g., accelerator-nvidia-clock-speed)
- `metric` (string, required) — Name of the metric to query (e.g., accelerator_nvidia_clock_speed_graphics_mhz)
- `entityLevel` (enum, required) — The level of the entity to query for. In the future we intend to support aggregation across tags, node groups, and compute zones
  - Allowed values: `node`
- `entityID` (string, required) — The ID of the compute zone, node group, or node

## Response

### 200

Successful response" (NOTE: the result fields will be JSON objects and JSON arrays in the actual response, not strings)

- `unavailable` (models.MetricUnavailable, required) — Unavailable is set for node-level queries when the metric does not apply to the node at all, so the caller can hide the chart rather than draw an empty one. Null whenever the metric does apply, including when it simply has no data in the window. Always null for aggregated levels, where sensor presence is not a single answer across the group.
- `warning` (models.MetricQueryWarning, required) — e.g. omitted invalid metric points; null when no issues
- `result` (list of models.MetricSeriesData, optional) — NodeAggregationFunction string `json:"nodeAggregationFunction" example:"avg"` // TODO: add this in later
- `step` (string, optional)
- `stepAggregationFunction` (string, optional)
- `timeRange` (models.TimeRange, optional)

## Errors

### 400 Bad Request Error

Bad Request

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 401 Unauthorized Error

Unauthorized

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 403 Forbidden Error

Forbidden - UAM authorization denied

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 404 Not Found Error

Not Found

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 499 Client Closed Request Error

Client Closed Request - request was canceled by the client

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 500 Internal Server Error

Internal Server Error

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

### 503 Service Unavailable Error

Service Unavailable

- `details` (string, optional) — Detailed error information
- `error` (string, optional) — Error message or type
- `requestStatus` (models.KASRequestStatus, optional) — RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

## Types

### models.MetricUnavailable

Unavailable is set for node-level queries when the metric does not apply to the node at all, so the caller can hide the chart rather than draw an empty one. Null whenever the metric does apply, including when it simply has no data in the window. Always null for aggregated levels, where sensor presence is not a single answer across the group.

- `code` (string, optional)
- `message` (string, optional)

### models.MetricQueryWarning

e.g. omitted invalid metric points; null when no issues

- `code` (string, optional)
- `message` (string, optional)

### models.MetricSeriesData

- `displayLabel` (string, optional) — DisplayLabel is the preferred label value for UI display (e.g., GPU index for DCGM metrics). Derived from the "gpu" key if present, otherwise falls back to "gpu_uuid". Omitted for aggregated levels where labels are not present.
- `label` (map from string to string, optional) — Label contains identifying information (e.g., GPU UUID) for node-level queries. Omitted for aggregated levels (customer/nodegroup/computezone). Typical keys: "gpu" (GPU index), "uuid" (GPU UUID).
- `values` (string, optional) — Values is a 2D array where each inner array contains [unix_timestamp, metric_value] This follows the Prometheus/Grafana standard format for compatibility The last element in the array represents the most recent/latest value Example: [[1705276800, 0.723], [1705277100, 0.741]] NOTE: swaggertype:"string" is a workaround for swag limitations with nested arrays

### models.TimeRange

- `end` (datetime, optional)
- `start` (datetime, optional)

### models.KASRequestStatus

RequestStatus contains KAS-specific error details This is added to reflect the field in OpenAPI docs for UI reference and not populated by our code If KAS returns an error, the request will not be forwarded to the backend

- `requestId` (string, optional) — Request ID for tracing
- `statusCode` (string, optional) — Status code from KAS
- `statusDescription` (string, optional) — Status description from KAS

## Examples

**Response**

```json
{
  "unavailable": {
    "code": "sensorNotPresent",
    "message": "This node does not report the sensors for this metric."
  },
  "warning": {
    "code": "invalidMetricValues",
    "message": "1 data point(s) had invalid values and were omitted."
  },
  "result": [
    {
      "displayLabel": "GPU 0",
      "label": {},
      "values": "[[1705276800, 0.723], [1705277100, 0.741]]"
    }
  ],
  "step": "5m",
  "stepAggregationFunction": "avg",
  "timeRange": {
    "end": "2024-01-01T01:00:00Z",
    "start": "2024-01-01T00:00:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/metrics/query_range"

querystring = {"component":"component","entityID":"entityID","entityLevel":"node","metric":"metric","step":"step"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/metrics/query_range?component=component&entityID=entityID&entityLevel=node&metric=metric&step=step")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```