Skip to content

Commit

Permalink
Move Jakarta JMS instrumentation to micrometer-jakarta10
Browse files Browse the repository at this point in the history
Introduces a new module micrometer-jakarta10 and moves the previously merged JMS instrumentation there. The reason for this is that we tend to try to support a range of versions when possible for our users, and if Jakarta makes breaking changes in the future, we would not be able to support that in a single module (such as micrometer-core, or micrometer-jakarta) unless the new Jakarta artifacts used different coordinates.
  • Loading branch information
shakuzen committed Oct 10, 2023
1 parent 3d7a390 commit 3cf4d2e
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ subprojects {

check.dependsOn("testModules")

if (!(project.name in ['micrometer-osgi-test'])) {
if (!(project.name in ['micrometer-jakarta10'])) {
apply plugin: 'me.champeau.gradle.japicmp'
apply plugin: 'de.undercouch.download'

Expand Down
26 changes: 26 additions & 0 deletions micrometer-jakarta10/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
description 'Module for Jakarta based instrumentations'

jar {
bundle {

bnd '''\
Import-Package: \
jakarta.jms.*;resolution:=dynamic;version="${@}",\
io.micrometer.observation.*;resolution:=dynamic;version="${@}",\
*
'''.stripIndent()
}
}

dependencies {
api project(":micrometer-core")
api project(":micrometer-commons")
api project(":micrometer-observation")

optionalApi 'jakarta.jms:jakarta.jms-api'

testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'com.tngtech.archunit:archunit-junit5'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.assertj:assertj-core'
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.KeyValue;
import io.micrometer.common.KeyValues;
import io.micrometer.core.instrument.binder.jms.JmsObservationDocumentation.LowCardinalityKeyNames;
import jakarta.jms.*;

import static io.micrometer.core.instrument.binder.jms.JmsObservationDocumentation.*;
import io.micrometer.jakarta10.instrument.jms.JmsObservationDocumentation.*;

/**
* Default implementation for {@link JmsProcessObservationConvention}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.KeyValue;
import io.micrometer.common.KeyValues;
import jakarta.jms.*;

import static io.micrometer.core.instrument.binder.jms.JmsObservationDocumentation.*;
import static io.micrometer.jakarta10.instrument.jms.JmsObservationDocumentation.*;

/**
* Default implementation for {@link JmsPublishObservationConvention}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.observation.ObservationRegistry;
import jakarta.jms.Session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.KeyValue;
import io.micrometer.common.docs.KeyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.observation.transport.ReceiverContext;
import jakarta.jms.JMSException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.transport.SenderContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.Observation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.observation.ObservationRegistry;
import jakarta.jms.MessageConsumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
@NonNullFields
@NonNullApi
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.lang.NonNullApi;
import io.micrometer.common.lang.NonNullFields;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2023 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.jakarta10;

import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.ArchRule;

import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;

@AnalyzeClasses(packages = "io.micrometer.jakarta10")
class NoJavaxArchitectureTests {

@ArchTest
static final ArchRule noJavaxDependencies = noClasses().that()
.resideInAPackage("io.micrometer.jakarta10..")
.should()
.dependOnClassesThat()
.resideInAPackage("javax..");

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.KeyValue;
import jakarta.jms.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.binder.jms;
package io.micrometer.jakarta10.instrument.jms;

import io.micrometer.common.KeyValue;
import jakarta.jms.*;
Expand Down
1 change: 1 addition & 0 deletions micrometer-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation 'org.awaitility:awaitility'

testImplementation project(':micrometer-observation-test')
testImplementation project(':micrometer-jakarta10')

testImplementation 'org.jsr107.ri:cache-ri-impl'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;

import io.micrometer.jakarta10.instrument.jms.JmsInstrumentation;
import io.micrometer.observation.tck.TestObservationRegistry;
import io.micrometer.observation.tck.TestObservationRegistryAssert;
import jakarta.jms.*;
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ include 'micrometer-test', 'micrometer-observation-test'
}

include 'micrometer-bom'
include 'micrometer-jakarta10'
include 'micrometer-jetty11'
include 'micrometer-osgi-test'
include 'docs'

0 comments on commit 3cf4d2e

Please sign in to comment.