Skip to content

metrics: expose --fn aggregation on service metrics series#176

Merged
AdrianLC merged 2 commits into
mainfrom
adrian/expose-aggfn
Jul 14, 2026
Merged

metrics: expose --fn aggregation on service metrics series#176
AdrianLC merged 2 commits into
mainfrom
adrian/expose-aggfn

Conversation

@AdrianLC

@AdrianLC AdrianLC commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Exposes the fn aggregation function on service metrics series end-to-end (OpenAPI, generated types, MCP tool, CLI flag), matching the corresponding gateway change (timescale/savannah-gateway#1864).

  • Adds fn to MetricsSeriesRequest in openapi.yaml with the full enum (RATE, INCREASE, SUM, AVG, MIN, MAX, COUNT, P50, P90, P99, LAST). The description enumerates the specific timescale_cloud_* metrics that reject fn rather than referring to internal project naming.
  • Regenerates internal/tiger/api/types.go.
  • Adds Fn to the MCP ServiceMetricsSeriesInput with enum + description on the schema; wires it through handleServiceMetricsSeries into the API body (case-insensitive).
  • Adds --fn to tiger service metrics series; wires it through into the API body (case-insensitive).
  • When unset, no fn is sent — server keeps its default behavior. Setting fn on one of the rejected timescale_cloud_* metrics surfaces as the gateway's INVALID_REQUEST (400), naming the specific metric.

AdrianLC added 2 commits July 9, 2026 18:26
Adds --fn (CLI) and fn (MCP + REST body) to service_metrics_series so
callers can pick per-bucket aggregation (RATE, INCREASE, SUM, AVG, MIN,
MAX, COUNT, P50, P90, P99, LAST) instead of relying on the server-side
default. When omitted, the gateway keeps picking the default for the
metric (typically LAST), so existing callers are unaffected.

fn only applies to metrics-store-backed series; the gateway rejects it
on legacy timescale_cloud_* metrics with INVALID_REQUEST.
Public OpenAPI, MCP schema, and CLI help for the new --fn parameter
listed metric prefixes and referenced internal project naming. Rewrite
them to enumerate the specific timescale_cloud metric names that reject
fn instead. CLI help stays terse (server error is the source of truth).
@AdrianLC AdrianLC self-assigned this Jul 13, 2026
@AdrianLC AdrianLC marked this pull request as ready for review July 13, 2026 09:36
@AdrianLC AdrianLC requested a review from RobAtticus July 13, 2026 09:39
@AdrianLC AdrianLC merged commit 3f5d769 into main Jul 14, 2026
2 checks passed
@AdrianLC AdrianLC deleted the adrian/expose-aggfn branch July 14, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants