cecemei commented on code in PR #18272:
URL: https://github.com/apache/druid/pull/18272#discussion_r2214284510
##########
processing/src/main/java/org/apache/druid/java/util/emitter/service/ServiceMetricEvent.java:
##########
@@ -153,22 +143,43 @@ public Builder setFeed(String feed)
public Builder setDimension(String dim, String[] values)
{
+ if (dim == null) {
+ throw new IAE("Dimension name cannot be null");
+ }
+
userDims.put(dim, Arrays.asList(values));
return this;
}
+ /**
+ * Adds a dimension to be emitted with this metric event, only if the given
+ * value is not null.
+ *
+ * @throws IAE if the dimension name is null.
+ */
public Builder setDimensionIfNotNull(String dim, Object value)
{
+ if (dim == null) {
Review Comment:
nit: as the name `setDimensionIfNotNull` suggests, consider only keep value
check in this function, move the dim check and `userDims.put` logic to
`setDimension`. Also consider use `StringUtils.isEmpty` to check dim is not
empty string as well.
--
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]