use of org.apache.kafka.connect.runtime.ConnectMetrics.MetricGroup in project apache-kafka-on-k8s by banzaicloud.
the class WorkerSinkTaskTest method assertTaskMetricValue.
private void assertTaskMetricValue(String name, String expected) {
MetricGroup taskGroup = workerTask.taskMetricsGroup().metricGroup();
String measured = metrics.currentMetricValueAsString(taskGroup, name);
assertEquals(expected, measured);
}
use of org.apache.kafka.connect.runtime.ConnectMetrics.MetricGroup in project apache-kafka-on-k8s by banzaicloud.
the class WorkerSinkTaskTest method assertTaskMetricValue.
private void assertTaskMetricValue(String name, double expected) {
MetricGroup taskGroup = workerTask.taskMetricsGroup().metricGroup();
double measured = metrics.currentMetricValueAsDouble(taskGroup, name);
assertEquals(expected, measured, 0.001d);
}
use of org.apache.kafka.connect.runtime.ConnectMetrics.MetricGroup in project apache-kafka-on-k8s by banzaicloud.
the class WorkerSinkTaskTest method assertMetrics.
private void assertMetrics(int minimumPollCountExpected) {
MetricGroup sinkTaskGroup = workerTask.sinkTaskMetricsGroup().metricGroup();
MetricGroup taskGroup = workerTask.taskMetricsGroup().metricGroup();
double readRate = metrics.currentMetricValueAsDouble(sinkTaskGroup, "sink-record-read-rate");
double readTotal = metrics.currentMetricValueAsDouble(sinkTaskGroup, "sink-record-read-total");
double sendRate = metrics.currentMetricValueAsDouble(sinkTaskGroup, "sink-record-send-rate");
double sendTotal = metrics.currentMetricValueAsDouble(sinkTaskGroup, "sink-record-send-total");
}
use of org.apache.kafka.connect.runtime.ConnectMetrics.MetricGroup in project apache-kafka-on-k8s by banzaicloud.
the class WorkerTest method assertStatistics.
private void assertStatistics(Worker worker, int connectors, int tasks) {
MetricGroup workerMetrics = worker.workerMetricsGroup().metricGroup();
assertEquals(connectors, MockConnectMetrics.currentMetricValueAsDouble(worker.metrics(), workerMetrics, "connector-count"), 0.0001d);
assertEquals(tasks, MockConnectMetrics.currentMetricValueAsDouble(worker.metrics(), workerMetrics, "task-count"), 0.0001d);
assertEquals(tasks, MockConnectMetrics.currentMetricValueAsDouble(worker.metrics(), workerMetrics, "task-count"), 0.0001d);
}
use of org.apache.kafka.connect.runtime.ConnectMetrics.MetricGroup in project apache-kafka-on-k8s by banzaicloud.
the class ConnectMetricsTest method addToGroup.
private int addToGroup(ConnectMetrics connectMetrics, boolean shouldClose) {
ConnectMetricsRegistry registry = connectMetrics.registry();
ConnectMetrics.MetricGroup metricGroup = connectMetrics.group(registry.taskGroupName(), registry.connectorTagName(), "conn_name");
if (shouldClose) {
metricGroup.close();
}
Sensor sensor = metricGroup.sensor("my_sensor");
sensor.add(metricName("x1"), new Max());
sensor.add(metricName("y2"), new Avg());
return metricGroup.metrics().metrics().size();
}
Aggregations