mirror of
https://github.com/prometheus/prometheus.git
synced 2026-03-03 20:52:01 +01:00
Some timestamp functions can be safely wrapped as a step invariant. Then once we do that we never need to check or unwrap at evaluation time. For instance; `timestamp(metric @ 1)` is step invariant, whereas `timestamp(abs(metric @ 1))` is not. Currently all `timestamp` `*parser.Call` are excluded from being considered step invariant since it is listed in the `AtModifierUnsafeFunctions` map. This PR adds an extra check for timestamp functions which consider the arguments, and if the argument is a simple VectorSelector then the entire `*parser.Call` can be safely wrapped as a step invariant. Signed-off-by: Andrew Hall <andrew.hall@grafana.com> Co-authored-by: Bryan Boreham <bjboreham@gmail.com>