use of com.datastax.oss.dsbulk.workflow.commons.metrics.prometheus.PrometheusManager in project dsbulk by datastax.
the class MetricsManagerTest method should_exchange_metrics_with_prometheus.
@Test
void should_exchange_metrics_with_prometheus() throws Exception {
Path executionDirectory = Files.createTempDirectory("test");
PrometheusManager prometheus = mock(PrometheusManager.class);
MetricsManager manager = new MetricsManager(new MetricRegistry(), true, "test", Executors.newSingleThreadScheduledExecutor(), SECONDS, MILLISECONDS, -1, -1, true, false, false, false, prometheus, executionDirectory, LogSettings.Verbosity.verbose, Duration.ofSeconds(5), true, protocolVersion, codecRegistry, RowType.REGULAR);
manager.init();
manager.start();
manager.stop(Duration.ofSeconds(123), true);
manager.close();
manager.reportFinalMetrics();
verify(prometheus).init();
verify(prometheus).start();
verify(prometheus).close();
verify(prometheus).pushMetrics(Duration.ofSeconds(123), true);
}
use of com.datastax.oss.dsbulk.workflow.commons.metrics.prometheus.PrometheusManager in project dsbulk by datastax.
the class MonitoringSettings method configurePrometheus.
private PrometheusManager configurePrometheus(Config config) {
boolean pullEnabled = config.getBoolean("pull.enabled");
boolean pushEnabled = config.getBoolean("push.enabled");
if (!pullEnabled && !pushEnabled) {
return null;
}
PullConfig pullConfig = null;
if (pullEnabled) {
pullConfig = new PullConfig(config.getString("pull.hostname"), config.getInt("pull.port"));
}
PushConfig pushConfig = null;
if (pushEnabled) {
pushConfig = new PushConfig(ConfigUtils.getURL(config, "push.url"), config.getString("push.username"), config.getString("push.password"), config.getBoolean("push.groupBy.instance"), config.getBoolean("push.groupBy.operation"), ConfigUtils.getStringMap(config, "push.groupBy.keys"));
}
return new PrometheusManager(registry, executionId, config.getString("job"), ConfigUtils.getStringMap(config, "labels"), pullConfig, pushConfig);
}
Aggregations