free / prometheus

The Prometheus monitoring system and time series database.
https://prometheus.io/
Apache License 2.0
48 stars 5 forks source link

promql: Provide an option to replace rate extrapolation funcs #4

Closed jgracenin closed 6 years ago

jgracenin commented 6 years ago

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" ...

jgracenin commented 6 years ago

I also hear you w.r.t the muddling. I really hope xrate merges in officially someday and would have no problem updating my dashboards/configs if that happens. Or, maybe a scrape_config group option to disable rate extrapolation for those targets if they don't want to add another rate function.