Use specific exception for duplicate timeseries#1074
Use specific exception for duplicate timeseries#1074kajinamit wants to merge 1 commit intoprometheus:masterfrom
Conversation
6e89bc8 to
c9a7636
Compare
csmarchbanks
left a comment
There was a problem hiding this comment.
Just curious what you would do when you encounter a duplicate name vs a different ValueError? I am not opposed to this if it is helpful but would like to understand as well/not encourage bad practices.
c9a7636 to
858d79a
Compare
We are currently using this client to export metrics of virtual machines running on a specific hypervisor. In this use case we have to register metrics dynamically, because virtual machines might be created/deleted/moved anytime. To achieve the dynamic detection, we check all virtual machines in a host and register metrics for them periodically, but we can't safely check if the virtual machine metrics were registered in the previous cycle without this. (For now we inspect _names_to_collectors before calling register but that's requires external access to a private item, which I want to get rid of) |
Use sub-class of ValueError instead of ValueError, so that we can distinguish issues caused by wrong input (like invalid name format) from duplicate metrics being registered into the same registry. Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
858d79a to
26c0fca
Compare
Use sub-class of ValueError instead of ValueError, so that we can distinguish issues caused by wrong input (like invalid name format) from duplicate metrics being registered into the same registry.