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