When running Spotbugs against the project, it was throwing the following errors:
[ERROR] Low: KafkaPrometheusMetricsReporter.httpServer not initialized in constructor and dereferenced in io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter.getPort() [io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter] At KafkaPrometheusMetricsReporter.java:[line 90] UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR
[ERROR] Low: KafkaPrometheusMetricsReporter.kafkaMetricsCollector not initialized in constructor and dereferenced in io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter.contextChange(MetricsContext) [io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter] At KafkaPrometheusMetricsReporter.java:[line 86] UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR
[ERROR] Low: KafkaPrometheusMetricsReporter.kafkaMetricsCollector not initialized in constructor and dereferenced in io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter.metricChange(KafkaMetric) [io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter] At KafkaPrometheusMetricsReporter.java:[line 55] UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR
[ERROR] Low: KafkaPrometheusMetricsReporter.kafkaMetricsCollector not initialized in constructor and dereferenced in io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter.metricRemoval(KafkaMetric) [io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter] At KafkaPrometheusMetricsReporter.java:[line 61] UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR```
This PR will try to fix this issue by making KafkaMetricsCollector configurable and adding to necessary constructors items.
When running Spotbugs against the project, it was throwing the following errors: