changes(process_start_time_seconds[1h]) is usually how you do this.
On 20 Aug 08:18, Gergely Brautigam wrote: > Nope... That did not work as expected. :( Last 3 hours I had 4 restarts; > doing that ( $_interval ) displayed a whole bunch of non-sense. :/ Like, > 3.4 or 1.1... > Especially when using something like selecting a range in the graph. I > think the metric is correct, as in I can verify that there was a server > restart failure at the time when the metric says 1.... > But it's flimsy, because it's coming from multiple instances. I tried doing > without (instance) but that isn't working with sum_over_time. > > On Thursday, August 20, 2020 at 5:08:41 PM UTC+2 [email protected] wrote: > > > Usually what I recommend is [$__interval] and setting the "min step" to > > 1h. This will make sure that the sum_over_time() works how you would > > expect, each point in the chart matches the width of the step.. > > > > On Thu, Aug 20, 2020 at 4:03 PM Gergely Brautigam <[email protected]> > > wrote: > > > >> > >> > >> On Thursday, August 20, 2020 at 3:56:11 PM UTC+2 [email protected] wrote: > >> > >>> Try sum_over_time(metric[4d]) > >>> > >> > >> Hi! > >> > >> Yep, tried that. Something like this: > >> > >> sum(sum(sum_over_time(server_restarts{result="failed"}[1h])) without > >> (instance)) > >> > >> But unfortunately this doesn't give an accurate number at all. If I > >> select last 7 days in Grafana, but the time range here is 1h this messes > >> up > >> badly. And to be honest, I don't fully understand the correlation between > >> time range in promql and the grafana time range. I do understand that time > >> range `[1h]` is like a sample rate. So I could try and change this to 7d > >> but that messes up things even more. :D > >> > >> What I can understand to use would to have a variable which you ALSO need > >> to adjust while selecting the time frame in Grafana. I guess that could > >> work. > >> > >> > >>> > >>> https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time > >>> > >>> If you are getting separate values per instance or pod, then sum() over > >>> all the timeseries. > >>> > >> -- > >> 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/32608f79-363f-4be1-9eb2-513fc5226e6bn%40googlegroups.com > >> > >> <https://groups.google.com/d/msgid/prometheus-users/32608f79-363f-4be1-9eb2-513fc5226e6bn%40googlegroups.com?utm_medium=email&utm_source=footer> > >> . > >> > > > > -- > 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/b529a81a-057c-4a57-af80-542776dd22bdn%40googlegroups.com. -- Julien Pivotto @roidelapluie -- 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/20200820152108.GA863343%40oxygen.

