Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upProposal: Client-side metric aggregation #4557
Comments
This comment has been minimized.
This comment has been minimized.
|
Thank you for your proposal. One of the principles of the Prometheus evaluation model is that you can calculate a given statistic over an arbitrary time window, and there is no efficient way to do that with a min or max. If you need this, you should probably look at a log-based solution. |
This comment has been minimized.
This comment has been minimized.
|
Could you clarify why it wouldn't be efficient to calculate the min or max over an arbitrary time window? Intuition tells me it would be at least as efficient as estimating quantiles over a time window, which is already supported per the docs . Then again, maybe we don't need a new metric type for this, and just use the |
This comment has been minimized.
This comment has been minimized.
|
For an arbitrary time window you'd basically need to remember every single point. Client-side quantiles aren't exact a good place to start if you care about efficiency. Ultimately this is not something we can do within the Prometheus evaluation and data models. |
This comment has been minimized.
This comment has been minimized.
Do you? Seems like you only need to maintain the min and the max for the time window. To implement a sliding window you can split it in For example, a sliding window of 10 minutes could be split into 5 buckets of 2 minutes. As new observations come in, they are compared against the max of the current bucket. If they are higher, they replace the max for that bucket. On scrapes, we return the value of the bucket with the highest max. Every two minutes, the oldest bucket is discarded and a new one is rotated in front as the new current bucket. Same could be done with the min. Average would be rather easy too: just keep a count and current average for each bucket. Seems pretty efficient. In fact I could see this as being an extension to the |
This comment has been minimized.
This comment has been minimized.
Yes, I said any arbitrary time window - not bucketed/sliding time windows. The person using PromQL need to be able to select the window on the fly, with no coordination with the client library. We actually recommend dropping min/max from any system that exposes them: https://prometheus.io/docs/instrumenting/writing_exporters/#drop-less-useful-statistics
We already provide average via _sum and _count, and they work over arbitrary windows. |
This comment has been minimized.
This comment has been minimized.
Fair enough. Still, I would prefer to have them reported to Prometheus rather than a logging system so that we can have nice visualization and alerting based on approximate state of the system over the sliding window. |
This comment has been minimized.
This comment has been minimized.
|
The best we can offer there are quantiles, which are approximate by their nature when dealing with metrics. |
This comment has been minimized.
This comment has been minimized.
|
Yeah But that's outside the scope of this repo, so feel free to close this issue. Thanks! |
brian-brazil
closed this
Aug 30, 2018
This comment has been minimized.
This comment has been minimized.
|
You can always request that client libraries add support for summary quantiles. |
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Wenzil commentedAug 28, 2018
Proposal
Prometheus seems to be missing a way to report the maximum observed value in a sample of observations (instant vector) where the cardinality would be too high for each observation to have a unique label set.
Replace maximum with any type of aggregation (e.g. minimum, average, median, etc.) in the previous sentence.
My first thought was to use a
Summarymetric with only e.g.0,0.5and1quantiles to get the minimum, median, and maximum. The problem is that some Prometheus clients don't even support sliding windows for summary metrics. This means that these aggregations are cumulative over time and don't represent the state of the system at the time of the scrape.What I'm proposing is a type of metric that would keep track of all these aggregations over a scrape interval (client-side), and expose them with a
_<aggretation_type>metric name suffix.Forgive me if there is already a way to achieve this with existing Prometheus functionality.