Search in sources :

Example 1 with PeakRateCounter

use of com.netflix.servo.monitor.PeakRateCounter in project tutorials by eugenp.

the class MetricTypeTest method givenPeakRateCounter_whenManipulate_thenPeakRateReturn.

@Test
public void givenPeakRateCounter_whenManipulate_thenPeakRateReturn() throws Exception {
    Counter counter = new PeakRateCounter(MonitorConfig.builder("test").build());
    assertEquals("counter should start with 0", 0, counter.getValue().intValue());
    counter.increment();
    SECONDS.sleep(1);
    counter.increment();
    counter.increment();
    assertEquals("peak rate should have be 2", 2, counter.getValue().intValue());
}
Also used : Counter(com.netflix.servo.monitor.Counter) StepCounter(com.netflix.servo.monitor.StepCounter) BasicCounter(com.netflix.servo.monitor.BasicCounter) PeakRateCounter(com.netflix.servo.monitor.PeakRateCounter) PeakRateCounter(com.netflix.servo.monitor.PeakRateCounter) Test(org.junit.Test)

Aggregations

BasicCounter (com.netflix.servo.monitor.BasicCounter)1 Counter (com.netflix.servo.monitor.Counter)1 PeakRateCounter (com.netflix.servo.monitor.PeakRateCounter)1 StepCounter (com.netflix.servo.monitor.StepCounter)1 Test (org.junit.Test)1