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());
}
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);
}
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();
}
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));
}
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));
}
Aggregations