On Mon, 1 Jun 2020 at 14:38, Oren <[email protected]> wrote: > Hi All, > > Using the java client, one usually calls Summary.observe with one amount > each call. > In my case I'm timing the operations of an insert to the database, and > those inserts are batches of a variable amount of records. > I cannot time each record insertion separately, and since the batches are > of variable size, I would also not like to just time the batches. > > I can use one of two approaches: > 1. Time the batch, divide by the number of records in the batch, and call > observe N times (where N is the number of records in the batch) with the > average time. > 2. Create two counters instead and just sum the times and records myself > separately. > > I was thinking that more elegantly a method for recording multiple > observations could be added to Summary that would take both a total amount > observed and an incrementation number, such that it would increment the > counter by the incrementation number. That way Summary would handle this > all itself and no workarounds would be necessary. >
That wouldn't be quite right though, as it assumes that all of the observations are exactly the same size. Having separate counters/summary metrics for the batches and then times is usual. You can they do whatever math if appropriate in PromQL. Brian > > Any thoughts on this? Seems straightforward to implement, but maybe I'm > going about it the wrong way. > Any comments or pointers for a first-timer are welcome. > > Thanks, > Oren > > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Developers" 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-developers/6987053c-2fb5-4b0f-b1da-e43a6686a639%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-developers/6987053c-2fb5-4b0f-b1da-e43a6686a639%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Brian Brazil www.robustperception.io -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" 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-developers/CAHJKeLo7D%2BvAsnajta1bu%3DdsEh89PgHTLA5PYGj%2B_aupw2Fegg%40mail.gmail.com.

