Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,21 +27,22 @@
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;
Expand Down Expand Up @@ -72,6 +73,7 @@ public void setError(boolean error) {
}

@Override
@Deprecated
public void setTag(Tag key, String value) {
String attribute = TAG_MAP.getOrDefault(key, key.getAttribute());
this.span.setAttribute(attribute, value);
Expand All @@ -81,6 +83,7 @@ public void setTag(Tag key, String value) {
}

@Override
@Deprecated
public void setTag(Tag key, Number value) {
this.span.setAttribute(TAG_MAP.getOrDefault(key, key.getAttribute()), value.intValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down