use of com.github.joshelser.dropwizard.metrics.hadoop.HadoopMetrics2Reporter in project hive by apache.
the class CodahaleMetrics method initReporting.
/**
* Should be only called once to initialize the reporters
*/
private void initReporting(Set<MetricsReporting> reportingSet) {
for (MetricsReporting reporting : reportingSet) {
switch(reporting) {
case CONSOLE:
final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build();
consoleReporter.start(1, TimeUnit.SECONDS);
reporters.add(consoleReporter);
break;
case JMX:
final JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build();
jmxReporter.start();
reporters.add(jmxReporter);
break;
case JSON_FILE:
final JsonFileReporter jsonFileReporter = new JsonFileReporter();
jsonFileReporter.start();
reporters.add(jsonFileReporter);
break;
case HADOOP2:
String applicationName = conf.get(HiveConf.ConfVars.HIVE_METRICS_HADOOP2_COMPONENT_NAME.varname);
long reportingInterval = HiveConf.toTime(conf.get(HiveConf.ConfVars.HIVE_METRICS_HADOOP2_INTERVAL.varname), TimeUnit.SECONDS, TimeUnit.SECONDS);
final HadoopMetrics2Reporter metrics2Reporter = HadoopMetrics2Reporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build(// The application-level name
DefaultMetricsSystem.initialize(applicationName), // Component name
applicationName, // Component description
applicationName, // Name for each metric record
"General");
metrics2Reporter.start(reportingInterval, TimeUnit.SECONDS);
break;
}
}
}
Aggregations