> This page is for version 0.5.1.
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo-helix/latest/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo-helix/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo-helix/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo-helix/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo-helix/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo-helix/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo-helix/v0.3.0/llms.txt
> - 0.2.0: https://docs.nvidia.com/nemo-helix/v0.2.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-helix/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo-helix/_mcp/server.

# Get Trace Metrics

GET /apis/intake/v2/workspaces/{workspace}/traces/metrics

Reference: https://docs.nvidia.com/nemo-helix/v0.5.1/documentation/reference/api-reference/traces/get-trace-metrics-apis-intake-v-2-workspaces-workspace-traces-metrics-get

## Request

### Path parameters

- `workspace` (string, required)

### Query parameters

- `bucket` (enum, optional, default: day) — Time bucket granularity. total collapses the filtered range into a single row.
  - Allowed values: `total`, `hour`, `day`, `week`, `month`
- `timezone` (string, optional, default: UTC) — IANA timezone the buckets are aligned to, e.g. America/Los_Angeles.
- `filter` (TraceFilter, optional) — Filter the traces the metrics are computed over. Accepts the same fields as the traces list, so agent_name scopes the rollup to one agent. Without a started_at lower bound the rollup covers the last 7 days.

## Response

### 200

Successful Response

- `bucket` (enum, required)
  - Allowed values: `total`, `hour`, `day`, `week`, `month`
- `timezone` (string, required)
- `data` (list of TraceMetricPointResponse, required)

## Errors

### 400 Bad Request Error

Unsupported query parameter or unknown timezone

- `detail` (string, required)

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 503 Service Unavailable Error

ClickHouse spans storage unavailable

- `detail` (string, required)

## Types

### TraceFilter

- `id` (string, optional) — Filter by canonical Intake trace id.
- `session_id` (string, optional) — Filter by session id.
- `status` (enum, optional) — Filter by root span status.
  - Allowed values: `success`, `error`, `cancelled`, `unknown`
- `started_at` (DatetimeFilter, optional) — Filter by root span start timestamp.
- `evaluation_name` (string, optional) — Filter by Evaluation name.
- `test_case_name` (string, optional) — Filter by test case name.
- `agent_name` (string, optional) — Filter by root-span agent name.
- `evaluation_id` (string, optional, deprecated) — Deprecated alias for evaluation_name. Use evaluation_name instead.
- `test_case_id` (string, optional, deprecated) — Deprecated alias for test_case_name. Use test_case_name instead.

### TraceMetricPointResponse

- `run_count` (integer, required) — Agent runs started in this bucket.
- `failed_run_count` (integer, required) — Runs whose root span ended in error.
- `input_tokens` (TokenRollupResponse, required)
- `output_tokens` (TokenRollupResponse, required)
- `cached_tokens` (TokenRollupResponse, required)
- `total_tokens` (TokenRollupResponse, required)
- `cost_usd` (CostRollupResponse, required)
- `latency_ms` (LatencyRollupResponse, required)
- `bucket_start` (datetime, optional) — Start of the bucket in the requested timezone. Omitted when bucket=total.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (map from string to any, optional)

### DatetimeFilter

- `$gte` (datetime, optional) — Filter for results greater than or equal to this datetime.
- `$lte` (datetime, optional) — Filter for results less than or equal to this datetime.

### TokenRollupResponse

- `sum` (integer, optional)
- `mean` (double, optional)
- `p90` (double, optional)
- `p99` (double, optional)

### CostRollupResponse

- `sum` (double, optional)
- `mean` (double, optional)
- `p90` (double, optional)
- `p99` (double, optional)

### LatencyRollupResponse

- `mean` (double, optional)
- `p50` (double, optional)
- `p90` (double, optional)
- `p95` (double, optional)
- `p99` (double, optional)

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "bucket": "total",
  "timezone": "string",
  "data": [
    {
      "run_count": 1,
      "failed_run_count": 1,
      "input_tokens": {
        "sum": 1,
        "mean": 1.1,
        "p90": 1.1,
        "p99": 1.1
      },
      "output_tokens": {
        "sum": 1,
        "mean": 1.1,
        "p90": 1.1,
        "p99": 1.1
      },
      "cached_tokens": {
        "sum": 1,
        "mean": 1.1,
        "p90": 1.1,
        "p99": 1.1
      },
      "total_tokens": {
        "sum": 1,
        "mean": 1.1,
        "p90": 1.1,
        "p99": 1.1
      },
      "cost_usd": {
        "sum": 1.1,
        "mean": 1.1,
        "p90": 1.1,
        "p99": 1.1
      },
      "latency_ms": {
        "mean": 1.1,
        "p50": 1.1,
        "p90": 1.1,
        "p95": 1.1,
        "p99": 1.1
      },
      "bucket_start": "2024-01-15T09:30:00Z"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/apis/intake/v2/workspaces/workspace/traces/metrics"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.example.com/apis/intake/v2/workspaces/workspace/traces/metrics';
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/apis/intake/v2/workspaces/workspace/traces/metrics"

	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/apis/intake/v2/workspaces/workspace/traces/metrics")

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/apis/intake/v2/workspaces/workspace/traces/metrics")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/apis/intake/v2/workspaces/workspace/traces/metrics');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/apis/intake/v2/workspaces/workspace/traces/metrics");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/apis/intake/v2/workspaces/workspace/traces/metrics")! 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()
```