Skip to content

Commit d260bf3

Browse files
committed
properties should never be null
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent 0f378df commit d260bf3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

prometheus-metrics-config/src/main/java/io/prometheus/metrics/config/PrometheusProperties.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.HashMap;
44
import java.util.Map;
5+
import javax.annotation.Nullable;
56

67
/**
78
* The Prometheus Java client library can be configured at runtime (e.g. using a properties file).
@@ -72,6 +73,7 @@ public MetricsProperties getDefaultMetricProperties() {
7273
* #getDefaultMetricProperties()}. May return {@code null} if no metric-specific properties are
7374
* configured for a metric name.
7475
*/
76+
@Nullable
7577
public MetricsProperties getMetricProperties(String metricName) {
7678
return metricProperties.get(metricName.replace(".", "_"));
7779
}
@@ -109,7 +111,7 @@ public static class Builder {
109111
ExporterFilterProperties.builder().build();
110112
private ExporterHttpServerProperties exporterHttpServerProperties =
111113
ExporterHttpServerProperties.builder().build();
112-
private ExporterPushgatewayProperties pushGatewayProperties =
114+
private ExporterPushgatewayProperties pushgatewayProperties =
113115
ExporterPushgatewayProperties.builder().build();
114116
private ExporterOpenTelemetryProperties otelConfig =
115117
ExporterOpenTelemetryProperties.builder().build();
@@ -154,7 +156,7 @@ public Builder exporterHttpServerProperties(
154156
}
155157

156158
public Builder pushgatewayProperties(ExporterPushgatewayProperties pushgatewayProperties) {
157-
this.pushGatewayProperties = pushgatewayProperties;
159+
this.pushgatewayProperties = pushgatewayProperties;
158160
return this;
159161
}
160162

@@ -172,7 +174,7 @@ public PrometheusProperties build() {
172174
exporterProperties,
173175
exporterFilterProperties,
174176
exporterHttpServerProperties,
175-
pushGatewayProperties,
177+
pushgatewayProperties,
176178
otelConfig);
177179
}
178180
}

0 commit comments

Comments
 (0)