You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2017/11/29 14:51:52 UTC
[camel] 05/08: Added decorator support similar to OpenTracing
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b3325893cfb66150dd526a943d9c47e7d0dddfe9
Author: Roman Vottner <ro...@gmx.at>
AuthorDate: Wed Nov 1 20:52:48 2017 +0100
Added decorator support similar to OpenTracing
---
.../camel/component/aws/xray/SegmentDecorator.java | 83 +++++++++++++++++
.../camel/component/aws/xray/XRayTracer.java | 67 +++++++++++---
.../xray/decorators/AbstractSegmentDecorator.java | 101 ++++++++++++++++++++
.../aws/xray/decorators/CqlSegmentDecorator.java | 58 ++++++++++++
.../decorators/ElasticsearchSegmentDecorator.java | 59 ++++++++++++
.../aws/xray/decorators/JdbcSegmentDecorator.java | 41 +++++++++
.../aws/xray/decorators/LogSegmentDecorator.java | 30 ++++++
.../xray/decorators/MongoDBSegmentDecorator.java | 52 +++++++++++
.../aws/xray/decorators/SqlSegmentDecorator.java | 43 +++++++++
.../aws/xray/decorators/TimerSegmentDecorator.java | 34 +++++++
.../http/AbstractHttpSegmentDecorator.java | 102 +++++++++++++++++++++
.../xray/decorators/http/AhcSegmentDecorator.java | 25 +++++
.../decorators/http/Http4SegmentDecorator.java | 25 +++++
.../xray/decorators/http/HttpSegmentDecorator.java | 25 +++++
.../decorators/http/JettySegmentDecorator.java | 25 +++++
.../http/NettyHttp4SegmentDecorator.java | 25 +++++
.../decorators/http/NettyHttpSegmentDecorator.java | 25 +++++
.../xray/decorators/http/RestSegmentDecorator.java | 101 ++++++++++++++++++++
.../decorators/http/RestletSegmentDecorator.java | 25 +++++
.../decorators/http/ServletSegmentDecorator.java | 25 +++++
.../decorators/http/UndertowSegmentDecorator.java | 25 +++++
.../internal/AbstractInternalSegmentDecorator.java | 31 +++++++
.../internal/DirectSegmentDecorator.java | 25 +++++
.../internal/DirectvmSegmentDecorator.java | 25 +++++
.../internal/DisruptorSegmentDecorator.java | 25 +++++
.../internal/DisruptorvmSegmentDecorator.java | 25 +++++
.../decorators/internal/SedaSegmentDecorator.java | 25 +++++
.../decorators/internal/VmSegmentDecorator.java | 25 +++++
.../AbstractMessagingSegmentDecorator.java | 52 +++++++++++
.../decorators/messaging/AmqpSegmentDecorator.java | 25 +++++
.../messaging/AwsSnsSegmentDecorator.java | 34 +++++++
.../messaging/AwsSqsSegmentDecorator.java | 34 +++++++
.../messaging/CometdSegmentDecorator.java | 35 +++++++
.../messaging/CometdsSegmentDecorator.java | 25 +++++
.../messaging/IronmqSegmentDecorator.java | 34 +++++++
.../decorators/messaging/JmsSegmentDecorator.java | 34 +++++++
.../messaging/KafkaSegmentDecorator.java | 80 ++++++++++++++++
.../decorators/messaging/MqttSegmentDecorator.java | 42 +++++++++
.../decorators/messaging/PahoSegmentDecorator.java | 25 +++++
.../messaging/RabbitmqSegmentDecorator.java | 38 ++++++++
.../decorators/messaging/SjmsSegmentDecorator.java | 25 +++++
.../messaging/StompSegmentDecorator.java | 36 ++++++++
.../camel/component/aws/xray/ABCRouteTest.java | 8 +-
.../camel/component/aws/xray/BeanTracingTest.java | 4 +-
.../aws/xray/ClientRecipientListRouteTest.java | 6 +-
.../camel/component/aws/xray/EIPTracingTest.java | 4 +-
.../component/aws/xray/ErrorHandlingTest.java | 4 +-
.../aws/xray/MulticastParallelRouteTest.java | 8 +-
.../component/aws/xray/MulticastRouteTest.java | 8 +-
.../camel/component/aws/xray/TwoService2Test.java | 2 +-
.../camel/component/aws/xray/TwoServiceTest.java | 2 +-
.../aws/xray/TwoServiceWithExcludeTest.java | 2 +-
52 files changed, 1708 insertions(+), 36 deletions(-)
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/SegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/SegmentDecorator.java
new file mode 100644
index 0000000..9656f70
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/SegmentDecorator.java
@@ -0,0 +1,83 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.aws.xray.decorators.AbstractSegmentDecorator;
+
+/**
+ * This interface represents a decorator specific to the component/endpoint being instrumented.
+ */
+public interface SegmentDecorator {
+
+ /* Prefix for camel component tag */
+ String CAMEL_COMPONENT = "camel-";
+
+ SegmentDecorator DEFAULT = new AbstractSegmentDecorator() {
+
+ @Override
+ public String getComponent() {
+ return null;
+ }
+ };
+
+ /**
+ * This method indicates whether the component associated with the SegmentDecorator should result in a new segment
+ * being created.
+ *
+ * @return Whether a new segment should be created
+ */
+ boolean newSegment();
+
+ /**
+ * The camel component associated with the decorator.
+ *
+ * @return The camel component name
+ */
+ String getComponent();
+
+ /**
+ * This method returns the operation name to use with the segment representing this exchange and endpoint.
+ *
+ * @param exchange The exchange
+ * @param endpoint The endpoint
+ * @return The operation name
+ */
+ String getOperationName(Exchange exchange, Endpoint endpoint);
+
+ /**
+ * This method adds appropriate details (tags/logs) to the supplied segment based on the pre processing of the
+ * exchange.
+ *
+ * @param segment The segment
+ * @param exchange The exchange
+ * @param endpoint The endpoint
+ */
+ void pre(Entity segment, Exchange exchange, Endpoint endpoint);
+
+ /**
+ * This method adds appropriate details (tags/logs) to the supplied segment based on the post processing of the
+ * exchange.
+ *
+ * @param segment The segment
+ * @param exchange The exchange
+ * @param endpoint The endpoint
+ */
+ void post(Entity segment, Exchange exchange, Endpoint endpoint);
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
index 0cedcd6..d6dcae2 100644
--- a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
@@ -17,9 +17,8 @@
package org.apache.camel.component.aws.xray;
import java.lang.invoke.MethodHandles;
-import java.util.EventObject;
-import java.util.HashSet;
-import java.util.Set;
+import java.net.URI;
+import java.util.*;
import com.amazonaws.xray.AWSXRay;
import com.amazonaws.xray.entities.Segment;
@@ -28,6 +27,7 @@ import com.amazonaws.xray.entities.TraceID;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
+import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Route;
import org.apache.camel.StaticService;
@@ -69,6 +69,8 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private static Map<String, SegmentDecorator> decorators = new HashMap<>();
+
/** Exchange property for passing a segment between threads **/
private static final String CURRENT_SEGMENT = "CAMEL_PROPERTY_AWS_XRAY_CURRENT_SEGMENT";
@@ -78,6 +80,17 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
private Set<String> excludePatterns = new HashSet<>();
private InterceptStrategy tracingStrategy;
+ static {
+ ServiceLoader.load(SegmentDecorator.class).forEach(d -> {
+ SegmentDecorator existing = decorators.get(d.getComponent());
+ // Add segment decorator only if no existing decorator for the component exists yet or if we have have a
+ // derived one. This allows custom decorators to be added if they extend the standard decorators
+ if (existing == null || existing.getClass().isInstance(d)) {
+ decorators.put(d.getComponent(), d);
+ }
+ });
+ }
+
@Override
public void setCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
@@ -153,10 +166,10 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
/**
* Specifies the instance responsible for tracking invoked EIP and beans with AWS XRay.
*
- * @param traceingStrategy The instance which tracks invoked EIP and beans
+ * @param tracingStrategy The instance which tracks invoked EIP and beans
*/
- public void setTracingStrategy(InterceptStrategy traceingStrategy) {
- this.tracingStrategy = traceingStrategy;
+ public void setTracingStrategy(InterceptStrategy tracingStrategy) {
+ this.tracingStrategy = tracingStrategy;
}
/**
@@ -202,6 +215,14 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
return false;
}
+ protected SegmentDecorator getSegmentDecorator(Endpoint endpoint) {
+ SegmentDecorator sd = decorators.get(URI.create(endpoint.getEndpointUri()).getScheme());
+ if (null == sd) {
+ return SegmentDecorator.DEFAULT;
+ }
+ return sd;
+ }
+
/**
* Custom camel event handler that will create a new {@link Subsegment XRay subsegment} in case
* the current exchange is forwarded via <code>.to(someEndpoint)</code> to some endpoint and
@@ -239,13 +260,16 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
AWSXRay.setTraceEntity(segment);
}
+ SegmentDecorator sd = getSegmentDecorator(ese.getEndpoint());
+ if (!sd.newSegment()) {
+ return;
+ }
+
if (AWSXRay.getCurrentSegmentOptional().isPresent()) {
- String endpointName = ese.getEndpoint().getEndpointKey();
- // AWS XRay does only allow a certain set of characters to appear within a name
- // Allowed characters: a-z, A-Z, 0-9, _, ., :, /, %, &, #, =, +, \, -, @
- endpointName = endpointName.replaceAll("://", "_");
- endpointName = endpointName.replaceAll("\\?", "&");
- Subsegment subsegment = AWSXRay.beginSubsegment("SendingTo_" + endpointName);
+// // AWS XRay does only allow a certain set of characters to appear within a name
+// // Allowed characters: a-z, A-Z, 0-9, _, ., :, /, %, &, #, =, +, \, -, @
+ Subsegment subsegment = AWSXRay.beginSubsegment(sd.getOperationName(ese.getExchange(), ese.getEndpoint()));
+ sd.pre(subsegment, ese.getExchange(), ese.getEndpoint());
LOG.trace("Creating new subsegment with ID {} and name {}",
subsegment.getId(), subsegment.getName());
} else {
@@ -257,8 +281,11 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
LOG.trace("-> {} - target: {} (routeId: {})",
event.getClass().getSimpleName(), ese.getEndpoint(), ese.getExchange().getFromRouteId());
+ SegmentDecorator sd = getSegmentDecorator(ese.getEndpoint());
+
if (AWSXRay.getCurrentSubsegmentOptional().isPresent()) {
Subsegment subsegment = AWSXRay.getCurrentSubsegment();
+ sd.post(subsegment, ese.getExchange(), ese.getEndpoint());
subsegment.close();
LOG.trace("Closing down subsegment with ID {} and name {}",
subsegment.getId(), subsegment.getName());
@@ -274,6 +301,11 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
return event instanceof ExchangeSendingEvent
|| event instanceof ExchangeSentEvent;
}
+
+ @Override
+ public String toString() {
+ return "XRayEventNotifier";
+ }
}
/**
@@ -316,14 +348,17 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
exchange.getIn().setHeader(XRAY_TRACE_ID, traceID.toString());
}
+ SegmentDecorator sd = getSegmentDecorator(route.getEndpoint());
if (!AWSXRay.getCurrentSegmentOptional().isPresent()) {
Segment segment = AWSXRay.beginSegment(route.getId());
segment.setTraceId(traceID);
+ sd.pre(segment, exchange, route.getEndpoint());
LOG.trace("Created new XRay segment {} with name {}",
segment.getId(), segment.getName());
exchange.setProperty(CURRENT_SEGMENT, segment);
} else {
Subsegment subsegment = AWSXRay.beginSubsegment(route.getId());
+ sd.pre(subsegment, exchange, route.getEndpoint());
LOG.trace("Created new XRay subsegment {} with name {}",
subsegment.getId(), subsegment.getName());
}
@@ -338,17 +373,25 @@ public class XRayTracer extends ServiceSupport implements RoutePolicyFactory, St
LOG.trace("=> RoutePolicy-Done: Route: {} - RouteId: {}", routeId, route.getId());
+ SegmentDecorator sd = getSegmentDecorator(route.getEndpoint());
if (AWSXRay.getCurrentSubsegmentOptional().isPresent()) {
Subsegment subsegment = AWSXRay.getCurrentSubsegment();
+ sd.post(subsegment, exchange, route.getEndpoint());
subsegment.close();
LOG.trace("Closing down Subsegment {} with name {}",
subsegment.getId(), subsegment.getName());
} else if (AWSXRay.getCurrentSegmentOptional().isPresent()) {
Segment segment = AWSXRay.getCurrentSegment();
+ sd.post(segment, exchange, route.getEndpoint());
segment.close();
LOG.trace("Closing down Segment {} with name {}",
segment.getId(), segment.getName());
}
}
+
+ @Override
+ public String toString() {
+ return "XRayRoutePolicy";
+ }
}
}
\ No newline at end of file
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/AbstractSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/AbstractSegmentDecorator.java
new file mode 100644
index 0000000..f5403a5
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/AbstractSegmentDecorator.java
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.aws.xray.SegmentDecorator;
+import org.apache.camel.util.URISupport;
+
+/**
+ * An abstract base implementation of the {@link SegmentDecorator} interface.
+ */
+public abstract class AbstractSegmentDecorator implements SegmentDecorator {
+
+ @Override
+ public boolean newSegment() {
+ return true;
+ }
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ URI uri = URI.create(endpoint.getEndpointUri());
+ return uri.getScheme() + "-" + uri.getRawAuthority();
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ segment.putMetadata("component", CAMEL_COMPONENT + URI.create(endpoint.getEndpointUri()).getScheme());
+ segment.putMetadata("camel.uri", URISupport.sanitizeUri(endpoint.getEndpointUri()));
+ }
+
+ @Override
+ public void post(Entity segment, Exchange exchange, Endpoint endpoint) {
+ if (exchange.isFailed()) {
+ segment.setFault(true);
+ if (exchange.getException() != null) {
+ segment.addException(exchange.getException());
+ }
+ }
+ }
+
+ /**
+ * This method removes the scheme, any leading slash characters and options from the supplied URI. This is intended
+ * to extract a meaningful name from the URI that can be used in situations, such as the operation name.
+ *
+ * @param endpoint The endpoint
+ * @return The stripped value from the URI
+ */
+ public static String stripSchemeAndOptions(Endpoint endpoint) {
+ int start = endpoint.getEndpointUri().indexOf(":");
+ start++;
+ // Remove any leading '/'
+ while (endpoint.getEndpointUri().charAt(start) == '/') {
+ start++;
+ }
+ int end = endpoint.getEndpointUri().indexOf("?");
+ return end == -1 ? endpoint.getEndpointUri().substring(start) : endpoint.getEndpointUri().substring(start, end);
+ }
+
+ /**
+ * Extracts any parameters passed in the given URI as a key-value representation.
+ *
+ * @param uri The URI to extract passed parameters from
+ * @return A {@link Map} representation of the contained parameters of the provided URI
+ */
+ public static Map<String, String> toQueryParameters(String uri) {
+ int index = uri.indexOf("?");
+ if (index != -1) {
+ String queryString = uri.substring(index + 1);
+ Map<String, String> map = new HashMap<>();
+ for (String param : queryString.split("&")) {
+ String[] parts = param.split("=");
+ if (parts.length == 2) {
+ map.put(parts[0], parts[1]);
+ }
+ }
+ return map;
+ }
+ return Collections.emptyMap();
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/CqlSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/CqlSegmentDecorator.java
new file mode 100644
index 0000000..8d691e6
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/CqlSegmentDecorator.java
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import java.net.URI;
+import java.util.Map;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class CqlSegmentDecorator extends AbstractSegmentDecorator {
+
+ public static final String CASSANDRA_DB_TYPE = "cassandra";
+ protected static final String CAMEL_CQL_QUERY = "CamelCqlQuery";
+
+ @Override
+ public String getComponent() {
+ return "cql";
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ segment.putMetadata("db.type", CASSANDRA_DB_TYPE);
+
+ URI uri = URI.create(endpoint.getEndpointUri());
+ if (uri.getPath() != null && uri.getPath().length() > 0) {
+ // Strip leading '/' from path
+ segment.putMetadata("db.instance", uri.getPath().substring(1));
+ }
+
+ Object cql = exchange.getIn().getHeader(CAMEL_CQL_QUERY);
+ if (cql != null) {
+ segment.putSql("db.statement", cql);
+ } else {
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ if (queryParameters.containsKey("cql")) {
+ segment.putSql("db.statement", queryParameters.get("cql"));
+ }
+ }
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/ElasticsearchSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/ElasticsearchSegmentDecorator.java
new file mode 100644
index 0000000..000d0cb
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/ElasticsearchSegmentDecorator.java
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import java.util.Map;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class ElasticsearchSegmentDecorator extends AbstractSegmentDecorator {
+
+ public static final String ELASTICSARCH_DB_TYPE = "elasticsearch";
+ public static final String ELASTICSEARCH_CLUSTER_TAG = "elasticsearch.cluster";
+
+ @Override
+ public String getComponent() {
+ return "elasticsearch";
+ }
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ return queryParameters.containsKey("operation")
+ ? queryParameters.get("operation")
+ : super.getOperationName(exchange, endpoint);
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ segment.putMetadata("db.type", ELASTICSARCH_DB_TYPE);
+
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ if (queryParameters.containsKey("indexName")) {
+ segment.putMetadata("db.instance", queryParameters.get("indexName"));
+ }
+
+ String cluster = stripSchemeAndOptions(endpoint);
+ if (null != cluster) {
+ segment.putMetadata(ELASTICSEARCH_CLUSTER_TAG, cluster);
+ }
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/JdbcSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/JdbcSegmentDecorator.java
new file mode 100644
index 0000000..43b0146
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/JdbcSegmentDecorator.java
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class JdbcSegmentDecorator extends AbstractSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "jdbc";
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ segment.putMetadata("db.type", "sql");
+
+ Object body = exchange.getIn().getBody();
+ if (body instanceof String) {
+ segment.putMetadata("db.statement", body);
+ }
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/LogSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/LogSegmentDecorator.java
new file mode 100644
index 0000000..fafd3a5
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/LogSegmentDecorator.java
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+public class LogSegmentDecorator extends AbstractSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "log";
+ }
+
+ @Override
+ public boolean newSegment() {
+ return false;
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/MongoDBSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/MongoDBSegmentDecorator.java
new file mode 100644
index 0000000..f7aebc1
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/MongoDBSegmentDecorator.java
@@ -0,0 +1,52 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import java.util.Map;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class MongoDBSegmentDecorator extends AbstractSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "mongodb";
+ }
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ String opName = queryParameters.get("operation");
+ return opName != null ? opName : super.getOperationName(exchange, endpoint);
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ segment.putMetadata("db.type", getComponent());
+
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ String database = queryParameters.get("database");
+ if (null != database) {
+ segment.putMetadata("db.instance", database);
+ }
+ segment.putSql("db.statement", queryParameters.toString());
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/SqlSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/SqlSegmentDecorator.java
new file mode 100644
index 0000000..681af4e
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/SqlSegmentDecorator.java
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class SqlSegmentDecorator extends AbstractSegmentDecorator {
+
+ public static final String CAMEL_SQL_QUERY = "CamelSqlQuery";
+
+ @Override
+ public String getComponent() {
+ return "sql";
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ segment.putMetadata("db.type", "sql");
+
+ Object sqlQuery = exchange.getIn().getHeader(CAMEL_SQL_QUERY);
+ if (sqlQuery instanceof String) {
+ segment.putSql("db.statement", sqlQuery);
+ }
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/TimerSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/TimerSegmentDecorator.java
new file mode 100644
index 0000000..e1d8247
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/TimerSegmentDecorator.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class TimerSegmentDecorator extends AbstractSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "timer";
+ }
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ Object name = exchange.getProperty(Exchange.TIMER_NAME);
+ return name instanceof String ? (String) name : super.getOperationName(exchange, endpoint);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/AbstractHttpSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/AbstractHttpSegmentDecorator.java
new file mode 100644
index 0000000..07914da
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/AbstractHttpSegmentDecorator.java
@@ -0,0 +1,102 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.aws.xray.decorators.AbstractSegmentDecorator;
+
+public abstract class AbstractHttpSegmentDecorator extends AbstractSegmentDecorator {
+
+ public static final String POST_METHOD = "POST";
+ public static final String GET_METHOD = "GET";
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ return getHttpMethod(exchange, endpoint);
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ String httpUrl = getHttpUrl(exchange, endpoint);
+ if (httpUrl != null) {
+ segment.putMetadata("http.url", httpUrl);
+ }
+ segment.putMetadata("http.method", getHttpMethod(exchange, endpoint));
+ }
+
+ @Override
+ public void post(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.post(segment, exchange, endpoint);
+
+ if (exchange.hasOut()) {
+ Object responseCode = exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE);
+ if (responseCode instanceof Integer) {
+ segment.putMetadata("htt.response.code", responseCode);
+ }
+ }
+ }
+
+ protected String getHttpMethod(Exchange exchange, Endpoint endpoint) {
+ // 1. Use method provided in header.
+ Object method = exchange.getIn().getHeader(Exchange.HTTP_METHOD);
+ if (method instanceof String) {
+ return (String)method;
+ }
+
+ // 2. GET if query string is provided in header.
+ if (exchange.getIn().getHeader(Exchange.HTTP_QUERY) != null) {
+ return GET_METHOD;
+ }
+
+ // 3. GET if endpoint is configured with a query string.
+ if (endpoint.getEndpointUri().indexOf('?') != -1) {
+ return GET_METHOD;
+ }
+
+ // 4. POST if there is data to send (body is not null).
+ if (exchange.getIn().getBody() != null) {
+ return POST_METHOD;
+ }
+
+ // 5. GET otherwise.
+ return GET_METHOD;
+ }
+
+
+ protected String getHttpUrl(Exchange exchange, Endpoint endpoint) {
+ Object url = exchange.getIn().getHeader(Exchange.HTTP_URL);
+ if (url instanceof String) {
+ return (String) url;
+ } else {
+ Object uri = exchange.getIn().getHeader(Exchange.HTTP_URI);
+ if (uri instanceof String) {
+ return (String) uri;
+ } else {
+ // Try to obtain from endpoint
+ int index = endpoint.getEndpointUri().lastIndexOf("http:");
+ if (index != -1) {
+ return endpoint.getEndpointUri().substring(index);
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/AhcSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/AhcSegmentDecorator.java
new file mode 100644
index 0000000..f1adea4
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/AhcSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class AhcSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "ahc";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/Http4SegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/Http4SegmentDecorator.java
new file mode 100644
index 0000000..171c370
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/Http4SegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class Http4SegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "http4";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/HttpSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/HttpSegmentDecorator.java
new file mode 100644
index 0000000..847d6ff
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/HttpSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class HttpSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "http";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/JettySegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/JettySegmentDecorator.java
new file mode 100644
index 0000000..0d2bd45
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/JettySegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class JettySegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "jetty";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/NettyHttp4SegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/NettyHttp4SegmentDecorator.java
new file mode 100644
index 0000000..b1a7b85
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/NettyHttp4SegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class NettyHttp4SegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "netty-http4";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/NettyHttpSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/NettyHttpSegmentDecorator.java
new file mode 100644
index 0000000..9d37143
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/NettyHttpSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class NettyHttpSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "netty-http";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java
new file mode 100644
index 0000000..5ab981a
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+import java.io.UnsupportedEncodingException;
+import java.lang.invoke.MethodHandles;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RestSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ @Override
+ public String getComponent() {
+ return "rest";
+ }
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ return getPath(endpoint.getEndpointUri());
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ getParameters(getPath(endpoint.getEndpointUri())).forEach(param -> {
+ Object value = exchange.getIn().getHeader(param);
+ if (value != null) {
+ segment.putMetadata(param, value);
+ }
+ });
+ }
+
+ protected static String getPath(String uri) {
+ // Obtain the 'path' part of the URI format: rest://method:path[:uriTemplate]?[options]
+ String path = null;
+ int index = uri.indexOf(':');
+ if (index != -1) {
+ index = uri.indexOf(':', index + 1);
+ if (index != -1) {
+ path = uri.substring(index + 1);
+ index = path.indexOf('?');
+ if (index != -1) {
+ path = path.substring(0, index);
+ }
+ path = path.replaceAll(":", "");
+ try {
+ path = URLDecoder.decode(path, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ LOG.debug("Failed to decode URL path '" + path + "', ignoring exception", e);
+ }
+ }
+ }
+ return path;
+ }
+
+ protected static List<String> getParameters(String path) {
+ List<String> parameters = null;
+
+ int startIndex = path.indexOf('{');
+ while (startIndex != -1) {
+ int endIndex = path.indexOf('}', startIndex);
+ if (endIndex != -1) {
+ if (parameters == null) {
+ parameters = new ArrayList<>();
+ }
+ parameters.add(path.substring(startIndex + 1, endIndex));
+ startIndex = path.indexOf('{', endIndex);
+ } else {
+ // Break out of loop as no valid end token
+ startIndex = -1;
+ }
+ }
+
+ return parameters == null ? Collections.emptyList() : parameters;
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestletSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestletSegmentDecorator.java
new file mode 100644
index 0000000..743b51b
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestletSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class RestletSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "restlet";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/ServletSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/ServletSegmentDecorator.java
new file mode 100644
index 0000000..577be50
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/ServletSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class ServletSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "servlet";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/UndertowSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/UndertowSegmentDecorator.java
new file mode 100644
index 0000000..e972ca2
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/UndertowSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.http;
+
+public class UndertowSegmentDecorator extends AbstractHttpSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "undertow";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/AbstractInternalSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/AbstractInternalSegmentDecorator.java
new file mode 100644
index 0000000..d8bb656
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/AbstractInternalSegmentDecorator.java
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.aws.xray.decorators.AbstractSegmentDecorator;
+
+public abstract class AbstractInternalSegmentDecorator extends AbstractSegmentDecorator {
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ // Internal communication use descriptive names, so suitable as an operation name, but need to strop the scheme
+ // and any options
+ return stripSchemeAndOptions(endpoint);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DirectSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DirectSegmentDecorator.java
new file mode 100644
index 0000000..356c08d
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DirectSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+public class DirectSegmentDecorator extends AbstractInternalSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "direct";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DirectvmSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DirectvmSegmentDecorator.java
new file mode 100644
index 0000000..a2098f7
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DirectvmSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+public class DirectvmSegmentDecorator extends AbstractInternalSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "direct-vm";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DisruptorSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DisruptorSegmentDecorator.java
new file mode 100644
index 0000000..d006177
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DisruptorSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+public class DisruptorSegmentDecorator extends AbstractInternalSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "disruptor";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DisruptorvmSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DisruptorvmSegmentDecorator.java
new file mode 100644
index 0000000..a12b3ab
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/DisruptorvmSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+public class DisruptorvmSegmentDecorator extends AbstractInternalSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "disruptor-vm";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/SedaSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/SedaSegmentDecorator.java
new file mode 100644
index 0000000..c7522c6
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/SedaSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+public class SedaSegmentDecorator extends AbstractInternalSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "seda";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/VmSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/VmSegmentDecorator.java
new file mode 100644
index 0000000..531d3c3
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/internal/VmSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.internal;
+
+public class VmSegmentDecorator extends AbstractInternalSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "vm";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AbstractMessagingSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AbstractMessagingSegmentDecorator.java
new file mode 100644
index 0000000..ac7c06f
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AbstractMessagingSegmentDecorator.java
@@ -0,0 +1,52 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.aws.xray.decorators.AbstractSegmentDecorator;
+
+public abstract class AbstractMessagingSegmentDecorator extends AbstractSegmentDecorator {
+
+ protected static final String MESSAGE_BUS_ID = "message_bus.id";
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ return getDestination(exchange, endpoint);
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ segment.putMetadata("message_bus.destination", getDestination(exchange, endpoint));
+
+ String messageId = getMessageId(exchange);
+ if (null != messageId) {
+ segment.putMetadata(MESSAGE_BUS_ID, messageId);
+ }
+ }
+
+ protected String getDestination(Exchange exchange, Endpoint endpoint) {
+ return stripSchemeAndOptions(endpoint);
+ }
+
+ protected String getMessageId(Exchange exchange) {
+ return null;
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AmqpSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AmqpSegmentDecorator.java
new file mode 100644
index 0000000..e8e4a47
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AmqpSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+public class AmqpSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "amqp";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AwsSnsSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AwsSnsSegmentDecorator.java
new file mode 100644
index 0000000..53033b9
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AwsSnsSegmentDecorator.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import org.apache.camel.Exchange;
+
+public class AwsSnsSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ protected static final String CAMEL_AWS_SNS_MESSAGE_ID = "CamelAwsSnsMessageId";
+
+ @Override
+ public String getComponent() {
+ return "aws-sns";
+ }
+
+ @Override
+ protected String getMessageId(Exchange exchange) {
+ return (String) exchange.getIn().getHeader(CAMEL_AWS_SNS_MESSAGE_ID);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AwsSqsSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AwsSqsSegmentDecorator.java
new file mode 100644
index 0000000..eabc901
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/AwsSqsSegmentDecorator.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import org.apache.camel.Exchange;
+
+public class AwsSqsSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ protected static final String CAMEL_AWS_SQS_MESSAGE_ID = "CamelAwsSqsMessageId";
+
+ @Override
+ public String getComponent() {
+ return "aws-sqs";
+ }
+
+ @Override
+ public String getMessageId(Exchange exchange) {
+ return (String) exchange.getIn().getHeader(CAMEL_AWS_SQS_MESSAGE_ID);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/CometdSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/CometdSegmentDecorator.java
new file mode 100644
index 0000000..19e52da
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/CometdSegmentDecorator.java
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import java.net.URI;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class CometdSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "cometd";
+ }
+
+ @Override
+ protected String getDestination(Exchange exchange, Endpoint endpoint) {
+ return URI.create(endpoint.getEndpointUri()).getPath().substring(1);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/CometdsSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/CometdsSegmentDecorator.java
new file mode 100644
index 0000000..473cdaa
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/CometdsSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+public class CometdsSegmentDecorator extends CometdSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "cometds";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/IronmqSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/IronmqSegmentDecorator.java
new file mode 100644
index 0000000..e4274f5
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/IronmqSegmentDecorator.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import org.apache.camel.Exchange;
+
+public class IronmqSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ public static final String CAMEL_IRON_MQ_MESSAGE_ID = "CamelIronMQMessageId";
+
+ @Override
+ public String getComponent() {
+ return "ironmq";
+ }
+
+ @Override
+ protected String getMessageId(Exchange exchange) {
+ return (String) exchange.getIn().getHeader(CAMEL_IRON_MQ_MESSAGE_ID);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/JmsSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/JmsSegmentDecorator.java
new file mode 100644
index 0000000..e16fd94
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/JmsSegmentDecorator.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import org.apache.camel.Exchange;
+
+public class JmsSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ public static final String JMS_MESSAGE_ID = "JMSMessageID";
+
+ @Override
+ public String getComponent() {
+ return "jms";
+ }
+
+ @Override
+ protected String getMessageId(Exchange exchange) {
+ return (String) exchange.getIn().getHeader(JMS_MESSAGE_ID);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/KafkaSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/KafkaSegmentDecorator.java
new file mode 100644
index 0000000..014290a
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/KafkaSegmentDecorator.java
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import java.util.Map;
+
+import com.amazonaws.xray.entities.Entity;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class KafkaSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ public static final String KAFKA_PARTITION_TAG = "kafka.partition";
+ public static final String KAFKA_PARTITION_KEY_TAG = "kafka.partition.key";
+ public static final String KAFKA_KEY_TAG = "kafka.key";
+ public static final String KAFKA_OFFSET_TAG = "kafka.offset";
+
+ /**
+ * Constants copied from {@link org.apache.camel.component.kafka.KafkaConstants}
+ */
+ protected static final String PARTITION_KEY = "kafka.PARTITION_KEY";
+ protected static final String PARTITION = "kafka.PARTITION";
+ protected static final String KEY = "kafka.KEY";
+ protected static final String TOPIC = "kafka.TOPIC";
+ protected static final String OFFSET = "kafka.OFFSET";
+
+ @Override
+ public String getComponent() {
+ return "kafka";
+ }
+
+ @Override
+ public String getDestination(Exchange exchange, Endpoint endpoint) {
+ String topic = (String) exchange.getIn().getHeader(TOPIC);
+ if (topic == null) {
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ topic = queryParameters.get("topic");
+ }
+ return topic != null ? topic : super.getDestination(exchange, endpoint);
+ }
+
+ @Override
+ public void pre(Entity segment, Exchange exchange, Endpoint endpoint) {
+ super.pre(segment, exchange, endpoint);
+
+ String partition = (String) exchange.getIn().getHeader(PARTITION);
+ if (partition != null) {
+ segment.putMetadata(KAFKA_PARTITION_TAG, partition);
+ }
+
+ String partitionKey = (String) exchange.getIn().getHeader(PARTITION_KEY);
+ if (partitionKey != null) {
+ segment.putMetadata(KAFKA_PARTITION_KEY_TAG, partitionKey);
+ }
+
+ String key = (String) exchange.getIn().getHeader(KEY);
+ if (key != null) {
+ segment.putMetadata(KAFKA_KEY_TAG, key);
+ }
+
+ String offset = (String) exchange.getIn().getHeader(OFFSET);
+ if (offset != null) {
+ segment.putMetadata(KAFKA_OFFSET_TAG, offset);
+ }
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/MqttSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/MqttSegmentDecorator.java
new file mode 100644
index 0000000..7d7be0b
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/MqttSegmentDecorator.java
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class MqttSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "mqtt";
+ }
+
+ @Override
+ public String getOperationName(Exchange exchange, Endpoint endpoint) {
+ return stripSchemeAndOptions(endpoint);
+ }
+
+ @Override
+ protected String getDestination(Exchange exchange, Endpoint endpoint) {
+ Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
+ String destination = queryParameters.get("subscribeTopicNames");
+ return null != destination ? destination : queryParameters.get("publishTopicName");
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/PahoSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/PahoSegmentDecorator.java
new file mode 100644
index 0000000..1b7a264
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/PahoSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+public class PahoSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "paho";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/RabbitmqSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/RabbitmqSegmentDecorator.java
new file mode 100644
index 0000000..d762527
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/RabbitmqSegmentDecorator.java
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class RabbitmqSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ /**
+ * Constants copied from {@link org.apache.camel.component.rabbitmq.RabbitMQConstants}
+ */
+ protected static final String EXCHANGE_NAME = "rabbitmq.EXCHANGE_NAME";
+
+ @Override
+ public String getComponent() {
+ return "rabbitmq";
+ }
+
+ @Override
+ public String getDestination(Exchange exchange, Endpoint endpoint) {
+ return (String) exchange.getIn().getHeader(EXCHANGE_NAME);
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/SjmsSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/SjmsSegmentDecorator.java
new file mode 100644
index 0000000..555b4e5
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/SjmsSegmentDecorator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+public class SjmsSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ @Override
+ public String getComponent() {
+ return "sjms";
+ }
+}
diff --git a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/StompSegmentDecorator.java b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/StompSegmentDecorator.java
new file mode 100644
index 0000000..4960bc2
--- /dev/null
+++ b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/messaging/StompSegmentDecorator.java
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.aws.xray.decorators.messaging;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+public class StompSegmentDecorator extends AbstractMessagingSegmentDecorator {
+
+ protected static final String QUEUE_PREFIX = "queue:";
+
+ @Override
+ public String getComponent() {
+ return "stomp";
+ }
+
+ @Override
+ public String getDestination(Exchange exchange, Endpoint endpoint) {
+ String destination = super.getDestination(exchange, endpoint);
+ return destination.startsWith(QUEUE_PREFIX) ? destination.substring(QUEUE_PREFIX.length()) : destination;
+ }
+}
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ABCRouteTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ABCRouteTest.java
index 65790c1..5f9f493 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ABCRouteTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ABCRouteTest.java
@@ -25,16 +25,16 @@ public class ABCRouteTest extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace().inRandomOrder()
.withSegment(TestDataBuilder.createSegment("start")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_direct_a")
+ .withSubsegment(TestDataBuilder.createSubsegment("direct-a")
.withSubsegment(TestDataBuilder.createSubsegment("a")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_b"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_c"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-b"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-c"))
)
)
)
.withSegment(TestDataBuilder.createSegment("b"))
.withSegment(TestDataBuilder.createSegment("c")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_log_test"))
+ .withSubsegment(TestDataBuilder.createSubsegment("log-test"))
)
.withSegment(TestDataBuilder.createSegment("d"))
);
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/BeanTracingTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/BeanTracingTest.java
index 6a136e4..f4213ee 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/BeanTracingTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/BeanTracingTest.java
@@ -34,8 +34,8 @@ public class BeanTracingTest extends CamelAwsXRayTestSupport {
TestDataBuilder.createTrace()
.withSegment(TestDataBuilder.createSegment("start")
.withSubsegment(TestDataBuilder.createSubsegment("TraceBean"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_otherRoute"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_mock_end"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-otherRoute"))
+ .withSubsegment(TestDataBuilder.createSubsegment("mock-end"))
.withAnnotation("body", "HELLO")
.withMetadata("originBody", "Hello")
)
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ClientRecipientListRouteTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ClientRecipientListRouteTest.java
index ed2b457..dda8865 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ClientRecipientListRouteTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ClientRecipientListRouteTest.java
@@ -25,9 +25,9 @@ public class ClientRecipientListRouteTest extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace().inRandomOrder()
.withSegment(TestDataBuilder.createSegment("start")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_a"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_b"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_c"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-a"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-b"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-c"))
)
.withSegment(TestDataBuilder.createSegment("a"))
.withSegment(TestDataBuilder.createSegment("b"))
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/EIPTracingTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/EIPTracingTest.java
index 998a6e4..650a072 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/EIPTracingTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/EIPTracingTest.java
@@ -37,10 +37,10 @@ public class EIPTracingTest extends CamelAwsXRayTestSupport {
.withSubsegment(TestDataBuilder.createSubsegment("bean"))
.withSubsegment(TestDataBuilder.createSubsegment("delay")
.withSubsegment(TestDataBuilder.createSubsegment("to")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_otherRoute"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-otherRoute"))
)
.withSubsegment(TestDataBuilder.createSubsegment("to")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_mock_end"))
+ .withSubsegment(TestDataBuilder.createSubsegment("mock-end"))
)
)
.withAnnotation("body", "HELLO")
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ErrorHandlingTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ErrorHandlingTest.java
index 2a1fa1d..e351684 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ErrorHandlingTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/ErrorHandlingTest.java
@@ -46,8 +46,8 @@ public class ErrorHandlingTest extends CamelAwsXRayTestSupport {
.withSubsegment(TestDataBuilder.createSubsegment("TraceBean"))
// .withSubsegment(TestDataBuilder.createSubsegment("ExceptionRetryProcessor"))
.withSubsegment(TestDataBuilder.createSubsegment("TraceBean"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_otherRoute"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_mock_end"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-otherRoute"))
+ .withSubsegment(TestDataBuilder.createSubsegment("mock-end"))
)
.withSegment(TestDataBuilder.createSegment("otherRoute"))
);
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastParallelRouteTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastParallelRouteTest.java
index 257e0bb..25c60c3 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastParallelRouteTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastParallelRouteTest.java
@@ -25,15 +25,15 @@ public class MulticastParallelRouteTest extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace().inRandomOrder()
.withSegment(TestDataBuilder.createSegment("start")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_a"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-a"))
)
.withSegment(TestDataBuilder.createSegment("a").inRandomOrder()
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_b"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_c"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-b"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-c"))
)
.withSegment(TestDataBuilder.createSegment("b"))
.withSegment(TestDataBuilder.createSegment("c")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_log_routing%20at%20$%7BrouteId%7D"))
+ .withSubsegment(TestDataBuilder.createSubsegment("log-routing%20at%20$%7BrouteId%7D"))
)
);
}
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastRouteTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastRouteTest.java
index f981cf8..f8f4714 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastRouteTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/MulticastRouteTest.java
@@ -25,15 +25,15 @@ public class MulticastRouteTest extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace()
.withSegment(TestDataBuilder.createSegment("start")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_a"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-a"))
)
.withSegment(TestDataBuilder.createSegment("a")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_b"))
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_seda_c"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-b"))
+ .withSubsegment(TestDataBuilder.createSubsegment("seda-c"))
)
.withSegment(TestDataBuilder.createSegment("b"))
.withSegment(TestDataBuilder.createSegment("c")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_log_routing%20at%20$%7BrouteId%7D"))
+ .withSubsegment(TestDataBuilder.createSubsegment("log-routing%20at%20$%7BrouteId%7D"))
)
);
}
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoService2Test.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoService2Test.java
index 2e07219..e27b67c 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoService2Test.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoService2Test.java
@@ -26,7 +26,7 @@ public class TwoService2Test extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace().inRandomOrder()
.withSegment(TestDataBuilder.createSegment("route1")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_direct_ServiceB")
+ .withSubsegment(TestDataBuilder.createSubsegment("direct-ServiceB")
.withSubsegment(TestDataBuilder.createSubsegment("route2"))
)
)
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceTest.java
index edf6aad..ffc45a1 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceTest.java
@@ -26,7 +26,7 @@ public class TwoServiceTest extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace().inRandomOrder()
.withSegment(TestDataBuilder.createSegment("ServiceA")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_direct_ServiceB")
+ .withSubsegment(TestDataBuilder.createSubsegment("direct-ServiceB")
.withSubsegment(TestDataBuilder.createSubsegment("ServiceB"))
)
)
diff --git a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceWithExcludeTest.java b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceWithExcludeTest.java
index 5f2fac5..5c41078 100644
--- a/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceWithExcludeTest.java
+++ b/components/camel-aws-xray/src/test/java/org/apache/camel/component/aws/xray/TwoServiceWithExcludeTest.java
@@ -28,7 +28,7 @@ public class TwoServiceWithExcludeTest extends CamelAwsXRayTestSupport {
super(
TestDataBuilder.createTrace().inRandomOrder()
.withSegment(TestDataBuilder.createSegment("ServiceA")
- .withSubsegment(TestDataBuilder.createSubsegment("SendingTo_direct_ServiceB"))
+ .withSubsegment(TestDataBuilder.createSubsegment("direct-ServiceB"))
)
);
}
--
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.