-
fix registration bug in SpectatorMetricServices · 63b0c8c6Brian Harrington authored
The primary change is to fix a memory leak reported in Netflix/spectator#264. Each time a gauge was updated it was creating a new registration and because the map holds a strong reference these would never get collected. Further, the aggregate value created by the multiple registrations was not correct. In addition I added some test cases around the various inputs and checked that the results were reflected as expected in the registry. I noticed the timer values had a unit of milliseconds, but it isn't immediately clear if the reported value can ever less than 1.0. The conversion to long is now delayed until after converting to nanoseconds so duration values less than 1.0 will now work instead of just recording 0. For the histogram I changed to just using a cast to `long` to avoid boxing to a `Double`. As an FYI for the future, there is a DoubleDistributionSummary we have experimented with in spectator-ext-sandbox that might be more appropriate for this use-case.
63b0c8c6
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
main | Loading commit data... | |
test/java/org/springframework/cloud/netflix/metrics/spectator | Loading commit data... |