Duplicate name when using Timed causes silent metrics loss
mihasya opened this issue · comments
Mikhail P commented
Because of the way tigertonic.Timed
interacts with go-metrics
, it's easy to end up in a confusing situation where there are metrics missing from an endpoint merely because another endpoint was given a timer with the same name.
I'm not yet sure what the correct behavior here is. My observations and thoughts so far:
- There are (debatably) legitimate reasons that the same endpoint might be registered at two different URLs, so it might actually be fine to have both instances present metrics at the same name. However, you can also work around this issue (by pre-defining the handler outside the calls to
.Handle
). So erroring out whentigertonic.Timed
is called with a dupe would still accommodate this usecase. - The route definitions are a thing that gets copy pasted all the time. It's a likely scenario that someone neglects to rename the metric, then has no real feedback that it's not working until they basically prove to themselves some other way that their graphs are wrong.
(Both of these scenarios have occurred here)