Search in sources :

Example 1 with StepCounter

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

the class MetricTypeTest method givenStepCounter_whenManipulate_thenRateValid.

@Ignore
@Test
public void givenStepCounter_whenManipulate_thenRateValid() throws Exception {
    System.setProperty("servo.pollers", "1000");
    Counter counter = new StepCounter(MonitorConfig.builder("test").build());
    assertEquals("counter should start with rate 0.0", 0.0, counter.getValue());
    counter.increment();
    SECONDS.sleep(1);
    assertEquals("counter rate should have increased to 1.0", 1.0, counter.getValue());
}
Also used : StepCounter(com.netflix.servo.monitor.StepCounter) Counter(com.netflix.servo.monitor.Counter) StepCounter(com.netflix.servo.monitor.StepCounter) BasicCounter(com.netflix.servo.monitor.BasicCounter) PeakRateCounter(com.netflix.servo.monitor.PeakRateCounter) Ignore(org.junit.Ignore) 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 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1