RAJESH DASARI
unread,Apr 21, 2021, 8:31:09 AM4/21/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to promethe...@googlegroups.com
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.