There is a mismatch of models here. You are asking about plotting a set of (x,y) points; Prometheus fundamentally thinks in terms of continuous time series that happen to be sampled at the scrape interval.
One way to resolve this is to consider the continuous time series of "how long did the last run take". This can be sampled at any time, whether 2 or 22 seconds after the job has finished. You need to sample (scrape) at least twice per job run to reliably get all counts, and you will not be directly able to determine whether a run happened to have exactly the same duration as the one before. However, you can use the knowledge of how often the job runs to make the graph look nice: play with the interval and overall time window alignment in Grafana to do that. /MR On Tue, Mar 16, 2021, 18:48 Dennis Kanygin <[email protected]> wrote: > Struggling with Prometheus use case. > > Periodic job runs every 30 seconds or so. Duration varies. Need a bar > graph with x-axis as time of run and y-axis as duration. Pushing duration > metrics to pushgateway. With this setup time stamp that is being attached > to duration metrics is the time of scrape of pushgateway. Timestamp of > duration is therefore "off" when graphing. As I understand, this is a > feature, not a bug. Any recommendation on how to accomplish what I need? > Seems like this would be a fairly common scenario so curious how others are > solving it. > > cheers, > > Dennis Kanygin > > -- > 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/e69c1cb3-683a-4652-9bd4-4cd93d3b996fn%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/e69c1cb3-683a-4652-9bd4-4cd93d3b996fn%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/CAMV%3D_gZsm9tVnm0q85eM1ZPZ1%2Bnq_CEmW_Yp3MohL9-26Nr3%3Dw%40mail.gmail.com.

