You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/02/26 08:45:55 UTC
[camel] branch camel-2.20.x updated: CAMEL-12289:
camel-opentracing: URISyntaxException in AbstractSpanDecorator
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.20.x by this push:
new 4909b61 CAMEL-12289: camel-opentracing: URISyntaxException in AbstractSpanDecorator
4909b61 is described below
commit 4909b6190ba73d3856512e8906811e4dc58c4acb
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 26 09:44:48 2018 +0100
CAMEL-12289: camel-opentracing: URISyntaxException in AbstractSpanDecorator
---
.../opentracing/decorators/AbstractSpanDecorator.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
index 74d42a0..702e43f 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.opentracing.decorators;
-import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -26,6 +25,7 @@ import io.opentracing.tag.Tags;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.opentracing.SpanDecorator;
+import org.apache.camel.util.StringHelper;
import org.apache.camel.util.URISupport;
/**
@@ -43,7 +43,7 @@ public abstract class AbstractSpanDecorator implements SpanDecorator {
// OpenTracing aims to use low cardinality operation names. Ideally a specific
// span decorator should be defined for all relevant Camel components that
// identify a meaningful operation name
- return URI.create(endpoint.getEndpointUri()).getScheme();
+ return getComponentName(endpoint);
}
/**
@@ -69,7 +69,8 @@ public abstract class AbstractSpanDecorator implements SpanDecorator {
@Override
public void pre(Span span, Exchange exchange, Endpoint endpoint) {
- span.setTag(Tags.COMPONENT.getKey(), CAMEL_COMPONENT + URI.create(endpoint.getEndpointUri()).getScheme());
+ String scheme = getComponentName(endpoint);
+ span.setTag(Tags.COMPONENT.getKey(), CAMEL_COMPONENT + scheme);
// Including the endpoint URI provides access to any options that may have been provided, for
// subsequent analysis
@@ -116,4 +117,13 @@ public abstract class AbstractSpanDecorator implements SpanDecorator {
return Collections.emptyMap();
}
+ private static String getComponentName(Endpoint endpoint) {
+ String[] splitURI = StringHelper.splitOnCharacter(endpoint.getEndpointUri(), ":", 2);
+ if (splitURI.length > 0) {
+ return splitURI[0];
+ } else {
+ return null;
+ }
+ }
+
}
--
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.