Search in sources :

Example 1 with MetricsManager

use of com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager in project dsbulk by datastax.

the class MonitoringSettings method newMetricsManager.

public MetricsManager newMetricsManager(boolean monitorWrites, boolean batchingEnabled, Path operationDirectory, Verbosity verbosity, ProtocolVersion protocolVersion, CodecRegistry codecRegistry, RowType rowType) {
    ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("reporter-%d").setPriority(Thread.MIN_PRIORITY).build();
    ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1, threadFactory);
    return new MetricsManager(registry, monitorWrites, executionId, scheduler, rateUnit, durationUnit, expectedWrites, expectedReads, trackBytes, jmx, csv, console, prometheus, operationDirectory, verbosity, reportRate, batchingEnabled, protocolVersion, codecRegistry, rowType);
}
Also used : ThreadFactory(java.util.concurrent.ThreadFactory) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) MetricsManager(com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager) ThreadFactoryBuilder(com.datastax.oss.driver.shaded.guava.common.util.concurrent.ThreadFactoryBuilder)

Example 2 with MetricsManager

use of com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager in project dsbulk by datastax.

the class MonitoringSettingsTest method should_create_metrics_manager_with_default_settings.

@Test
void should_create_metrics_manager_with_default_settings() {
    Config config = TestConfigUtils.createTestConfig("dsbulk.monitoring");
    MonitoringSettings settings = new MonitoringSettings(config, "test");
    settings.init();
    MetricsManager metricsManager = settings.newMetricsManager(false, true, null, LogSettings.Verbosity.normal, protocolVersion, codecRegistry, RowType.REGULAR);
    assertThat(metricsManager).isNotNull();
    assertThat(ReflectionUtils.getInternalState(metricsManager, "rateUnit")).isEqualTo(SECONDS);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "durationUnit")).isEqualTo(MILLISECONDS);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "reportInterval")).isEqualTo(Duration.ofSeconds(5));
    assertThat(ReflectionUtils.getInternalState(metricsManager, "expectedWrites")).isEqualTo(-1L);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "expectedReads")).isEqualTo(-1L);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "jmx")).isEqualTo(true);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "csv")).isEqualTo(false);
}
Also used : Config(com.typesafe.config.Config) MetricsManager(com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager) Test(org.junit.jupiter.api.Test)

Example 3 with MetricsManager

use of com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager in project dsbulk by datastax.

the class MonitoringSettingsTest method should_create_metrics_manager_with_user_supplied_settings.

@Test
void should_create_metrics_manager_with_user_supplied_settings() {
    Path tmpPath = Files.newTemporaryFolder().toPath();
    Config config = TestConfigUtils.createTestConfig("dsbulk.monitoring", "rateUnit", "MINUTES", "durationUnit", "SECONDS", "reportRate", "30 minutes", "expectedWrites", 1000, "expectedReads", 50, "trackBytes", true, "jmx", false, "csv", true);
    MonitoringSettings settings = new MonitoringSettings(config, "test");
    settings.init();
    MetricsManager metricsManager = settings.newMetricsManager(false, true, tmpPath, LogSettings.Verbosity.normal, protocolVersion, codecRegistry, RowType.REGULAR);
    assertThat(metricsManager).isNotNull();
    assertThat(ReflectionUtils.getInternalState(metricsManager, "rateUnit")).isEqualTo(MINUTES);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "durationUnit")).isEqualTo(SECONDS);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "reportInterval")).isEqualTo(Duration.ofMinutes(30));
    assertThat(ReflectionUtils.getInternalState(metricsManager, "expectedWrites")).isEqualTo(1000L);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "expectedReads")).isEqualTo(50L);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "jmx")).isEqualTo(false);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "csv")).isEqualTo(true);
    assertThat(ReflectionUtils.getInternalState(metricsManager, "operationDirectory")).isEqualTo(tmpPath);
}
Also used : Path(java.nio.file.Path) Config(com.typesafe.config.Config) MetricsManager(com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager) Test(org.junit.jupiter.api.Test)

Aggregations

MetricsManager (com.datastax.oss.dsbulk.workflow.commons.metrics.MetricsManager)3 Config (com.typesafe.config.Config)2 Test (org.junit.jupiter.api.Test)2 ThreadFactoryBuilder (com.datastax.oss.driver.shaded.guava.common.util.concurrent.ThreadFactoryBuilder)1 Path (java.nio.file.Path)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ThreadFactory (java.util.concurrent.ThreadFactory)1