Closed jgracenin closed 6 years ago
Hi Alin,
Thanks again for xrate. It is used everyday extensively on millions of series (and recording/alert rules) -- I haven't seen any problems yet.
This is the code I'm always adding on top of your fork, so I figured it may be useful for someone else that wants to just turn off rate extrapolation without changing anything else.
Let me know if you want to make it a flag instead of an env var. I just figured that would be more painful to remember over time.
I was going to object that this muddies the waters and will make it more difficult to integrate the patch into Prometheus (which I still hope will eventually happen). But seeing how well contained it is, that's not really a good argument.
So yeah, LGTM, but this needs to be merged into the xrate
branch, as master
doesn't have the xrate
functions, it's simply a mirror of prometheus/master
(so I can still contribute other patches). Send out another PR, to the xrate
branch, and I'll be happy to merge it.
This change adds an option to replace the rate & friends functions outright with xrate & friends functions. It allows for a drop-in replacement to disable rate extrapolation without needing to change dashboards, recording rules, alerts, etc. This should also keep the ecosystem working: Grafana auto-complete, tooling, Thanos, etc.
I decided to use an env var since the kingpin flags aren't global and this should be easier to merge over time (otherwise we'd need to change main.go). I also figured it makes sense to remove the xrate keys if using this mode instead of having both sets.
Tested locally and ran queries too: $ REPLACE_RATE_FUNCS=1 ./prometheus Successfully replaced rate & friends with xrate & friends (and removed xrate & friends function keys). level=info ts=2018-06-15T00:34:27.021727565Z caller=main.go:222 msg="Starting Prometheus" ...