Skip to content

Commit

Permalink
Fix Javadoc Warnings (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Owen <[email protected]>
  • Loading branch information
OwenCorrigan76 authored Mar 11, 2024
1 parent 19050c4 commit 3c6d761
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
<configuration>
<show>public</show>
<failOnError>true</failOnError>
<failOnWarnings>false</failOnWarnings>
<failOnWarnings>true</failOnWarnings>
</configuration>
</execution>
</executions>
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/io/strimzi/kafka/metrics/KafkaMetricsCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ public class KafkaMetricsCollector extends Collector {
@SuppressFBWarnings({"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"}) // Should be investigated as part of https://github.com/strimzi/metrics-reporter/issues/12
private String prefix;

/**
* Constructs a new KafkaMetricsCollector with provided configuration.
*
* @param config The configuration for the PrometheusMetricsReporter.
*/
public KafkaMetricsCollector(PrometheusMetricsReporterConfig config) {
this.config = config;
this.metrics = new ConcurrentHashMap<>();
}

/**
* Sets the prefix to be used for metric names.
*
* @param prefix The prefix to set.
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
}
Expand Down Expand Up @@ -65,10 +75,20 @@ public List<MetricFamilySamples> collect() {
return samples;
}

/**
* Adds a Kafka metric to be collected.
*
* @param metric The Kafka metric to add.
*/
public void addMetric(KafkaMetric metric) {
metrics.put(metric.metricName(), metric);
}

/**
* Removes a Kafka metric from collection.
*
* @param metric The Kafka metric to remove.
*/
public void removeMetric(KafkaMetric metric) {
metrics.remove(metric.metricName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public void contextChange(MetricsContext metricsContext) {
kafkaMetricsCollector.setPrefix(prefix);
}

/**
*
Retrieves the port number on which the HTTP server is running.
*
@return The port number of the HTTP server.
*/
public int getPort() {
return httpServer.get().getPort();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public class MetricFamilySamplesBuilder {
private final String help;
private final List<Collector.MetricFamilySamples.Sample> samples;

/**
* Constructor for MetricFamilySamplesBuilder.
*
* @param type The type of the metric family.
* @param help The help string for the metric family.
*/
public MetricFamilySamplesBuilder(Collector.Type type, String help) {
this.type = type;
this.help = help;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class YammerMetricsCollector extends Collector {
private final List<MetricsRegistry> registries;
private final PrometheusMetricsReporterConfig config;

/**
* Constructs a new YammerMetricsCollector with the provided configuration.
*
* @param config The configuration for the YammerMetricsCollector.
*/
public YammerMetricsCollector(PrometheusMetricsReporterConfig config) {
this.config = config;
this.registries = Arrays.asList(KafkaYammerMetrics.defaultRegistry(), Metrics.defaultRegistry());
Expand Down

0 comments on commit 3c6d761

Please sign in to comment.