Search in sources :

Example 1 with Counter0

use of com.google.gerrit.metrics.Counter0 in project gerrit by GerritCodeReview.

the class ProcMetricModuleTest method counter0.

@Test
public void counter0() {
    Counter0 cntr = metrics.newCounter("test/count", new Description("simple test").setCumulative());
    Counter raw = get("test/count", Counter.class);
    assertThat(raw.getCount()).isEqualTo(0);
    cntr.increment();
    assertThat(raw.getCount()).isEqualTo(1);
    cntr.incrementBy(5);
    assertThat(raw.getCount()).isEqualTo(6);
}
Also used : Description(com.google.gerrit.metrics.Description) Counter(com.codahale.metrics.Counter) Counter0(com.google.gerrit.metrics.Counter0) Test(org.junit.Test)

Example 2 with Counter0

use of com.google.gerrit.metrics.Counter0 in project gerrit by GerritCodeReview.

the class PluginMetricMaker method newCounter.

@Override
public Counter0 newCounter(String name, Description desc) {
    Counter0 m = root.newCounter(prefix + name, desc);
    cleanup.add(m);
    return m;
}
Also used : Counter0(com.google.gerrit.metrics.Counter0)

Aggregations

Counter0 (com.google.gerrit.metrics.Counter0)2 Counter (com.codahale.metrics.Counter)1 Description (com.google.gerrit.metrics.Description)1 Test (org.junit.Test)1