Add metrics commands as experimental#175
Conversation
These commands can be used to get either summaries (default) of metrics, or the full series of data points. We introduce a TIGER_EXPERIMENTAL env var to enable this since the REST endpoint is currently marked as preview. After some testing, we can graduate this.
|
|
| type MetricSummary struct { | ||
| Name string `json:"name"` | ||
| Labels map[string]string `json:"labels,omitempty"` | ||
| From time.Time `json:"from"` | ||
| To time.Time `json:"to"` | ||
| Count int `json:"count"` | ||
| Min float64 `json:"min"` | ||
| MinTime time.Time `json:"min_time"` | ||
| Max float64 `json:"max"` | ||
| MaxTime time.Time `json:"max_time"` | ||
| Avg float64 `json:"avg"` | ||
| P50 float64 `json:"p50"` | ||
| P95 float64 `json:"p95"` | ||
| } |
There was a problem hiding this comment.
I would just return the data points and let the agent do its own calculations.
We already have the AggFn parameter and everything, it's just not exposed in the gateway yet so if we want aggregations I would expose that instead of doing it here.
Doing average and percentiles over last value aggregations (what the API does currently) is not accurate because there is already a big lose of data points since we are only taking last_value from the samples.
The handler returns either ServiceMetricsSummaryOutput or ServiceMetricsFullOutput depending on the requested mode, but the tool was registered with only the summary schema. Full-mode responses failed validation with `unexpected additional properties ["series"]`. Register an anyOf union of both shapes. Top-level `Type: "object"` is required by the MCP SDK.
These commands can be used to get either summaries (default) of metrics, or the full series of data points. We introduce a TIGER_EXPERIMENTAL env var to enable this since the REST endpoint is currently marked as preview. After some testing, we can graduate this.