michaeljmarshall commented on code in PR #4300:
URL: https://github.com/apache/bookkeeper/pull/4300#discussion_r1576573455


##########
stats/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/prometheus/ThreadScopedDataSketchesStatsLogger.java:
##########
@@ -96,15 +96,25 @@ private DataSketchesOpStatsLogger getStatsLogger() {
             ThreadRegistry.ThreadPoolThread tpt = ThreadRegistry.get();
             if (tpt == null) {
                 statsLoggers.set(defaultStatsLogger);
-                provider.opStats.put(new ScopeContext(scopeContext.getScope(), 
originalLabels), defaultStatsLogger);
+                DataSketchesOpStatsLogger previous = provider.opStats
+                        .put(new ScopeContext(scopeContext.getScope(), 
originalLabels), defaultStatsLogger);
+                // If we overwrite a logger, metrics will not be collected 
correctly
+                if (previous != null && previous != defaultStatsLogger) {
+                    throw new IllegalStateException("Invalid state. Overwrote 
a stats logger.");
+                }

Review Comment:
   > its matrics don't make much sense
   
   Can just remove these labels? It's a slight breaking change, but they seem 
unnecessary.



-- 
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]

Reply via email to