Search in sources :

Example 1 with MaxGauge

use of com.netflix.servo.monitor.MaxGauge in project incubator-servicecomb-java-chassis by apache.

the class MonitorManager method getMaxGauge.

public MaxGauge getMaxGauge(String name, String... tags) {
    validateMonitorNameAndTags(name, tags);
    return maxGauges.computeIfAbsent(getMonitorKey(name, tags), f -> {
        MaxGauge maxGauge = new MaxGauge(getConfig(name, tags));
        basicMonitorRegistry.register(maxGauge);
        return maxGauge;
    });
}
Also used : MaxGauge(com.netflix.servo.monitor.MaxGauge)

Example 2 with MaxGauge

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

the class MetricTypeTest method givenMaxGauge_whenUpdateMultipleTimes_thenMaxReturned.

@Test
public void givenMaxGauge_whenUpdateMultipleTimes_thenMaxReturned() {
    MaxGauge gauge = new MaxGauge(MonitorConfig.builder("test").build());
    assertEquals(0, gauge.getValue().intValue());
    gauge.update(4);
    assertEquals(4, gauge.getCurrentValue(0));
    gauge.update(1);
    assertEquals(4, gauge.getCurrentValue(0));
}
Also used : MaxGauge(com.netflix.servo.monitor.MaxGauge) Test(org.junit.Test)

Aggregations

MaxGauge (com.netflix.servo.monitor.MaxGauge)2 Test (org.junit.Test)1