|
|
|
|
|
by jrv
3629 days ago
|
|
Prometheus range queries work a bit differently, so this is not 100% reproducible in a graph query, but a similar thing is possible. A given PromQL expression is evaluated at every resolution step along the graph and doesn't have context about what the "graph range" is. At every evaluation point, it can still look back over a given time window, but that's more of a sliding window approach then and independent of what the visible graph time range is. For example, instead of highestCurrent, you could do something like: topk(3, my_metric) This would at every point along the graph select the current top 3 series that have the my_metric metric name. Or if you want to average each series over the last 10 minutes at every point in the graph before selecting the top 3: topk(3, avg_over_time(my_metric[10m])) Note that due to the reasons mentioned above, topk() here does not select whatever line has the largest area under the entire visible graph range, but whatever is at the top at each given resolution step. So you may actually get more than 3 series in your graph, but only 3 at a time at any given X. There's also an issue asking about this, but we're not sure if that is fundamentally compatible with Prometheus's query execution model without major changes: https://github.com/prometheus/prometheus/issues/586 |
|
Still look forward to rolling out Prometheus for all of the other great features. Congrats on the release!