This is an automated email from the ASF dual-hosted git repository. fmariani pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 56a1c78f49bdea570e91b08ed499852dcf722321 Author: Pasquale Congiusti <[email protected]> AuthorDate: Fri Jan 16 10:46:51 2026 +0100 chore(components): clear otel warnings Ref CAMEL-22549 --- ...OpenTelemetryInstrumentedThreadPoolFactory.java | 2 +- .../opentelemetry/OpenTelemetrySpanAdapter.java | 23 ++++++++++++---------- .../apache/camel/opentelemetry/SpanTestData.java | 1 - 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryInstrumentedThreadPoolFactory.java b/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryInstrumentedThreadPoolFactory.java index 733d3921d1e6..512ee8603580 100644 --- a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryInstrumentedThreadPoolFactory.java +++ b/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryInstrumentedThreadPoolFactory.java @@ -29,7 +29,7 @@ import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.support.DefaultThreadPoolFactory; @JdkService(ThreadPoolFactory.FACTORY) -public class OpenTelemetryInstrumentedThreadPoolFactory extends DefaultThreadPoolFactory implements ThreadPoolFactory { +public class OpenTelemetryInstrumentedThreadPoolFactory extends DefaultThreadPoolFactory { @Override public ExecutorService newCachedThreadPool(ThreadFactory threadFactory) { diff --git a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetrySpanAdapter.java b/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetrySpanAdapter.java index 61e8c18a68ee..65ad40dbd932 100644 --- a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetrySpanAdapter.java +++ b/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetrySpanAdapter.java @@ -16,7 +16,7 @@ */ package org.apache.camel.opentelemetry; -import java.util.EnumMap; +import java.util.HashMap; import java.util.Map; import io.opentelemetry.api.baggage.Baggage; @@ -27,21 +27,22 @@ import io.opentelemetry.api.trace.StatusCode; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import org.apache.camel.tracing.SpanAdapter; import org.apache.camel.tracing.Tag; +import org.apache.camel.tracing.TagConstants; public class OpenTelemetrySpanAdapter implements SpanAdapter { private static final String DEFAULT_EVENT_NAME = "log"; - private static final Map<Tag, String> TAG_MAP = new EnumMap<>(Tag.class); + private static final Map<String, String> TAG_MAP = new HashMap<>(); static { - TAG_MAP.put(Tag.COMPONENT, "component"); - TAG_MAP.put(Tag.DB_TYPE, SemanticAttributes.DB_SYSTEM.getKey()); - TAG_MAP.put(Tag.DB_STATEMENT, SemanticAttributes.DB_STATEMENT.getKey()); - TAG_MAP.put(Tag.DB_INSTANCE, SemanticAttributes.DB_NAME.getKey()); - TAG_MAP.put(Tag.HTTP_METHOD, SemanticAttributes.HTTP_METHOD.getKey()); - TAG_MAP.put(Tag.HTTP_STATUS, SemanticAttributes.HTTP_STATUS_CODE.getKey()); - TAG_MAP.put(Tag.HTTP_URL, SemanticAttributes.HTTP_URL.getKey()); - TAG_MAP.put(Tag.MESSAGE_BUS_DESTINATION, "message_bus.destination"); + TAG_MAP.put(TagConstants.COMPONENT, "component"); + TAG_MAP.put(TagConstants.DB_SYSTEM, SemanticAttributes.DB_SYSTEM.getKey()); + TAG_MAP.put(TagConstants.DB_STATEMENT, SemanticAttributes.DB_STATEMENT.getKey()); + TAG_MAP.put(TagConstants.DB_NAME, SemanticAttributes.DB_NAME.getKey()); + TAG_MAP.put(TagConstants.HTTP_METHOD, SemanticAttributes.HTTP_METHOD.getKey()); + TAG_MAP.put(TagConstants.HTTP_STATUS, SemanticAttributes.HTTP_STATUS_CODE.getKey()); + TAG_MAP.put(TagConstants.HTTP_URL, SemanticAttributes.HTTP_URL.getKey()); + TAG_MAP.put(TagConstants.MESSAGE_BUS_DESTINATION, "message_bus.destination"); } private Baggage baggage; @@ -72,6 +73,7 @@ public class OpenTelemetrySpanAdapter implements SpanAdapter { } @Override + @Deprecated public void setTag(Tag key, String value) { String attribute = TAG_MAP.getOrDefault(key, key.getAttribute()); this.span.setAttribute(attribute, value); @@ -81,6 +83,7 @@ public class OpenTelemetrySpanAdapter implements SpanAdapter { } @Override + @Deprecated public void setTag(Tag key, Number value) { this.span.setAttribute(TAG_MAP.getOrDefault(key, key.getAttribute()), value.intValue()); } diff --git a/components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/SpanTestData.java b/components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/SpanTestData.java index 34fb7a1e560e..99cf5eb864a8 100644 --- a/components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/SpanTestData.java +++ b/components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/SpanTestData.java @@ -35,7 +35,6 @@ public class SpanTestData { private final List<String> logMessages = new ArrayList<>(); private final Map<String, String> tags = new HashMap<>(); private final ArrayList<SpanTestData> children = new ArrayList<>(); - private final Map<String, String> baggage = new HashMap<>(); public String getLabel() { return label;
