private void incrementStateCounter(PassportState state) { switch (state) { case IN_REQ_HEADERS_RECEIVED: IN_REQ_HEADERS_RECEIVED_CNT.increment(); break; case IN_REQ_LAST_CONTENT_RECEIVED: IN_REQ_LAST_CONTENT_RECEIVED_CNT.increment(); break; case OUT_REQ_HEADERS_SENT: OUT_REQ_HEADERS_SENT_CNT.increment(); break; case OUT_REQ_LAST_CONTENT_SENT: OUT_REQ_LAST_CONTENT_SENT_CNT.increment(); break; case IN_RESP_HEADERS_RECEIVED: IN_RESP_HEADERS_RECEIVED_CNT.increment(); break; case IN_RESP_LAST_CONTENT_RECEIVED: IN_RESP_LAST_CONTENT_RECEIVED_CNT.increment(); break; case OUT_RESP_HEADERS_SENT: OUT_RESP_HEADERS_SENT_CNT.increment(); break; case OUT_RESP_LAST_CONTENT_SENT: OUT_RESP_LAST_CONTENT_SENT_CNT.increment(); break; } } }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt == MaxInboundConnectionsHandler.CONNECTION_THROTTLED_EVENT) { connectionThrottled.increment(); } else if (evt instanceof IdleStateEvent) { connectionIdleTimeout.increment(); } super.userEventTriggered(ctx, evt); } }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { try { super.channelInactive(ctx); } finally { currentConnections.decrementAndGet(); connectionClosed.increment(); } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { connectionErrors.increment(); if (LOG.isInfoEnabled()) { LOG.info("Connection error caught. " + String.valueOf(cause), cause); } super.exceptionCaught(ctx, cause); }
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { currentConnections.incrementAndGet(); totalConnections.increment(); ctx.channel().attr(ATTR_CURRENT_CONNS).set(currentConnections); super.channelActive(ctx); }
@Override public void increment(String name) { BasicCounter counter = getCounter(name); counter.increment(); }
public void update() { c.increment(); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt == MaxInboundConnectionsHandler.CONNECTION_THROTTLED_EVENT) { connectionThrottled.increment(); } else if (evt instanceof IdleStateEvent) { connectionIdleTimeout.increment(); } super.userEventTriggered(ctx, evt); } }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { try { super.channelInactive(ctx); } finally { currentConnections.decrementAndGet(); connectionClosed.increment(); } }
@Override public void increment(String name) { BasicCounter counter = getCounter(name); counter.increment(); }
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { currentConnections.incrementAndGet(); totalConnections.increment(); ctx.channel().attr(ATTR_CURRENT_CONNS).set(currentConnections); super.channelActive(ctx); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpRequestReadTimeoutEvent) { CurrentPassport.fromChannel(ctx.channel()).add(PassportState.IN_REQ_READ_TIMEOUT); removeInternalHandler(ctx); httpRequestReadTimeoutCounter.increment(); } super.userEventTriggered(ctx, evt); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { connectionErrors.increment(); if (LOG.isInfoEnabled()) { LOG.info("Connection error caught. " + String.valueOf(cause), cause); } super.exceptionCaught(ctx, cause); }
@Test public void testUnregisteredBasicCounterIncrement() { BasicCounter c = new BasicCounter(CONFIG); c.increment(); assertEquals(1, registry.counters().count()); assertEquals(1, registry.counter("test").count()); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpRequestReadTimeoutEvent) { CurrentPassport.fromChannel(ctx.channel()).add(PassportState.IN_REQ_READ_TIMEOUT); removeInternalHandler(ctx); httpRequestReadTimeoutCounter.increment(); } super.userEventTriggered(ctx, evt); }
public void increment(String value) { counters.computeIfAbsent(value, v -> { MonitorConfig c = baseConfig.withAdditionalTag(new com.netflix.servo.tag.BasicTag("c", v)); return new BasicCounter(c); }).increment(); }
@Test public void testBasicCounterIncrementAmount() { BasicCounter c = new BasicCounter(CONFIG); register(c); c.increment(42); assertEquals(42, registry.counter(ID).count()); }
@Test public void testBasicCounterIncrement() { BasicCounter c = new BasicCounter(CONFIG); register(c); c.increment(); assertEquals(1, registry.counter(ID).count()); }