From 192f02089b1a7896a5526c952669de69b6c225f5 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Tue, 5 Sep 2023 12:19:29 +0300 Subject: [PATCH] Fix NPE --- .../prometheus/CassandraTasksExports.java | 44 ++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/management-api-agent-common/src/main/java/io/k8ssandra/metrics/prometheus/CassandraTasksExports.java b/management-api-agent-common/src/main/java/io/k8ssandra/metrics/prometheus/CassandraTasksExports.java index bf871ced..dc95c727 100644 --- a/management-api-agent-common/src/main/java/io/k8ssandra/metrics/prometheus/CassandraTasksExports.java +++ b/management-api-agent-common/src/main/java/io/k8ssandra/metrics/prometheus/CassandraTasksExports.java @@ -69,35 +69,59 @@ List getStreamInfoStats() { // These should be EA targets, 8 metrics to create CassandraMetricDefinition filesToReceive = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_files_to_receive", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_files_to_receive", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition filesReceived = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_files_received", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_files_received", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition sizeToReceive = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_size_to_receive", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_size_to_receive", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition sizeReceived = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_size_received", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_size_received", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition filesToSend = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_files_to_send", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_files_to_send", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition filesSent = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_files_sent", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_files_sent", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition sizeToSend = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_size_to_send", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_size_to_send", + "", + additionalLabels, + Lists.newArrayList()); CassandraMetricDefinition sizeSent = parser.parseDropwizardMetric( - METRICS_PREFIX + "streaming_total_size_sent", "", additionalLabels, null); + METRICS_PREFIX + "streaming_total_size_sent", + "", + additionalLabels, + Lists.newArrayList()); // This is a lot simpler code without all the casting back and forth if description was in the // same place for @@ -275,11 +299,11 @@ List getCompactionStats() { // These should be EA targets.. CassandraMetricDefinition protoCompleted = parser.parseDropwizardMetric( - METRICS_PREFIX + "compaction_stats_completed", "", additionalLabels, null); + METRICS_PREFIX + "compaction_stats_completed", "", additionalLabels, new ArrayList<>()); CassandraMetricDefinition protoTotal = parser.parseDropwizardMetric( - METRICS_PREFIX + "compaction_stats_total", "", additionalLabels, null); + METRICS_PREFIX + "compaction_stats_total", "", additionalLabels, new ArrayList<>()); List completedSamples = new ArrayList<>(compactions.size() * 2); List totalSamples = new ArrayList<>(compactions.size() * 2);