You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/11/24 10:35:18 UTC

[camel] branch main updated (346fe3cecf1 -> 449079655cb)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 346fe3cecf1 Sync deps
     new dcf434744b6 camel-jbang - Upgrade known dependencies
     new 215659a91ed CAMEL-18733: camel-core - Move the discovery of route policy to when being added to the route, as previously if a route policy was added such as from a component that are in use in the route, then that would be too late.
     new 19ac4fa6f96 camel-jbang - camel get micrometer
     new 449079655cb CAMEL-18732: camel-micrometer - Include description of metrics

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../MicrometerExchangeEventNotifier.java           |  1 +
 .../messagehistory/MicrometerMessageHistory.java   |  2 +-
 .../MicrometerRoutePolicyNamingStrategy.java       | 17 ++------
 .../org/apache/camel/reifier/RouteReifier.java     | 51 +++++++++++-----------
 .../core/commands/process/ListMicrometer.java      | 41 ++++++++++++++---
 .../camel-main-known-dependencies.properties       |  6 +--
 6 files changed, 69 insertions(+), 49 deletions(-)


[camel] 03/04: camel-jbang - camel get micrometer

Posted by da...@apache.org.
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

commit 19ac4fa6f96e0c5fb670782624a8178491fa1dc0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 24 11:26:10 2022 +0100

    camel-jbang - camel get micrometer
---
 .../core/commands/process/ListMicrometer.java      | 41 ++++++++++++++++++----
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListMicrometer.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListMicrometer.java
index 779210df04c..ff313ab0e82 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListMicrometer.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListMicrometer.java
@@ -50,6 +50,10 @@ public class ListMicrometer extends ProcessBaseCommand {
                         description = "Only show custom metrics", defaultValue = "false")
     boolean custom;
 
+    @CommandLine.Option(names = { "--all" },
+                        description = "Whether to show all metrics (also unused with counter being 0)", defaultValue = "false")
+    boolean all;
+
     public ListMicrometer(CamelJBangMain main) {
         super(main);
     }
@@ -95,6 +99,9 @@ public class ListMicrometer extends ProcessBaseCommand {
                                     if (custom && row.metricName.startsWith("Camel")) {
                                         continue; // skip internal camel metrics
                                     }
+                                    if (!all && getNumber(row.count).isEmpty()) {
+                                        continue;
+                                    }
                                     if (filter == null || row.type.equals(filter) || row.metricName.contains(filter)) {
                                         rows.add(row);
                                     }
@@ -117,6 +124,9 @@ public class ListMicrometer extends ProcessBaseCommand {
                                     if (custom && row.metricName.startsWith("Camel")) {
                                         continue; // skip internal camel metrics
                                     }
+                                    if (!all && getNumber(row.count).isEmpty()) {
+                                        continue;
+                                    }
                                     if (filter == null || row.type.equals(filter) || row.metricName.contains(filter)) {
                                         rows.add(row);
                                     }
@@ -136,6 +146,9 @@ public class ListMicrometer extends ProcessBaseCommand {
                                     if (custom && row.metricName.startsWith("Camel")) {
                                         continue; // skip internal camel metrics
                                     }
+                                    if (!all && getNumber(row.count).isEmpty()) {
+                                        continue;
+                                    }
                                     if (filter == null || row.type.equals(filter) || row.metricName.contains(filter)) {
                                         rows.add(row);
                                     }
@@ -158,6 +171,9 @@ public class ListMicrometer extends ProcessBaseCommand {
                                     if (custom && row.metricName.startsWith("Camel")) {
                                         continue; // skip internal camel metrics
                                     }
+                                    if (!all && getNumber(row.count).isEmpty()) {
+                                        continue;
+                                    }
                                     if (filter == null || row.type.equals(filter) || row.metricName.contains(filter)) {
                                         rows.add(row);
                                     }
@@ -176,7 +192,7 @@ public class ListMicrometer extends ProcessBaseCommand {
                     new Column().header("NAME").dataAlign(HorizontalAlign.LEFT).maxWidth(30, OverflowBehaviour.ELLIPSIS_RIGHT)
                             .with(r -> r.name),
                     new Column().header("TYPE").dataAlign(HorizontalAlign.LEFT).with(r -> r.type),
-                    new Column().header("METRIC").dataAlign(HorizontalAlign.LEFT).maxWidth(25, OverflowBehaviour.ELLIPSIS_RIGHT)
+                    new Column().header("METRIC").dataAlign(HorizontalAlign.LEFT).maxWidth(40, OverflowBehaviour.ELLIPSIS_RIGHT)
                             .with(r -> r.metricName),
                     new Column().header("ROUTE").dataAlign(HorizontalAlign.LEFT).maxWidth(25, OverflowBehaviour.ELLIPSIS_RIGHT)
                             .with(r -> r.metricRouteId),
@@ -200,16 +216,29 @@ public class ListMicrometer extends ProcessBaseCommand {
             s = s.substring(1);
             negate = -1;
         }
+
+        int answer;
         switch (s) {
             case "pid":
-                return Long.compare(Long.parseLong(o1.pid), Long.parseLong(o2.pid)) * negate;
+                answer = Long.compare(Long.parseLong(o1.pid), Long.parseLong(o2.pid)) * negate;
+                break;
             case "name":
-                return o1.name.compareToIgnoreCase(o2.name) * negate;
+                answer = o1.name.compareToIgnoreCase(o2.name) * negate;
+                break;
             case "age":
-                return Long.compare(o1.uptime, o2.uptime) * negate;
+                answer = Long.compare(o1.uptime, o2.uptime) * negate;
+                break;
             default:
-                return 0;
+                answer = 0;
+        }
+        if (answer == 0) {
+            // sort by metric/route
+            answer = o1.metricName.compareToIgnoreCase(o2.metricName) * negate;
+            if (answer == 0) {
+                answer = o1.metricRouteId.compareToIgnoreCase(o2.metricRouteId) * negate;
+            }
         }
+        return answer;
     }
 
     private String getNumber(double d) {
@@ -232,7 +261,7 @@ public class ListMicrometer extends ProcessBaseCommand {
                 }
             }
         }
-        return null;
+        return "";
     }
 
     private static class Row implements Cloneable {


[camel] 04/04: CAMEL-18732: camel-micrometer - Include description of metrics

Posted by da...@apache.org.
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

commit 449079655cb20e0939b2899f0da8829904bce875
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 24 11:35:05 2022 +0100

    CAMEL-18732: camel-micrometer - Include description of metrics
---
 .../eventnotifier/MicrometerExchangeEventNotifier.java  |  1 +
 .../messagehistory/MicrometerMessageHistory.java        |  2 +-
 .../MicrometerRoutePolicyNamingStrategy.java            | 17 ++++-------------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifier.java b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifier.java
index 2c37060838a..265bfd76973 100644
--- a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifier.java
+++ b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifier.java
@@ -83,6 +83,7 @@ public class MicrometerExchangeEventNotifier extends AbstractMicrometerEventNoti
             String name = namingStrategy.getInflightExchangesName(exchange, exchange.getFromEndpoint());
             Tags tags = namingStrategy.getInflightExchangesTags(exchangeEvent, exchange.getFromEndpoint());
             Gauge.builder(name, () -> getInflightExchangesInRoute(exchangeEvent))
+                    .description("Route inflight messages")
                     .tags(tags)
                     .register(getMeterRegistry());
         }
diff --git a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/messagehistory/MicrometerMessageHistory.java b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/messagehistory/MicrometerMessageHistory.java
index f8605f32b4b..c88c8f9912d 100644
--- a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/messagehistory/MicrometerMessageHistory.java
+++ b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/messagehistory/MicrometerMessageHistory.java
@@ -50,7 +50,7 @@ public class MicrometerMessageHistory extends DefaultMessageHistory {
         super.nodeProcessingDone();
         Timer timer = Timer.builder(namingStrategy.getName(route, getNode()))
                 .tags(namingStrategy.getTags(route, getNode()))
-                .description(getNode().getDescriptionText())
+                .description("Node performance metrics")
                 .register(meterRegistry);
         sample.stop(timer);
     }
diff --git a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/routepolicy/MicrometerRoutePolicyNamingStrategy.java b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/routepolicy/MicrometerRoutePolicyNamingStrategy.java
index 5c1077cca24..846f1937b5e 100644
--- a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/routepolicy/MicrometerRoutePolicyNamingStrategy.java
+++ b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/routepolicy/MicrometerRoutePolicyNamingStrategy.java
@@ -29,7 +29,6 @@ import static org.apache.camel.component.micrometer.MicrometerConstants.DEFAULT_
 import static org.apache.camel.component.micrometer.MicrometerConstants.DEFAULT_CAMEL_ROUTE_POLICY_EXCHANGES_SUCCEEDED_METER_NAME;
 import static org.apache.camel.component.micrometer.MicrometerConstants.DEFAULT_CAMEL_ROUTE_POLICY_EXCHANGES_TOTAL_METER_NAME;
 import static org.apache.camel.component.micrometer.MicrometerConstants.DEFAULT_CAMEL_ROUTE_POLICY_METER_NAME;
-import static org.apache.camel.component.micrometer.MicrometerConstants.ROUTE_DESCRIPTION_TAG;
 import static org.apache.camel.component.micrometer.MicrometerConstants.ROUTE_ID_TAG;
 import static org.apache.camel.component.micrometer.MicrometerConstants.SERVICE_NAME;
 
@@ -66,18 +65,10 @@ public interface MicrometerRoutePolicyNamingStrategy {
     }
 
     default Tags getTags(Route route) {
-        if (route.getRouteDescription() != null) {
-            return Tags.of(
-                    CAMEL_CONTEXT_TAG, route.getCamelContext().getName(),
-                    SERVICE_NAME, MicrometerRoutePolicyService.class.getSimpleName(),
-                    ROUTE_ID_TAG, route.getId(),
-                    ROUTE_DESCRIPTION_TAG, route.getRouteDescription());
-        } else {
-            return Tags.of(
-                    CAMEL_CONTEXT_TAG, route.getCamelContext().getName(),
-                    SERVICE_NAME, MicrometerRoutePolicyService.class.getSimpleName(),
-                    ROUTE_ID_TAG, route.getId());
-        }
+        return Tags.of(
+                CAMEL_CONTEXT_TAG, route.getCamelContext().getName(),
+                SERVICE_NAME, MicrometerRoutePolicyService.class.getSimpleName(),
+                ROUTE_ID_TAG, route.getId());
     }
 
     default Tags getExchangeStatusTags(Route route) {


[camel] 01/04: camel-jbang - Upgrade known dependencies

Posted by da...@apache.org.
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

commit dcf434744b6502863b77c14d737334ca1289270a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 24 10:42:14 2022 +0100

    camel-jbang - Upgrade known dependencies
---
 .../src/main/resources/camel-main-known-dependencies.properties     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties b/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties
index 37e6b499cb4..6c5b2070f2d 100644
--- a/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties
+++ b/dsl/camel-kamelet-main/src/main/resources/camel-main-known-dependencies.properties
@@ -17,12 +17,12 @@
 
 com.amazon.redshift.jdbc.Driver = com.amazon.redshift:redshift-jdbc42:2.1.0.9
 com.microsoft.sqlserver.jdbc.SQLServerDriver = com.microsoft.sqlserver:mssql-jdbc:11.2.1.jre11
-com.mysql.cj.jdbc.Driver = mysql:mysql-connector-java:8.0.30
+com.mysql.cj.jdbc.Driver = mysql:mysql-connector-java:8.0.31
 net.sf.saxon.xpath.XPathFactoryImpl = camel:saxon
-org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory = org.apache.activemq:artemis-jms-client-all:2.25.0
+org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory = org.apache.activemq:artemis-jms-client-all:2.27.0
 org.apache.commons.dbcp2.BasicDataSource = org.apache.commons:commons-dbcp2:2.9.0
 org.apache.qpid.jms.JmsConnectionFactory = org.apache.qpid:qpid-jms-client:1.7.0
-org.postgresql.Driver = org.postgresql:postgresql:42.5.0
+org.postgresql.Driver = org.postgresql:postgresql:42.5.1
 org.apache.camel.component.cxf.jaxws.CxfEndpoint = camel:cxf-soap
 org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint = camel:cxf-rest
 META-INF/services/org/apache/camel/restapi/openapi = camel:openapi-java
\ No newline at end of file


[camel] 02/04: CAMEL-18733: camel-core - Move the discovery of route policy to when being added to the route, as previously if a route policy was added such as from a component that are in use in the route, then that would be too late.

Posted by da...@apache.org.
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

commit 215659a91edeb1ae6a9d51ddc6c5c5626ae849e6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 24 11:06:11 2022 +0100

    CAMEL-18733: camel-core - Move the discovery of route policy to when being added to the route, as previously if a route policy was added such as from a component that are in use in the route, then that would be too late.
---
 .../org/apache/camel/reifier/RouteReifier.java     | 51 +++++++++++-----------
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java
index 2302fca53c6..e8239ebf32f 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java
@@ -164,32 +164,6 @@ public class RouteReifier extends ProcessorReifier<RouteDefinition> {
             }
         }
 
-        // configure route policy
-        if (definition.getRoutePolicies() != null && !definition.getRoutePolicies().isEmpty()) {
-            for (RoutePolicy policy : definition.getRoutePolicies()) {
-                LOG.debug("RoutePolicy is enabled: {} on route: {}", policy, definition.getId());
-                route.getRoutePolicyList().add(policy);
-            }
-        }
-        if (definition.getRoutePolicyRef() != null) {
-            StringTokenizer policyTokens = new StringTokenizer(definition.getRoutePolicyRef(), ",");
-            while (policyTokens.hasMoreTokens()) {
-                String ref = policyTokens.nextToken().trim();
-                RoutePolicy policy = mandatoryLookup(ref, RoutePolicy.class);
-                LOG.debug("RoutePolicy is enabled: {} on route: {}", policy, definition.getId());
-                route.getRoutePolicyList().add(policy);
-            }
-        }
-        if (camelContext.getRoutePolicyFactories() != null) {
-            for (RoutePolicyFactory factory : camelContext.getRoutePolicyFactories()) {
-                RoutePolicy policy = factory.createRoutePolicy(camelContext, definition.getId(), definition);
-                if (policy != null) {
-                    LOG.debug("RoutePolicy is enabled: {} on route: {}", policy, definition.getId());
-                    route.getRoutePolicyList().add(policy);
-                }
-            }
-        }
-
         // configure auto startup
         Boolean isAutoStartup = parseBoolean(definition.getAutoStartup());
 
@@ -260,6 +234,31 @@ public class RouteReifier extends ProcessorReifier<RouteDefinition> {
         InternalProcessor internal = camelContext.adapt(ExtendedCamelContext.class).getInternalProcessorFactory()
                 .addUnitOfWorkProcessorAdvice(camelContext, target, route);
 
+        // configure route policy
+        if (definition.getRoutePolicies() != null && !definition.getRoutePolicies().isEmpty()) {
+            for (RoutePolicy policy : definition.getRoutePolicies()) {
+                LOG.debug("RoutePolicy is enabled: {} on route: {}", policy, definition.getId());
+                route.getRoutePolicyList().add(policy);
+            }
+        }
+        if (definition.getRoutePolicyRef() != null) {
+            StringTokenizer policyTokens = new StringTokenizer(definition.getRoutePolicyRef(), ",");
+            while (policyTokens.hasMoreTokens()) {
+                String ref = policyTokens.nextToken().trim();
+                RoutePolicy policy = mandatoryLookup(ref, RoutePolicy.class);
+                LOG.debug("RoutePolicy is enabled: {} on route: {}", policy, definition.getId());
+                route.getRoutePolicyList().add(policy);
+            }
+        }
+        if (camelContext.getRoutePolicyFactories() != null) {
+            for (RoutePolicyFactory factory : camelContext.getRoutePolicyFactories()) {
+                RoutePolicy policy = factory.createRoutePolicy(camelContext, definition.getId(), definition);
+                if (policy != null) {
+                    LOG.debug("RoutePolicy is enabled: {} on route: {}", policy, definition.getId());
+                    route.getRoutePolicyList().add(policy);
+                }
+            }
+        }
         // and then optionally add route policy processor if a custom policy is set
         List<RoutePolicy> routePolicyList = route.getRoutePolicyList();
         if (routePolicyList != null && !routePolicyList.isEmpty()) {