You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/09/08 10:11:32 UTC

[GitHub] [druid] FrankChen021 commented on pull request #13034: prometheus-emitter supports sending metrics to pushgateway regularly …

FrankChen021 commented on PR #13034:
URL: https://github.com/apache/druid/pull/13034#issuecomment-1240509396

   @kfaraz Good point. 
   
   I looked through the code, the underlying `registeredMetrics` is intialized when `PrometheusEmitter` is initialized and the map won't change after that. When `emit` is called, it just gets value from the map, and does some change on the value object, but not the map object itself. So I think there's no concurrency problem.
   
   But to prevent potential map modification, I'm suggesting to change the `getRegisteredMetrics` to return a unmodifiable map like
   
   ```java
     public Map<String, DimensionsAndCollector> getRegisteredMetrics()
     {
       return Collections.unmodifiableMap(registeredMetrics);
     }
   ```
   
   Correct me if I'm wrong.


-- 
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-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org