On Fri, 1 May 2020 at 07:46, Christian Hoffmann < [email protected]> wrote:
> Hi, > > On 5/1/20 3:57 AM, O wrote: > > I am using increase() function to calculate the increase in counter > > value over a time period. These values are being displayed in a table in > > Grafana. But, for a duration of 15 days or so, it errors out because the > > number of samples that are being pulled is too high and the limit > > for |--query.max-samples| flag is crossed. > > > > So, my question is if there is a better way to calculate the increase in > > counter and display it in the Grafana table without pulling so many > > labels from Prometheus. > > increase() tries to detect counter resets. In order for this to work, > each data point has to be considered (at least I assume that this is the > case). I don't see a a way around this. > You're correct. > > If you know for sure that your counter does not reset (at least in the > timeframe you are interested in), you might achieve what you want by a > simple substraction which should be less resource-intensive: > > your_metric - your_metric offset 14d > > Of course, you can also increase the max-samples value. It is primarily > there as a safeguard against high resource usage (i.e. you might need > more RAM and longer processing times). > Even with 15d of data at a 1s interval, that's only 1.3M samples that need to be in memory at a time to calculate the rate() - so it's not the rate() function that's the issue here. -- Brian Brazil www.robustperception.io -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAHJKeLomScYPHhn%2BsJvMKRyiT5Jm4DPCE7uG_CZqgY28TkA_aA%40mail.gmail.com.

