Hey there,
it is currently possible to retrieve query statistics using the stats query parameter. Since v2.35 query statistics of range queries can be extended with per-step data by running Prometheus with --enable-feature=promql-per-step-stats.
When I'm not interested in per-step stats I simply need to pass stats with in arbitrary non-empty value, e.g. stats=foo. So the query parameters basically behaves like a boolean, see source:
func defaultStatsRenderer(ctx context.Context, s *stats.Statistics, param string) stats.QueryStats {
if param != "" {
return stats.NewQueryStats(s)
}
return nil
}
In the context of per-step stats however I need to pass stats=all in order to retrieve the data. So in the latter case the value matters and is pattern-matched in the handler:
I guess my question is if it does make sense to change stats to an enum and deny unsupported values since other endpoints already do this (e.g. /api/v1/rules with type=alert|record).
I think that would make it easier for client libraries to reason about this parameter as well.
Feel free to close this issue when the matter has been discussed ad nauseam.
Hey there, it is currently possible to retrieve query statistics using the
stats
query parameter. Since v2.35 query statistics of range queries can be extended with per-step data by running Prometheus with--enable-feature=promql-per-step-stats
. When I'm not interested in per-step stats I simply need to passstats
with in arbitrary non-empty value, e.g.stats=foo
. So the query parameters basically behaves like a boolean, see source:In the context of per-step stats however I need to pass
stats=all
in order to retrieve the data. So in the latter case the value matters and is pattern-matched in the handler:I guess my question is if it does make sense to change
stats
to an enum and deny unsupported values since other endpoints already do this (e.g./api/v1/rules
withtype=alert|record
). I think that would make it easier for client libraries to reason about this parameter as well.Feel free to close this issue when the matter has been discussed ad nauseam.