On Thursday, 21 April 2022 at 19:40:07 UTC+1 [email protected] wrote:

> Thanks a lot for your valuable inputs and suggestions. 
> *query1:*
> I had created with python with  Prometheus-client library,  I want to 
> execute this lib as Pod so need to create docker 
> image(python,prometheus-client ).
> here size of the image is going up to 130+mb and also CPU core utilization 
> is more. Only for few 4 to 6 custom metrics its consuming approximate 1 
> core.
>
> Do you have any idea to minimize the CPU utilization
>

In principle it should use zero cores while it's idle.  Normally an 
exporter only does work when it's being scraped (i.e. handling an incoming 
http request).  If that's not the case, then it's doing whatever you told 
it to do.  Maybe you have an infinite loop or something in your code?

If you copied their sample code:

if __name__ == '__main__':
    # Start up the server to expose the metrics.
    start_http_server(8000)
    # Generate some requests.
*    while True:*
*        process_request(random.random())*

then clearly you'll be using a whole CPU core as this loop spins as fast as 
it can.  This is not meant to be how a real exporter works.  Rather, when 
your application does some other work (e.g. processing an incoming HTTP 
request) it can also increment counters or whatever.

 

> *query2:*
> When I am using this lib , I can still see some unwanted metrics are 
> populating other than mu custom metrics. Do you have any idea like jow I 
> can remove it from my metrics list?
>
>
Can you show the metrics?

-- 
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/cc5e5823-2055-4311-91bb-153cc75d299en%40googlegroups.com.

Reply via email to