Skip to content

Commit ac27835

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

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ root = true
22

33
[*]
44
max_line_length = 100
5+
indent_size = 2

checkstyle.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@
266266
</module>
267267
-->
268268
<module name="OverloadMethodsDeclarationOrder"/>
269-
<!-- there are only a few violations of this, and they all appear to be for good reasons
270269
<module name="VariableDeclarationUsageDistance"/>
271-
-->
272270
<module name="CustomImportOrder">
273271
<property name="sortImportsInGroupAlphabetically" value="true"/>
274272
<property name="separateLineBetweenGroups" value="true"/>

integration-tests/it-exporter/it-exporter-httpserver-sample/src/main/java/io/prometheus/metrics/it/exporter/httpserver/HTTPServerSample.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public static void main(String[] args) throws IOException, InterruptedException
2626

2727
int port = parsePortOrExit(args[0]);
2828
Mode mode = parseModeOrExit(args[1]);
29+
run(mode, port);
30+
}
2931

32+
private static void run(Mode mode, int port) throws IOException, InterruptedException {
3033
Counter counter =
3134
Counter.builder()
3235
.name("uptime_seconds_total")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,11 @@ public void register() {
309309
}
310310

311311
public void register(PrometheusRegistry registry) {
312-
MemoryMXBean memoryMXBean =
312+
MemoryMXBean bean =
313313
this.memoryBean != null ? this.memoryBean : ManagementFactory.getMemoryMXBean();
314314
List<MemoryPoolMXBean> poolBeans =
315315
this.poolBeans != null ? this.poolBeans : ManagementFactory.getMemoryPoolMXBeans();
316-
new JvmMemoryMetrics(poolBeans, memoryMXBean, config).register(registry);
316+
new JvmMemoryMetrics(poolBeans, bean, config).register(registry);
317317
}
318318
}
319319
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ private JvmMemoryPoolAllocationMetrics(List<GarbageCollectorMXBean> garbageColle
5656
}
5757

5858
private void register(PrometheusRegistry registry) {
59-
6059
Counter allocatedCounter =
6160
Counter.builder()
6261
.name(JVM_MEMORY_POOL_ALLOCATED_BYTES_TOTAL)
@@ -68,10 +67,9 @@ private void register(PrometheusRegistry registry) {
6867

6968
AllocationCountingNotificationListener listener =
7069
new AllocationCountingNotificationListener(allocatedCounter);
71-
for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorBeans) {
72-
if (garbageCollectorMXBean instanceof NotificationEmitter) {
73-
((NotificationEmitter) garbageCollectorMXBean)
74-
.addNotificationListener(listener, null, null);
70+
for (GarbageCollectorMXBean bean : garbageCollectorBeans) {
71+
if (bean instanceof NotificationEmitter) {
72+
((NotificationEmitter) bean).addNotificationListener(listener, null, null);
7573
}
7674
}
7775
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private Map<String, Integer> getThreadStateCountMap(ThreadMXBean threadBean) {
149149
}
150150
}
151151

152-
int numberOfInvalidThreadIds = threadIds.length - writePos;
152+
final int numberOfInvalidThreadIds = threadIds.length - writePos;
153153
threadIds = Arrays.copyOf(threadIds, writePos);
154154

155155
// Get thread information without computing any stack traces

0 commit comments

Comments
 (0)