Hi,

Thanks for your reply.

I'm aware of the cumulative nature of the buckets. I assumed that if do:

increase(operation_x_bucket{operationType="TypeA", le="+Inf"}[24h]), I'd be
getting the total number of observations of the bucket for that specific
operationType in the last 24h. Is that correct?

The problem is the that the values I get are significantly lower than
reality for a period of let's say 24 hours. I thought that maybe he buckets
might not behave as a regular counter (it seems they do).

I do have multiple buckets (each k8s pod seems to be create a new one), so
I used sum(increase(operation_x_bucket{operationType="TypeA",
le="+Inf"}[24h])) to sum the observations.

Thanks,

On Mon, 30 Aug 2021 at 22:49, Bjoern Rabenstein <[email protected]> wrote:

> On 27.08.21 03:55, José San Gil wrote:
> >
> > We're recording the duration of completed operations within our system.
> > Every time something succeeds, we observe the duration using a
> Prometheus
> > histogram.
> >
> > - I set up the buckets using an exponential distribution: 1000, 5000,
> > 25000, 125000, 625000.
> > - Each observation includes around 6 labels e.g: operationType,
> > organizationId
> >
> > I want to count the number of observations per bucket for a specific
> > operation type within a given range. I tried the following queries
> (using a
> > Grafana Bar Gauge with Heatmap format):
> >
> > sum(operation_x_bucket{operationType="TypeA"}) by (le)
> >
> >
> > I also tried using the `increase` function, but I'm clearly missing the
> > point here (I also tried with a fixed range vector).
> >
> > sum(increase(operation_x_bucket{operationType="TypeA"}[$__range])) by
> (le)
> >
> > The result in both case doesn't make sense. *The values are way below
> the
> > real number of successful operations*.
> >
> > I validated that operations are properly observed, so my guess is that
> I'm
> > completely misunderstanding Prometheus _bucket usage.
> >
> > *What's the proper way to count many observation per bucket do we have
> for
> > given label value?*
>
> Perhaps you are confused by the fact that the buckets are cumulative?
> That means that the bucket marked by {le="25000"} contains all
> observations of 25000 or below (not just those between 5000 and 25000).
>
> If you want to get, let's say, the observations between 5000 and 25000
> in the last 10m, you need something like
>
>     increase(operation_x_bucket{operationType="TypeA",le="25000"}[10m])
>     - increase(operation_x_bucket{operationType="TypeA",le="5000"}[10m])
>
> --
> Björn Rabenstein
> [PGP-ID] 0x851C3DA17D748D03
> [email] [email protected]
>


-- 

*José San Gill*
Senior Full-Stack Developer


[email protected]
candis.io


<http://candis.io>









<http://candis.io>


<https://www.linkedin.com/company/9474511>  <https://twitter.com/candis_io>
<https://www.facebook.com/CandisDeutschland/>
<https://www.youtube.com/channel/UCPW6S23hVXrJlpvegnS0mDA>


Candis GmbH
Friedrichstraße 200, 10117 Berlin
CEOs: Christian Ritosek, Christopher Becker
Registry court: Berlin Charlottenburg
Register number: HRB 168078

-- 
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/CAOULDYmnSbgvJuHpso7t53gTB0GusvxGk2SiQDGChsVzy3hXeA%40mail.gmail.com.

Reply via email to