/** * Starts the reporter polling at the given period. * * @param period the amount of time between polls * @param unit the unit for {@code period} */ public void start(long period, TimeUnit unit) { start(period, period, unit); }
@Override public void start() { if (reporter != null) { LOG.debug("Starting..."); reporter.start(reportingPeriod, reportingPeriodUnit); } else { throw new IllegalStateException("Attempt to start without preparing " + getClass().getSimpleName()); } }
@Override public void start(long period, TimeUnit unit) { // Create metrics directory if it is not present if (!metricsDir.toFile().exists()) { LOG.warn("Metrics directory {} does not exist, creating one", metricsDir); try { // createDirectories creates all non-existent parent directories Files.createDirectories(metricsDir, DIR_ATTRS); } catch (IOException e) { LOG.warn("Failed to initialize JSON reporter: failed to create directory {}: {}", metricsDir, e.getMessage()); return; } } jsonWriter = new ObjectMapper().registerModule(new MetricsModule(TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS, false)).writerWithDefaultPrettyPrinter(); super.start(period, unit); }
/** * Begins reporting metrics using the configured {@link ScheduledReporter}. * * @throws Exception */ @Override public void start() throws Exception { reporter.start(period.getQuantity(), period.getUnit()); }
/** * Starts the reporter polling at the given period. * * @param initialDelay the time to delay the first execution * @param period the amount of time between polls * @param unit the unit for {@code period} and {@code initialDelay} */ synchronized public void start(long initialDelay, long period, TimeUnit unit) { start(initialDelay, period, unit, () -> { try { report(); } catch (Throwable ex) { LOG.error("Exception thrown from {}#report. Exception was suppressed.", ScheduledReporter.this.getClass().getSimpleName(), ex); } }); }
scheduledReporter.start(reportInterval, reportTimeUnit);
@Override public void start() { if (isEnabled() && !isRunning()) { getObject().start(getPeriod(), TimeUnit.NANOSECONDS); running = true; } }
@Override public void start(long period, TimeUnit unit) { this.countFactor = 1.0 / (double)unit.toMillis(period) * 1000.0; super.start(period, unit); }
@Override public void start() { if (reporter != null) { LOG.debug("Starting..."); reporter.start(reportingPeriod, reportingPeriodUnit); } else { throw new IllegalStateException("Attempt to start without preparing " + getClass().getSimpleName()); } }
@Override protected void startUp() throws Exception { jmxReporter.start(); reporter.start(reportPeriod, TimeUnit.SECONDS); LOG.info("Started metrics reporter"); }
@Override public void start(long period, TimeUnit unit) { super.start(period, unit); if (dynamicMonitoringView != null) { dynamicMonitoringView.start(); } }
@Override protected void init() { if (monitorEnable) { try { getReporter().start(10, TimeUnit.SECONDS); } catch (Exception e) { log.error("start metric reporter exception -> {}", e.getMessage()); } } }
@Override protected void init() { if (monitorEnable) { try { getReporter().start(10, TimeUnit.SECONDS); } catch (Exception e) { log.error("start metric reporter exception -> {}", e.getMessage()); } } }
/** * Start CsvReporter with default period and time. */ public static void startCsvReporter(long period, TimeUnit unit) { if (!start) { ScheduledReporter reporter = CsvReporter.forRegistry(metrics).build(new File("./tmp")); reporter.start(period, unit); start = true; } }
/** * Begins reporting metrics using the configured {@link ScheduledReporter}. * * @throws Exception */ @Override public void start() throws Exception { reporter.start(period.getQuantity(), period.getUnit()); }
/** * Begins reporting metrics using the configured {@link ScheduledReporter}. */ @Override public void start() { reporter.start(period.getQuantity(), period.getUnit()); }
@Override public void copierStart(String copierImplementation) { runningMetricsReporter = runningMetricsReporterFactory.newInstance(qualifiedReplicaName); runningMetricsReporter.start(metricsReporterPeriod, metricsReporterTimeUnit); runningMetricsReporter.report(); }
@Override public void init(Driver d, Properties properties) { this.driver = d; LOG.debug("Initialize Metric"); driver.getEventManager().register(EventManager.EVENT_PROXY_POST, this); driver.getEventManager().register(EventManager.EVENT_FETCH_POST, this); ScheduledReporter reporter = Slf4jReporter.forRegistry(this.metric).outputTo(LOG).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).build(); reporter.start(PARAM_METRIC_PERIOD.getValue(properties), TimeUnit.SECONDS); }
/** * Initialize metrics. */ protected void initializeMetrics() { if (getInstanceSettings().isLogMetrics()) { this.metricsReporter = Slf4jReporter.forRegistry(getMetricRegistry()).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).build(); getMetricsReporter().start(20, TimeUnit.SECONDS); } else { getLogger().info(MicroserviceMessages.METRICS_REPORTING_DISABLED); } }
private static ScheduledReporter startInfluxdbReporterUDPV09(MetricRegistry registry) { final ScheduledReporter reporter = InfluxdbReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .protocol(new UdpInfluxdbProtocol("127.0.0.1", 8089)) .build(); reporter.start(20, TimeUnit.SECONDS); return reporter; }