I'm making use of the multiprocess prometheus collector (in python), but likely this problem would exist for single process as well.
Is there a way to check if a Counter Metric already exists, to prevent the attempt of registering a duplicate ? Multiple calls to the below code generate the appended error. Or alternatively to check if a given metric exists, and get it.
Some kind of look up in the Registry ? The docs seems rather lacking.
Code:
logging_counter = prometheus_client.Counter('test', 'test')
Error generated:
ValueError: Duplicated timeseries in CollectorRegistry: {'test', 'test_total', 'test_created'}