Skip to content

Commit

Permalink
Merge pull request #15 from auto1-oss/COR-4981-upgrade-to-1_13_4
Browse files Browse the repository at this point in the history
COR-4981: upgrade to 1.13.4
  • Loading branch information
sondemar authored Oct 17, 2024
2 parents 201e112 + 80d8cb5 commit 0cc346f
Show file tree
Hide file tree
Showing 59 changed files with 1,017 additions and 380 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ executors:
machine-executor:
working_directory: ~/micrometer
machine:
image: ubuntu-2204:2024.01.2
image: ubuntu-2204:2024.05.1

commands:
gradlew-build:
Expand Down
22 changes: 14 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ subprojects {
useJUnitPlatform {
excludeTags 'docker'
}

develocity.testRetry {
maxFailures = 5
maxRetries = 3
}
}

task dockerTest(type: Test) {
Expand All @@ -192,8 +187,12 @@ subprojects {
}
}

project.tasks.withType(Test) { Test testTask ->
testTask.testLogging.exceptionFormat = 'full'
tasks.withType(Test).configureEach {
testLogging.exceptionFormat = 'full'
develocity.testRetry {
maxFailures = 5
maxRetries = 3
}
}

license {
Expand Down Expand Up @@ -281,6 +280,13 @@ subprojects {
}
}

plugins.withId('org.jetbrains.kotlin.jvm') {
// We disble the kotlinSourcesJar task since it conflicts with the sourcesJar task of the Java plugin
// See: https://github.com/micrometer-metrics/micrometer/issues/5151
// See: https://youtrack.jetbrains.com/issue/KT-54207/Kotlin-has-two-sources-tasks-kotlinSourcesJar-and-sourcesJar-that-archives-sources-to-the-same-artifact
kotlinSourcesJar.enabled = false
}

tasks.register('downloadDependencies') {
outputs.upToDateWhen { false }
doLast {
Expand Down Expand Up @@ -427,7 +433,7 @@ nexusPublishing {
}

wrapper {
gradleVersion = '8.6'
gradleVersion = '8.10'
}

defaultTasks 'build'
4 changes: 3 additions & 1 deletion concurrency-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ plugins {
dependencies {
implementation project(":micrometer-core")
// implementation("io.micrometer:micrometer-core:1.12.4")
implementation project(":micrometer-test")
implementation project(":micrometer-registry-prometheus")
runtimeOnly(libs.logbackLatest)
}

jcstress {
jcstressDependency 'org.openjdk.jcstress:jcstress-core:0.16'
libs.jcstressCore

verbose = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
* Copyright 2024 VMware, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.concurrencytests;

import io.micrometer.core.Issue;
import io.micrometer.core.instrument.DistributionSummary;
import io.micrometer.core.instrument.LongTaskTimer;
import io.micrometer.core.instrument.LongTaskTimer.Sample;
import io.micrometer.core.instrument.Timer;
import io.micrometer.prometheusmetrics.PrometheusConfig;
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry;
import org.openjdk.jcstress.annotations.Actor;
import org.openjdk.jcstress.annotations.JCStressTest;
import org.openjdk.jcstress.annotations.Outcome;
import org.openjdk.jcstress.annotations.State;
import org.openjdk.jcstress.infra.results.Z_Result;

import java.time.Duration;

import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE;
import static org.openjdk.jcstress.annotations.Expect.FORBIDDEN;

/**
* Concurrency tests for histogram using {@link PrometheusMeterRegistry}.
*/
public class PrometheusMeterRegistryConcurrencyTest {

@Issue("#5193")
@JCStressTest
@State
@Outcome(id = "true", expect = ACCEPTABLE, desc = "Successful scrape")
@Outcome(expect = FORBIDDEN, desc = "Failed scrape")
public static class ConsistentTimerHistogram {

PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);

Timer timer = Timer.builder("test").publishPercentileHistogram().register(registry);

@Actor
public void record() {
timer.record(Duration.ofMillis(100));
}

@Actor
public void scrape(Z_Result r) {
try {
registry.scrape();
r.r1 = true;
}
catch (Exception e) {
r.r1 = false;
}
}

}

@Issue("#5193")
@JCStressTest
@State
@Outcome(id = "true", expect = ACCEPTABLE, desc = "Successful scrape")
@Outcome(expect = FORBIDDEN, desc = "Failed scrape")
public static class ConsistentDistributionSummaryHistogram {

PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);

DistributionSummary ds = DistributionSummary.builder("test").publishPercentileHistogram().register(registry);

@Actor
public void record() {
ds.record(100);
}

@Actor
public void scrape(Z_Result r) {
try {
registry.scrape();
r.r1 = true;
}
catch (Exception e) {
r.r1 = false;
}
}

}

@Issue("#5193")
@JCStressTest
@State
@Outcome(id = "true", expect = ACCEPTABLE, desc = "Successful scrape")
@Outcome(expect = FORBIDDEN, desc = "Failed scrape")
public static class ConsistentLongTaskTimerHistogram {

PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);

LongTaskTimer ltt = LongTaskTimer.builder("test").publishPercentileHistogram().register(registry);

@Actor
public void record() {
Sample sample = ltt.start();
sample.stop();
}

@Actor
public void scrape(Z_Result r) {
try {
registry.scrape();
r.r1 = true;
}
catch (Exception e) {
r.r1 = false;
}
}

}

}
2 changes: 1 addition & 1 deletion docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* xref:installing.adoc[Installing]
* xref:concepts.adoc[Concepts]
** xref:concepts/implementations.adoc[Supported Monitoring Systems]
** xref:concepts/registry.adoc[Registry]
** xref:concepts/meters.adoc[Meters]
** xref:concepts/registry.adoc[Registry]
** xref:concepts/naming.adoc[Naming Meters]
** xref:concepts/meter-filters.adoc[Meter Filters]
** xref:concepts/rate-aggregation.adoc[Rate Aggregation]
Expand Down
5 changes: 5 additions & 0 deletions docs/modules/ROOT/pages/concepts/meters.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[[meters]]
= Meters

A `Meter` is the interface for collecting a set of measurements (which we individually call metrics) about your application.

Micrometer supports a set of `Meter` primitives, including `Timer`, `Counter`, `Gauge`, `DistributionSummary`, `LongTaskTimer`, `FunctionCounter`, `FunctionTimer`, and `TimeGauge`. Different meter types result in a different number of time series metrics. For example, while there is a single metric that represents a `Gauge`, a `Timer` measures both the count of timed events and the total time of all timed events.

TIP: Recording a measurement for a `Meter` is expected to be a relatively cheap operation and should not throw any exception.
If the xref:./registry.adoc[registry] supports publishing metrics to a monitoring system, this is done in a separate thread and should not affect recording metrics.

A meter is uniquely identified by its name and dimensions. We use the terms, "`dimensions`" and "`tags,`" interchangeably, and the Micrometer interface is `Tag` simply because it is shorter. As a general rule, it should be possible to use the name as a pivot. Dimensions let a particular named metric be sliced to drill down and reason about the data. This means that, if only the name is selected, you can drill down by using other dimensions and reason about the value being shown.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/concepts/registry.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[registry]]
= Registry

A `Meter` is the interface for collecting a set of measurements (which we individually call metrics) about your application. Meters in Micrometer are created from and held in a `MeterRegistry`. Each supported monitoring system has an implementation of `MeterRegistry`. How a registry is created varies for each implementation.
Meters in Micrometer are created from and held in a `MeterRegistry`. Each supported monitoring system has an implementation of `MeterRegistry`. How a registry is created varies for each implementation.

Micrometer includes a `SimpleMeterRegistry` that holds the latest value of each meter in memory and does not export the data anywhere. If you do not yet have a preferred monitoring system, you can get started playing with metrics by using the simple registry:

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/implementations/prometheus.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ catch (IOException e) {
----
<1> The `PrometheusMeterRegistry` has a `scrape()` function that knows how to supply the String data necessary for the scrape. All you have to do is wire it to an endpoint.

If you use the "new" client (`micrometer-registry-prometheus`), you can alternatively use `io.prometheus.metrics.exporter.httpserver.HTTPServer`, which you can find in `io.prometheus:prometheus-metrics-exporter-httpserver`:
If you use the "new" client (`micrometer-registry-prometheus`), you can alternatively use `io.prometheus.metrics.exporter.httpserver.HTTPServer`, which you can find in `io.prometheus:prometheus-metrics-exporter-httpserver` (you need to add it as a dependency if you want to use it):

[source,java]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
/**
* Sources for netty/index.adoc
*/
public class NettyMetricsTests {
class NettyMetricsTests {

private SimpleMeterRegistry registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());

Expand Down
40 changes: 20 additions & 20 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ archunit = "1.3.0"
asmForPlugins = "7.3.1"
aspectjweaver = "1.9.22.1"
assertj = "3.25.3"
awaitility = "4.2.1"
awaitility = "4.2.2"
caffeine = "2.9.3"
cloudwatch2 = "2.25.69"
cloudwatch2 = "2.25.70"
colt = "1.2.0"
dagger = "2.51.1"
dropwizard-metrics = "4.2.26"
dropwizard-metrics = "4.2.27"
dropwizard-metrics5 = "5.0.0"
dynatrace-utils = "2.2.1"
ehcache2 = "2.10.9.2"
Expand All @@ -35,48 +35,48 @@ httpcomponents-client5 = "5.3.1"
# in hystrix 1.5.12, but Netflix re-released 1.5.11 as 1.5.18 late in 2018.
# <=1.5.11 or 1.5.18 doesn't break with Micrometer, but open metrics won't be correct necessarily.
hystrix = "1.5.12"
jackson-databind = "2.17.1"
jackson-databind = "2.17.2"
javax-cache = "1.1.1"
javax-inject = "1"
jaxb = "2.3.1"
jetty9 = "9.4.54.v20240208"
jetty9 = "9.4.55.v20240627"
jetty11 = "11.0.16"
jetty12 = "12.0.6"
jersey2 = "2.43"
jersey3 = "3.0.11"
jersey3 = "3.0.12"
jmh = "1.37"
# 3.14.x is the newest version of OSS jOOQ that supports Java 8
jooqOld = "3.14.16"
# latest version of jOOQ to run tests against
jooqNew = "3.19.8"
jsr107 = "1.1.1"
jsr305 = "3.0.2"
junit = "5.10.2"
junit-platform = "1.10.2"
junit = "5.10.3"
junit-platform = "1.10.3"
kafka = "2.8.2"
kafka-junit = "4.2.10"
latency-utils = "2.0.3"
logback12 = "1.2.13"
logback-latest = "1.5.3"
log4j = "2.23.1"
maven-resolver = "1.9.20"
maven-resolver = "1.9.22"
mockito4 = "4.11.0"
mockito5 = "5.11.0"
mongo = "4.11.2"
netty = "4.1.110.Final"
mongo = "4.11.3"
netty = "4.1.112.Final"
newrelic-api = "5.14.0"
# Kotlin 1.7 sample will fail from OkHttp 4.12.0 due to okio dependency being a Kotlin 1.9 module
okhttp = "4.11.0"
postgre = "42.7.3"
postgre = "42.7.4"
prometheus = "1.2.1"
prometheusSimpleClient = "0.16.0"
reactor = "2022.0.19"
reactor = "2022.0.22"
rest-assured = "5.4.0"
signalfx = "1.0.42"
signalfx = "1.0.45"
slf4j = "1.7.36"
spectator-atlas = "1.7.13"
spring = "5.3.36"
spring-javaformat = "0.0.42"
spectator-atlas = "1.7.19"
spring = "5.3.37"
spring-javaformat = "0.0.43"
testcontainers = "1.19.8"
tomcat = "8.5.100"
wavefront = "3.4.3"
Expand Down Expand Up @@ -163,7 +163,7 @@ jsr107 = { module = "org.jsr107.ri:cache-ri-impl", version.ref = "jsr107" }
jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" }
junitBom = { module = "org.junit:junit-bom", version.ref = "junit" }
junitJupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
junitLoggingExtention = "com.innoq:junit5-logging-extension:0.2.0"
junitLoggingExtension = "com.innoq:junit5-logging-extension:0.2.0"
junitPlatformLauncher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }
kafkaClients = { module = "org.apache.kafka:kafka-clients", version.ref = "kafka" }
kafkaStreams = { module = "org.apache.kafka:kafka-streams", version.ref = "kafka" }
Expand All @@ -176,7 +176,7 @@ logbackLatest = {module = "ch.qos.logback:logback-classic", version.ref = "logba
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" }
mavenResolverProvider = { module = "org.apache.maven:maven-resolver-provider", version = "3.9.7" }
mavenResolverProvider = { module = "org.apache.maven:maven-resolver-provider", version = "3.9.9" }
mockitoCore4 = { module = "org.mockito:mockito-core", version.ref = "mockito4" }
mockitoCore5 = { module = "org.mockito:mockito-core", version.ref = "mockito5" }
mongoSync = { module = "org.mongodb:mongodb-driver-sync", version.ref = "mongo" }
Expand Down Expand Up @@ -229,6 +229,6 @@ plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", ver
plugin-bnd = "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0"

[plugins]
kotlin19 = { id = "org.jetbrains.kotlin.jvm", version = "1.9.23" }
kotlin19 = { id = "org.jetbrains.kotlin.jvm", version = "1.9.24" }
kotlin17 = { id = "org.jetbrains.kotlin.jvm", version = "1.7.22" }
jcstress = { id = "io.github.reyerizo.gradle.jcstress", version = "0.8.15" }
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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Loading

0 comments on commit 0cc346f

Please sign in to comment.