void initMonitors(String name) { Preconditions.checkNotNull(name); freeEntryCounter = Monitors.newCounter(name + "_Reuse"); createEntryCounter = Monitors.newCounter(name + "_CreateNew"); requestCounter = Monitors.newCounter(name + "_Request"); releaseCounter = Monitors.newCounter(name + "_Release"); deleteCounter = Monitors.newCounter(name + "_Delete"); requestTimer = Monitors.newTimer(name + "_RequestConnectionTimer", TimeUnit.MILLISECONDS); creationTimer = Monitors.newTimer(name + "_CreateConnectionTimer", TimeUnit.MILLISECONDS); this.name = name; Monitors.registerObject(name, this); }
public TimedSupervisorTask(String name, ScheduledExecutorService scheduler, ThreadPoolExecutor executor, int timeout, TimeUnit timeUnit, int expBackOffBound, Runnable task) { this.scheduler = scheduler; this.executor = executor; this.timeoutMillis = timeUnit.toMillis(timeout); this.task = task; this.delay = new AtomicLong(timeoutMillis); this.maxDelay = timeoutMillis * expBackOffBound; // Initialize the counters and register. successCounter = Monitors.newCounter("success"); timeoutCounter = Monitors.newCounter("timeouts"); rejectedCounter = Monitors.newCounter("rejectedExecutions"); throwableCounter = Monitors.newCounter("throwables"); threadPoolLevelGauge = new LongGauge(MonitorConfig.builder("threadPoolUsed").build()); Monitors.registerObject(name, this); }
static Counter newCounter(String name) { Counter c = Monitors.newCounter(name); DefaultMonitorRegistry.getInstance().register(c); return c; }
@Test public void testAddMonitorsAnon() throws Exception { List<Monitor<?>> monitors = new ArrayList<>(); ClassWithMonitors obj = new ClassWithMonitors() { final Counter c1 = Monitors.newCounter("publicCounter"); @com.netflix.servo.annotations.Monitor( name = "primitiveGauge", type = DataSourceType.GAUGE) static final long A1 = 0L; }; TagList tags = BasicTagList.of("abc", "def"); Monitors.addMonitors(monitors, null, tags, obj); assertEquals(monitors.size(), 10); for (Monitor m : monitors) { assertEquals(m.getConfig().getTags().getValue("class"), "MonitorsTest", String.format("%s should have class MonitorsTest", m.getConfig().getName())); } }
@Test public void testBasic() throws Exception { MonitorRegistry registry = new BasicMonitorRegistry(); registry.register(Monitors.newCounter("test")); MetricPoller poller = new MonitorRegistryMetricPoller(registry); Metric metric = poller.poll(MATCH_ALL).get(0); MonitorConfig expected = MonitorConfig.builder("test") .withTag(DataSourceType.COUNTER) .build(); assertEquals(metric.getConfig(), expected); }
@Test(enabled = false) public void testShutdown() throws Exception { MonitorRegistry registry = new BasicMonitorRegistry(); registry.register(Monitors.newCounter("test"));
@Test public void testSlowMonitor() throws Exception { MonitorRegistry registry = new BasicMonitorRegistry(); registry.register(new SlowCounter("slow")); registry.register(Monitors.newCounter("test")); MetricPoller poller = new MonitorRegistryMetricPoller(registry); long start = System.currentTimeMillis(); Metric metric = poller.poll(MATCH_ALL).get(0); long end = System.currentTimeMillis(); // Verify we didn't wait too long, we should only wait 1 second but allow up to // 10 to make it less likely to have spurious test failures assertTrue(end - start < TEN_SECONDS); MonitorConfig expected = MonitorConfig.builder("test") .withTag(DataSourceType.COUNTER) .build(); assertEquals(metric.getConfig(), expected); }
private final Counter createCounter() { return Monitors.newCounter("LoadBalancer_ChooseServer"); }
void initMonitors(String name) { Preconditions.checkNotNull(name); freeEntryCounter = Monitors.newCounter(name + "_Reuse"); createEntryCounter = Monitors.newCounter(name + "_CreateNew"); requestCounter = Monitors.newCounter(name + "_Request"); releaseCounter = Monitors.newCounter(name + "_Release"); deleteCounter = Monitors.newCounter(name + "_Delete"); requestTimer = Monitors.newTimer(name + "_RequestConnectionTimer", TimeUnit.MILLISECONDS); creationTimer = Monitors.newTimer(name + "_CreateConnectionTimer", TimeUnit.MILLISECONDS); this.name = name; Monitors.registerObject(name, this); }
void initMonitors(String name) { Preconditions.checkNotNull(name); freeEntryCounter = Monitors.newCounter(name + "_Reuse"); createEntryCounter = Monitors.newCounter(name + "_CreateNew"); requestCounter = Monitors.newCounter(name + "_Request"); releaseCounter = Monitors.newCounter(name + "_Release"); deleteCounter = Monitors.newCounter(name + "_Delete"); requestTimer = Monitors.newTimer(name + "_RequestConnectionTimer", TimeUnit.MILLISECONDS); creationTimer = Monitors.newTimer(name + "_CreateConnectionTimer", TimeUnit.MILLISECONDS); this.name = name; Monitors.registerObject(name, this); }
public ZoneStats(String name, String zone, LoadBalancerStats loadBalancerStats) { this.zone = zone; this.loadBalancerStats = loadBalancerStats; monitorId = name + ":" + zone; counter = Monitors.newCounter(PREFIX + name + "_" + zone + "_Counter"); Monitors.registerObject(monitorId, this); }
protected WebSocketServerListener(String monitorId) { super(monitorId); processedHandshakes = newLongGauge("processedHandshakes"); failedHandshakes = newLongGauge("failedHandshakes"); webSocketWrites = newCounter("webSocketWrites"); getWebSocketReads = newCounter("getWebSocketReads"); }
protected WebSocketServerListener(String monitorId) { super(monitorId); processedHandshakes = newLongGauge("processedHandshakes"); failedHandshakes = newLongGauge("failedHandshakes"); webSocketWrites = newCounter("webSocketWrites"); getWebSocketReads = newCounter("getWebSocketReads"); }
protected HttpClientListener(String monitorId) { super(monitorId); requestBacklog = newLongGauge("requestBacklog"); inflightRequests = newLongGauge("inflightRequests"); requestWriteTimes = newTimer("requestWriteTimes"); responseReadTimes = newTimer("responseReadTimes"); processedRequests = newCounter("processedRequests"); requestWriteFailed = newCounter("requestWriteFailed"); failedResponses = newCounter("failedResponses"); failedContentSource = newCounter("failedContentSource"); requestProcessingTimes = newTimer("requestProcessingTimes"); }
protected HttpClientListener(String monitorId) { super(monitorId); requestBacklog = newLongGauge("requestBacklog"); inflightRequests = newLongGauge("inflightRequests"); requestWriteTimes = newTimer("requestWriteTimes"); responseReadTimes = newTimer("responseReadTimes"); processedRequests = newCounter("processedRequests"); requestWriteFailed = newCounter("requestWriteFailed"); failedResponses = newCounter("failedResponses"); failedContentSource = newCounter("failedContentSource"); requestProcessingTimes = newTimer("requestProcessingTimes"); }
protected HttpServerListener(String monitorId) { super(monitorId); requestBacklog = newLongGauge("requestBacklog"); inflightRequests = newLongGauge("inflightRequests"); responseWriteTimes = newTimer("responseWriteTimes"); requestReadTimes = newTimer("requestReadTimes"); processedRequests = newCounter("processedRequests"); failedRequests = newCounter("failedRequests"); responseWriteFailed = newCounter("responseWriteFailed"); delegate = new HttpServerMetricEventsListenerImpl(); }
protected HttpServerListener(String monitorId) { super(monitorId); requestBacklog = newLongGauge("requestBacklog"); inflightRequests = newLongGauge("inflightRequests"); responseWriteTimes = newTimer("responseWriteTimes"); requestReadTimes = newTimer("requestReadTimes"); processedRequests = newCounter("processedRequests"); failedRequests = newCounter("failedRequests"); responseWriteFailed = newCounter("responseWriteFailed"); delegate = new HttpServerMetricEventsListenerImpl(); }
static Counter newCounter(String name) { Counter c = Monitors.newCounter(name); DefaultMonitorRegistry.getInstance().register(c); return c; }
protected WebSocketClientListener(String monitorId) { super(monitorId); inflightHandshakes = newLongGauge("inflightHandshakes"); processedHandshakes = newLongGauge("processedHandshakes"); failedHandshakes = newLongGauge("failedHandshakes"); webSocketWrites = newCounter("webSocketWrites"); getWebSocketReads = newCounter("getWebSocketReads"); handshakeProcessingTimes = newTimer("handshakeProcessingTimes"); }
protected WebSocketClientListener(String monitorId) { super(monitorId); inflightHandshakes = newLongGauge("inflightHandshakes"); processedHandshakes = newLongGauge("processedHandshakes"); failedHandshakes = newLongGauge("failedHandshakes"); webSocketWrites = newCounter("webSocketWrites"); getWebSocketReads = newCounter("getWebSocketReads"); handshakeProcessingTimes = newTimer("handshakeProcessingTimes"); }