analyze_metric
Compute summary statistics, trends, seasonality, change points, anomalies, forecasts, and baseline comparisons from recent device or OTLP metric history to support monitoring decisions.
Instructions
Analyze one device instance's metric series, such as CPU, memory or disk usage: call this for statistics on a datapoint's recent history, such as its current level against the window, whether it is rising, its daily cycle, when it shifted, or which samples stand out. One paged read of the window feeds every section; 'summary' gives latest, mean, standard deviation, min, max and the latest sample's signed z-score; 'trend' gives least-squares and Theil-Sen slopes per hour, r-squared, coefficient of variation, the detrended 24-hour autocorrelation and a label (volatile, cyclic, increasing, decreasing or stable); 'seasonality' gives detrended autocorrelation at 1, 4, 12, 24 and 168 hours, the dominant period and the peak hours in UTC; 'change_points' gives level shifts, where the mean of the next 30 samples leaves the mean of the previous 30 by five times the noise in that comparison (measured with any steady trend and autocorrelation the noise has), with the daily cycle removed first when the window holds three days or more and that leaves less noise; each shift has its timestamp and the levels before and after it, less the daily cycle when that was removed. A change in the last 30 samples is not reported yet, small shifts in strongly autocorrelated noise go unfound, on a window under a day a change inflates the noise and smaller shifts go unfound, and changes about a day apart in a few days leave the cycle in and go unfound; 'anomalies' gives z-score, IQR and MAD hits, each method's 20 most extreme; 'forecast' gives the least-squares and Holt-Winters (daily season, two days of samples needed) slopes per hour and, with threshold, when each crosses it, within 30 days; 'baseline' compares the window with one as long ending baseline_hours_ago hours ago (one more read): both windows' statistics, the mean's percent deviation and a status (normal within 20 percent, elevated or reduced within 50, anomalous past it). The baseline runs only with baseline_hours_ago. Use get_device_data for the raw samples. With source="otlp" it reads one PromQL range query (query, hours, step) in place of a device instance and runs the same sections on each series it returns, the first 20.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "analyze_metric"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | Resolution step of the otlp read, such as '5m'; the metrics backend picks one when omitted | |
| hours | No | Hours of history to read (default: 168) | |
| query | No | PromQL expression; required with source otlp | |
| source | No | device reads a device instance's datapoints; otlp reads a PromQL range query over native OTLP metrics | device |
| analyses | No | Sections to compute (all if omitted; the baseline only with baseline_hours_ago) | |
| device_id | No | Device ID; required with source device | |
| threshold | No | Level the forecast reports the crossing of | |
| datapoints | No | Comma-separated datapoint names (all if omitted); source device | |
| instance_id | No | Instance ID; required with source device | |
| baseline_hours_ago | No | Hours before now the baseline window ends, such as 168 for the same window a week earlier | |
| device_datasource_id | No | Device-DataSource ID; required with source device |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | ||
| hours | Yes | Hours the window reaches back. | |
| query | No | ||
| portal | No | The portal the call ran against, in multi-portal mode. | |
| series | No | Sections per series label set. | |
| source | No | ||
| analyses | Yes | ||
| warnings | No | ||
| device_id | No | ||
| datapoints | No | Sections per datapoint name. | |
| instance_id | No | ||
| baseline_hours_ago | No | ||
| series_count_total | No | ||
| device_datasource_id | No |