metrics: expose --fn aggregation on service metrics series#176
Merged
Conversation
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).
RobAtticus
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the
fnaggregation function onservice metrics seriesend-to-end (OpenAPI, generated types, MCP tool, CLI flag), matching the corresponding gateway change (timescale/savannah-gateway#1864).fntoMetricsSeriesRequestinopenapi.yamlwith the full enum (RATE, INCREASE, SUM, AVG, MIN, MAX, COUNT, P50, P90, P99, LAST). The description enumerates the specifictimescale_cloud_*metrics that rejectfnrather than referring to internal project naming.internal/tiger/api/types.go.Fnto the MCPServiceMetricsSeriesInputwith enum + description on the schema; wires it throughhandleServiceMetricsSeriesinto the API body (case-insensitive).--fntotiger service metrics series; wires it through into the API body (case-insensitive).fnis sent — server keeps its default behavior. Settingfnon one of the rejectedtimescale_cloud_*metrics surfaces as the gateway'sINVALID_REQUEST(400), naming the specific metric.