Skip to content

Commit 64b9194

Browse files
committed
Merge branch '1.13.x' into 1.14.x
2 parents e8fa905 + 8149b4d commit 64b9194

File tree

20 files changed

+72
-47
lines changed

20 files changed

+72
-47
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ executors:
44
circle-jdk-executor:
55
working_directory: ~/micrometer
66
environment:
7-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
7+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
88
resource_class: medium+
99
docker:
1010
- image: cimg/openjdk:21.0.6
1111
circle-jdk17-executor:
1212
working_directory: ~/micrometer
1313
environment:
14-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
14+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
1515
resource_class: medium+
1616
docker:
1717
- image: cimg/openjdk:17.0.14
1818
circle-jdk11-executor:
1919
working_directory: ~/micrometer
2020
environment:
21-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
21+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
2222
resource_class: medium+
2323
docker:
2424
- image: cimg/openjdk:11.0.26

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11+
classpath libs.plugin.errorprone
1112
classpath libs.plugin.license
1213
classpath libs.plugin.nebulaRelease
1314
classpath libs.plugin.nebulaPublishing
@@ -61,11 +62,21 @@ allprojects {
6162
}
6263

6364
subprojects {
65+
apply plugin: 'net.ltgt.errorprone'
6466
apply plugin: 'signing'
6567
apply plugin: 'io.spring.javaformat'
6668
apply plugin: 'com.diffplug.spotless'
6769

6870
if (project.name != 'micrometer-bom') {
71+
tasks.withType(JavaCompile).configureEach {
72+
if (!javaLanguageVersion.canCompileOrRun(17)) {
73+
// Error Prone does not work with JDK <17
74+
options.errorprone.enabled = false
75+
}
76+
if (System.env.CI != null) {
77+
options.errorprone.disableAllWarnings = true
78+
}
79+
}
6980
if ((project.name.contains('samples') && !project.name.contains('kotlin')) || project.name.contains('benchmarks')) {
7081
apply plugin: 'java'
7182
} else {
@@ -103,6 +114,7 @@ subprojects {
103114
// JSR-305 only used for non-required meta-annotations
104115
optionalApi libs.jsr305
105116
checkstyle libs.spring.javaformatCheckstyle
117+
errorprone(libs.errorprone)
106118
}
107119

108120
tasks {

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ dropwizardMetricsCore5 = { module = "io.dropwizard.metrics5:metrics-core", versi
105105
dynatraceUtils = { module = "com.dynatrace.metric.util:dynatrace-metric-utils-java", version.ref = "dynatrace-utils" }
106106
ehcache2 = { module = "net.sf.ehcache:ehcache", version.ref = "ehcache2" }
107107
ehcache3 = { module = "org.ehcache:ehcache", version.ref = "ehcache3" }
108+
errorprone = { module = "com.google.errorprone:error_prone_core", version = "2.37.0" }
108109
felixFramework = "org.apache.felix:org.apache.felix.framework:7.0.5"
109110
felixScr = "org.apache.felix:org.apache.felix.scr:2.2.12"
110111
gmetric4j = { module = "info.ganglia.gmetric4j:gmetric4j", version.ref = "gmetric4j" }
@@ -219,6 +220,7 @@ wiremock = { module = "com.github.tomakehurst:wiremock-jre8-standalone", version
219220
wiremockJunit5 = { module = "ru.lanwen.wiremock:wiremock-junit5", version.ref = "wiremock-junit5" }
220221

221222
# plugin dependencies
223+
plugin-errorprone = { module = "net.ltgt.errorprone:net.ltgt.errorprone.gradle.plugin", version = "4.1.0" }
222224
plugin-license = { module = "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin", version = "0.16.1" }
223225
plugin-nebulaRelease = { module = "com.netflix.nebula:nebula-release-plugin", version = "18.0.8" }
224226
plugin-nebulaPublishing = { module = "com.netflix.nebula:nebula-publishing-plugin", version = "20.3.0" }

implementations/micrometer-registry-elastic/src/main/java/io/micrometer/elastic/ElasticConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ default String index() {
7676
* separated by the {@link #indexDateSeparator()}. Default is: "yyyy-MM"
7777
* @return date format for index
7878
*/
79+
@SuppressWarnings("ReturnValueIgnored")
7980
default String indexDateFormat() {
8081
return getString(this, "indexDateFormat").invalidateWhen(format -> {
8182
if (format == null) {
@@ -189,6 +190,7 @@ default boolean enableSource() {
189190
return getBoolean(this, "enableSource").orElse(false);
190191
}
191192

193+
@SuppressWarnings("ReturnValueIgnored")
192194
@Override
193195
default Validated<?> validate() {
194196
return checkAll(this, c -> StepRegistryConfig.validate(c), checkRequired("host", ElasticConfig::host),

micrometer-core/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,11 @@ java11Test {
289289
}
290290

291291
compileJava11TestJava {
292+
options.errorprone.enabled = false
292293
sourceCompatibility = JavaVersion.VERSION_11
293294
targetCompatibility = JavaVersion.VERSION_11
294295
}
296+
297+
compileJava11Java {
298+
options.errorprone.enabled = false
299+
}

micrometer-core/src/main/java/io/micrometer/core/aop/TimedAspect.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ private void record(ProceedingJoinPoint pjp, Timed timed, String metricName, Tim
278278

279279
private Timer.Builder recordBuilder(ProceedingJoinPoint pjp, Timed timed, String metricName,
280280
String exceptionClass) {
281+
@SuppressWarnings("NullTernary")
281282
Timer.Builder builder = Timer.builder(metricName)
282283
.description(timed.description().isEmpty() ? null : timed.description())
283284
.tags(timed.extraTags())

micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ static ResourceSample resource(MeterRegistry registry, String name) {
9090
* empty.
9191
* @return This builder.
9292
*/
93+
@SuppressWarnings("NullTernary")
9394
static Builder builder(Timed timed, String defaultName) {
9495
if (timed.longTask() && timed.value().isEmpty()) {
9596
// the user MUST name long task timers, we don't lump them in with regular

micrometer-core/src/main/java/io/micrometer/core/instrument/binder/grpc/AbstractMetricCollectingInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ protected Function<Code, Timer> asTimerFunction(final Supplier<Timer.Builder> ti
205205
final Function<Code, Timer> cacheResolver = code -> cache.computeIfAbsent(code, creator);
206206
// Eager initialize
207207
for (final Code code : this.eagerInitializedCodes) {
208-
cacheResolver.apply(code);
208+
Timer ignored = cacheResolver.apply(code);
209209
}
210210
return cacheResolver;
211211
}

micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/JvmGcMetrics.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -362,33 +362,33 @@ enum GcGenerationAge {
362362

363363
OLD, YOUNG, UNKNOWN;
364364

365-
private static final Map<String, GcGenerationAge> knownCollectors = new HashMap<String, GcGenerationAge>() {
366-
{
367-
put("ConcurrentMarkSweep", OLD);
368-
put("Copy", YOUNG);
369-
put("G1 Old Generation", OLD);
370-
put("G1 Young Generation", YOUNG);
371-
put("MarkSweepCompact", OLD);
372-
put("PS MarkSweep", OLD);
373-
put("PS Scavenge", YOUNG);
374-
put("ParNew", YOUNG);
375-
put("global", OLD);
376-
put("scavenge", YOUNG);
377-
put("partial gc", YOUNG);
378-
put("global garbage collect", OLD);
379-
put("Epsilon", OLD);
380-
// GPGC (Azul's C4, see:
381-
// https://docs.azul.com/prime/release-notes#prime_stream_22_12_0_0)
382-
put("GPGC New", YOUNG); // old naming
383-
put("GPGC Old", OLD); // old naming
384-
put("GPGC New Cycles", YOUNG); // new naming
385-
put("GPGC Old Cycles", OLD); // new naming
386-
put("GPGC New Pauses", YOUNG); // new naming
387-
put("GPGC Old Pauses", OLD); // new naming
388-
put("ZGC Major Cycles", OLD); // do not include 'ZGC Major Pauses'; see
389-
// gh-2872
390-
}
391-
};
365+
private static final Map<String, GcGenerationAge> knownCollectors = new HashMap<>();
366+
367+
static {
368+
knownCollectors.put("ConcurrentMarkSweep", OLD);
369+
knownCollectors.put("Copy", YOUNG);
370+
knownCollectors.put("G1 Old Generation", OLD);
371+
knownCollectors.put("G1 Young Generation", YOUNG);
372+
knownCollectors.put("MarkSweepCompact", OLD);
373+
knownCollectors.put("PS MarkSweep", OLD);
374+
knownCollectors.put("PS Scavenge", YOUNG);
375+
knownCollectors.put("ParNew", YOUNG);
376+
knownCollectors.put("global", OLD);
377+
knownCollectors.put("scavenge", YOUNG);
378+
knownCollectors.put("partial gc", YOUNG);
379+
knownCollectors.put("global garbage collect", OLD);
380+
knownCollectors.put("Epsilon", OLD);
381+
// GPGC (Azul's C4, see:
382+
// https://docs.azul.com/prime/release-notes#prime_stream_22_12_0_0)
383+
knownCollectors.put("GPGC New", YOUNG); // old naming
384+
knownCollectors.put("GPGC Old", OLD); // old naming
385+
knownCollectors.put("GPGC New Cycles", YOUNG); // new naming
386+
knownCollectors.put("GPGC Old Cycles", OLD); // new naming
387+
knownCollectors.put("GPGC New Pauses", YOUNG); // new naming
388+
knownCollectors.put("GPGC Old Pauses", OLD); // new naming
389+
// do not include 'ZGC Major Pauses'; see gh-2872
390+
knownCollectors.put("ZGC Major Cycles", OLD);
391+
}
392392

393393
static GcGenerationAge fromGcName(String gcName) {
394394
return knownCollectors.getOrDefault(gcName, UNKNOWN);

micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/FileDescriptorMetrics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private Method detectMethod(String name) {
123123
}
124124
try {
125125
// ensure the Bean we have is actually an instance of the interface
126-
osBeanClass.cast(osBean);
126+
Object ignored = osBeanClass.cast(osBean);
127127
return osBeanClass.getDeclaredMethod(name);
128128
}
129129
catch (ClassCastException | NoSuchMethodException | SecurityException e) {

0 commit comments

Comments
 (0)