Package org.apache.kafka.common.metrics
Interface MetricsReporter
- All Superinterfaces:
- AutoCloseable,- Configurable,- Reconfigurable
- All Known Implementing Classes:
- JmxReporter
A plugin interface to allow things to listen as new metrics are created so they can be reported.
 
 Implement ClusterResourceListener to receive cluster metadata once it's available. Please see the class documentation for ClusterResourceListener for more information.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Called when the metrics repository is closed.default voidcontextChange(MetricsContext metricsContext) Sets the context labels for the service or library exposing metrics.voidinit(List<KafkaMetric> metrics) This is called when the reporter is first registered to initially register all existing metricsvoidmetricChange(KafkaMetric metric) This is called whenever a metric is updated or addedvoidmetricRemoval(KafkaMetric metric) This is called whenever a metric is removedReturns the names of configs that may be reconfigured.default voidreconfigure(Map<String, ?> configs) Reconfigures this instance with the given key-value pairs.default voidvalidateReconfiguration(Map<String, ?> configs) Validates the provided configuration.Methods inherited from interface org.apache.kafka.common.Configurableconfigure
- 
Method Details- 
initThis is called when the reporter is first registered to initially register all existing metrics- Parameters:
- metrics- All currently existing metrics
 
- 
metricChangeThis is called whenever a metric is updated or added- Parameters:
- metric-
 
- 
metricRemovalThis is called whenever a metric is removed- Parameters:
- metric-
 
- 
closevoid close()Called when the metrics repository is closed.- Specified by:
- closein interface- AutoCloseable
 
- 
reconfigurableConfigsDescription copied from interface:ReconfigurableReturns the names of configs that may be reconfigured.- Specified by:
- reconfigurableConfigsin interface- Reconfigurable
 
- 
validateReconfigurationDescription copied from interface:ReconfigurableValidates the provided configuration. The provided map contains all configs including any reconfigurable configs that may be different from the initial configuration. Reconfiguration will be not performed if this method throws any exception.- Specified by:
- validateReconfigurationin interface- Reconfigurable
- Throws:
- ConfigException- if the provided configs are not valid. The exception message from ConfigException will be returned to the client in the AlterConfigs response.
 
- 
reconfigureDescription copied from interface:ReconfigurableReconfigures this instance with the given key-value pairs. The provided map contains all configs including any reconfigurable configs that may have changed since the object was initially configured usingConfigurable.configure(Map). This method will only be invoked if the configs have passed validation usingReconfigurable.validateReconfiguration(Map).- Specified by:
- reconfigurein interface- Reconfigurable
 
- 
contextChangeSets the context labels for the service or library exposing metrics. This will be called beforeinit(List)and may be called anytime after that.- Parameters:
- metricsContext- the metric context
 
 
-