You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2024/06/04 19:22:17 UTC
(tomee) 02/02: TOMEE-4343 - WIP: OpenTelemetry 1.0
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch TOMEE-4343
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit f57fa8450cf01b86c93aa6830861c56c6b3245d4
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Tue Jun 4 21:22:06 2024 +0200
TOMEE-4343 - WIP: OpenTelemetry 1.0
---
boms/tomee-microprofile/pom.xml | 60 ++++-----
boms/tomee-plume/pom.xml | 60 ++++-----
boms/tomee-plus/pom.xml | 60 ++++-----
pom.xml | 2 +-
.../microprofile/TomEEMicroProfileListener.java | 1 +
.../opentelemetry/MPOpenTelemetryCDIExtension.java | 142 ++-------------------
.../opentelemetry/WithSpanInterceptorProducer.java | 19 ---
.../META-INF/openwebbeans/openwebbeans.properties | 20 ---
8 files changed, 100 insertions(+), 264 deletions(-)
diff --git a/boms/tomee-microprofile/pom.xml b/boms/tomee-microprofile/pom.xml
index 7a72c0c39d..b8d7b01564 100644
--- a/boms/tomee-microprofile/pom.xml
+++ b/boms/tomee-microprofile/pom.xml
@@ -246,7 +246,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations-support</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -257,7 +257,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -268,7 +268,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api-semconv</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -279,7 +279,18 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.opentelemetry.semconv</groupId>
+ <artifactId>opentelemetry-semconv</artifactId>
+ <version>1.21.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -290,7 +301,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api-events</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -301,7 +312,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -312,7 +323,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -334,7 +345,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-extension-incubator</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -345,7 +356,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-common</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -356,7 +367,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -367,7 +378,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -378,7 +389,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-logs</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -389,7 +400,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-metrics</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -400,7 +411,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -411,18 +422,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
- <version>1.29.0</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.opentelemetry</groupId>
- <artifactId>opentelemetry-semconv</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -620,7 +620,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-api</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -631,7 +631,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-cdi</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -642,7 +642,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-config</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -653,7 +653,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-rest</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
diff --git a/boms/tomee-plume/pom.xml b/boms/tomee-plume/pom.xml
index 5da3912446..d1a392e843 100644
--- a/boms/tomee-plume/pom.xml
+++ b/boms/tomee-plume/pom.xml
@@ -246,7 +246,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations-support</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -257,7 +257,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -268,7 +268,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api-semconv</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -279,7 +279,18 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.opentelemetry.semconv</groupId>
+ <artifactId>opentelemetry-semconv</artifactId>
+ <version>1.21.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -290,7 +301,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api-events</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -301,7 +312,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -312,7 +323,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -334,7 +345,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-extension-incubator</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -345,7 +356,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-common</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -356,7 +367,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -367,7 +378,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -378,7 +389,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-logs</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -389,7 +400,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-metrics</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -400,7 +411,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -411,18 +422,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
- <version>1.29.0</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.opentelemetry</groupId>
- <artifactId>opentelemetry-semconv</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -620,7 +620,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-api</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -631,7 +631,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-cdi</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -642,7 +642,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-config</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -653,7 +653,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-rest</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
diff --git a/boms/tomee-plus/pom.xml b/boms/tomee-plus/pom.xml
index 586d997242..57de665601 100644
--- a/boms/tomee-plus/pom.xml
+++ b/boms/tomee-plus/pom.xml
@@ -246,7 +246,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations-support</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -257,7 +257,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -268,7 +268,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api-semconv</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -279,7 +279,18 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>*</artifactId>
+ <groupId>*</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.opentelemetry.semconv</groupId>
+ <artifactId>opentelemetry-semconv</artifactId>
+ <version>1.21.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -290,7 +301,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api-events</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -301,7 +312,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -312,7 +323,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -334,7 +345,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-extension-incubator</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0-alpha</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -345,7 +356,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-common</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -356,7 +367,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -367,7 +378,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -378,7 +389,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-logs</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -389,7 +400,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-metrics</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -400,7 +411,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
- <version>1.29.0</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -411,18 +422,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
- <version>1.29.0</version>
- <exclusions>
- <exclusion>
- <artifactId>*</artifactId>
- <groupId>*</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.opentelemetry</groupId>
- <artifactId>opentelemetry-semconv</artifactId>
- <version>1.29.0-alpha</version>
+ <version>1.32.0</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -620,7 +620,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-api</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -631,7 +631,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-cdi</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -642,7 +642,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-config</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
@@ -653,7 +653,7 @@
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-rest</artifactId>
- <version>2.6.0</version>
+ <version>2.6.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
diff --git a/pom.xml b/pom.xml
index 009a651ed6..b28179f52e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -198,7 +198,7 @@
<version.microprofile.impl.metrics>5.0.1</version.microprofile.impl.metrics>
<version.microprofile.impl.openapi>3.10.0</version.microprofile.impl.openapi>
<version.microprofile.impl.opentracing>3.0.3</version.microprofile.impl.opentracing>
- <version.microprofile.impl.opentelemetry>2.6.0</version.microprofile.impl.opentelemetry>
+ <version.microprofile.impl.opentelemetry>2.6.1-SNAPSHOT</version.microprofile.impl.opentelemetry>
<!-- Jackson and snakeyaml required by OpenAPI Impl -->
<version.jackson>2.16.2</version.jackson>
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
index 9f7f3b04b5..1e685c5ab1 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
@@ -64,6 +64,7 @@ public class TomEEMicroProfileListener {
"io.smallrye.opentracing.SmallRyeTracingDynamicFeature",
"io.smallrye.opentracing.contrib.interceptor.OpenTracingInterceptor",
"io.smallrye.faulttolerance.FaultToleranceExtension",
+ "io.smallrye.opentelemetry.implementation.cdi.OpenTelemetryExtension",
};
public void enhanceScannableUrls(@Observes final EnhanceScannableUrlsEvent enhanceScannableUrlsEvent) {
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/MPOpenTelemetryCDIExtension.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/MPOpenTelemetryCDIExtension.java
index 522561bb1e..98035a0850 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/MPOpenTelemetryCDIExtension.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/MPOpenTelemetryCDIExtension.java
@@ -16,149 +16,23 @@
*/
package org.apache.tomee.microprofile.opentelemetry;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import io.opentelemetry.instrumentation.annotations.WithSpan;
-import io.smallrye.opentelemetry.implementation.cdi.OpenTelemetryProducer;
import io.smallrye.opentelemetry.implementation.config.OpenTelemetryConfigProducer;
import jakarta.enterprise.event.Observes;
-import jakarta.enterprise.inject.spi.AnnotatedConstructor;
-import jakarta.enterprise.inject.spi.AnnotatedField;
-import jakarta.enterprise.inject.spi.AnnotatedMethod;
-import jakarta.enterprise.inject.spi.AnnotatedParameter;
-import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
import jakarta.enterprise.inject.spi.Extension;
-import jakarta.enterprise.util.Nonbinding;
+import org.apache.openejb.loader.SystemInstance;
public class MPOpenTelemetryCDIExtension implements Extension {
- public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
- beforeBeanDiscovery.addInterceptorBinding(
- new MPOpenTelemetryCDIExtension.WithSpanAnnotatedType(beanManager.createAnnotatedType(WithSpan.class)));
-
- beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(OpenTelemetryProducer.class), "OpenTelemetryProducer");
- beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(WithSpanInterceptorProducer.class), "WithSpanInterceptorProducer");
- beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(OpenTelemetryConfigProducer.class), "OpenTelemetryConfigProducer");
+ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
+ final String mpScan = SystemInstance.get().getOptions().get("tomee.mp.scan", "none");
+ if (mpScan.equals("none")) {
+ SystemInstance.get().setProperty(MPOpenTelemetryCDIExtension.class.getName() + ".active", "false");
+ return;
}
- // To add Nonbinding to @WithSpan members
- @SuppressWarnings("unchecked")
- static class WithSpanAnnotatedType implements AnnotatedType<WithSpan> {
- private final AnnotatedType<WithSpan> delegate;
- private final Set<AnnotatedMethod<? super WithSpan>> methods;
-
- WithSpanAnnotatedType(final AnnotatedType<WithSpan> delegate) {
- this.delegate = delegate;
- this.methods = new HashSet<>();
-
- for (AnnotatedMethod<? super WithSpan> method : delegate.getMethods()) {
- methods.add(new AnnotatedMethod<WithSpan>() {
- private final AnnotatedMethod<WithSpan> delegate = (AnnotatedMethod<WithSpan>) method;
- private final Set<Annotation> annotations = Collections.singleton(Nonbinding.Literal.INSTANCE);
-
- @Override
- public Method getJavaMember() {
- return delegate.getJavaMember();
- }
-
- @Override
- public List<AnnotatedParameter<WithSpan>> getParameters() {
- return delegate.getParameters();
- }
-
- @Override
- public boolean isStatic() {
- return delegate.isStatic();
- }
-
- @Override
- public AnnotatedType<WithSpan> getDeclaringType() {
- return delegate.getDeclaringType();
- }
-
- @Override
- public Type getBaseType() {
- return delegate.getBaseType();
- }
-
- @Override
- public Set<Type> getTypeClosure() {
- return delegate.getTypeClosure();
- }
-
- @Override
- public <T extends Annotation> T getAnnotation(final Class<T> annotationType) {
- if (annotationType.equals(Nonbinding.class)) {
- return (T) annotations.iterator().next();
- }
- return null;
- }
-
- @Override
- public Set<Annotation> getAnnotations() {
- return annotations;
- }
-
- @Override
- public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) {
- return annotationType.equals(Nonbinding.class);
- }
- });
- }
- }
-
- @Override
- public Class<WithSpan> getJavaClass() {
- return delegate.getJavaClass();
- }
-
- @Override
- public Set<AnnotatedConstructor<WithSpan>> getConstructors() {
- return delegate.getConstructors();
- }
-
- @Override
- public Set<AnnotatedMethod<? super WithSpan>> getMethods() {
- return this.methods;
- }
-
- @Override
- public Set<AnnotatedField<? super WithSpan>> getFields() {
- return delegate.getFields();
- }
-
- @Override
- public Type getBaseType() {
- return delegate.getBaseType();
- }
-
- @Override
- public Set<Type> getTypeClosure() {
- return delegate.getTypeClosure();
- }
-
- @Override
- public <T extends Annotation> T getAnnotation(final Class<T> annotationType) {
- return delegate.getAnnotation(annotationType);
- }
-
- @Override
- public Set<Annotation> getAnnotations() {
- return delegate.getAnnotations();
- }
-
- @Override
- public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) {
- return delegate.isAnnotationPresent(annotationType);
- }
- }
+ beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(OpenTelemetryConfigProducer.class), "OpenTelemetryConfigProducer");
+ }
}
\ No newline at end of file
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/WithSpanInterceptorProducer.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/WithSpanInterceptorProducer.java
deleted file mode 100644
index 13fdc95dd0..0000000000
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentelemetry/WithSpanInterceptorProducer.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.tomee.microprofile.opentelemetry;
-
-import io.smallrye.opentelemetry.implementation.cdi.WithSpanInterceptorBean;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.enterprise.inject.Produces;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.inject.Inject;
-
-@ApplicationScoped
-public class WithSpanInterceptorProducer {
-
- @Inject
- private BeanManager beanManager;
-
- @Produces
- public WithSpanInterceptorBean createWithSpanInterceptorBean() {
- return new WithSpanInterceptorBean(beanManager); //This is a hack as the actual interceptor bean from Smallrye has no default constructor breaking OWB.
- }
-}
\ No newline at end of file
diff --git a/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
deleted file mode 100644
index c8770a9761..0000000000
--- a/tomee/tomee-microprofile/mp-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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
-#
-# http://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.
-
-configuration.ordinal=75
-
-# exclude this extension from being loaded as we need to workaround a smallrye bean with no default constructor
-org.apache.webbeans.ignoredExtensions=io.smallrye.opentelemetry.implementation.cdi.OpenTelemetryExtension