adutra commented on code in PR #1916:
URL:
https://github.com/apache/cassandra-java-driver/pull/1916#discussion_r1532813593
##########
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:
Well I think we can keep both approaches, the weak ref trick can still be
useful.
Also, what would be really awesome is to have a test for this. Maybe
adapting the code that was used to detect the leak in the first place? FYI we
have a `SessionLeakIT` class that runs in isolation, so we can get crazy there
and create 100 sessions if it's necessary. (Although, it's probably enough to
create just one session, generate some activity, assert that the registry isn't
empty, close the session, then assert that the registry becomes empty again
within some configured timeframe.)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]