Create stats — POST /v1/o11y/metrics/stats

Lists metrics with their sample and time-series counts for a time range — the volume view of the metrics explorer, pageable and sortable.

POST /v1/o11y/metrics/stats

Addresshttps://api.hanzo.ai/v1/o11y/metrics/stats
MethodPOST
OperationGetMetricsStats
AuthAuthorization: Bearer $HANZO_API_KEY

Lists metrics with their sample and time-series counts for a time range — the volume view of the metrics explorer, pageable and sortable.

Request

15 fields, body application/json (required).

FieldInTypeRequiredDescription
endbodyinteger (int64)yesEnd is the end of the window as a Unix timestamp in milliseconds.
filterbodyo11y.O11yMetricFilter—
filter.expressionbodystring—Expression is the filter, in the query-builder filter syntax.
limitbodyinteger (int64)yesLimit caps how many metrics come back, between 1 and 5000.
offsetbodyinteger (int64)—Offset is how many metrics to skip, for paging.
orderBybodyo11y.O11yMetricOrder—
orderBy.directionbodystring—Direction is asc or desc.
orderBy.keybodyo11y.O11yMetricField—
orderBy.key.descriptionbodystring—Description describes the field.
orderBy.key.fieldContextbodystring—FieldContext is the context the field lives in, e.g. resource, attribute.
orderBy.key.fieldDataTypebodystring—FieldDataType is the field's data type.
orderBy.key.namebodystring—Name is the field's name.
orderBy.key.signalbodystring—Signal is the telemetry signal the field belongs to.
orderBy.key.unitbodystring—Unit is the field's unit.
startbodyinteger (int64)yesStart is the start of the window as a Unix timestamp in milliseconds.

Response

StatusBodyMeaning
200o11y.O11yMetricStatsOutok
202Approvalheld for approval
defaultproblem-detailsrefused

200 body — 10 fields.

FieldInTypeAlwaysDescription
databodyo11y.O11yMetricStats—
data.metricsbodyo11y.O11yMetricStat[]—Metrics are the counted metrics.
data.metrics[].descriptionbodystring—Description describes the metric.
data.metrics[].metricNamebodystring—MetricName is the metric's name.
data.metrics[].samplesbodyinteger (uint64)—Samples is how many samples the metric had.
data.metrics[].timeseriesbodyinteger (uint64)—TimeSeries is how many time series the metric had.
data.metrics[].typebodystring—Type is the metric type.
data.metrics[].unitbodystring—Unit is the metric's unit.
data.totalbodyinteger (uint64)—Total is how many metrics matched, across all pages.
statusbodystring—Status is "success".

Failure carries the platform error shape — see Errors.

Examples

hanzo o11y metrics stats \
  --end 0 \
  --limit 0 \
  --start 0
import { Configuration, O11yApi } from 'hanzoai';

const api = new O11yApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getMetricsStats({ start: 0, end: 0, limit: 0 });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import O11yApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = O11yApi(client).get_metrics_stats(start=0, end=0, limit=0)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.O11yAPI.GetMetricsStats(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, o11y_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = o11y_api::get_metrics_stats(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.O11yApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new O11yApi(client).getMetricsStats();
curl -X POST https://api.hanzo.ai/v1/o11y/metrics/stats \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "start": 0,
       "end": 0,
       "limit": 0
     }'

Tool o11y, op GetMetricsStats — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "o11y",
         "arguments": {
           "op": "GetMetricsStats",
           "input": {
             "start": 0,
             "end": 0,
             "limit": 0
           }
         }
       }
     }'

O11y API · All Hanzo APIs · Interactive reference

Was this page useful?