Skip to content

Commit e1d56a7

Browse files
committed
add checkstyle
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent 94d5674 commit e1d56a7

File tree

11 files changed

+26
-15
lines changed

11 files changed

+26
-15
lines changed

checkstyle.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242

4343
<module name="LineLength">
4444
<property name="fileExtensions" value="java"/>
45-
<property name="max" value="200"/>
45+
<property name="max" value="100"/>
4646
<property name="ignorePattern"
47-
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
47+
value="^package.*|^import.*|a href|href|http://|https://|ftp://|# HELP.*|jvm_runtime_info\{"/>
4848
</module>
4949

5050
<module name="TreeWalker">

examples/example-exporter-opentelemetry/src/main/java/io/prometheus/metrics/examples/opentelemetry/ManualCompleteMetricsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public static void main(String[] args) throws Exception {
5959
histogram.labelValues("200").observe(random.nextGaussian());
6060
}
6161
62-
// Explicitly use a classic-only histogram to have an example of a classic histogram in OpenTelemetry
62+
// Explicitly use a classic-only histogram to have an example of a classic
63+
// histogram in OpenTelemetry
6364
Histogram classicHistogram = Histogram.newBuilder()
6465
.withName("request_size_bytes")
6566
.withHelp("Request size in Bytes")

prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/StatefulMetric.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public D labelValues(String... labelValues) {
105105
getClass().getSimpleName()
106106
+ " "
107107
+ getMetadata().getName()
108-
+ " was created with label names, so you must call labelValues(...) when using it.");
108+
+ " was created with label names, so you must call labelValues(...)"
109+
+ " when using it.");
109110
} else {
110111
throw new IllegalArgumentException(
111112
"Expected " + labelNames.length + " label values, but got " + labelValues.length + ".");

prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusScrapeHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ private boolean writeDebugResponse(MetricSnapshots snapshots, PrometheusHttpExch
157157
body.write(
158158
("debug="
159159
+ debugParam
160-
+ ": Unsupported query parameter. Valid values are 'openmetrics', 'text', and 'prometheus-protobuf'.")
160+
+ ": Unsupported query parameter. Valid values are 'openmetrics', "
161+
+ "'text', and 'prometheus-protobuf'.")
161162
.getBytes(StandardCharsets.UTF_8));
162163
break;
163164
}

prometheus-metrics-exporter-httpserver/src/main/java/io/prometheus/metrics/exporter/httpserver/HttpExchangeAdapter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ private void sendErrorResponseWithStackTrace(Exception requestHandlerException)
120120
Logger.getLogger(this.getClass().getName())
121121
.log(
122122
Level.SEVERE,
123-
"The Prometheus metrics HTTPServer caught an Exception during scrape and failed to send an error response to the client.",
123+
"The Prometheus metrics HTTPServer caught an Exception during scrape and "
124+
+ "failed to send an error response to the client.",
124125
errorWriterException);
125126
Logger.getLogger(this.getClass().getName())
126127
.log(
@@ -134,7 +135,8 @@ private void sendErrorResponseWithStackTrace(Exception requestHandlerException)
134135
Logger.getLogger(this.getClass().getName())
135136
.log(
136137
Level.SEVERE,
137-
"The Prometheus metrics HTTPServer caught an Exception while trying to send the metrics response.",
138+
"The Prometheus metrics HTTPServer caught an Exception while trying to send "
139+
+ "the metrics response.",
138140
requestHandlerException);
139141
}
140142
}

prometheus-metrics-instrumentation-dropwizard5/src/main/java/io/prometheus/metrics/instrumentation/dropwizard5/DropwizardExports.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ MetricSnapshot fromMeter(String dropwizardName, Meter meter) {
196196
@Override
197197
public MetricSnapshots collect() {
198198
MetricSnapshots.Builder metricSnapshots = MetricSnapshots.builder();
199-
for (Map.Entry<MetricName, Gauge> entry : registry.getGauges(metricFilter).entrySet()) {
199+
for (@SuppressWarnings("rawtypes")
200+
Map.Entry<MetricName, Gauge> entry : registry.getGauges(metricFilter).entrySet()) {
200201
Optional.ofNullable(fromGauge(entry.getKey().getKey(), entry.getValue()))
201202
.ifPresent(metricSnapshots::metricSnapshot);
202203
}

prometheus-metrics-instrumentation-jvm/src/main/java/io/prometheus/metrics/instrumentation/jvm/JvmClassLoadingMetrics.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ private void register(PrometheusRegistry registry) {
6767
CounterWithCallback.builder(config)
6868
.name(JVM_CLASSES_UNLOADED_TOTAL)
6969
.help(
70-
"The total number of classes that have been unloaded since the JVM has started execution")
70+
"The total number of classes that have been unloaded since the JVM has "
71+
+ "started execution")
7172
.callback(callback -> callback.call(classLoadingBean.getUnloadedClassCount()))
7273
.register(registry);
7374
}

prometheus-metrics-instrumentation-jvm/src/main/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetrics.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ private void register(PrometheusRegistry registry) {
6161
Counter.builder()
6262
.name(JVM_MEMORY_POOL_ALLOCATED_BYTES_TOTAL)
6363
.help(
64-
"Total bytes allocated in a given JVM memory pool. Only updated after GC, not continuously.")
64+
"Total bytes allocated in a given JVM memory pool. Only updated after GC, "
65+
+ "not continuously.")
6566
.labelNames("pool")
6667
.register(registry);
6768

prometheus-metrics-instrumentation-jvm/src/main/java/io/prometheus/metrics/instrumentation/jvm/JvmNativeMemoryMetrics.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ private void register(PrometheusRegistry registry) {
110110
GaugeWithCallback.builder(config)
111111
.name(JVM_NATIVE_MEMORY_RESERVED_BYTES)
112112
.help(
113-
"Reserved bytes of a given JVM. Reserved memory represents the total amount of memory the JVM can potentially use.")
113+
"Reserved bytes of a given JVM. Reserved memory represents the total amount of "
114+
+ "memory the JVM can potentially use.")
114115
.unit(Unit.BYTES)
115116
.labelNames("pool")
116117
.callback(makeCallback(true))
@@ -119,7 +120,8 @@ private void register(PrometheusRegistry registry) {
119120
GaugeWithCallback.builder(config)
120121
.name(JVM_NATIVE_MEMORY_COMMITTED_BYTES)
121122
.help(
122-
"Committed bytes of a given JVM. Committed memory represents the amount of memory the JVM is using right now.")
123+
"Committed bytes of a given JVM. Committed memory represents the amount of "
124+
+ "memory the JVM is using right now.")
123125
.unit(Unit.BYTES)
124126
.labelNames("pool")
125127
.callback(makeCallback(false))

prometheus-metrics-instrumentation-jvm/src/main/java/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetrics.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ private void register(PrometheusRegistry registry) {
109109
GaugeWithCallback.builder(config)
110110
.name(JVM_THREADS_DEADLOCKED)
111111
.help(
112-
"Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers")
112+
"Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or "
113+
+ "ownable synchronizers")
113114
.callback(
114115
callback -> callback.call(nullSafeArrayLength(threadBean.findDeadlockedThreads())))
115116
.register(registry);

0 commit comments

Comments
 (0)