@ManagedResource(description="MetricWriter for pushing metrics to JMX MBeans.") public class JmxMetricWriter extends Object implements MetricWriter
MetricWriter
for MBeans. Each metric is registered as an individual MBean, so
(for instance) it can be graphed and monitored. The object names are provided by an
ObjectNamingStrategy
, where the default is a
DefaultMetricNamingStrategy
which provides type
, name
and
value
keys by splitting up the metric name on periods.Modifier and Type | Class and Description |
---|---|
static class |
JmxMetricWriter.MetricValue
A single metric value.
|
Constructor and Description |
---|
JmxMetricWriter(MBeanExporter exporter) |
Modifier and Type | Method and Description |
---|---|
void |
increment(Delta<?> delta)
Increment the value of a metric (or decrement if the delta is negative).
|
void |
increment(String name,
long value) |
void |
reset(String name)
Reset the value of a metric, usually to zero value.
|
void |
set(Metric<?> value)
Set the value of a metric.
|
void |
set(String name,
double value) |
void |
setDomain(String domain) |
void |
setNamingStrategy(ObjectNamingStrategy namingStrategy) |
public JmxMetricWriter(MBeanExporter exporter)
public void setNamingStrategy(ObjectNamingStrategy namingStrategy)
public void setDomain(String domain)
@ManagedOperation public void increment(String name, long value)
public void increment(Delta<?> delta)
CounterWriter
increment
in interface CounterWriter
delta
- the amount to increment by@ManagedOperation public void set(String name, double value)
public void set(Metric<?> value)
GaugeWriter
set
in interface GaugeWriter
value
- the value@ManagedOperation public void reset(String name)
CounterWriter
reset
in interface CounterWriter
name
- the name to resetCopyright © 2016 Pivotal Software, Inc.. All rights reserved.