merlimat commented on a change in pull request #2839:
URL: https://github.com/apache/bookkeeper/pull/2839#discussion_r736071278
##########
File path:
bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/prometheus/PrometheusStatsLogger.java
##########
@@ -46,11 +46,22 @@ public OpStatsLogger getOpStatsLogger(String name) {
return provider.opStats.computeIfAbsent(scopeContext(name), x -> new
DataSketchesOpStatsLogger(labels));
}
+ @Override
+ public OpStatsLogger getThreadScopedOpStatsLogger(String name) {
+ return provider.threadScopedOpStats.computeIfAbsent(scopeContext(name),
+ x -> new ThreadScopedDataSketchesStatsLogger(provider,
scopeContext(name), labels));
Review comment:
it will still be capturing to take `provider` and `labels`.
Since this might be getting called a lot, it might be a good idea to do it
in the old-fashioned way:
```java
X x = map.get(key);
if (x == null) {
map.putIfAbsent(x, new X());
}
/// use x
```
--
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]