Search in sources :

Example 1 with TrafficCounter

use of org.jboss.netty.handler.traffic.TrafficCounter in project graylog2-server by Graylog2.

the class ThroughputCounter method gauges.

public Map<String, Gauge<Long>> gauges() {
    Map<String, Gauge<Long>> gauges = Maps.newHashMap();
    final TrafficCounter tc = this.getTrafficCounter();
    gauges.put("read_bytes_1sec", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return tc.getLastReadBytes();
        }
    });
    gauges.put("written_bytes_1sec", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return tc.getLastWrittenBytes();
        }
    });
    gauges.put("read_bytes_total", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return tc.getCumulativeReadBytes();
        }
    });
    gauges.put("written_bytes_total", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return tc.getCumulativeWrittenBytes();
        }
    });
    return gauges;
}
Also used : TrafficCounter(org.jboss.netty.handler.traffic.TrafficCounter) Gauge(com.codahale.metrics.Gauge)

Aggregations

Gauge (com.codahale.metrics.Gauge)1 TrafficCounter (org.jboss.netty.handler.traffic.TrafficCounter)1