Skip to content

Commit 0db27ce

Browse files
committed
Merge branch '1.14.x'
2 parents d58af90 + 64b9194 commit 0db27ce

File tree

21 files changed

+72
-49
lines changed

21 files changed

+72
-49
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ executors:
1111
circle-jdk-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:21.0.6
1818
circle-jdk17-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:17.0.14
2525
circle-jdk11-executor:
2626
working_directory: ~/micrometer
2727
environment:
28-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
28+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
2929
resource_class: medium+
3030
docker:
3131
- 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
@@ -66,11 +67,21 @@ allprojects {
6667
}
6768

6869
subprojects {
70+
apply plugin: 'net.ltgt.errorprone'
6971
apply plugin: 'signing'
7072
apply plugin: 'io.spring.javaformat'
7173
apply plugin: 'com.diffplug.spotless'
7274

7375
if (project.name != 'micrometer-bom') {
76+
tasks.withType(JavaCompile).configureEach {
77+
if (!javaLanguageVersion.canCompileOrRun(17)) {
78+
// Error Prone does not work with JDK <17
79+
options.errorprone.enabled = false
80+
}
81+
if (System.env.CI != null) {
82+
options.errorprone.disableAllWarnings = true
83+
}
84+
}
7485
if ((project.name.contains('samples') && !project.name.contains('kotlin')) || project.name.contains('benchmarks')) {
7586
apply plugin: 'java'
7687
} else {
@@ -108,6 +119,7 @@ subprojects {
108119
// JSR-305 only used for non-required meta-annotations
109120
optionalApi libs.jsr305
110121
checkstyle libs.spring.javaformatCheckstyle
122+
errorprone(libs.errorprone)
111123
}
112124

113125
tasks {

gradle/libs.versions.toml

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

220221
# plugin dependencies
222+
plugin-errorprone = { module = "net.ltgt.errorprone:net.ltgt.errorprone.gradle.plugin", version = "4.1.0" }
221223
plugin-license = { module = "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin", version = "0.16.1" }
222224
plugin-nebulaRelease = { module = "com.netflix.nebula:nebula-release-plugin", version = "18.0.8" }
223225
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),

implementations/micrometer-registry-otlp/src/test/java/io/micrometer/registry/otlp/OtlpDeltaMeterRegistryTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public String get(String key) {
100100
void gauge() {
101101
Gauge gauge = Gauge.builder(METER_NAME, new AtomicInteger(5), AtomicInteger::doubleValue).register(registry);
102102
Metric metric = writeToMetric(gauge);
103-
assertThat(metric.getGauge()).isNotNull();
104103
assertThat(metric.getGauge().getDataPoints(0).getAsDouble()).isEqualTo(5);
105104
assertThat(metric.getGauge().getDataPoints(0).getTimeUnixNano())
106105
.describedAs("Gauges should have timestamp of the instant when data is sampled")
@@ -112,7 +111,6 @@ void timeGauge() {
112111
TimeGauge timeGauge = TimeGauge.builder("gauge.time", this, TimeUnit.MICROSECONDS, o -> 24).register(registry);
113112

114113
Metric metric = writeToMetric(timeGauge);
115-
assertThat(metric.getGauge()).isNotNull();
116114
assertThat(metric.getGauge().getDataPoints(0).getAsDouble()).isEqualTo(0.024);
117115
assertThat(metric.getGauge().getDataPoints(0).getTimeUnixNano())
118116
.describedAs("Gauges should have timestamp of the instant when data is sampled")

micrometer-core/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ java11Test {
312312
}
313313

314314
compileJava11TestJava {
315+
options.errorprone.enabled = false
315316
sourceCompatibility = JavaVersion.VERSION_11
316317
targetCompatibility = JavaVersion.VERSION_11
317318
}
319+
320+
compileJava11Java {
321+
options.errorprone.enabled = false
322+
}

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
@@ -282,6 +282,7 @@ private void record(ProceedingJoinPoint pjp, @Nullable Object methodResult, Time
282282

283283
private Timer.Builder recordBuilder(ProceedingJoinPoint pjp, @Nullable Object methodResult, Timed timed,
284284
String metricName, String exceptionClass) {
285+
@SuppressWarnings("NullTernary")
285286
Timer.Builder builder = Timer.builder(metricName)
286287
.description(timed.description().isEmpty() ? null : timed.description())
287288
.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);

0 commit comments

Comments
 (0)