Micrometer gauges may return NaN values when monitoring in-memory objects due to garbage collection clearing weak references. By default, Micrometer uses weak references to prevent memory leaks, but this causes monitored objects to be garbage collected if no strong references exist. The issue can be resolved by either storing

4m read time From feeds.feedblitz.com
Post cover image
Table of contents
1. Overview2. Reproducing the NaN Issue3. Understanding the Root Cause4. Using Strong References5. Conclusion

Sort: