Hi Salah,

I am unfamiliar with the prometheus/client_python
<https://github.com/prometheus/client_python>, but a quick search
<https://github.com/prometheus/client_python/search?q=add_metric> for
add_metric in that repository leads me to the definition of this function
here
<https://github.com/prometheus/client_python/blob/9a6e21de144e81ac666828aa843efb398d184b27/prometheus_client/metrics_core.py#L196-L206>.
Helpfully,
this function has a docstring explaining the function parameters.

In this situation I would also look for examples of this function being
used in this codebase, the libraries unit-tests
<https://github.com/prometheus/client_python/blob/master/tests/test_core.py#L647-L654>
are
normally always a good place to start.

Best,

Ian

On Wed, Jun 16, 2021 at 11:28 AM Salah Bmba <[email protected]> wrote:

> Hello everyone ,
>
> am trying to expose Histogram Metric Family , bate i don't know the
> parameter of .add_metric(), specify buckets. I already doing that while
> Metric() and its working
>
> class CustomCollector(object):
>     def __init__(self):
>         pass
>     def collect(self):
>         ll= [1,2,3,4,5]
>         *#With 'Metric' - Working*
>         metricH = Metric("a_teste",  "A simple teste",'histogram')
>         for element in ll:
>             metricH.add_sample("a_teste", value=element,
> labels={'element':'a labels'})
>         yield metricH
> *       #with Histogram - not working*
>         h =  HistogramMetricFamily("HistogramMetricFamily_teste",
> "HistogramMetricFamily simple teste")
>         h.add_metric(???????)
>         yield h
> if __name__ == '__main__':
>     start_http_server(1234)
>     REGISTRY.register(CustomCollector())
>     while True:
>         time.sleep(1)
>
> I need an example of how add_metric work for Histogram Metric Family, and
> the specificity of Metric Family in generale.
>
> *I would be grateful for anyone who will help me*
>
> thank you so much
>
>
> --
> 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/4ac425fc-7294-4747-8a8e-2ae83c1165aan%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/4ac425fc-7294-4747-8a8e-2ae83c1165aan%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/CADoMBNW8d1aG-eMv8rJGNUJv4xcVYPmVXHSVkMWQ8Z7OU294cA%40mail.gmail.com.

Reply via email to