public class JmxReporter extends Object implements MetricsReporter
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_EXCLUDE |
static String |
DEFAULT_INCLUDE |
static String |
EXCLUDE_CONFIG |
static String |
EXCLUDE_CONFIG_ALIAS |
static String |
INCLUDE_CONFIG |
static String |
INCLUDE_CONFIG_ALIAS |
static String |
METRICS_CONFIG_PREFIX |
static Set<String> |
RECONFIGURABLE_CONFIGS |
Constructor and Description |
---|
JmxReporter() |
JmxReporter(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 Predicate<String> |
compilePredicate(Map<String,?> originalConfig) |
void |
configure(Map<String,?> configs)
Configure this class with the given key-value pairs
|
boolean |
containsMbean(String mbeanName) |
void |
contextChange(MetricsContext metricsContext)
Sets the context labels for the service or library exposing metrics.
|
void |
init(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
|
Set<String> |
reconfigurableConfigs()
Returns the names of configs that may be reconfigured.
|
void |
reconfigure(Map<String,?> configs)
Reconfigures this instance with the given key-value pairs.
|
void |
validateReconfiguration(Map<String,?> configs)
Validates the provided configuration.
|
public static final String METRICS_CONFIG_PREFIX
public static final String EXCLUDE_CONFIG
public static final String EXCLUDE_CONFIG_ALIAS
public static final String INCLUDE_CONFIG
public static final String INCLUDE_CONFIG_ALIAS
public static final String DEFAULT_INCLUDE
public static final String DEFAULT_EXCLUDE
public JmxReporter()
@Deprecated public JmxReporter(String prefix)
JmxReporter()
Initialize JmxReporter with contextChange(MetricsContext)
Populate prefix by adding _namespace/prefix key value pair to MetricsContext
public void configure(Map<String,?> configs)
Configurable
configure
in interface Configurable
public Set<String> reconfigurableConfigs()
Reconfigurable
reconfigurableConfigs
in interface MetricsReporter
reconfigurableConfigs
in interface Reconfigurable
public void validateReconfiguration(Map<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(Map<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(List<KafkaMetric> metrics)
MetricsReporter
init
in interface MetricsReporter
metrics
- All currently existing metricspublic boolean containsMbean(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 AutoCloseable
close
in interface MetricsReporter
public void contextChange(MetricsContext metricsContext)
MetricsReporter
MetricsReporter.init(List)
and may be called anytime after that.contextChange
in interface MetricsReporter
metricsContext
- the metric context