public static void startPoller(){ scheduler.start(); final int heartbeatInterval = 1200; final File metricsDir; try { metricsDir = File.createTempFile("zuul-servo-metrics-", ""); metricsDir.delete(); metricsDir.mkdir(); } catch (IOException e) { throw new RuntimeException(e); } LOG.debug("created metrics dir " + metricsDir.getAbsolutePath()); MetricObserver transform = new CounterToRateMetricTransform( new FileMetricObserver("ZuulMetrics", metricsDir), heartbeatInterval, TimeUnit.SECONDS); PollRunnable task = new PollRunnable( new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, transform); final int samplingInterval = 10; scheduler.addPoller(task, samplingInterval, TimeUnit.SECONDS); }
private static void schedule(MetricPoller poller, List<MetricObserver> observers) { final PollRunnable task = new PollRunnable(poller, BasicMetricFilter.MATCH_ALL, true, observers); PollScheduler.getInstance().addPoller(task, Config.getPollInterval(), TimeUnit.SECONDS); }
public static void startPoller(){ scheduler.start(); final int heartbeatInterval = 1200; final File metricsDir; try { metricsDir = File.createTempFile("zuul-servo-metrics-", ""); metricsDir.delete(); metricsDir.mkdir(); } catch (IOException e) { throw new RuntimeException(e); } LOG.debug("created metrics dir " + metricsDir.getAbsolutePath()); MetricObserver transform = new CounterToRateMetricTransform( new FileMetricObserver("ZuulMetrics", metricsDir), heartbeatInterval, TimeUnit.SECONDS); PollRunnable task = new PollRunnable( new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, transform); final int samplingInterval = 10; scheduler.addPoller(task, samplingInterval, TimeUnit.SECONDS); }
private void scheduleTasks(final List<PollRunnable> tasks) { if (tasks != null) { for (final PollRunnable task : tasks) { PollScheduler.getInstance().addPoller(task, pollInterval, timeUnit); } } }
public static void startPoller(){ scheduler.start(); final int heartbeatInterval = 1200; final File metricsDir; try { metricsDir = File.createTempFile("zuul-servo-metrics-", ""); metricsDir.delete(); metricsDir.mkdir(); } catch (IOException e) { throw new RuntimeException(e); } LOG.debug("created metrics dir " + metricsDir.getAbsolutePath()); MetricObserver transform = new CounterToRateMetricTransform( new FileMetricObserver("ZuulMetrics", metricsDir), heartbeatInterval, TimeUnit.SECONDS); PollRunnable task = new PollRunnable( new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, transform); final int samplingInterval = 10; scheduler.addPoller(task, samplingInterval, TimeUnit.SECONDS); }
public static void startPoller(){ scheduler.start(); final int heartbeatInterval = 1200; final File metricsDir; try { metricsDir = File.createTempFile("zuul-servo-metrics-", ""); metricsDir.delete(); metricsDir.mkdir(); } catch (IOException e) { throw new RuntimeException(e); } LOG.debug("created metrics dir " + metricsDir.getAbsolutePath()); MetricObserver transform = new CounterToRateMetricTransform( new FileMetricObserver("ZuulMetrics", metricsDir), heartbeatInterval, TimeUnit.SECONDS); PollRunnable task = new PollRunnable( new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, transform); final int samplingInterval = 10; scheduler.addPoller(task, samplingInterval, TimeUnit.SECONDS); }
/** * Starts the polling that will publish metrics at regular intervals. This start() method should be called by * the main() method of the application. Calling this method more than once is allowed, but will have no effect if * the polling has already been started. * * @param graphiteConfig Tells the library how to talk to Graphite */ public void start(GraphiteConfig graphiteConfig) { synchronized (POLL_SCHEDULER) { POLL_SCHEDULER_START_COUNT.addAndGet(1); if(!POLL_SCHEDULER.isStarted()) { POLL_SCHEDULER.start(); final MetricPoller monitorRegistryMetricPoller = factory.createMonitorRegistryMetricPoller(); final List<MetricObserver> observers = Collections.singletonList(createGraphiteObserver(graphiteConfig)); final PollRunnable task = factory.createTask(monitorRegistryMetricPoller, observers); POLL_SCHEDULER.addPoller(task, graphiteConfig.pollintervalseconds(), SECONDS); } } }
@Override protected void initializePlatform() { if (initalized) return; try { PollScheduler scheduler = PollScheduler.getInstance(); scheduler.start(); MetricObserver fileObserver = new FileMetricObserver("stats", new File(".")); MetricObserver transform = new CounterToRateMetricTransform(fileObserver, 2, TimeUnit.MINUTES); PollRunnable task = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, transform); scheduler.addPoller(task, 1, TimeUnit.MINUTES); } catch (Throwable e) { // dont do anything... just eat. logger.error("Epic Plugin was not intialized: ", e); } initalized = true; }
public void init() { PollScheduler scheduler = PollScheduler.getInstance(); if (!scheduler.isStarted()) { scheduler.start(); } if (isRollingFileEnabled()) { MetricObserver fileObserver = new FileOutputMetricObserver(fileOutput, convertor, formatter); MetricObserver fileTransform = new CounterToRateMetricTransform(fileObserver, metricPoll, TimeUnit.SECONDS); PollRunnable fileTask = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, fileTransform); scheduler.addPoller(fileTask, metricPoll, TimeUnit.SECONDS); } }