A given metric is only meant to be registered once, this issue is to decide how to handle duplicate or already registered metric (Currently not permitted and cause an error with Prometheus).
Option 1: Replace the old registered metric by the new: This seems to be problematic, especially when you use the same name but different type or unit. This might create a problem in backend.
Option 2: Throw an error: This is not really advocated by the specs.
Option 3: Log a warning and skip duplicate metric: This might confuse the end users.
Suggest other options?
It is my opinion that Option 3 is the only currently viable option as option 1 may create problems with different backends (maybe this is handled by individual exporters?) and option 2 is not compatible with current spec (incorrect usage should not throw).
Option 3 may be confusing at first (generally I would expect it to behave like other Set-like APIs which overwrite rather than ignore if you try to set the same thing twice), but it is an easy to understand difference if documented properly.
Looks like we have an agreement here, closing this issue now.
Most helpful comment
It is my opinion that Option 3 is the only currently viable option as option 1 may create problems with different backends (maybe this is handled by individual exporters?) and option 2 is not compatible with current spec (incorrect usage should not throw).
Option 3 may be confusing at first (generally I would expect it to behave like other
Set-like APIs which overwrite rather than ignore if you try to set the same thing twice), but it is an easy to understand difference if documented properly.