Search in sources :

Example 1 with MetricsPresentationConfig

use of com.yahoo.metrics.MetricsPresentationConfig in project vespa by vespa-engine.

the class StateHandlerTest method startTestDriver.

@Before
public void startTestDriver() {
    Timer timer = this.currentTimeMillis::get;
    this.driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() {

        @Override
        protected void configure() {
            bind(Timer.class).toInstance(timer);
        }
    });
    ContainerBuilder builder = driver.newContainerBuilder();
    HealthMonitorConfig healthMonitorConfig = new HealthMonitorConfig(new HealthMonitorConfig.Builder().snapshot_interval(TimeUnit.MILLISECONDS.toSeconds(SNAPSHOT_INTERVAL)));
    ThreadFactory threadFactory = ignored -> mock(Thread.class);
    this.monitor = new StateMonitor(healthMonitorConfig, timer, threadFactory);
    builder.guiceModules().install(new AbstractModule() {

        @Override
        protected void configure() {
            bind(StateMonitor.class).toInstance(monitor);
            bind(MetricConsumer.class).toProvider(MetricConsumerProviders.wrap(monitor));
            bind(ApplicationMetadataConfig.class).toInstance(new ApplicationMetadataConfig(new ApplicationMetadataConfig.Builder().generation(META_GENERATION)));
            bind(MetricsPresentationConfig.class).toInstance(new MetricsPresentationConfig(new MetricsPresentationConfig.Builder()));
        }
    });
    builder.serverBindings().bind("http://*/*", builder.getInstance(StateHandler.class));
    driver.activateContainer(builder);
    metric = builder.getInstance(Metric.class);
}
Also used : Metric(com.yahoo.jdisc.Metric) TestDriver(com.yahoo.jdisc.test.TestDriver) Defaults(com.yahoo.vespa.defaults.Defaults) ApplicationMetadataConfig(com.yahoo.container.core.ApplicationMetadataConfig) Vtag(com.yahoo.component.Vtag) HashMap(java.util.HashMap) After(org.junit.After) Map(java.util.Map) JsonNode(com.fasterxml.jackson.databind.JsonNode) ThreadFactory(java.util.concurrent.ThreadFactory) Before(org.junit.Before) ContentChannel(com.yahoo.jdisc.handler.ContentChannel) Response(com.yahoo.jdisc.Response) Assert.assertNotNull(org.junit.Assert.assertNotNull) MetricConsumer(com.yahoo.jdisc.application.MetricConsumer) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) ResponseHandler(com.yahoo.jdisc.handler.ResponseHandler) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) StandardCharsets(java.nio.charset.StandardCharsets) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) ContainerBuilder(com.yahoo.jdisc.application.ContainerBuilder) TreeMap(java.util.TreeMap) Assert.assertFalse(org.junit.Assert.assertFalse) Timer(com.yahoo.jdisc.Timer) BufferedContentChannel(com.yahoo.jdisc.handler.BufferedContentChannel) MetricsPresentationConfig(com.yahoo.metrics.MetricsPresentationConfig) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) AbstractModule(com.google.inject.AbstractModule) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) Mockito.mock(org.mockito.Mockito.mock) ThreadFactory(java.util.concurrent.ThreadFactory) ContainerBuilder(com.yahoo.jdisc.application.ContainerBuilder) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) AbstractModule(com.google.inject.AbstractModule) ContainerBuilder(com.yahoo.jdisc.application.ContainerBuilder) Timer(com.yahoo.jdisc.Timer) ApplicationMetadataConfig(com.yahoo.container.core.ApplicationMetadataConfig) Metric(com.yahoo.jdisc.Metric) MetricsPresentationConfig(com.yahoo.metrics.MetricsPresentationConfig) Before(org.junit.Before)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 AbstractModule (com.google.inject.AbstractModule)1 Vtag (com.yahoo.component.Vtag)1 ApplicationMetadataConfig (com.yahoo.container.core.ApplicationMetadataConfig)1 HealthMonitorConfig (com.yahoo.container.jdisc.config.HealthMonitorConfig)1 Metric (com.yahoo.jdisc.Metric)1 Response (com.yahoo.jdisc.Response)1 Timer (com.yahoo.jdisc.Timer)1 ContainerBuilder (com.yahoo.jdisc.application.ContainerBuilder)1 MetricConsumer (com.yahoo.jdisc.application.MetricConsumer)1 BufferedContentChannel (com.yahoo.jdisc.handler.BufferedContentChannel)1 ContentChannel (com.yahoo.jdisc.handler.ContentChannel)1 ResponseHandler (com.yahoo.jdisc.handler.ResponseHandler)1 TestDriver (com.yahoo.jdisc.test.TestDriver)1 MetricsPresentationConfig (com.yahoo.metrics.MetricsPresentationConfig)1 Defaults (com.yahoo.vespa.defaults.Defaults)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 StandardCharsets (java.nio.charset.StandardCharsets)1