Skip to content

Instantly share code, notes, and snippets.

@hach-que
Last active January 21, 2025 12:51
Show Gist options
  • Save hach-que/e9baa0763bb09b0049b0cf7b70360743 to your computer and use it in GitHub Desktop.
Save hach-que/e9baa0763bb09b0049b0cf7b70360743 to your computer and use it in GitHub Desktop.
Instantaneous rate of change for Prometheus counter queries in Grafana

If you have a monotonic counter that is being sampled e.g. every 15 seconds, you can get the instantaneous rate-of-change at each sample time (rather than the average rate per second), by using a query like this:

sum(my_counter{} - my_counter{} offset $__interval) by (grouping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment