This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch ra in repository https://gitbox.apache.org/repos/asf/camel.git
commit 07b45693778b845eb9e33db8d9be9f61043ea433 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon May 27 13:58:00 2024 +0200 CAMEL-20798: Add RemoteAddress to endpoints so they can tell the url/hostname etc for the system it connects. This is needed for better monitoring, tracing and management. Add this information into camel-tracer as tags. --- .../org/apache/camel/spi/EndpointServiceLocation.java | 6 +++--- .../apache/camel/impl/console/ProtocolDevConsole.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointServiceLocation.java b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointServiceLocation.java index 86a3a119398..230af3c5e2c 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointServiceLocation.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointServiceLocation.java @@ -43,9 +43,9 @@ public interface EndpointServiceLocation { String getServiceProtocol(); /** - * Optional metadata that is relevant to the service as key value pairs. Notice that the metadata is not - * supposed to contain sensitive security details such as access token, api keys, or passwords. Only share - * information that can be safely accessed and written to logs. + * Optional metadata that is relevant to the service as key value pairs. Notice that the metadata is not supposed to + * contain sensitive security details such as access token, api keys, or passwords. Only share information that can + * be safely accessed and written to logs. * * @return optional metadata or null if no data */ diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/ProtocolDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/ProtocolDevConsole.java index cd8abb50039..04f5732c617 100644 --- a/core/camel-console/src/main/java/org/apache/camel/impl/console/ProtocolDevConsole.java +++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/ProtocolDevConsole.java @@ -16,20 +16,20 @@ */ package org.apache.camel.impl.console; +import java.util.List; +import java.util.Map; +import java.util.Optional; + import org.apache.camel.Consumer; import org.apache.camel.Endpoint; import org.apache.camel.Route; -import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.EndpointRegistry; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.RuntimeEndpointRegistry; import org.apache.camel.spi.annotations.DevConsole; import org.apache.camel.support.DefaultConsumer; import org.apache.camel.support.console.AbstractDevConsole; -import java.util.List; -import java.util.Map; -import java.util.Optional; - @DevConsole(name = "protocol", displayName = "Protocols", description = "Protocols used for network communication with clients") public class ProtocolDevConsole extends AbstractDevConsole { @@ -79,7 +79,8 @@ public class ProtocolDevConsole extends AbstractDevConsole { if (adr != null) { var stat = findStats(stats, endpoint.getEndpointUri(), "in"); // skip IN as already found via consumer (platform-http is only IN) - boolean skip = "platform-http".equals(component) || stat.isPresent() && "in".equals(stat.get().getDirection()); + boolean skip + = "platform-http".equals(component) || stat.isPresent() && "in".equals(stat.get().getDirection()); if (!skip) { var uri = endpoint.toString(); printLine(sb, component, stat, "in", hosted, protocol, adr, uri); @@ -93,8 +94,9 @@ public class ProtocolDevConsole extends AbstractDevConsole { return sb.toString(); } - private static void printLine(StringBuilder sb, String component, Optional<RuntimeEndpointRegistry.Statistic> stat, - String dir, boolean hosted, String protocol, String adr, String uri) { + private static void printLine( + StringBuilder sb, String component, Optional<RuntimeEndpointRegistry.Statistic> stat, + String dir, boolean hosted, String protocol, String adr, String uri) { long total = 0; if (stat.isPresent()) {