rhauch commented on a change in pull request #8691:
URL: https://github.com/apache/kafka/pull/8691#discussion_r431194915



##########
File path: 
clients/src/main/java/org/apache/kafka/common/metrics/MetricsReporter.java
##########
@@ -65,4 +66,12 @@ default void validateReconfiguration(Map<String, ?> configs) 
throws ConfigExcept
     default void reconfigure(Map<String, ?> configs) {
     }
 
+    /**
+     * Provides context labels for the service or library exposing metrics
+     *
+     * @param metricsContext the metric context
+     */
+    @InterfaceStability.Evolving
+    default void contextChange(MetricsContext metricsContext) {

Review comment:
       If there is no clear call pattern, then it's fine to not say anything. 
However, `JmxReporter.contextChange(...)` seems to assume that 
`contextChange(...)` will be called before any metrics are added via 
`init(...)`.
   
   If that call pattern is true, then I think we should document it. If it's 
also true it can be called later, then mention this as well. For example, the 
JavaDoc text on `contextChange(...)` could be something like:
   
   > Sets the context labels for the service or library that is exposing 
metrics. 
   > This will be called before {@link #init(List)} and may be called anytime 
after that.
   
   WDYT?




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

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


Reply via email to