suneet-s commented on code in PR #14200:
URL: https://github.com/apache/druid/pull/14200#discussion_r1195598954


##########
server/src/main/java/org/apache/druid/server/emitter/ExtraServiceDimensions.java:
##########
@@ -29,12 +29,25 @@
 
 /**
  * Annotation to inject extra dimensions, added to all events, emitted via 
{@link EmitterModule#getServiceEmitter}.
- *
+ * <p/>
  * For example, write this in a body of {@link 
com.google.inject.Module#configure} of your extension module):
- *
+ * <p/>
  * MapBinder<String, String> extraDims =
  *     MapBinder.newMapBinder(binder, String.class, String.class, 
ExtraServiceDimensions.class);
  * extraDims.addBinding("foo").toInstance("bar");
+ * <p/>
+ * If a module wishes to optionally bind service dimensions they may do so by 
using the binding to
+ * Map<String, Optional<String>. The key is only added to the service 
dimensions that are emitted if the Optional is
+ * present.
+ * <p/>
+ * MapBinder<String, Optional<String>> extraDims =
+ *     MapBinder.newMapBinder(
+ *        binder,
+ *        new TypeLiteral<String>() {},
+ *        new TypeLiteral<Optional<String>>() {},
+ *        ExtraServiceDimensions.class
+ * );
+ * extraDims.addBinding("foo").toInstance(Optional.fromNullable(bar));

Review Comment:
   Thanks for the pointer @TSFenwick! Since that works, I will close this PR. 
There's no need to introduce another way of binding these dimensions



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