public class JmxReporter extends AbstractReporter implements MetricsRegistryListener, MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
Modifier and Type | Class and Description |
---|---|
static interface |
JmxReporter.CounterMBean |
static interface |
JmxReporter.GaugeMBean |
static interface |
JmxReporter.HistogramMBean |
static interface |
JmxReporter.MeterMBean |
static interface |
JmxReporter.MetricMBean |
static interface |
JmxReporter.TimerMBean |
Constructor and Description |
---|
JmxReporter(MetricsRegistry registry)
Creates a new
JmxReporter for the given registry. |
Modifier and Type | Method and Description |
---|---|
static JmxReporter |
getDefault()
Returns the default instance of
JmxReporter if it has been started. |
void |
onMetricAdded(MetricName name,
Metric metric)
Called when a metric has been added to the
MetricsRegistry . |
void |
onMetricRemoved(MetricName name)
Called when a metric has been removed from the
MetricsRegistry . |
void |
processCounter(MetricName name,
Counter counter,
com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
Process the given counter.
|
void |
processGauge(MetricName name,
Gauge gauge,
com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
Process the given gauge.
|
void |
processHistogram(MetricName name,
Histogram histogram,
com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
Process the given histogram.
|
void |
processMeter(MetricName name,
Metered meter,
com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
Process the given
Metered instance. |
void |
processTimer(MetricName name,
Timer timer,
com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
Process the given timer.
|
void |
shutdown()
Stops the reporter and closes any internal resources.
|
static void |
shutdownDefault()
Stops the default instance of
JmxReporter . |
void |
start()
Starts the reporter.
|
static void |
startDefault(MetricsRegistry registry)
Starts the default instance of
JmxReporter . |
getMetricsRegistry
public JmxReporter(MetricsRegistry registry)
JmxReporter
for the given registry.registry
- a MetricsRegistry
public static void startDefault(MetricsRegistry registry)
JmxReporter
.registry
- the MetricsRegistry
to report frompublic static JmxReporter getDefault()
JmxReporter
if it has been started.public static void shutdownDefault()
JmxReporter
.public void onMetricAdded(MetricName name, Metric metric)
MetricsRegistryListener
MetricsRegistry
.onMetricAdded
in interface MetricsRegistryListener
name
- the name of the Metric
metric
- the Metric
public void onMetricRemoved(MetricName name)
MetricsRegistryListener
MetricsRegistry
.onMetricRemoved
in interface MetricsRegistryListener
name
- the name of the Metric
public void processMeter(MetricName name, Metered meter, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context) throws java.lang.Exception
MetricProcessor
Metered
instance.processMeter
in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
name
- the name of the metermeter
- the metercontext
- the context of the meterjava.lang.Exception
- if something goes wrongpublic void processCounter(MetricName name, Counter counter, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context) throws java.lang.Exception
MetricProcessor
processCounter
in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
name
- the name of the countercounter
- the countercontext
- the context of the meterjava.lang.Exception
- if something goes wrongpublic void processHistogram(MetricName name, Histogram histogram, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context) throws java.lang.Exception
MetricProcessor
processHistogram
in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
name
- the name of the histogramhistogram
- the histogramcontext
- the context of the meterjava.lang.Exception
- if something goes wrongpublic void processTimer(MetricName name, Timer timer, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context) throws java.lang.Exception
MetricProcessor
processTimer
in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
name
- the name of the timertimer
- the timercontext
- the context of the meterjava.lang.Exception
- if something goes wrongpublic void processGauge(MetricName name, Gauge gauge, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context) throws java.lang.Exception
MetricProcessor
processGauge
in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
name
- the name of the gaugegauge
- the gaugecontext
- the context of the meterjava.lang.Exception
- if something goes wrongpublic void shutdown()
AbstractReporter
shutdown
in class AbstractReporter
public final void start()