Hi ,

We have implemented a custom exporter by using the python client library.

We have 400 metrics for each ethernet port and  we have around 38
ethernet ports.


for index,metric in enumerate(network_snmp_counters):
     g = GaugeMetricFamily(metric, 'Per Port Counters', labels=['portNumber'])
     for port_name,metrics in port_snmp_counters.items():
           g.add_metric(["PORT-"+port_name],metrics[metric])
     yield g

per each metric we add portNumber as label and per each metric we add
label values and metric values . so overall we loop for 400(first for
loop)*38(second for loop) times.

with the above logic, we see that per every scraping interval there is
a spike in cpu usage for the exporter process and we see that
add_metric call is causing the spikes in CPU,Is there any way to
optimize our exporter logic by using cpp based exporters or any other
way to avoid nested for loops.

Could someone please help me with this?

Regards,
Rajesh.

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAPXMrf8DBKuUoYXRn8M5DRLJWC%2B8KqRc91Jn-CJz0QYfZQ66fg%40mail.gmail.com.

Reply via email to