Within data series of one scrape source this still makes sense when I am 
not mistaken.
You could align the data to its interval (which is I think done anyway when 
I understand this correctly: 
https://promlabs.com/blog/2020/06/18/the-anatomy-of-a-promql-query).
But even if one datapoint would be outside the window due to slower scrapes 
you end up with the same error extrapolating then without alignment.
The same is true for missing a sample - it would still work the same way as 
it dows now for such cases.

For multiple series this approach might not be better in general but at 
least not worse then the current approach since if it is not aligned the 
extrapolation works the same way and should give the same error on average 
is now.
You could also consider using a different window alignment for a series 
from a different scrape source.

Maybe I still miss something here but in my understanding an alignment can 
not make the extrapolation result worse
Stuart Clark schrieb am Montag, 1. Februar 2021 um 13:51:50 UTC+1:

> On 2021-02-01 12:38, Alex wrote:
> > Thank you both for the detailed explanation and the additional
> > material on this topic. I do now understand why I get the results I
> > get.
> > I however think the method used for calculation can be improved to
> > provide more precise results and provide a better match to
> > expectations.
> > 
> > I propose one changes to the algorithm for this:
> > align the window with the data points. This way you do not need to
> > extrapolate at all in most cases and if you need to do so you would
> > only do it to one edge. In the example above this would mean the 1m
> > window covers 5 datapoints from edge to edge with a 15s scrape
> > interval with datapoints aligning on the edges perfectly.
> > I understand that this may add complexity for multiple series in one
> > query especially when they are on a different interval but in general
> > the results would match up better especially for smaller ranges.
> > 
> > What do you think about that?
> > 
>
> As Julius mentioned that is in general not possible to achieve.
>
> Say you are monitoring 4 servers with a 1 minute scrape interval. You 
> would therefore expect one server to be scraped every 15 seconds (as 
> Prometheus tries to spread out scrapes evenly). If you then do a query 
> there is no window that would include 5 datapoints for all 4 timeseries.
>
> In general I'd expect the vast majority of queries to be working on 
> multiple series in this way (multiple servers, pods, etc.)
>
> Equally you are also expecting that all scrapes are going to be at 
> precisely the same interval (exactly 15 seconds apart). You might lose a 
> scrape occasionally (network or app error) and scrapes might take 
> slightly less or more time to be returned (while Prometheus tries to 
> keep things regular it couldn't guarantee that points are going to be 
> 15s to the millisocond apart - you could have a scrape that sometimes 
> takes an extra second to return data).
>
> -- 
> Stuart Clark
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/d02ca9ee-2c17-4029-a6c5-cd794903d20cn%40googlegroups.com.

Reply via email to