absurdfarce commented on code in PR #1916: URL: https://github.com/apache/cassandra-java-driver/pull/1916#discussion_r1532705838
########## metrics/micrometer/src/main/java/com/datastax/oss/driver/internal/metrics/micrometer/MicrometerMetricUpdater.java: ########## @@ -100,7 +100,10 @@ protected void initializeGauge( m -> { MetricId id = getMetricId(m); Iterable<Tag> tags = MicrometerTags.toMicrometerTags(id.getTags()); - return Gauge.builder(id.getName(), supplier).tags(tags).register(registry); + return Gauge.builder(id.getName(), supplier) + .strongReference(false) Review Comment: Ooooooh, I _very_ much like this! I _vastly_ prefer this to the current proposed fix; it's _far_ more explicit about what's going on and doesn't require complicated comments to explain what's going on. FWIW I did [mention](https://issues.apache.org/jira/browse/CASSANDRA-19457?focusedCommentId=17824523&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17824523) some initial testing I'd done to try to determine the scope of this issue. That testing seemed to indicate that the other metrics impls might be subject to similar issues but I'm now somewhat suspicious of those results, especially since the cause was so clearly tracked down to an issue with Micrometer. Regardless, we should (a) re-confirm the current state of MicroProfile + DropWizard behaviour and (b) confirm that your proposed fix addresses any issues there (which it absolutely will). @SiyaoIsHiding I very much agree with @adutra that something in this vein is a better way to implement metric lifetimes than what we have now. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org