MetricsSource, MetricsSystemMXBean@Private @Metrics(context="metricssystem") public class MetricsSystemImpl extends MetricsSystem implements MetricsSource
MetricsSystem.AbstractCallback, MetricsSystem.Callback| Constructor | Description |
|---|---|
MetricsSystemImpl() |
Construct the system but not initializing (read config etc.) it.
|
MetricsSystemImpl(java.lang.String prefix) |
Construct the metrics system
|
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
currentConfig() |
|
void |
getMetrics(MetricsCollector builder,
boolean all) |
Get metrics from the metrics source
|
org.apache.hadoop.metrics2.impl.MetricsSinkAdapter |
getSinkAdapter(java.lang.String name) |
|
MetricsSource |
getSource(java.lang.String name) |
|
MetricsSystem |
init(java.lang.String prefix) |
Initialized the metrics system with a prefix.
|
void |
publishMetricsNow() |
Requests an immediate publish of all metrics from sources to sinks.
|
<T> T |
register(java.lang.String name,
java.lang.String desc,
T source) |
Register a metrics source
|
void |
register(MetricsSystem.Callback callback) |
Register a callback interface for JMX events
|
org.apache.hadoop.metrics2.impl.MetricsBuffer |
sampleMetrics() |
Sample all the sources for a snapshot of metrics/tags
|
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.
|
void |
unregisterSource(java.lang.String name) |
Unregister a metrics source
|
registerpublic MetricsSystemImpl(java.lang.String prefix)
prefix - for the systempublic MetricsSystemImpl()
public MetricsSystem init(java.lang.String prefix)
init in class MetricsSystemprefix - the system will look for configs with the prefixpublic void start()
MetricsSystemMXBeanstart in interface MetricsSystemMXBeanpublic void stop()
MetricsSystemMXBeanstop in interface MetricsSystemMXBeanpublic <T> T register(java.lang.String name,
java.lang.String desc,
T source)
MetricsSystemregister in class MetricsSystemT - 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 void unregisterSource(java.lang.String name)
MetricsSystemunregisterSource in class MetricsSystemname - of the source. This is the name you use to call register()public <T extends MetricsSink> T register(java.lang.String name, java.lang.String description, T sink)
MetricsSystemregister in class MetricsSystemT - the type of the sinkname - of the sink. Must be unique.description - the description of the sinksink - to registerpublic void register(MetricsSystem.Callback callback)
MetricsSystemregister in class MetricsSystemcallback - the callback object implementing the MBean interface.public void startMetricsMBeans()
MetricsSystemMXBeanstartMetricsMBeans in interface MetricsSystemMXBeanpublic void stopMetricsMBeans()
MetricsSystemMXBeanstopMetricsMBeans in interface MetricsSystemMXBeanpublic java.lang.String currentConfig()
currentConfig in interface MetricsSystemMXBeanpublic void publishMetricsNow()
publishMetricsNow in class MetricsSystem@VisibleForTesting public org.apache.hadoop.metrics2.impl.MetricsBuffer sampleMetrics()
public void getMetrics(MetricsCollector builder, boolean all)
MetricsSourcegetMetrics in interface MetricsSourcebuilder - to contain the resulting metrics snapshotall - if true, return all metrics even if unchanged.public boolean shutdown()
MetricsSystemshutdown in class MetricsSystempublic MetricsSource getSource(java.lang.String name)
getSource in class MetricsSystemname - of the metrics source@VisibleForTesting public org.apache.hadoop.metrics2.impl.MetricsSinkAdapter getSinkAdapter(java.lang.String name)
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.