Refine search
/** * Create a {@link ConsoleReporter} attached to the Titan Metrics registry. * * @param reportInterval * time to wait between dumping metrics to the console */ public synchronized void addConsoleReporter(Duration reportInterval) { if (null != consoleReporter) { log.debug("Metrics ConsoleReporter already active; not creating another"); return; } consoleReporter = ConsoleReporter.forRegistry(getRegistry()).build(); consoleReporter.start(reportInterval.toMillis(), TimeUnit.MILLISECONDS); }
public ConsoleMetricsReporter(MetricRegistry registry, HiveConf conf) { reporter = ConsoleReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); }
@Override public String toString() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { PrintStream out = new PrintStream(os, true, StandardCharsets.UTF_8.name()); ConsoleReporter.forRegistry(metrics).outputTo(out).build().report(); return os.toString(StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }
ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(reportIntervalInSeconds, TimeUnit.SECONDS); for (int i = 0; i < numberOfThreads; i++) { final EventGenerator eventGenerator = useJexl ? } finally { reporter.stop();
System.out.printf("\t %.2f string attributes per second\n", numStringAttributesPerSecond); ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(reportIntervalInSeconds, TimeUnit.SECONDS); reporter.stop(); abort.set(true); executor.shutdownNow();
public static void main(final String[] args) { final MetricRegistry metricRegistry = new MetricRegistry(); new GcMemoryMetrics("demo", metricRegistry); final ConsoleReporter reporter = ConsoleReporter .forRegistry(metricRegistry) .build(); reporter.start(1, TimeUnit.SECONDS); while (true) { try { System.gc(); Thread.sleep(Duration.ofSeconds(1).toMillis()); } catch (@SuppressWarnings("unused") final InterruptedException e) { Thread.currentThread().interrupt(); break; } } reporter.stop(); reporter.close(); } }
ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.MILLISECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.report(); reporter.close(); System.out.printf("Total miliseconds elapsed: %d\n", afterResponse - beforeExec); System.out.printf("Miliseconds spent generating requests: %d\n", afterExec - beforeExec);
@Test public void testJVMMetrics() throws InterruptedException { LOG.info("Starting testJVMMetrics"); final MetricRegistry metrics = new MetricRegistry(); ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); metrics.registerAll(new MemoryUsageGaugeSet()); metrics.register("sample", (Gauge<Double>) () -> 0.1234); reporter.start(1, TimeUnit.SECONDS); reporter.close(); } }
private String getMetricReport(MetricRegistry registry) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(outputStream); ConsoleReporter reporter = ConsoleReporter.forRegistry(registry) .outputTo(ps) .build(); reporter.report(); return new String(outputStream.toByteArray()); }
ConsoleReporter reporter = ConsoleReporter.forRegistry(SharedMetricRegistries.getOrCreate("metrics-registry")) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(1, TimeUnit.SECONDS); executor.submit(pipeline::start); Thread.sleep(2000); pipeline.stop(); reporter.stop();
ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics) .convertRatesTo(TimeUnit.MILLISECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.report(); reporter.close(); System.out.printf("Total miliseconds elapsed: %d\n", afterResponse - beforeExec); System.out.printf("Miliseconds spent generating requests: %d\n", afterExec - beforeExec);
/** * Create a {@link ConsoleReporter} attached to the JanusGraph Metrics registry. * * @param reportInterval * time to wait between dumping metrics to the console */ public synchronized void addConsoleReporter(Duration reportInterval) { if (null != consoleReporter) { log.debug("Metrics ConsoleReporter already active; not creating another"); return; } consoleReporter = ConsoleReporter.forRegistry(getRegistry()).build(); consoleReporter.start(reportInterval.toMillis(), TimeUnit.MILLISECONDS); }
public ConsoleMetricsReporter(MetricRegistry registry, KylinConfig conf) { reporter = ConsoleReporter.forRegistry(registry).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 ===================="); }
MetricRegistry metricRegistry = new MetricRegistry(); ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.report(); reporter.close();
for (String reporterName : reporterNames) { if (reporterName.equals("console") || reporterName.endsWith("consolemetricsreporter")) { ConsoleReporter reporter = ConsoleReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(15, TimeUnit.SECONDS); reporters.add(reporter); scheduledReporters.add(reporter);
@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(); }
final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metricRegistry) .convertDurationsTo(TimeUnit.MILLISECONDS) .convertRatesTo(TimeUnit.SECONDS) .build(); consoleReporter.report();
syncInterval, traceFreq), ""); ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics). outputTo(System.out).convertRatesTo(TimeUnit.SECONDS).filter(MetricFilter.ALL).build(); reporter.start(30, TimeUnit.SECONDS);
/** * 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()); }