ConsoleReporter reporter = ConsoleReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(15, TimeUnit.SECONDS);
@Override public void prepare(MetricRegistry metricsRegistry, Map<String, Object> topoConf) { LOG.debug("Preparing..."); ConsoleReporter.Builder builder = ConsoleReporter.forRegistry(metricsRegistry); builder.outputTo(System.out); Locale locale = ClientMetricsUtils.getMetricsReporterLocale(topoConf); if (locale != null) { builder.formattedFor(locale); } TimeUnit rateUnit = ClientMetricsUtils.getMetricsRateUnit(topoConf); if (rateUnit != null) { builder.convertRatesTo(rateUnit); } TimeUnit durationUnit = ClientMetricsUtils.getMetricsDurationUnit(topoConf); if (durationUnit != null) { builder.convertDurationsTo(durationUnit); } reporter = builder.build(); }
@Override public void prepare(MetricRegistry registry, Map stormConf, Map reporterConf) { LOG.debug("Preparing ConsoleReporter"); ConsoleReporter.Builder builder = ConsoleReporter.forRegistry(registry); builder.outputTo(System.out); Locale locale = ClientMetricsUtils.getMetricsReporterLocale(stormConf); if (locale != null) { builder.formattedFor(locale); } TimeUnit rateUnit = ClientMetricsUtils.getMetricsRateUnit(stormConf); if (rateUnit != null) { builder.convertRatesTo(rateUnit); } TimeUnit durationUnit = ClientMetricsUtils.getMetricsDurationUnit(stormConf); if (durationUnit != null) { builder.convertDurationsTo(durationUnit); } StormMetricsFilter filter = getMetricsFilter(reporterConf); if (filter != null) { builder.filter(filter); } //defaults to 10 reportingPeriod = getReportPeriod(reporterConf); //defaults to seconds reportingPeriodUnit = getReportPeriodUnit(reporterConf); reporter = builder.build(); }
private ScheduledReporter createAndGetConfiguredConsoleReporter() { return ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); }
Dispatcher(Config config) { checkNotNull(config, "config argument"); m_threads = new Worker[config.getThreads()]; m_reporter = ConsoleReporter.forRegistry(m_metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); m_reporter.start(30, TimeUnit.SECONDS); }
private ScheduledReporter createAndGetConfiguredConsoleReporter(String prefix) { return ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); }
public static void reportTo(PrintStream out) { out.println("==================== BEGIN-METRIC-LOG ===================="); ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(ActivityMetrics.getMetricRegistry()) .convertDurationsTo(TimeUnit.MICROSECONDS) .convertRatesTo(TimeUnit.SECONDS) .filter(MetricFilter.ALL) .outputTo(out) .build(); consoleReporter.report(); out.println("==================== END-METRIC-LOG ===================="); }
@Override public void startReporter() { consoleReporter = ConsoleReporter.forRegistry(metricRegistry).filter(metricFilter) .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build(); consoleReporter.start(pollingPeriod, TimeUnit.SECONDS); }
private static ConsoleReporter startConsoleReporter(MetricRegistry registry) throws Exception { final ConsoleReporter reporter = ConsoleReporter .forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.MINUTES); return reporter; } }
private static ConsoleReporter startConsoleReporter(MetricRegistry registry) throws Exception { final ConsoleReporter reporter = ConsoleReporter.forRegistry(registry).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).build(); reporter.start(1, TimeUnit.MINUTES); return reporter; } }
/** * Sets up a ConsoleReporter, if not yet setup. */ public static void setupConsoleReporter(final long reportEveryMillis) { if (reporter == null) { reporter = ConsoleReporter.forRegistry(REGISTRY) .convertDurationsTo(TimeUnit.MILLISECONDS) .convertRatesTo(TimeUnit.SECONDS).build(); reporter.start(reportEveryMillis, TimeUnit.MILLISECONDS); } }
@Override public synchronized Reporter getReporter(MetricRegistry registry) { if (null == reporter) { reporter = ConsoleReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); } return reporter; }
@Override public void report(MetricRegistry metricRegistry) { final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.MINUTES); } }
public ConsoleMetricsReporter(MetricRegistry registry, HiveConf conf) { reporter = ConsoleReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); }
@Override public ScheduledReporter build(MetricRegistry registry) { return ConsoleReporter.forRegistry(registry) .convertDurationsTo(getDurationUnit()) .convertRatesTo(getRateUnit()) .filter(getFilter()) .formattedFor(getLocale()) .formattedFor(getTimeZone()) .outputTo(getOutput().get()) .build(); } }
@Override protected ConsoleReporter createInstance() { final ConsoleReporter.Builder reporter = ConsoleReporter.forRegistry(getMetricRegistry()); if (hasProperty(DURATION_UNIT)) { reporter.convertDurationsTo(getProperty(DURATION_UNIT, TimeUnit.class)); } if (hasProperty(RATE_UNIT)) { reporter.convertRatesTo(getProperty(RATE_UNIT, TimeUnit.class)); } reporter.filter(getMetricFilter()); if (hasProperty(CLOCK_REF)) { reporter.withClock(getPropertyRef(CLOCK_REF, Clock.class)); } if (hasProperty(OUTPUT_REF)) { reporter.outputTo(getPropertyRef(OUTPUT_REF, PrintStream.class)); } if (hasProperty(LOCALE)) { reporter.formattedFor(parseLocale(getProperty(LOCALE))); } if (hasProperty(TIMEZONE)) { reporter.formattedFor(TimeZone.getTimeZone(getProperty(TIMEZONE))); } return reporter.build(); }
public ConsoleMetricsReporter(MetricRegistry registry, KylinConfig conf) { reporter = ConsoleReporter.forRegistry(registry).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).build(); }
public ConsoleMetricsReporter(MetricRegistry registry, HiveConf conf) { reporter = ConsoleReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); }
/** * Creates a new {@link ConsoleSink} with a {@link Properties} and {@link MetricRegistry}. * * @param properties the properties which may contain polling period and unit properties * @param registry the metric registry to register */ public ConsoleSink(Properties properties, MetricRegistry registry) { mProperties = properties; mReporter = ConsoleReporter.forRegistry(registry).convertDurationsTo(TimeUnit.MILLISECONDS) .convertRatesTo(TimeUnit.SECONDS).build(); MetricsSystem.checkMinimalPollingPeriod(getPollUnit(), getPollPeriod()); }
@Override public ScheduledReporter build(MetricRegistry registry) { return ConsoleReporter.forRegistry(registry) .convertDurationsTo(getDurationUnit()) .convertRatesTo(getRateUnit()) .filter(getFilter()) .formattedFor(getLocale()) .formattedFor(getTimeZone()) .outputTo(getOutput().get()) .build(); } }