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