OpenapiO11y
Returns trigger and resolution statistics for a rule, current window against…
Returns trigger and resolution statistics for a rule, current window against the prior one, for the posted query range.
POST /v1/o11y/rules/{id}/history/stats
| Address | https://api.hanzo.ai/v1/o11y/rules/{id}/history/stats |
| Method | POST |
| Operation | GetRuleStats |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Returns trigger and resolution statistics for a rule, current window against the prior one, for the posted query range. Viewer gate.
Request
18 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | |
end | body | integer | — | |
filters | body | o11y.FilterSet | — | |
filters.items | body | o11y.FilterItem[] | — | |
filters.items[].key | body | o11y.AttributeKey | — | |
filters.items[].key.dataType | body | string | — | |
filters.items[].key.isColumn | body | boolean | — | |
filters.items[].key.isJSON | body | boolean | — | |
filters.items[].key.key | body | string | — | |
filters.items[].key.type | body | string | — | |
filters.items[].op | body | string | — | |
filters.items[].value | body | object | — | |
filters.op | body | string | — | |
limit | body | integer | — | |
offset | body | integer | — | |
order | body | string | — | |
start | body | integer | — | |
state | body | string | — |
Response
| Status | Body | Meaning |
|---|---|---|
200 | o11y.O11yRuleStatsOut | ok |
200 body — 30 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
data | body | o11y.Stats | — | |
data.currentAvgResolutionTime | body | string | — | |
data.currentAvgResolutionTimeSeries | body | o11y.Series | — | |
data.currentAvgResolutionTimeSeries.labels | body | object | — | |
data.currentAvgResolutionTimeSeries.labels.* | body | string | — | |
data.currentAvgResolutionTimeSeries.labelsArray | body | object[] | — | |
data.currentAvgResolutionTimeSeries.labelsArray[].* | body | string | — | |
data.currentAvgResolutionTimeSeries.values | body | any[] | — | |
data.currentTriggersSeries | body | o11y.Series | — | |
data.currentTriggersSeries.labels | body | object | — | |
data.currentTriggersSeries.labels.* | body | string | — | |
data.currentTriggersSeries.labelsArray | body | object[] | — | |
data.currentTriggersSeries.labelsArray[].* | body | string | — | |
data.currentTriggersSeries.values | body | any[] | — | |
data.pastAvgResolutionTime | body | string | — | |
data.pastAvgResolutionTimeSeries | body | o11y.Series | — | |
data.pastAvgResolutionTimeSeries.labels | body | object | — | |
data.pastAvgResolutionTimeSeries.labels.* | body | string | — | |
data.pastAvgResolutionTimeSeries.labelsArray | body | object[] | — | |
data.pastAvgResolutionTimeSeries.labelsArray[].* | body | string | — | |
data.pastAvgResolutionTimeSeries.values | body | any[] | — | |
data.pastTriggersSeries | body | o11y.Series | — | |
data.pastTriggersSeries.labels | body | object | — | |
data.pastTriggersSeries.labels.* | body | string | — | |
data.pastTriggersSeries.labelsArray | body | object[] | — | |
data.pastTriggersSeries.labelsArray[].* | body | string | — | |
data.pastTriggersSeries.values | body | any[] | — | |
data.totalCurrentTriggers | body | integer | — | |
data.totalPastTriggers | body | integer | — | |
status | body | string | — | Status is "success". |
Failure carries the platform error shape — see Errors.
Examples
hanzo o11y rules history stats create <id>import { Configuration, O11yApi } from 'hanzoai';
const api = new O11yApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getRuleStats({ id: 'id', end: 0, filters: {"items":[{"key":{"dataType":null,"isColumn":null,"isJSON":null,"key":null},"op":"<op>","value":{}}],"op":"<op>"} });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_rule_stats(id='id', end=0, filters={"items":[{"key":{"dataType":null,"isColumn":null,"isJSON":null,"key":null},"op":"<op>","value":{}}],"op":"<op>"})cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.O11yAPI.GetRuleStats(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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_rule_stats(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.O11yApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new O11yApi(client).getRuleStats();curl -X POST https://api.hanzo.ai/v1/o11y/rules/<id>/history/stats \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"end": 0,
"filters": {
"items": [
{
"key": {
"dataType": null,
"isColumn": null,
"isJSON": null,
"key": null
},
"op": "<op>",
"value": {}
}
],
"op": "<op>"
}
}'Tool o11y, op GetRuleStats — 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": "GetRuleStats",
"input": {
"id": "<id>",
"end": 0,
"filters": {
"items": [
{
"key": {
"dataType": null,
"isColumn": null,
"isJSON": null,
"key": null
},
"op": "<op>",
"value": {}
}
],
"op": "<op>"
}
}
}
}
}'How is this guide?