Skip to content

Commit

Permalink
CAMEL-21489: camel-micrometer - Add option to exclude routes in captu…
Browse files Browse the repository at this point in the history
…ring metrics
  • Loading branch information
davsclaus committed Nov 29, 2024
1 parent f3dab9c commit 2af73d0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private void configureMicrometer(CamelContext camelContext, CamelMetricsConfigur
factory.getPolicyConfiguration().setContextEnabled(false);
factory.getPolicyConfiguration().setRouteEnabled(true);
}
factory.getPolicyConfiguration().setExcludePattern(configuration.getRoutePolicyExcludePattern());
camelContext.addRoutePolicyFactory(factory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -115,6 +120,14 @@ public void setRoutePolicyLevel(String routePolicyLevel) {
this.routePolicyLevel = routePolicyLevel;
}

public String getRoutePolicyExcludePattern() {
return routePolicyExcludePattern;
}

public void setRoutePolicyExcludePattern(String routePolicyExcludePattern) {
this.routePolicyExcludePattern = routePolicyExcludePattern;
}

public boolean isEnableMessageHistory() {
return enableMessageHistory;
}
Expand Down

0 comments on commit 2af73d0

Please sign in to comment.