aho135 commented on code in PR #18689:
URL: https://github.com/apache/druid/pull/18689#discussion_r2466937718


##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitter.java:
##########
@@ -286,13 +290,16 @@ private void cleanUpStaleMetrics()
     Map<String, DimensionsAndCollector> map = metrics.getRegisteredMetrics();
     for (Map.Entry<String, DimensionsAndCollector> entry : map.entrySet()) {
       DimensionsAndCollector metric = entry.getValue();
-      if (metric.isExpired()) {
-        log.debug(
-            "Metric [%s] has expired (last updated [%d] ms ago)",
-            entry.getKey(),
-            metric.getMillisSinceLastUpdate()
-        );
-        metric.getCollector().clear();
+      Set<List<String>> labelValuesCopy = new 
HashSet<>(metric.getLabelValuesToStopwatch().keySet());

Review Comment:
   Yeah good point. Felt a little dangerous to be iterating over while removing 
keys, but I think the consistency guarantees of the ConcurrentMap make this safe



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

Reply via email to