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-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 2af73d084f6 CAMEL-21489: camel-micrometer - Add option to exclude 
routes in capturing metrics
2af73d084f6 is described below

commit 2af73d084f6342e811003b48a674a2025f2806e7
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Nov 29 11:15:52 2024 +0100

    CAMEL-21489: camel-micrometer - Add option to exclude routes in capturing 
metrics
---
 .../camel-micrometer-starter/src/main/docs/micrometer.json  |  6 ++++++
 .../springboot/metrics/CamelMetricsAutoConfiguration.java   |  1 +
 .../springboot/metrics/CamelMetricsConfiguration.java       | 13 +++++++++++++
 3 files changed, 20 insertions(+)

diff --git 
a/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json 
b/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
index 47450cf7f53..28994b0bf95 100644
--- a/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
+++ b/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
@@ -84,6 +84,12 @@
       "sourceType": 
"org.apache.camel.component.micrometer.springboot.metrics.CamelMetricsConfiguration",
       "defaultValue": "default"
     },
+    {
+      "name": "camel.metrics.route-policy-exclude-pattern",
+      "type": "java.lang.String",
+      "description": "Pattern to exclude routes (by id) to capture. Multiple 
route ids can be separated by comma.",
+      "sourceType": 
"org.apache.camel.component.micrometer.springboot.metrics.CamelMetricsConfiguration"
+    },
     {
       "name": "camel.metrics.route-policy-level",
       "type": "java.lang.String",
diff --git 
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
 
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
index ac7f7b6c543..f2525fe1d17 100644
--- 
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
+++ 
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
@@ -64,6 +64,7 @@ public class CamelMetricsAutoConfiguration {
                 factory.getPolicyConfiguration().setContextEnabled(false);
                 factory.getPolicyConfiguration().setRouteEnabled(true);
             }
+            
factory.getPolicyConfiguration().setExcludePattern(configuration.getRoutePolicyExcludePattern());
             camelContext.addRoutePolicyFactory(factory);
         }
 
diff --git 
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
 
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
index 04593eee95c..dd3203b9351 100644
--- 
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
+++ 
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
@@ -49,6 +49,11 @@ public class CamelMetricsConfiguration {
      */
     private String routePolicyLevel = "all";
 
+    /**
+     * Pattern to exclude routes (by id) to capture. Multiple route ids can be 
separated by comma.
+     */
+    private String routePolicyExcludePattern;
+
     /**
      * Controls the name style to use for metrics. Default = uses micrometer 
naming convention. Legacy = uses the
      * classic naming style (camelCase)
@@ -115,6 +120,14 @@ public class CamelMetricsConfiguration {
         this.routePolicyLevel = routePolicyLevel;
     }
 
+    public String getRoutePolicyExcludePattern() {
+        return routePolicyExcludePattern;
+    }
+
+    public void setRoutePolicyExcludePattern(String routePolicyExcludePattern) 
{
+        this.routePolicyExcludePattern = routePolicyExcludePattern;
+    }
+
     public boolean isEnableMessageHistory() {
         return enableMessageHistory;
     }

Reply via email to