Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: micrometer-metrics/micrometer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.10.12
Choose a base ref
...
head repository: micrometer-metrics/micrometer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.10.x
Choose a head ref
Loading
Showing with 441 additions and 121 deletions.
  1. +5 −5 .circleci/config.yml
  2. +1 −1 .github/workflows/gradle-wrapper-validation.yml
  3. +2 −0 .gitignore
  4. +1 −1 benchmarks/benchmarks-core/build.gradle
  5. +3 −3 build.gradle
  6. +1 −3 config/checkstyle/checkstyle.xml
  7. +1 −1 dependencies.gradle
  8. +23 −19 gradle/libs.versions.toml
  9. BIN gradle/wrapper/gradle-wrapper.jar
  10. +1 −1 gradle/wrapper/gradle-wrapper.properties
  11. +10 −10 gradlew.bat
  12. +5 −1 ...tations/micrometer-registry-otlp/src/main/java/io/micrometer/registry/otlp/OtlpMeterRegistry.java
  13. +49 −2 ...ometer-registry-stackdriver/src/main/java/io/micrometer/stackdriver/StackdriverMeterRegistry.java
  14. +1 −1 implementations/micrometer-registry-statsd/build.gradle
  15. +2 −1 micrometer-core/build.gradle
  16. +2 −1 micrometer-core/src/main/java/io/micrometer/core/instrument/AbstractTimerBuilder.java
  17. +14 −1 micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java
  18. +19 −5 micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/JvmGcMetrics.java
  19. +5 −5 ...er-core/src/main/java/io/micrometer/core/instrument/cumulative/CumulativeDistributionSummary.java
  20. +9 −9 micrometer-core/src/main/java/io/micrometer/core/instrument/cumulative/CumulativeTimer.java
  21. +4 −2 ...er-core/src/main/java/io/micrometer/core/instrument/distribution/DistributionStatisticConfig.java
  22. +8 −1 micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/TimeWindowMax.java
  23. +5 −3 micrometer-core/src/main/java/io/micrometer/core/instrument/dropwizard/DropwizardMeterRegistry.java
  24. +2 −2 micrometer-core/src/main/java/io/micrometer/core/instrument/internal/DefaultLongTaskTimer.java
  25. +16 −0 micrometer-core/src/test/java/io/micrometer/core/instrument/MeterRegistryTest.java
  26. +2 −36 micrometer-core/src/test/java/io/micrometer/core/instrument/TagsTest.java
  27. +1 −0 ...est/java/io/micrometer/core/instrument/binder/mongodb/MongoMetricsConnectionPoolListenerTest.java
  28. +8 −0 micrometer-core/src/test/java/io/micrometer/core/instrument/distribution/TimeWindowMaxTest.java
  29. +9 −0 ...eter-core/src/test/java/io/micrometer/core/instrument/dropwizard/DropwizardMeterRegistryTest.java
  30. +1 −1 samples/micrometer-samples-boot2-reactive/build.gradle
  31. +1 −1 samples/micrometer-samples-boot2/build.gradle
  32. +87 −0 samples/micrometer-samples-core/src/main/java/io/micrometer/core/samples/MultiGaugeSample.java
  33. +19 −0 samples/micrometer-samples-kotlin/build.gradle
  34. +53 −0 ...s/micrometer-samples-kotlin/src/test/kotlin/io/micrometer/samples/kotlin/KotlinCoroutinesTests.kt
  35. +66 −0 ...rc/test/kotlin/io/micrometer/samples/kotlin/OkHttpClientTimingInstrumentationVerificationTests.kt
  36. +1 −1 samples/micrometer-samples-spring-integration/build.gradle
  37. +4 −4 settings.gradle
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -7,25 +7,25 @@ executors:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
resource_class: medium+
docker:
- image: cimg/openjdk:20.0.1
- image: cimg/openjdk:21.0.2
circle-jdk17-executor:
working_directory: ~/micrometer
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
resource_class: medium+
docker:
- image: cimg/openjdk:17.0.7
- image: cimg/openjdk:17.0.10
circle-jdk11-executor:
working_directory: ~/micrometer
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
resource_class: medium+
docker:
- image: cimg/openjdk:11.0.19
- image: cimg/openjdk:11.0.22
machine-executor:
working_directory: ~/micrometer
machine:
image: ubuntu-2204:2023.04.2
image: ubuntu-2204:2024.01.1

commands:
gradlew-build:
@@ -89,7 +89,7 @@ jobs:
- checkout
- restore_cache:
key: gradle-dependencies-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum ".circleci/config.yml" }}
- deploy:
- run:
name: Deployment
command: sh ./gradle/deploy.sh

2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -10,4 +10,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/wrapper-validation-action@v2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ build/
.gradle/
out/

code/

*.iml
*.ipr
*.iws
2 changes: 1 addition & 1 deletion benchmarks/benchmarks-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "me.champeau.jmh" version "0.7.1"
id "me.champeau.jmh" version "0.7.2"
}

dependencies {
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ subprojects {
apply plugin: 'com.diffplug.spotless'

if (project.name != 'micrometer-bom') {
if (project.name.contains('samples') || project.name.contains('benchmarks')) {
if ((project.name.contains('samples') && !project.name.contains('kotlin')) || project.name.contains('benchmarks')) {
apply plugin: 'java'
} else {
apply plugin: 'java-library'
@@ -304,7 +304,7 @@ subprojects {

check.dependsOn("testModules")

if (!(project.name in ['micrometer-commons', 'micrometer-jetty11'])) {
if (!(project.name in ['micrometer-commons', 'micrometer-jetty11'])) { // add projects here that do not exist in the previous minor so should be excluded from japicmp
apply plugin: 'me.champeau.gradle.japicmp'
apply plugin: 'de.undercouch.download'

@@ -392,7 +392,7 @@ nexusPublishing {
}

wrapper {
gradleVersion = '8.4'
gradleVersion = '8.6'
}

defaultTasks 'build'
4 changes: 1 addition & 3 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -25,9 +25,7 @@
<property name="illegalPkgs" value="org.slf4j.*"/>
<property name="regexp" value="true"/>
</module>
<module name="UnusedImports">
<property name="processJavadoc" value="true" />
</module>
<module name="UnusedImports" />

<!-- Regexp -->
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck">
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def VERSIONS = [
libs.logback,
libs.logback12,
libs.colt,
libs.aws.javaSdkCloudwatch,
libs.dynatraceUtils,
42 changes: 23 additions & 19 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@ aspectjweaver = "1.8.14"
assertj = "3.24.2"
awaitility = "4.2.0"
# legacy SDK
aws-cloudwatch = "1.12.565"
aws-cloudwatch = "1.12.650"
caffeine = "2.9.3"
cloudwatch2 = "2.18.41"
colt = "1.2.0"
dagger = "2.11"
dropwizard-metrics = "4.2.20"
dropwizard-metrics = "4.2.25"
dropwizard-metrics5 = "5.0.0"
dynatrace-utils = "1.6.0"
ehcache2 = "2.10.9.2"
@@ -38,7 +38,7 @@ jackson-databind = "2.14.3"
javax-cache = "1.1.1"
javax-inject = "1"
jaxb = "2.3.1"
jetty = "9.4.52.v20230823"
jetty = "9.4.53.v20231009"
jetty11 = "11.0.12"
jersey2 = "2.37"
jersey3 = "3.0.8"
@@ -49,27 +49,27 @@ jsr305 = "3.0.2"
junit = "5.9.3"
junit-platform = "1.9.3"
kafka = "2.8.2"
kafka-junit = "4.2.7"
kafka-junit = "4.2.10"
latency-utils = "2.0.3"
logback = "1.2.12"
logback12 = "1.2.13"
log4j = "2.19.0"
maven-resolver = "1.8.2"
mockito = "5.5.0"
mongo = "4.8.2"
netty = "4.1.99.Final"
netty = "4.1.106.Final"
newrelic-api = "5.14.0"
okhttp = "5.0.0-alpha.11" # TODO is compiling against an alpha version intentional?
okhttp = "4.11.0"
postgre = "42.5.4"
prometheus = "0.16.0"
reactor = "2020.0.36"
reactor = "2020.0.40"
rest-assured = "5.3.2"
signalfx = "1.0.35"
signalfx = "1.0.38"
slf4j = "1.7.36"
spectator-atlas = "1.3.10"
spring = "5.3.30"
spring-javaformat = "0.0.39"
testcontainers = "1.19.1"
tomcat = "8.5.93"
spring = "5.3.31"
spring-javaformat = "0.0.41"
testcontainers = "1.19.4"
tomcat = "8.5.98"
wavefront = "3.0.4"
# pinned to avoid issues with shaded slf4j version - see gh-3414
wiremock = "2.33.2"
@@ -150,8 +150,8 @@ kafkaJunit = { module = "com.github.charithe:kafka-junit", version.ref = "kafka-
kotlinxCoroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.6.4" }
latencyUtils = { module = "org.latencyutils:LatencyUtils", version.ref = "latency-utils" }
lmaxDisruptor = "com.lmax:disruptor:3.4.4"
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
logback14 = {module = "ch.qos.logback:logback-classic", version = "1.4.11" }
logback12 = { module = "ch.qos.logback:logback-classic", version.ref = "logback12" }
logback14 = {module = "ch.qos.logback:logback-classic", version = "1.4.14" }
log4j = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
mavenResolverConnectorBasic = { module = "org.apache.maven.resolver:maven-resolver-connector-basic", version.ref = "maven-resolver" }
mavenResolverTransportHttp = { module = "org.apache.maven.resolver:maven-resolver-transport-http", version.ref = "maven-resolver" }
@@ -173,9 +173,9 @@ slf4jApi = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
spectatorAtlas = { module = "com.netflix.spectator:spectator-reg-atlas", version.ref = "spectator-atlas" }
spring-context = { module = "org.springframework:spring-context", version.ref = "spring" }
spring-core = { module = "org.springframework:spring-core", version.ref = "spring" }
spring-cloud = { module = "org.springframework.cloud:spring-cloud-dependencies", version = "2021.0.8" }
spring-cloud = { module = "org.springframework.cloud:spring-cloud-dependencies", version = "2021.0.9" }
spring-javaformatCheckstyle = { module = "io.spring.javaformat:spring-javaformat-checkstyle", version.ref = "spring-javaformat" }
systemStubsJupiter = { module = "uk.org.webcompere:system-stubs-jupiter", version = "2.1.3" }
systemStubsJupiter = { module = "uk.org.webcompere:system-stubs-jupiter", version = "2.1.6" }
testcontainers-junitJupiter = { module = "org.testcontainers:junit-jupiter", version.ref = "testcontainers" }
testcontainers-kafka = { module = "org.testcontainers:kafka", version.ref = "testcontainers" }
testcontainers-postgresql = { module = "org.testcontainers:postgresql", version.ref = "testcontainers" }
@@ -188,7 +188,7 @@ wiremockJunit5 = { module = "ru.lanwen.wiremock:wiremock-junit5", version.ref =

# plugin dependencies
plugin-license = { module = "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin", version = "0.16.1" }
plugin-nebulaRelease = { module = "com.netflix.nebula:nebula-release-plugin", version = "17.2.2" }
plugin-nebulaRelease = { module = "com.netflix.nebula:nebula-release-plugin", version = "18.0.8" }
plugin-nebulaPublishing = { module = "com.netflix.nebula:nebula-publishing-plugin", version = "20.3.0" }
plugin-nebulaProject = { module = "com.netflix.nebula:nebula-project-plugin", version = "10.1.5" }
plugin-nebulaInfo = { module = "com.netflix.nebula:gradle-info-plugin", version = "12.1.6" }
@@ -197,4 +197,8 @@ plugin-nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", versio
plugin-javaformat = { module = "io.spring.javaformat:spring-javaformat-gradle-plugin", version.ref = "spring-javaformat" }
plugin-japicmp = { module = "me.champeau.gradle:japicmp-gradle-plugin", version = "0.4.2" }
plugin-downloadTask = { module = "de.undercouch:gradle-download-task", version = "5.5.0" }
plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.22.0" }
plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" }

[plugins]
kotlin19 = { id = "org.jetbrains.kotlin.jvm", version = "1.9.22" }
kotlin17 = { id = "org.jetbrains.kotlin.jvm", version = "1.7.22" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Original file line number Diff line number Diff line change
@@ -107,9 +107,13 @@ protected void publish() {
.build())
.build())
.build();
this.httpSender.post(this.config.url())
HttpSender.Response response = this.httpSender.post(this.config.url())
.withContent("application/x-protobuf", request.toByteArray())
.send();
if (!response.isSuccessful()) {
logger.warn("Failed to publish metrics. Server responded with HTTP status code {} and body {}",
response.code(), response.body());
}
}
catch (Throwable e) {
logger.warn("Failed to publish metrics to OTLP receiver", e);
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ public void start(ThreadFactory threadFactory) {
logger.error("unable to start stackdriver, service settings are not available");
}
else {
shutdownClientIfNecessary(true);
try {
this.client = MetricServiceClient.create(metricServiceSettings);
super.start(threadFactory);
@@ -136,13 +137,59 @@ public void start(ThreadFactory threadFactory) {
}
}

@Override
public void close() {
try {
super.close();
}
finally {
shutdownClientIfNecessary(false);
}
}

@Override
public void stop() {
if (client != null)
client.shutdownNow();
super.stop();
}

private void shutdownClientIfNecessary(final boolean quietly) {
if (client == null)
return;
if (!client.isShutdown()) {
try {
client.shutdownNow();
final boolean terminated = client.awaitTermination(10, TimeUnit.SECONDS);
if (!terminated) {
logger.warn("The metric service client failed to terminate within the timeout");
}
}
catch (final RuntimeException e) {
if (quietly) {
logger.warn("Failed to shutdown the metric service client", e);
}
else {
throw e;
}
}
catch (final InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
}
try {
client.close();
}
catch (final RuntimeException e) {
if (quietly) {
logger.warn("Failed to close metric service client", e);
}
else {
throw e;
}
}
client = null;
}

@Override
protected void publish() {
if (client == null) {
2 changes: 1 addition & 1 deletion implementations/micrometer-registry-statsd/build.gradle
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ publishing {
asNode()
.dependencies
.dependency
.findAll { ['reactor-core', 'reactor-netty-core', 'netty-resolver-dns-native-macos'].contains(it.artifactId.text()) }
.findAll { ['reactor-core', 'reactor-netty-core', 'netty-resolver-dns-native-macos', 'netty-transport-native-epoll'].contains(it.artifactId.text()) }
.each { it.parent().remove(it) }
}
}
3 changes: 2 additions & 1 deletion micrometer-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.jetbrains.kotlin.jvm" version "1.7.22"
alias(libs.plugins.kotlin17)
id 'me.champeau.mrjar' version "0.1.1"
}

@@ -82,6 +82,7 @@ dependencies {
optionalApi 'io.micrometer:context-propagation'

// kotlin
optionalApi enforcedPlatform('org.jetbrains.kotlin:kotlin-bom')
optionalApi 'org.jetbrains.kotlin:kotlin-reflect'
optionalApi 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
optionalApi 'org.jetbrains.kotlinx:kotlinx-coroutines-core'
Original file line number Diff line number Diff line change
@@ -199,7 +199,8 @@ public B maximumExpectedValue(@Nullable Duration max) {
* over time to give greater weight to recent samples (exception: histogram counts are
* cumulative for those systems that expect cumulative histogram buckets). Samples are
* accumulated to such statistics in ring buffers which rotate after this expiry, with
* a buffer length of {@link #distributionStatisticBufferLength(Integer)}.
* a buffer length of {@link #distributionStatisticBufferLength(Integer)}, hence
* complete expiry happens after this expiry * buffer length.
* @param expiry The amount of time samples are accumulated to a histogram before it
* is reset and rotated.
* @return This builder.
Loading