Skip to content

Commit 651587b

Browse files
authored
Upgrade to Spring Java Format 0.0.34 (#3248)
This commit also applies its updated formatting.
1 parent 0838312 commit 651587b

File tree

28 files changed

+784
-780
lines changed

28 files changed

+784
-780
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ buildscript {
1616
classpath 'io.spring.nohttp:nohttp-gradle:0.0.10'
1717
classpath 'org.gradle:test-retry-gradle-plugin:1.4.0'
1818
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
19-
classpath 'io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.33'
19+
classpath 'io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.34'
2020

2121
constraints {
2222
classpath('org.ow2.asm:asm:7.3.1') {

buildscript-gradle.lockfile

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

implementations/micrometer-registry-atlas/src/main/java/io/micrometer/atlas/AtlasUtils.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ public class AtlasUtils {
2525
@Nullable
2626
static com.netflix.spectator.api.Statistic toSpectatorStatistic(Statistic stat) {
2727
switch (stat) {
28-
case COUNT:
29-
return count;
30-
case TOTAL_TIME:
31-
return totalTime;
32-
case TOTAL:
33-
return totalAmount;
34-
case VALUE:
35-
return gauge;
36-
case ACTIVE_TASKS:
37-
return activeTasks;
38-
case DURATION:
39-
return duration;
40-
case MAX:
41-
return max;
28+
case COUNT:
29+
return count;
30+
case TOTAL_TIME:
31+
return totalTime;
32+
case TOTAL:
33+
return totalAmount;
34+
case VALUE:
35+
return gauge;
36+
case ACTIVE_TASKS:
37+
return activeTasks;
38+
case DURATION:
39+
return duration;
40+
case MAX:
41+
return max;
4242
}
4343
return null;
4444
}

implementations/micrometer-registry-datadog/src/main/java/io/micrometer/datadog/DatadogMetricMetadata.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ static String sanitizeBaseUnit(@Nullable String baseUnit, @Nullable String overr
100100

101101
static String sanitizeType(Statistic statistic) {
102102
switch (statistic) {
103-
case COUNT:
104-
case TOTAL:
105-
case TOTAL_TIME:
106-
return "count";
107-
default:
108-
return "gauge";
103+
case COUNT:
104+
case TOTAL:
105+
case TOTAL_TIME:
106+
return "count";
107+
default:
108+
return "gauge";
109109
}
110110
}
111111

implementations/micrometer-registry-graphite/src/main/java/io/micrometer/graphite/GraphiteMeterRegistry.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ private static GraphiteReporter defaultGraphiteReporter(GraphiteConfig config, C
6666

6767
private static GraphiteSender getGraphiteSender(GraphiteConfig config) {
6868
switch (config.protocol()) {
69-
case PLAINTEXT:
70-
return new Graphite(config.host(), config.port());
71-
case UDP:
72-
return new GraphiteUDP(config.host(), config.port());
73-
case PICKLED:
74-
default:
75-
return new PickledGraphite(config.host(), config.port());
69+
case PLAINTEXT:
70+
return new Graphite(config.host(), config.port());
71+
case UDP:
72+
return new GraphiteUDP(config.host(), config.port());
73+
case PICKLED:
74+
default:
75+
return new PickledGraphite(config.host(), config.port());
7676
}
7777
}
7878

implementations/micrometer-registry-opentsdb/src/main/java/io/micrometer/opentsdb/OpenTSDBMeterRegistry.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -351,19 +351,19 @@ private Stream<String> writeCustomMetric(Meter meter) {
351351
String name = getConventionName(meter.getId());
352352

353353
switch (ms.getStatistic()) {
354-
case TOTAL:
355-
case TOTAL_TIME:
356-
name += ".sum";
357-
break;
358-
case MAX:
359-
name += ".max";
360-
break;
361-
case ACTIVE_TASKS:
362-
name += ".active.count";
363-
break;
364-
case DURATION:
365-
name += ".duration.sum";
366-
break;
354+
case TOTAL:
355+
case TOTAL_TIME:
356+
name += ".sum";
357+
break;
358+
case MAX:
359+
name += ".max";
360+
break;
361+
case ACTIVE_TASKS:
362+
name += ".active.count";
363+
break;
364+
case DURATION:
365+
name += ".duration.sum";
366+
break;
367367
}
368368

369369
return new OpenTSDBMetricBuilder().field("metric", name).datapoints(wallTime, ms.getValue()).tags(localTags)

implementations/micrometer-registry-opentsdb/src/main/java/io/micrometer/opentsdb/OpenTSDBNamingConvention.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,27 @@ public String name(String name, Meter.Type type, @Nullable String baseUnit) {
5757
String conventionName = NamingConvention.snakeCase.name(name, type, baseUnit);
5858

5959
switch (type) {
60-
case COUNTER:
61-
case DISTRIBUTION_SUMMARY:
62-
case GAUGE:
63-
if (baseUnit != null && !conventionName.endsWith("_" + baseUnit))
64-
conventionName += "_" + baseUnit;
65-
break;
60+
case COUNTER:
61+
case DISTRIBUTION_SUMMARY:
62+
case GAUGE:
63+
if (baseUnit != null && !conventionName.endsWith("_" + baseUnit))
64+
conventionName += "_" + baseUnit;
65+
break;
6666
}
6767

6868
switch (type) {
69-
case COUNTER:
70-
if (!conventionName.endsWith("_total"))
71-
conventionName += "_total";
72-
break;
73-
case TIMER:
74-
case LONG_TASK_TIMER:
75-
if (conventionName.endsWith(timerSuffix)) {
76-
conventionName += "_seconds";
77-
}
78-
else if (!conventionName.endsWith("_seconds"))
79-
conventionName += timerSuffix + "_seconds";
80-
break;
69+
case COUNTER:
70+
if (!conventionName.endsWith("_total"))
71+
conventionName += "_total";
72+
break;
73+
case TIMER:
74+
case LONG_TASK_TIMER:
75+
if (conventionName.endsWith(timerSuffix)) {
76+
conventionName += "_seconds";
77+
}
78+
else if (!conventionName.endsWith("_seconds"))
79+
conventionName += timerSuffix + "_seconds";
80+
break;
8181
}
8282

8383
String sanitized = nameChars.matcher(conventionName).replaceAll(SEPARATOR);

implementations/micrometer-registry-prometheus/src/main/java/io/micrometer/prometheus/MicrometerCollector.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,24 @@ public List<MetricFamilySamples> collect() {
8686
@Override
8787
public List<MetricFamilySamples> describe() {
8888
switch (id.getType()) {
89-
case COUNTER:
90-
return Collections.singletonList(
91-
new MetricFamilySamples(conventionName, Type.COUNTER, help, Collections.emptyList()));
92-
93-
case GAUGE:
94-
return Collections
95-
.singletonList(new MetricFamilySamples(conventionName, Type.GAUGE, help, Collections.emptyList()));
96-
97-
case TIMER:
98-
case DISTRIBUTION_SUMMARY:
99-
case LONG_TASK_TIMER:
100-
return Arrays.asList(new MetricFamilySamples(conventionName, Type.HISTOGRAM, help, Collections.emptyList()),
101-
new MetricFamilySamples(conventionName + "_max", Type.GAUGE, help, Collections.emptyList()));
102-
103-
default:
104-
return Collections.singletonList(
105-
new MetricFamilySamples(conventionName, Type.UNKNOWN, help, Collections.emptyList()));
89+
case COUNTER:
90+
return Collections.singletonList(
91+
new MetricFamilySamples(conventionName, Type.COUNTER, help, Collections.emptyList()));
92+
93+
case GAUGE:
94+
return Collections.singletonList(
95+
new MetricFamilySamples(conventionName, Type.GAUGE, help, Collections.emptyList()));
96+
97+
case TIMER:
98+
case DISTRIBUTION_SUMMARY:
99+
case LONG_TASK_TIMER:
100+
return Arrays.asList(
101+
new MetricFamilySamples(conventionName, Type.HISTOGRAM, help, Collections.emptyList()),
102+
new MetricFamilySamples(conventionName + "_max", Type.GAUGE, help, Collections.emptyList()));
103+
104+
default:
105+
return Collections.singletonList(
106+
new MetricFamilySamples(conventionName, Type.UNKNOWN, help, Collections.emptyList()));
106107
}
107108
}
108109

implementations/micrometer-registry-prometheus/src/main/java/io/micrometer/prometheus/PrometheusDistributionSummary.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public class PrometheusDistributionSummary extends AbstractDistributionSummary {
4949

5050
if (distributionStatisticConfig.isPublishingHistogram()) {
5151
switch (histogramFlavor) {
52-
case Prometheus:
53-
histogram = new TimeWindowFixedBoundaryHistogram(clock, DistributionStatisticConfig.builder()
54-
// effectively never roll over
55-
.expiry(Duration.ofDays(1825)).bufferLength(1).build().merge(distributionStatisticConfig),
56-
true);
57-
break;
58-
case VictoriaMetrics:
59-
histogram = new FixedBoundaryVictoriaMetricsHistogram();
60-
break;
61-
default:
62-
histogram = null;
63-
break;
52+
case Prometheus:
53+
histogram = new TimeWindowFixedBoundaryHistogram(clock, DistributionStatisticConfig.builder()
54+
// effectively never roll over
55+
.expiry(Duration.ofDays(1825)).bufferLength(1).build().merge(distributionStatisticConfig),
56+
true);
57+
break;
58+
case VictoriaMetrics:
59+
histogram = new FixedBoundaryVictoriaMetricsHistogram();
60+
break;
61+
default:
62+
histogram = null;
63+
break;
6464
}
6565
}
6666
else {

0 commit comments

Comments
 (0)