@InterfaceAudience.Private @Metrics(context="metricssystem") public class MetricsSystemImpl extends MetricsSystem implements MetricsSource
MetricsSystem.AbstractCallback, MetricsSystem.Callback
Constructor and Description |
---|
MetricsSystemImpl()
Construct the system but not initializing (read config etc.) it.
|
MetricsSystemImpl(String prefix)
Construct the metrics system
|
Modifier and Type | Method and Description |
---|---|
String |
currentConfig() |
void |
getMetrics(MetricsCollector builder,
boolean all)
Get metrics from the source
|
MetricsSource |
getSource(String name) |
MetricsSystem |
init(String prefix)
Initialized the metrics system with a prefix.
|
void |
publishMetricsNow()
Requests an immediate publish of all metrics from sources to sinks.
|
void |
register(MetricsSystem.Callback callback)
Register a callback interface for JMX events
|
<T> T |
register(String name,
String desc,
T source)
Register a metrics source
|
<T extends MetricsSink> |
register(String name,
String description,
T sink)
Register a metrics sink
|
boolean |
shutdown()
Shutdown the metrics system completely (usually during server shutdown.)
The MetricsSystemMXBean will be unregistered.
|
void |
start()
Start the metrics system
|
void |
startMetricsMBeans()
Start metrics MBeans
|
void |
stop()
Stop the metrics system
|
void |
stopMetricsMBeans()
Stop metrics MBeans.
|
register
public MetricsSystemImpl(String prefix)
prefix
- for the systempublic MetricsSystemImpl()
public MetricsSystem init(String prefix)
init
in class MetricsSystem
prefix
- the system will look for configs with the prefixpublic void start()
MetricsSystemMXBean
start
in interface MetricsSystemMXBean
public void stop()
MetricsSystemMXBean
stop
in interface MetricsSystemMXBean
public <T> T register(String name, String desc, T source)
MetricsSystem
register
in class MetricsSystem
T
- the actual type of the source objectname
- of the source. Must be unique or null (then extracted from
the annotations of the source object.)desc
- the description of the source (or null. See above.)source
- object to registerpublic <T extends MetricsSink> T register(String name, String description, T sink)
MetricsSystem
register
in class MetricsSystem
T
- the type of the sinkname
- of the sink. Must be unique.description
- the description of the sinksink
- to registerpublic void register(MetricsSystem.Callback callback)
MetricsSystem
register
in class MetricsSystem
callback
- the callback object implementing the MBean interface.public void startMetricsMBeans()
MetricsSystemMXBean
startMetricsMBeans
in interface MetricsSystemMXBean
public void stopMetricsMBeans()
MetricsSystemMXBean
stopMetricsMBeans
in interface MetricsSystemMXBean
public String currentConfig()
currentConfig
in interface MetricsSystemMXBean
public void publishMetricsNow()
publishMetricsNow
in class MetricsSystem
public void getMetrics(MetricsCollector builder, boolean all)
MetricsSource
getMetrics
in interface MetricsSource
builder
- to contain the resulting metrics snapshotall
- if true, return all metrics even if unchanged.public boolean shutdown()
MetricsSystem
shutdown
in class MetricsSystem
public MetricsSource getSource(String name)
getSource
in class MetricsSystem
name
- of the metrics sourceCopyright © 2013 Apache Software Foundation. All rights reserved.