-
Notifications
You must be signed in to change notification settings - Fork 10.3k
PromQL: add limit keyword to reduce too much datapoint return #7485
Description
Proposal
I'm curious why no limit keyword for PromQL. It's a general grammar for other SQL-like language, i.e. select * from users limit 5.
Keyword limit is a very useful feature for graph or preview data, an alternative is topk or bottomk now.
Use case: preview data structure
Consider that, user got metric go_gc_duration_seconds and do not know labels which metrics had, then it need query go_gc_duration_seconds to preview some data as follow.

Unfortunately, prometheus fetch over 20000+ series which over 10000+ series is useless and dropped (due to UI limit).
It could reduce query load time and series by add limit keyword.
Use case: avoid too much graph datapoint
For grafana dashboard, it's no explicit way to keep graph datapoint in a reasonable boundary.
Possible Solution
Similarly to topk, add keyword limitk(10000, up) which is without sort option.