Akshat-Jain commented on code in PR #17170:
URL: https://github.com/apache/druid/pull/17170#discussion_r1878342987
##########
processing/src/main/java/org/apache/druid/java/util/emitter/service/ServiceMetricEvent.java:
##########
@@ -197,7 +198,7 @@ public ServiceMetricEvent build(ImmutableMap<String,
String> serviceDimensions)
return new ServiceMetricEvent(
createdTime,
serviceDimensions,
- userDims,
+ new HashMap<>(userDims),
Review Comment:
@findingrish Thanks for the confirmation!
It doesn't seem ideal to be copying the `userDims` just for test purposes.
One possible option that would allow us to keep passing `userDims` directly
while not making any compromises with the test quality is to change
`StubServiceEmitter`.
The following can be changed to also store the `userDims`:
https://github.com/apache/druid/blob/7705694481aa479cddde8a13f555ced913339a16/processing/src/test/java/org/apache/druid/java/util/metrics/StubServiceEmitter.java#L41
So it can look like `ConcurrentHashMap<String, List<Map<ServiceMetricEvent,
Map<String, Object>>>>` where the innermost `Map<String, Object>` represents
the `userDims`. This would work since `ServiceMetricEvent#getUserDims` returns
a copy of `userDims`:
https://github.com/apache/druid/blob/7705694481aa479cddde8a13f555ced913339a16/processing/src/main/java/org/apache/druid/java/util/emitter/service/ServiceMetricEvent.java#L95
(Instead of `ConcurrentHashMap<String, List<Map<ServiceMetricEvent,
Map<String, Object>>>>`, we can have a separate class to encapsulate
`List<Map<ServiceMetricEvent, Map<String, Object>>>` for readability, but the
basic idea remains the same)
@gianm @findingrish Thoughts on this approach?
--
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]