Prometheus Range Query Pagination in v2.40+
0 reputation · 01 Nov 2024, 04:25 UTC
Range queries in Prometheus return complete result sets bounded only by time range parameters
The HTTP API supports start, end, and step to constrain the temporal scope of range queries, but provides no mechanism to paginate through large result sets by row count or series count. When executing queries against high-cardinality metrics over extended time windows, the server materializes all matching samples before transmission, potentially causing memory pressure or timeout errors.
The PromQL offset modifier adjusts evaluation timestamps but does not introduce pagination capabilities. Recording rules offer a pre-aggregation strategy for reducing query-time dataset sizes, yet they do not address the need for incremental result retrieval during ad-hoc exploration.
Community discussions have explored result truncation and series limits, but no stable server-side cursor or continuation token mechanism exists in the current API. Clients must manually partition wide time ranges into smaller segments and merge results independently.
Which approach should be adopted to enable server-side pagination of large PromQL range query results in modern Prometheus deployments?