PromPHP / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
415 stars 91 forks source link

Question: adding values to a histogram appears to add to the bucket the value belongs to and all larger buckets #114

Open tetrode opened 1 year ago

tetrode commented 1 year ago

I created the following from the example code:

$h = rand(0, 10);
$histogram = $registry->getOrRegisterHistogram(
    'example',
    'the_histogram',
    'A histogram puts your observations in predefined buckets (+Inf is registered when no bucket found)',
    ['type'],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]
);
$histogram->observe($h, ['blue']);

When I repeatedly call this code and $h is e.g. 6, the buckets for 6, 7, 8 and 9 are increased

Is this the expected behaviour?

MSid01 commented 7 months ago

That's cumulative behaviour and... it is expected...