Search in sources :

Example 1 with HealthMonitorConfig

use of com.yahoo.container.jdisc.config.HealthMonitorConfig in project vespa by vespa-engine.

the class AdminTestCase method testContainerMetricsSnapshotInterval.

@Test
public void testContainerMetricsSnapshotInterval() throws Exception {
    VespaModel vespaModel = getVespaModel(TESTDIR + "metricconfig");
    ContainerCluster docprocCluster = vespaModel.getContainerClusters().get("cluster.music.indexing");
    HealthMonitorConfig.Builder builder = new HealthMonitorConfig.Builder();
    docprocCluster.getConfig(builder);
    HealthMonitorConfig docprocConfig = new HealthMonitorConfig(builder);
    assertEquals(60, (int) docprocConfig.snapshot_interval());
    ContainerCluster qrCluster = vespaModel.getContainerClusters().get("container");
    builder = new HealthMonitorConfig.Builder();
    qrCluster.getConfig(builder);
    HealthMonitorConfig qrClusterConfig = new HealthMonitorConfig(builder);
    assertEquals(60, (int) qrClusterConfig.snapshot_interval());
    StatisticsComponent stat = null;
    for (Component component : qrCluster.getAllComponents()) {
        if (component.getClassId().getName().contains("com.yahoo.statistics.StatisticsImpl")) {
            stat = (StatisticsComponent) component;
            break;
        }
    }
    assertNotNull(stat);
    StatisticsConfig.Builder sb = new StatisticsConfig.Builder();
    stat.getConfig(sb);
    StatisticsConfig sc = new StatisticsConfig(sb);
    assertEquals(60, (int) sc.collectionintervalsec());
    assertEquals(60, (int) sc.loggingintervalsec());
}
Also used : StatisticsComponent(com.yahoo.vespa.model.container.component.StatisticsComponent) StatisticsConfig(com.yahoo.container.StatisticsConfig) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) StatisticsComponent(com.yahoo.vespa.model.container.component.StatisticsComponent) Component(com.yahoo.vespa.model.container.component.Component) Test(org.junit.Test)

Example 2 with HealthMonitorConfig

use of com.yahoo.container.jdisc.config.HealthMonitorConfig 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)

Example 3 with HealthMonitorConfig

use of com.yahoo.container.jdisc.config.HealthMonitorConfig in project vespa by vespa-engine.

the class StateMonitorBenchmarkTest method requireThatHealthMonitorDoesNotBlockMetricThreads.

@Test
public void requireThatHealthMonitorDoesNotBlockMetricThreads() throws Exception {
    StateMonitor monitor = new StateMonitor(new HealthMonitorConfig(new HealthMonitorConfig.Builder()), new SystemTimer());
    Provider<MetricConsumer> provider = MetricConsumerProviders.wrap(monitor);
    performUpdates(provider, 8);
    for (int i = 1; i <= NUM_THREADS; i *= 2) {
        long millis = performUpdates(provider, i);
        System.err.format("%2d threads, %5d millis => %9d ups\n", i, millis, (int) ((i * NUM_UPDATES) / (millis / 1000.0)));
    }
    monitor.deconstruct();
}
Also used : MetricConsumer(com.yahoo.jdisc.application.MetricConsumer) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) SystemTimer(com.yahoo.jdisc.core.SystemTimer) Test(org.junit.Test)

Example 4 with HealthMonitorConfig

use of com.yahoo.container.jdisc.config.HealthMonitorConfig in project vespa by vespa-engine.

the class ConfigserverClusterTest method testHealthMonitorConfig.

@Test
public void testHealthMonitorConfig() {
    HealthMonitorConfig config = root.getConfig(HealthMonitorConfig.class, "configserver/standalone");
    assertThat(((int) config.snapshot_interval()), is(60));
}
Also used : HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) Test(org.junit.Test)

Example 5 with HealthMonitorConfig

use of com.yahoo.container.jdisc.config.HealthMonitorConfig in project vespa by vespa-engine.

the class Metrics method createTestMetrics.

public static Metrics createTestMetrics() {
    NullMetric metric = new NullMetric();
    Statistics.NullImplementation statistics = new Statistics.NullImplementation();
    HealthMonitorConfig.Builder builder = new HealthMonitorConfig.Builder();
    builder.snapshot_interval(60.0);
    return new Metrics(metric, statistics, new HealthMonitorConfig(builder));
}
Also used : NullMetric(com.yahoo.docproc.jdisc.metric.NullMetric) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) Statistics(com.yahoo.statistics.Statistics)

Aggregations

HealthMonitorConfig (com.yahoo.container.jdisc.config.HealthMonitorConfig)5 Test (org.junit.Test)4 MetricConsumer (com.yahoo.jdisc.application.MetricConsumer)2 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 StatisticsConfig (com.yahoo.container.StatisticsConfig)1 ApplicationMetadataConfig (com.yahoo.container.core.ApplicationMetadataConfig)1 NullMetric (com.yahoo.docproc.jdisc.metric.NullMetric)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 SystemTimer (com.yahoo.jdisc.core.SystemTimer)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