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 upActual timestamp() for max_over_time (and other agg functions) #5003
Comments
This comment has been minimized.
This comment has been minimized.
|
That'd class as a breaking change, as the timestamp returned by a function is documented to be the eval time and returning other values would break graphing etc. It'd also be kkinda weird, why for max and not avg, quantile, or sum? If you want this I'd suggest working from a graph, or using the API directly the fetch the data. |
This comment has been minimized.
This comment has been minimized.
|
Yes, I figured, so if in any case it should be a new function. I think any aggregate function that ultimately points to one record in timeline (min, max most notable) can be easily (in theory) be accompanied with the actual timestamp. The case for other aggregate functions such as avg or quantile gets complicated and perhaps not very useful. I have the external solution (saving each new max or min in a separate metric) as an alternative in mind, but having this built in would be nice too. This is rather the default mode in InfluxDB (although kind of comparing apples and oranges): https://docs.influxdata.com/influxdb/v1.7/query_language/functions/#max |
This comment has been minimized.
This comment has been minimized.
|
what if there are multiple timestamps ?? |
ali-sattari commentedDec 15, 2018
Proposal
Use case. Why is this important?
Knowing when a min or max happened in defined window of time is useful. Imagine monitoring a gauge like metric over a week, you want to know the max value in that period (easy) and the time it happened (currently impossible using PromQL)
Something like:
Would give the value, but we don't know when the
maxpoint happened in1w.Suggestion
If only the
timestamp()(or a new function) would return the actual timestamp of evaluated point in time, the problem would be solved:It returns
nowor actually same value astime()at the moment.I can see the
timestamp()can return the actual timestamp of a metric (only last value) when used without aggregate functions, as discussed in #1557