This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 34c516d450b CAMEL-16364: camel-tracing - Add more decorators 34c516d450b is described below commit 34c516d450b3be79f927315ebbe5f73be4482d24 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Jun 17 20:48:10 2024 +0200 CAMEL-16364: camel-tracing - Add more decorators --- .../tracing/decorators/Paho5SpanDecorator.java | 44 ++++++++++++++++++++++ .../decorators/RestOpenapiSpanDecorator.java | 31 +++++++++++++++ .../tracing/decorators/RestSpanDecorator.java | 4 -- 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/Paho5SpanDecorator.java b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/Paho5SpanDecorator.java new file mode 100644 index 00000000000..1a158fec0b5 --- /dev/null +++ b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/Paho5SpanDecorator.java @@ -0,0 +1,44 @@ +/* + * 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.tracing.decorators; + +import org.apache.camel.Endpoint; +import org.apache.camel.Exchange; + +public class Paho5SpanDecorator extends AbstractMessagingSpanDecorator { + + @Override + public String getComponent() { + return "paho-mqtt5"; + } + + @Override + protected String getDestination(Exchange exchange, Endpoint endpoint) { + // when using toD for dynamic destination then extract from header + String destination = exchange.getMessage().getHeader("CamelPahoMqtt5OverrideTopic", String.class); + if (destination == null) { + destination = super.getDestination(exchange, endpoint); + } + return destination; + } + + @Override + public String getComponentClassName() { + return "org.apache.camel.component.paho.mqtt5.PahoMqtt5Component"; + } + +} diff --git a/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestOpenapiSpanDecorator.java b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestOpenapiSpanDecorator.java new file mode 100644 index 00000000000..8ac672230ba --- /dev/null +++ b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestOpenapiSpanDecorator.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.tracing.decorators; + +public class RestOpenapiSpanDecorator extends AbstractHttpSpanDecorator { + + @Override + public String getComponent() { + return "rest-openapi"; + } + + @Override + public String getComponentClassName() { + return "org.apache.camel.component.rest.openapi.RestOpenApiComponent"; + } + +} diff --git a/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestSpanDecorator.java b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestSpanDecorator.java index 77624a9374d..d7c32c80ac3 100644 --- a/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestSpanDecorator.java +++ b/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/RestSpanDecorator.java @@ -25,13 +25,9 @@ import java.util.List; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.tracing.SpanAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class RestSpanDecorator extends AbstractHttpSpanDecorator { - private static final Logger LOG = LoggerFactory.getLogger(RestSpanDecorator.class); - @Override public String getComponent() { return "rest";