@Override public void start(Configuration conf) { super.start(conf); Integer httpPort = conf.getInteger("codahaleStatsHttpPort", null); if (null != httpPort) { servletReporter = new ServletReporter( getMetrics(), healthCheckRegistry, httpPort); try { servletReporter.start(); } catch (Exception e) { logger.warn("Encountered error on starting the codahale metrics servlet", e); } } }
@Override public void stop() { if (null != servletReporter) { try { servletReporter.stop(); } catch (Exception e) { logger.error("Encountered error on stopping the codahale metrics servlet", e); } } super.stop(); } }
@Override public StatsLogger getStatsLogger(String name) { initIfNecessary(); return new CodahaleStatsLogger(getMetrics(), name); }
@Override public void start(Configuration conf) { initIfNecessary(); final Graphite graphite = new Graphite( new InetSocketAddress(addr.getHostText(), addr.getPort())); reporters.add(GraphiteReporter.forRegistry(getMetrics()) .prefixedWith(prefix) .convertRatesTo(TimeUnit.SECONDS) reporters.add(CsvReporter.forRegistry(getMetrics()) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) reporters.add(Slf4jReporter.forRegistry(getMetrics()) .outputTo(LoggerFactory.getLogger(slf4jCat)) .convertRatesTo(TimeUnit.SECONDS) jmx = JmxReporter.forRegistry(getMetrics()) .inDomain(jmxDomain) .convertRatesTo(TimeUnit.SECONDS)
@Override public void stop() { if (null != servletReporter) { try { servletReporter.stop(); } catch (Exception e) { logger.error("Encountered error on stopping the codahale metrics servlet", e); } } super.stop(); } }
@Override public void start(Configuration conf) { super.start(conf); Integer httpPort = conf.getInteger("codahaleStatsHttpPort", null); if (null != httpPort) { servletReporter = new ServletReporter( getMetrics(), healthCheckRegistry, httpPort); try { servletReporter.start(); } catch (Exception e) { logger.warn("Encountered error on starting the codahale metrics servlet", e); } } }