This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch filter-kamelet2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2c6995d51a6fc1529d7ae4676a11f7967d6a49b8 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Feb 24 14:37:26 2024 +0100 CAMEL-18858: camel-core - Mark route as created by Kamelet so we know this, so we can filter out in tooling and whereelse (kamelet is a blackbox) --- .../MainConfigurationPropertiesConfigurer.java | 12 ++++ .../camel-main-configuration-metadata.json | 2 + core/camel-main/src/main/docs/main.adoc | 4 +- .../camel/main/DefaultConfigurationConfigurer.java | 4 ++ .../camel/main/DefaultConfigurationProperties.java | 66 ++++++++++++++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java index ca08ad52360..7d2f91e74db 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java @@ -125,6 +125,10 @@ public class MainConfigurationPropertiesConfigurer extends org.apache.camel.supp case "JmxManagementMBeansLevel": target.setJmxManagementMBeansLevel(property(camelContext, org.apache.camel.ManagementMBeansLevel.class, value)); return true; case "jmxmanagementnamepattern": case "JmxManagementNamePattern": target.setJmxManagementNamePattern(property(camelContext, java.lang.String.class, value)); return true; + case "jmxmanagementregisterroutescreatebykamelet": + case "JmxManagementRegisterRoutesCreateByKamelet": target.setJmxManagementRegisterRoutesCreateByKamelet(property(camelContext, boolean.class, value)); return true; + case "jmxmanagementregisterroutescreatebytemplate": + case "JmxManagementRegisterRoutesCreateByTemplate": target.setJmxManagementRegisterRoutesCreateByTemplate(property(camelContext, boolean.class, value)); return true; case "jmxmanagementstatisticslevel": case "JmxManagementStatisticsLevel": target.setJmxManagementStatisticsLevel(property(camelContext, org.apache.camel.ManagementStatisticsLevel.class, value)); return true; case "jmxupdaterouteenabled": @@ -366,6 +370,10 @@ public class MainConfigurationPropertiesConfigurer extends org.apache.camel.supp case "JmxManagementMBeansLevel": return org.apache.camel.ManagementMBeansLevel.class; case "jmxmanagementnamepattern": case "JmxManagementNamePattern": return java.lang.String.class; + case "jmxmanagementregisterroutescreatebykamelet": + case "JmxManagementRegisterRoutesCreateByKamelet": return boolean.class; + case "jmxmanagementregisterroutescreatebytemplate": + case "JmxManagementRegisterRoutesCreateByTemplate": return boolean.class; case "jmxmanagementstatisticslevel": case "JmxManagementStatisticsLevel": return org.apache.camel.ManagementStatisticsLevel.class; case "jmxupdaterouteenabled": @@ -608,6 +616,10 @@ public class MainConfigurationPropertiesConfigurer extends org.apache.camel.supp case "JmxManagementMBeansLevel": return target.getJmxManagementMBeansLevel(); case "jmxmanagementnamepattern": case "JmxManagementNamePattern": return target.getJmxManagementNamePattern(); + case "jmxmanagementregisterroutescreatebykamelet": + case "JmxManagementRegisterRoutesCreateByKamelet": return target.isJmxManagementRegisterRoutesCreateByKamelet(); + case "jmxmanagementregisterroutescreatebytemplate": + case "JmxManagementRegisterRoutesCreateByTemplate": return target.isJmxManagementRegisterRoutesCreateByTemplate(); case "jmxmanagementstatisticslevel": case "JmxManagementStatisticsLevel": return target.getJmxManagementStatisticsLevel(); case "jmxupdaterouteenabled": diff --git a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json index 127e310a2c6..f1e51f670bf 100644 --- a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json +++ b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json @@ -70,6 +70,8 @@ { "name": "camel.main.jmxEnabled", "description": "Enable JMX in your Camel application.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true }, { "name": "camel.main.jmxManagementMBeansLevel", "description": "Sets the mbeans registration level. The default value is Default.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "object", "javaType": "org.apache.camel.ManagementMBeansLevel", "defaultValue": "Default" }, { "name": "camel.main.jmxManagementNamePattern", "description": "The naming pattern for creating the CamelContext JMX management name. The default pattern is #name#", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "#name#" }, + { "name": "camel.main.jmxManagementRegisterRoutesCreateByKamelet", "description": "Whether routes created by Kamelets should be registered for JMX management. Enabling this allows to have fine-grained monitoring and management of every route created via Kamelets. This is default disabled as a Kamelet is intended as a component (black-box) and its implementation details as Camel route makes the overall management and monitoring of Camel applications more verbose. During development of [...] + { "name": "camel.main.jmxManagementRegisterRoutesCreateByTemplate", "description": "Whether routes created by route templates (not Kamelets) should be registered for JMX management. Enabling this allows to have fine-grained monitoring and management of every route created via route templates. This is default enabled (unlike Kamelets) as routes created via templates is regarded as standard routes, and should be available for management and monitoring.", "sourceType": "org.apache.camel [...] { "name": "camel.main.jmxManagementStatisticsLevel", "description": "Sets the JMX statistics level, the level can be set to Extended to gather additional information The default value is Default.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "object", "javaType": "org.apache.camel.ManagementStatisticsLevel", "defaultValue": "Default", "enum": [ "Extended", "Default", "RoutesOnly", "Off" ] }, { "name": "camel.main.jmxUpdateRouteEnabled", "description": "Whether to allow updating routes at runtime via JMX using the ManagedRouteMBean. This is disabled by default, but can be enabled for development and troubleshooting purposes, such as updating routes in an existing running Camel via JMX and other tools.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.main.lightweight", "description": "Configure the context to be lightweight. This will trigger some optimizations and memory reduction options. Lightweight context have some limitations. At this moment, dynamic endpoint destinations are not supported.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc index c709db4e390..a12a25f0edb 100644 --- a/core/camel-main/src/main/docs/main.adoc +++ b/core/camel-main/src/main/docs/main.adoc @@ -19,7 +19,7 @@ The following tables lists all the options: // main options: START === Camel Main configurations -The camel.main supports 117 options, which are listed below. +The camel.main supports 119 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -76,6 +76,8 @@ The camel.main supports 117 options, which are listed below. | *camel.main.jmxEnabled* | Enable JMX in your Camel application. | true | boolean | *camel.main.jmxManagementMBeans{zwsp}Level* | Sets the mbeans registration level. The default value is Default. | Default | ManagementMBeansLevel | *camel.main.jmxManagementName{zwsp}Pattern* | The naming pattern for creating the CamelContext JMX management name. The default pattern is #name# | #name# | String +| *camel.main.jmxManagement{zwsp}RegisterRoutesCreateByKamelet* | Whether routes created by Kamelets should be registered for JMX management. Enabling this allows to have fine-grained monitoring and management of every route created via Kamelets. This is default disabled as a Kamelet is intended as a component (black-box) and its implementation details as Camel route makes the overall management and monitoring of Camel applications more verbose. During development of Kamelets then enabli [...] +| *camel.main.jmxManagement{zwsp}RegisterRoutesCreateByTemplate* | Whether routes created by route templates (not Kamelets) should be registered for JMX management. Enabling this allows to have fine-grained monitoring and management of every route created via route templates. This is default enabled (unlike Kamelets) as routes created via templates is regarded as standard routes, and should be available for management and monitoring. | true | boolean | *camel.main.jmxManagement{zwsp}StatisticsLevel* | Sets the JMX statistics level, the level can be set to Extended to gather additional information The default value is Default. | Default | ManagementStatisticsLevel | *camel.main.jmxUpdateRoute{zwsp}Enabled* | Whether to allow updating routes at runtime via JMX using the ManagedRouteMBean. This is disabled by default, but can be enabled for development and troubleshooting purposes, such as updating routes in an existing running Camel via JMX and other tools. | false | boolean | *camel.main.lightweight* | Configure the context to be lightweight. This will trigger some optimizations and memory reduction options. Lightweight context have some limitations. At this moment, dynamic endpoint destinations are not supported. | false | boolean diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java index 4d4f664c20f..22674dad7f2 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java @@ -294,6 +294,10 @@ public final class DefaultConfigurationConfigurer { .setManagementNamePattern(config.getJmxManagementNamePattern()); camelContext.getManagementStrategy().getManagementAgent() .setUpdateRouteEnabled(config.isJmxUpdateRouteEnabled()); + camelContext.getManagementStrategy().getManagementAgent() + .setRegisterRoutesCreateByKamelet(config.isJmxManagementRegisterRoutesCreateByKamelet()); + camelContext.getManagementStrategy().getManagementAgent() + .setRegisterRoutesCreateByTemplate(config.isJmxManagementRegisterRoutesCreateByTemplate()); } if (config.isCamelEventsTimestampEnabled()) { camelContext.getManagementStrategy().getEventFactory().setTimestampEnabled(true); diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java index 2e3fc64a8f3..62def825c2f 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java @@ -101,6 +101,8 @@ public abstract class DefaultConfigurationProperties<T> { @Metadata(defaultValue = "Default") private ManagementStatisticsLevel jmxManagementStatisticsLevel = ManagementStatisticsLevel.Default; private String jmxManagementNamePattern = "#name#"; + private boolean jmxManagementRegisterRoutesCreateByKamelet; + private boolean jmxManagementRegisterRoutesCreateByTemplate = true; private boolean camelEventsTimestampEnabled; private boolean useMdcLogging; private String mdcLoggingKeysPattern; @@ -997,6 +999,41 @@ public abstract class DefaultConfigurationProperties<T> { this.jmxManagementNamePattern = jmxManagementNamePattern; } + public boolean isJmxManagementRegisterRoutesCreateByKamelet() { + return jmxManagementRegisterRoutesCreateByKamelet; + } + + /** + * Whether routes created by Kamelets should be registered for JMX management. + * Enabling this allows to have fine-grained monitoring and management of every route created via Kamelets. + * + * This is default disabled as a Kamelet is intended as a component (black-box) and its implementation + * details as Camel route makes the overall management and monitoring of Camel applications more verbose. + * + * During development of Kamelets then enabling this will make it possible for developers to do + * fine-grained performance inspection and identify potential bottlenecks in the Kamelet routes. + * + * However, for production usage then keeping this disabled is recommended. + */ + public void setJmxManagementRegisterRoutesCreateByKamelet(boolean jmxManagementRegisterRoutesCreateByKamelet) { + this.jmxManagementRegisterRoutesCreateByKamelet = jmxManagementRegisterRoutesCreateByKamelet; + } + + public boolean isJmxManagementRegisterRoutesCreateByTemplate() { + return jmxManagementRegisterRoutesCreateByTemplate; + } + + /** + * Whether routes created by route templates (not Kamelets) should be registered for JMX management. + * Enabling this allows to have fine-grained monitoring and management of every route created via route templates. + * + * This is default enabled (unlike Kamelets) as routes created via templates is regarded as standard routes, + * and should be available for management and monitoring. + */ + public void setJmxManagementRegisterRoutesCreateByTemplate(boolean jmxManagementRegisterRoutesCreateByTemplate) { + this.jmxManagementRegisterRoutesCreateByTemplate = jmxManagementRegisterRoutesCreateByTemplate; + } + public boolean isCamelEventsTimestampEnabled() { return camelEventsTimestampEnabled; } @@ -2201,6 +2238,35 @@ public abstract class DefaultConfigurationProperties<T> { return (T) this; } + /** + * Whether routes created by Kamelets should be registered for JMX management. + * Enabling this allows to have fine-grained monitoring and management of every route created via Kamelets. + * + * This is default disabled as a Kamelet is intended as a component (black-box) and its implementation + * details as Camel route makes the overall management and monitoring of Camel applications more verbose. + * + * During development of Kamelets then enabling this will make it possible for developers to do + * fine-grained performance inspection and identify potential bottlenecks in the Kamelet routes. + * + * However, for production usage then keeping this disabled is recommended. + */ + public T withJmxManagementRegisterRoutesCreateByKamelet(boolean jmxManagementRegisterRoutesCreateByKamelet) { + this.jmxManagementRegisterRoutesCreateByKamelet = jmxManagementRegisterRoutesCreateByKamelet; + return (T) this; + } + + /** + * Whether routes created by route templates (not Kamelets) should be registered for JMX management. + * Enabling this allows to have fine-grained monitoring and management of every route created via route templates. + * + * This is default enabled (unlike Kamelets) as routes created via templates is regarded as standard routes, + * and should be available for management and monitoring. + */ + public T withJmxManagementRegisterRoutesCreateByTemplate(boolean jmxManagementRegisterRoutesCreateByTemplate) { + this.jmxManagementRegisterRoutesCreateByTemplate = jmxManagementRegisterRoutesCreateByTemplate; + return (T) this; + } + /** * Whether to include timestamps for all emitted Camel Events. Enabling this allows to know fine-grained at what * time each event was emitted, which can be used for reporting to report exactly the time of the events. This is by