Search in sources :

Example 6 with MetricConsumer

use of com.yahoo.jdisc.application.MetricConsumer in project vespa by vespa-engine.

the class MetricProviderTest method requireThatMetricProviderDelegatesToConsumerFactory.

@Test
public void requireThatMetricProviderDelegatesToConsumerFactory() {
    MetricConsumer consumer = Mockito.mock(MetricConsumer.class);
    MetricProvider provider = MetricProviders.newInstance(consumer);
    Metric metric = provider.get();
    assertNotNull(metric);
    Metric.Context fooCtx = Mockito.mock(Metric.Context.class);
    metric.add("foo", 6, fooCtx);
    metric.set("foo", 9, fooCtx);
    Mockito.verify(consumer, Mockito.times(1)).add("foo", 6, fooCtx);
    Mockito.verify(consumer, Mockito.times(1)).set("foo", 9, fooCtx);
}
Also used : MetricConsumer(com.yahoo.jdisc.application.MetricConsumer) Metric(com.yahoo.jdisc.Metric) Test(org.junit.Test)

Aggregations

MetricConsumer (com.yahoo.jdisc.application.MetricConsumer)6 Test (org.junit.Test)6 Metric (com.yahoo.jdisc.Metric)2 HealthMonitorConfig (com.yahoo.container.jdisc.config.HealthMonitorConfig)1 SystemTimer (com.yahoo.jdisc.core.SystemTimer)1 HashMap (java.util.HashMap)1