From 253689e129b4b0c6fa84caa04f14a15bd23c5c4f Mon Sep 17 00:00:00 2001 From: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Date: Wed, 28 Feb 2024 12:47:43 +0900 Subject: [PATCH] Polish gh-4753 Makes the Jetty server dependency optional. We plan to add Jetty client instrumentation and users may be use only one or the other, so micrometer-jetty12 should not pull in both dependencies. It will be up to users to separately have a dependency on Jetty server or client. Updated copyright years and since tags. Removed incubating annotations. --- micrometer-jetty12/build.gradle | 9 ++------- .../jetty12/DefaultJettyCoreRequestTagsProvider.java | 6 ++---- .../micrometer/jetty12/JettyCoreRequestTagsProvider.java | 6 ++---- .../main/java/io/micrometer/jetty12/TimedHandler.java | 4 ++-- .../main/java/io/micrometer/jetty12/package-info.java | 2 +- .../java/io/micrometer/jetty12/TimedHandlerTest.java | 2 +- micrometer-jetty12/src/test/resources/logback.xml | 2 +- 7 files changed, 11 insertions(+), 20 deletions(-) diff --git a/micrometer-jetty12/build.gradle b/micrometer-jetty12/build.gradle index 0a0890c7b5..c4031d3cfa 100644 --- a/micrometer-jetty12/build.gradle +++ b/micrometer-jetty12/build.gradle @@ -7,14 +7,9 @@ if (!javaLanguageVersion.canCompileOrRun(17)) { dependencies { api project(":micrometer-core") - api libs.jetty12Server + optionalApi libs.jetty12Server + - // Test sample project with SLFJ4 2.x / Logback 1.4 - runtimeOnly(libs.logback14) { - version { - strictly libs.logback14.get().version - } - } testRuntimeOnly(libs.logback14) { version { strictly libs.logback14.get().version diff --git a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/DefaultJettyCoreRequestTagsProvider.java b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/DefaultJettyCoreRequestTagsProvider.java index 18519d27e7..2abe923db5 100644 --- a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/DefaultJettyCoreRequestTagsProvider.java +++ b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/DefaultJettyCoreRequestTagsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 VMware, Inc. + * 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. @@ -16,7 +16,6 @@ package io.micrometer.jetty12; -import io.micrometer.core.annotation.Incubating; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.binder.http.Outcome; @@ -26,9 +25,8 @@ * Default {@link JettyCoreRequestTagsProvider}. * * @author Joakim Erdfelt - * @since 1.11.0 + * @since 1.13.0 */ -@Incubating(since = "1.11.0") public class DefaultJettyCoreRequestTagsProvider implements JettyCoreRequestTagsProvider { private static final Tag STATUS_UNKNOWN = Tag.of("status", "UNKNOWN"); diff --git a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/JettyCoreRequestTagsProvider.java b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/JettyCoreRequestTagsProvider.java index 0c14e8c721..0047759698 100644 --- a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/JettyCoreRequestTagsProvider.java +++ b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/JettyCoreRequestTagsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 VMware, Inc. + * 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. @@ -16,7 +16,6 @@ package io.micrometer.jetty12; -import io.micrometer.core.annotation.Incubating; import io.micrometer.core.instrument.Tag; import org.eclipse.jetty.server.Request; @@ -24,9 +23,8 @@ * Provides {@link Tag Tags} for Jetty Core request handling. * * @author Joakim Erdfelt - * @since 1.11.0 + * @since 1.13.0 */ -@Incubating(since = "1.11.0") @FunctionalInterface public interface JettyCoreRequestTagsProvider { diff --git a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/TimedHandler.java b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/TimedHandler.java index 851ec1af17..d5e5f3726e 100644 --- a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/TimedHandler.java +++ b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/TimedHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 VMware, Inc. + * 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. @@ -35,7 +35,7 @@ * * @author Jon Schneider * @author Joakim Erdfelt - * @since 1.10.0 + * @since 1.13.0 */ public class TimedHandler extends EventsHandler implements Graceful { diff --git a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/package-info.java b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/package-info.java index 636aee9154..41e2f70a03 100644 --- a/micrometer-jetty12/src/main/java/io/micrometer/jetty12/package-info.java +++ b/micrometer-jetty12/src/main/java/io/micrometer/jetty12/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 VMware, Inc. + * 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. diff --git a/micrometer-jetty12/src/test/java/io/micrometer/jetty12/TimedHandlerTest.java b/micrometer-jetty12/src/test/java/io/micrometer/jetty12/TimedHandlerTest.java index 74427e01ad..4a35217a3f 100644 --- a/micrometer-jetty12/src/test/java/io/micrometer/jetty12/TimedHandlerTest.java +++ b/micrometer-jetty12/src/test/java/io/micrometer/jetty12/TimedHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 VMware, Inc. + * 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. diff --git a/micrometer-jetty12/src/test/resources/logback.xml b/micrometer-jetty12/src/test/resources/logback.xml index a40423827b..009b27389c 100644 --- a/micrometer-jetty12/src/test/resources/logback.xml +++ b/micrometer-jetty12/src/test/resources/logback.xml @@ -1,6 +1,6 @@