zio / zio-metrics-connectors

Monitoring, Metrics and Diagnostics for ZIO
https://zio.dev/zio-metrics-connectors
Apache License 2.0
30 stars 24 forks source link

Fixed gauge states collection by GC. #46

Closed Grryum closed 1 year ago

Grryum commented 1 year ago

Closes #45

Grryum commented 1 year ago

This seems like a good workaround for now, thank you @Grryum. However, I don't understand why this failed in the first place. Since we stored the AtomicDouble in the activeGauges map, I would have assumed that we will always have a strong reference for it so the WeakReference inside the micrometer registry should never be emptied.

@petoalbert to be honest, I couldn’t reproduce this bug and also don’t really understand how it may be. Those changes are done to prevent such rare cases. Besides, using micrometer strong reference for gauges does not affect the overall performance