/** * How frequently to poll metrics in seconds and report to observers. */ public static long getPollInterval() { return Pollers.getPollingIntervals().get(0) / 1000L; }
join(DEFAULT_PERIODS)); return DEFAULT_PERIODS; } else {
@Test public void testParseInvalid() throws Exception { assertEquals(Pollers.parse("0"), Pollers.DEFAULT_PERIODS); assertEquals(Pollers.parse("-1"), Pollers.DEFAULT_PERIODS); assertEquals(Pollers.parse("1L"), Pollers.DEFAULT_PERIODS); assertEquals(Pollers.parse("100,-1"), Pollers.DEFAULT_PERIODS); assertEquals(Pollers.parse("100,0"), Pollers.DEFAULT_PERIODS); }
/** * Create an atlas observer. For internal use of servo only. */ public AtlasMetricObserver(ServoAtlasConfig config, TagList commonTags, int pollerIdx, HttpHelper httpHelper) { this.httpHelper = httpHelper; this.config = config; this.stepMs = Pollers.getPollingIntervals().get(pollerIdx); this.sendTimeoutMs = stepMs * 9 / 10; this.commonTags = commonTags; pushQueue = new LinkedBlockingQueue<>(config.getPushQueueSize()); pushThread = new Thread(new PushProcessor(), "BaseAtlasMetricObserver-Push"); pushThread.setDaemon(true); pushThread.start(); }
join(DEFAULT_PERIODS)); return DEFAULT_PERIODS; } else {
/** Create builder for a polled gauge based on the config. */ public static PolledMeter.Builder polledGauge(MonitorConfig config) { long delayMillis = Math.max(Pollers.getPollingIntervals().get(0) - 1000, 5000); Id id = createId(config); PolledMeter.remove(registry, id); return PolledMeter.using(registry) .withId(id) .withDelay(Duration.ofMillis(delayMillis)) .scheduleOn(gaugePool()); }
@Test public void testParseMultiple() throws Exception { long[] expected = {60000L, 10000L, 2000L}; assertEquals(Pollers.parse("60000,10000,2000"), expected); }
/** * Create an atlas observer. For internal use of servo only. */ public AtlasMetricObserver(ServoAtlasConfig config, TagList commonTags, int pollerIdx, HttpHelper httpHelper) { this.httpHelper = httpHelper; this.config = config; this.stepMs = Pollers.getPollingIntervals().get(pollerIdx); this.sendTimeoutMs = stepMs * 9 / 10; this.commonTags = commonTags; pushQueue = new LinkedBlockingQueue<>(config.getPushQueueSize()); pushThread = new Thread(new PushProcessor(), "BaseAtlasMetricObserver-Push"); pushThread.setDaemon(true); pushThread.start(); }
/** Create builder for a polled gauge based on the config. */ public static PolledMeter.Builder polledGauge(MonitorConfig config) { long delayMillis = Math.max(Pollers.getPollingIntervals().get(0) - 1000, 5000); Id id = createId(config); PolledMeter.remove(registry, id); return PolledMeter.using(registry) .withId(id) .withDelay(Duration.ofMillis(delayMillis)) .scheduleOn(gaugePool()); }