Package org.apache.hadoop.metrics2.sink
Class StatsDSink
java.lang.Object
org.apache.hadoop.metrics2.sink.StatsDSink
- All Implemented Interfaces:
Closeable,AutoCloseable,MetricsPlugin,MetricsSink
A metrics sink that writes metrics to a StatsD daemon.
This sink will produce metrics of the form
'[hostname].servicename.context.name.metricname:value|type'
where hostname is optional. This is useful when sending to
a daemon that is running on the localhost and will add the
hostname to the metric (such as the
CollectD StatsD plugin).
To configure this plugin, you will need to add the following entries to your hadoop-metrics2.properties file:
To configure this plugin, you will need to add the following entries to your hadoop-metrics2.properties file:
*.sink.statsd.class=org.apache.hadoop.metrics2.sink.StatsDSink [prefix].sink.statsd.server.host= [prefix].sink.statsd.server.port= [prefix].sink.statsd.skip.hostname=true|false (optional) [prefix].sink.statsd.service.name=NameNode (name you want for service)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classorg.apache.hadoop.metrics2.sink.StatsDSink.StatsDClass that sends UDP packets to StatsD daemon. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()Flush any buffered metricsvoidinit(org.apache.commons.configuration2.SubsetConfiguration conf) Initialize the pluginvoidputMetrics(MetricsRecord record) Put a metrics record in the sinkvoidwriteMetric(String line)
-
Constructor Details
-
StatsDSink
public StatsDSink()
-
-
Method Details
-
init
public void init(org.apache.commons.configuration2.SubsetConfiguration conf) Description copied from interface:MetricsPluginInitialize the plugin- Specified by:
initin interfaceMetricsPlugin- Parameters:
conf- the configuration object for the plugin
-
putMetrics
Description copied from interface:MetricsSinkPut a metrics record in the sink- Specified by:
putMetricsin interfaceMetricsSink- Parameters:
record- the record to put
-
writeMetric
-
flush
public void flush()Description copied from interface:MetricsSinkFlush any buffered metrics- Specified by:
flushin interfaceMetricsSink
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-