Skip to content

Commit 31c8c7c

Browse files
committed
fix
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 93a5083 commit 31c8c7c

1 file changed

Lines changed: 31 additions & 33 deletions

File tree

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

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ MetricsProperties get(String metricName) {
5656
return map.get(normalize(metricName));
5757
}
5858

59-
// copied from PrometheusNaming - but we can't reuse that class here because it's in a module that
59+
// copied from PrometheusNaming - but we can't reuse that class here because it's in a module
60+
// that
6061
// depends on PrometheusProperties, which would create a circular dependency.
6162
private static String normalize(String name) {
6263
StringBuilder escaped = new StringBuilder();
@@ -76,10 +77,10 @@ private static String normalize(String name) {
7677

7778
private static boolean isValidLegacyChar(int c, int i) {
7879
return (c >= 'a' && c <= 'z')
79-
|| (c >= 'A' && c <= 'Z')
80-
|| c == '_'
81-
|| c == ':'
82-
|| (c >= '0' && c <= '9' && i > 0);
80+
|| (c >= 'A' && c <= 'Z')
81+
|| c == '_'
82+
|| c == ':'
83+
|| (c >= '0' && c <= '9' && i > 0);
8384
}
8485

8586
/**
@@ -103,14 +104,14 @@ public static Builder builder() {
103104

104105
// Package-private constructor for PrometheusPropertiesLoader and Builder
105106
PrometheusProperties(
106-
MetricsProperties defaultMetricsProperties,
107-
MetricPropertiesMap metricProperties,
108-
ExemplarsProperties exemplarProperties,
109-
ExporterProperties exporterProperties,
110-
ExporterFilterProperties exporterFilterProperties,
111-
ExporterHttpServerProperties httpServerConfig,
112-
ExporterPushgatewayProperties pushgatewayProperties,
113-
ExporterOpenTelemetryProperties otelConfig) {
107+
MetricsProperties defaultMetricsProperties,
108+
MetricPropertiesMap metricProperties,
109+
ExemplarsProperties exemplarProperties,
110+
ExporterProperties exporterProperties,
111+
ExporterFilterProperties exporterFilterProperties,
112+
ExporterHttpServerProperties httpServerConfig,
113+
ExporterPushgatewayProperties pushgatewayProperties,
114+
ExporterOpenTelemetryProperties otelConfig) {
114115
this.defaultMetricsProperties = defaultMetricsProperties;
115116
this.metricProperties = metricProperties;
116117
this.exemplarProperties = exemplarProperties;
@@ -135,7 +136,7 @@ public MetricsProperties getDefaultMetricProperties() {
135136
* configured for a metric name.
136137
*
137138
* @param metricName the metric name (dots will be automatically converted to underscores to match
138-
* exposition format)
139+
* exposition format)
139140
*/
140141
@Nullable
141142
public MetricsProperties getMetricProperties(String metricName) {
@@ -172,16 +173,15 @@ public static class Builder {
172173
private ExemplarsProperties exemplarProperties = ExemplarsProperties.builder().build();
173174
private ExporterProperties exporterProperties = ExporterProperties.builder().build();
174175
private ExporterFilterProperties exporterFilterProperties =
175-
ExporterFilterProperties.builder().build();
176+
ExporterFilterProperties.builder().build();
176177
private ExporterHttpServerProperties exporterHttpServerProperties =
177-
ExporterHttpServerProperties.builder().build();
178+
ExporterHttpServerProperties.builder().build();
178179
private ExporterPushgatewayProperties pushgatewayProperties =
179-
ExporterPushgatewayProperties.builder().build();
180+
ExporterPushgatewayProperties.builder().build();
180181
private ExporterOpenTelemetryProperties otelConfig =
181-
ExporterOpenTelemetryProperties.builder().build();
182+
ExporterOpenTelemetryProperties.builder().build();
182183

183-
private Builder() {
184-
}
184+
private Builder() {}
185185

186186
public Builder defaultMetricsProperties(MetricsProperties defaultMetricsProperties) {
187187
this.defaultMetricsProperties = defaultMetricsProperties;
@@ -193,9 +193,7 @@ public Builder metricProperties(Map<String, MetricsProperties> metricProperties)
193193
return this;
194194
}
195195

196-
/**
197-
* Convenience for adding a single named MetricsProperties
198-
*/
196+
/** Convenience for adding a single named MetricsProperties */
199197
public Builder putMetricProperty(String name, MetricsProperties props) {
200198
this.metricProperties.put(name, props);
201199
return this;
@@ -217,7 +215,7 @@ public Builder exporterFilterProperties(ExporterFilterProperties exporterFilterP
217215
}
218216

219217
public Builder exporterHttpServerProperties(
220-
ExporterHttpServerProperties exporterHttpServerProperties) {
218+
ExporterHttpServerProperties exporterHttpServerProperties) {
221219
this.exporterHttpServerProperties = exporterHttpServerProperties;
222220
return this;
223221
}
@@ -228,21 +226,21 @@ public Builder pushgatewayProperties(ExporterPushgatewayProperties pushgatewayPr
228226
}
229227

230228
public Builder exporterOpenTelemetryProperties(
231-
ExporterOpenTelemetryProperties exporterOpenTelemetryProperties) {
229+
ExporterOpenTelemetryProperties exporterOpenTelemetryProperties) {
232230
this.otelConfig = exporterOpenTelemetryProperties;
233231
return this;
234232
}
235233

236234
public PrometheusProperties build() {
237235
return new PrometheusProperties(
238-
defaultMetricsProperties,
239-
metricProperties,
240-
exemplarProperties,
241-
exporterProperties,
242-
exporterFilterProperties,
243-
exporterHttpServerProperties,
244-
pushgatewayProperties,
245-
otelConfig);
236+
defaultMetricsProperties,
237+
metricProperties,
238+
exemplarProperties,
239+
exporterProperties,
240+
exporterFilterProperties,
241+
exporterHttpServerProperties,
242+
pushgatewayProperties,
243+
otelConfig);
246244
}
247245
}
248246
}

0 commit comments

Comments
 (0)