public class JmxReporter extends java.lang.Object implements MetricsReporter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_EXCLUDE |
static java.lang.String |
DEFAULT_INCLUDE |
static java.lang.String |
EXCLUDE_CONFIG |
static java.lang.String |
EXCLUDE_CONFIG_ALIAS |
static java.lang.String |
INCLUDE_CONFIG |
static java.lang.String |
INCLUDE_CONFIG_ALIAS |
static java.lang.String |
JMX_IGNORE_TAG |
static java.lang.String |
METRICS_CONFIG_PREFIX |
static java.util.Set<java.lang.String> |
RECONFIGURABLE_CONFIGS |
Constructor and Description |
---|
JmxReporter() |
JmxReporter(java.lang.String prefix)
Deprecated.
Since 2.6.0. Use
JmxReporter()
Initialize JmxReporter with contextChange(MetricsContext)
Populate prefix by adding _namespace/prefix key value pair to MetricsContext |
Modifier and Type | Method and Description |
---|---|
void |
close()
Called when the metrics repository is closed.
|
static java.util.function.Predicate<java.lang.String> |
compilePredicate(java.util.Map<java.lang.String,?> originalConfig) |
void |
configure(java.util.Map<java.lang.String,?> configs)
Configure this class with the given key-value pairs
|
boolean |
containsMbean(java.lang.String mbeanName) |
void |
contextChange(MetricsContext metricsContext)
Sets the context labels for the service or library exposing metrics.
|
void |
init(java.util.List<KafkaMetric> metrics)
This is called when the reporter is first registered to initially register all existing metrics
|
void |
metricChange(KafkaMetric metric)
This is called whenever a metric is updated or added
|
void |
metricRemoval(KafkaMetric metric)
This is called whenever a metric is removed
|
java.util.Set<java.lang.String> |
reconfigurableConfigs()
Returns the names of configs that may be reconfigured.
|
void |
reconfigure(java.util.Map<java.lang.String,?> configs)
Reconfigures this instance with the given key-value pairs.
|
void |
validateReconfiguration(java.util.Map<java.lang.String,?> configs)
Validates the provided configuration.
|
public static final java.lang.String METRICS_CONFIG_PREFIX
public static final java.lang.String EXCLUDE_CONFIG
public static final java.lang.String EXCLUDE_CONFIG_ALIAS
public static final java.lang.String INCLUDE_CONFIG
public static final java.lang.String INCLUDE_CONFIG_ALIAS
public static final java.util.Set<java.lang.String> RECONFIGURABLE_CONFIGS
public static final java.lang.String DEFAULT_INCLUDE
public static final java.lang.String DEFAULT_EXCLUDE
public static final java.lang.String JMX_IGNORE_TAG
public JmxReporter()
@Deprecated public JmxReporter(java.lang.String prefix)
JmxReporter()
Initialize JmxReporter with contextChange(MetricsContext)
Populate prefix by adding _namespace/prefix key value pair to MetricsContext
public void configure(java.util.Map<java.lang.String,?> configs)
Configurable
configure
in interface Configurable
public java.util.Set<java.lang.String> reconfigurableConfigs()
Reconfigurable
reconfigurableConfigs
in interface MetricsReporter
reconfigurableConfigs
in interface Reconfigurable
public void validateReconfiguration(java.util.Map<java.lang.String,?> configs) throws ConfigException
Reconfigurable
validateReconfiguration
in interface MetricsReporter
validateReconfiguration
in interface Reconfigurable
ConfigException
- if the provided configs are not valid. The exception
message from ConfigException will be returned to the client in
the AlterConfigs response.public void reconfigure(java.util.Map<java.lang.String,?> configs)
Reconfigurable
Configurable.configure(Map)
. This method will only be invoked if
the configs have passed validation using Reconfigurable.validateReconfiguration(Map)
.reconfigure
in interface MetricsReporter
reconfigure
in interface Reconfigurable
public void init(java.util.List<KafkaMetric> metrics)
MetricsReporter
init
in interface MetricsReporter
metrics
- All currently existing metricspublic boolean containsMbean(java.lang.String mbeanName)
public void metricChange(KafkaMetric metric)
MetricsReporter
metricChange
in interface MetricsReporter
public void metricRemoval(KafkaMetric metric)
MetricsReporter
metricRemoval
in interface MetricsReporter
public void close()
MetricsReporter
close
in interface java.lang.AutoCloseable
close
in interface MetricsReporter
public static java.util.function.Predicate<java.lang.String> compilePredicate(java.util.Map<java.lang.String,?> originalConfig)
public void contextChange(MetricsContext metricsContext)
MetricsReporter
MetricsReporter.init(List)
and may be called anytime after that.contextChange
in interface MetricsReporter
metricsContext
- the metric context