This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch mm in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4990669db6ef3a3ad3ebcb27f842331886f65692 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Nov 15 20:32:16 2023 +0100 CAMEL-20105: camel-micromemter - Make it easier to configure for camel-main --- .../main/LraConfigurationPropertiesConfigurer.java | 6 ++++++ .../MetricsConfigurationPropertiesConfigurer.java | 6 ++++++ .../main/OtelConfigurationPropertiesConfigurer.java | 6 ++++++ .../META-INF/camel-main-configuration-metadata.json | 3 +++ core/camel-main/src/main/docs/main.adoc | 9 ++++++--- .../camel/main/LraConfigurationProperties.java | 21 +++++++++++++++++++++ .../camel/main/MetricsConfigurationProperties.java | 20 ++++++++++++++++++++ .../camel/main/OtelConfigurationProperties.java | 20 ++++++++++++++++++++ 8 files changed, 88 insertions(+), 3 deletions(-) diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/LraConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/LraConfigurationPropertiesConfigurer.java index 106befdd04b..e34dc0a7610 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/LraConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/LraConfigurationPropertiesConfigurer.java @@ -25,6 +25,8 @@ public class LraConfigurationPropertiesConfigurer extends org.apache.camel.suppo case "CoordinatorContextPath": target.setCoordinatorContextPath(property(camelContext, java.lang.String.class, value)); return true; case "coordinatorurl": case "CoordinatorUrl": target.setCoordinatorUrl(property(camelContext, java.lang.String.class, value)); return true; + case "enabled": + case "Enabled": target.setEnabled(property(camelContext, boolean.class, value)); return true; case "localparticipantcontextpath": case "LocalParticipantContextPath": target.setLocalParticipantContextPath(property(camelContext, java.lang.String.class, value)); return true; case "localparticipanturl": @@ -40,6 +42,8 @@ public class LraConfigurationPropertiesConfigurer extends org.apache.camel.suppo case "CoordinatorContextPath": return java.lang.String.class; case "coordinatorurl": case "CoordinatorUrl": return java.lang.String.class; + case "enabled": + case "Enabled": return boolean.class; case "localparticipantcontextpath": case "LocalParticipantContextPath": return java.lang.String.class; case "localparticipanturl": @@ -56,6 +60,8 @@ public class LraConfigurationPropertiesConfigurer extends org.apache.camel.suppo case "CoordinatorContextPath": return target.getCoordinatorContextPath(); case "coordinatorurl": case "CoordinatorUrl": return target.getCoordinatorUrl(); + case "enabled": + case "Enabled": return target.isEnabled(); case "localparticipantcontextpath": case "LocalParticipantContextPath": return target.getLocalParticipantContextPath(); case "localparticipanturl": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/MetricsConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/MetricsConfigurationPropertiesConfigurer.java index e81062ff0eb..a20fbbf666e 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/MetricsConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/MetricsConfigurationPropertiesConfigurer.java @@ -29,6 +29,8 @@ public class MetricsConfigurationPropertiesConfigurer extends org.apache.camel.s case "EnableRouteEventNotifier": target.setEnableRouteEventNotifier(property(camelContext, boolean.class, value)); return true; case "enableroutepolicy": case "EnableRoutePolicy": target.setEnableRoutePolicy(property(camelContext, boolean.class, value)); return true; + case "enabled": + case "Enabled": target.setEnabled(property(camelContext, boolean.class, value)); return true; default: return false; } } @@ -44,6 +46,8 @@ public class MetricsConfigurationPropertiesConfigurer extends org.apache.camel.s case "EnableRouteEventNotifier": return boolean.class; case "enableroutepolicy": case "EnableRoutePolicy": return boolean.class; + case "enabled": + case "Enabled": return boolean.class; default: return null; } } @@ -60,6 +64,8 @@ public class MetricsConfigurationPropertiesConfigurer extends org.apache.camel.s case "EnableRouteEventNotifier": return target.isEnableRouteEventNotifier(); case "enableroutepolicy": case "EnableRoutePolicy": return target.isEnableRoutePolicy(); + case "enabled": + case "Enabled": return target.isEnabled(); default: return null; } } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/OtelConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/OtelConfigurationPropertiesConfigurer.java index 2cd0234490c..c035d6aab7c 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/OtelConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/OtelConfigurationPropertiesConfigurer.java @@ -21,6 +21,8 @@ public class OtelConfigurationPropertiesConfigurer extends org.apache.camel.supp public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { org.apache.camel.main.OtelConfigurationProperties target = (org.apache.camel.main.OtelConfigurationProperties) obj; switch (ignoreCase ? name.toLowerCase() : name) { + case "enabled": + case "Enabled": target.setEnabled(property(camelContext, boolean.class, value)); return true; case "encoding": case "Encoding": target.setEncoding(property(camelContext, boolean.class, value)); return true; case "excludepatterns": @@ -34,6 +36,8 @@ public class OtelConfigurationPropertiesConfigurer extends org.apache.camel.supp @Override public Class<?> getOptionType(String name, boolean ignoreCase) { switch (ignoreCase ? name.toLowerCase() : name) { + case "enabled": + case "Enabled": return boolean.class; case "encoding": case "Encoding": return boolean.class; case "excludepatterns": @@ -48,6 +52,8 @@ public class OtelConfigurationPropertiesConfigurer extends org.apache.camel.supp public Object getOptionValue(Object obj, String name, boolean ignoreCase) { org.apache.camel.main.OtelConfigurationProperties target = (org.apache.camel.main.OtelConfigurationProperties) obj; switch (ignoreCase ? name.toLowerCase() : name) { + case "enabled": + case "Enabled": return target.isEnabled(); case "encoding": case "Encoding": return target.isEncoding(); case "excludepatterns": 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 d5a1d229594..5521078c575 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 @@ -177,12 +177,15 @@ { "name": "camel.health.routesEnabled", "description": "Whether routes health check is enabled", "sourceType": "org.apache.camel.main.HealthConfigurationProperties", "type": "boolean", "javaType": "java.lang.Boolean", "defaultValue": true }, { "name": "camel.lra.coordinatorContextPath", "description": "The context-path for the LRA coordinator. Is default \/lra-coordinator", "sourceType": "org.apache.camel.main.LraConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/lra-coordinator" }, { "name": "camel.lra.coordinatorUrl", "description": "The URL for the LRA coordinator service that orchestrates the transactions", "sourceType": "org.apache.camel.main.LraConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.lra.enabled", "description": "To enable Saga LRA", "sourceType": "org.apache.camel.main.LraConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false }, { "name": "camel.lra.localParticipantContextPath", "description": "The context-path for the local participant. Is default \/lra-participant", "sourceType": "org.apache.camel.main.LraConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/lra-participant" }, { "name": "camel.lra.localParticipantUrl", "description": "The URL for the local participant", "sourceType": "org.apache.camel.main.LraConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.metrics.enabled", "description": "To enable Micrometer metrics.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.metrics.enableExchangeEventNotifier", "description": "Set whether to enable the MicrometerExchangeEventNotifier for capturing metrics on exchange processing times.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true }, { "name": "camel.metrics.enableMessageHistory", "description": "Set whether to enable the MicrometerMessageHistoryFactory for capturing metrics on individual route node processing times. Depending on the number of configured route nodes, there is the potential to create a large volume of metrics. Therefore, this option is disabled by default.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.metrics.enableRouteEventNotifier", "description": "Set whether to enable the MicrometerRouteEventNotifier for capturing metrics on the total number of routes and total number of routes running.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true }, { "name": "camel.metrics.enableRoutePolicy", "description": "Set whether to enable the MicrometerRoutePolicyFactory for capturing metrics on route processing times.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true }, + { "name": "camel.opentelemetry.enabled", "description": "To enable OpenTelemetry", "sourceType": "org.apache.camel.main.OtelConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.opentelemetry.encoding", "description": "Sets whether the header keys need to be encoded (connector specific) or not. The value is a boolean. Dashes need for instances to be encoded for JMS property keys.", "sourceType": "org.apache.camel.main.OtelConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.opentelemetry.excludePatterns", "description": "Adds an exclude pattern that will disable tracing for Camel messages that matches the pattern. Multiple patterns can be separated by comma.", "sourceType": "org.apache.camel.main.OtelConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.opentelemetry.instrumentationName", "description": "A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null.", "sourceType": "org.apache.camel.main.OtelConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "camel" }, diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc index c855cacb293..9eb1ebfe7a9 100644 --- a/core/camel-main/src/main/docs/main.adoc +++ b/core/camel-main/src/main/docs/main.adoc @@ -333,11 +333,12 @@ The camel.vault.azure supports 11 options, which are listed below. === Camel OpenTelemtry configurations -The camel.opentelemetry supports 3 options, which are listed below. +The camel.opentelemetry supports 4 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type +| *camel.opentelemetry.enabled* | To enable OpenTelemetry | false | boolean | *camel.opentelemetry.encoding* | Sets whether the header keys need to be encoded (connector specific) or not. The value is a boolean. Dashes need for instances to be encoded for JMS property keys. | false | boolean | *camel.opentelemetry.exclude{zwsp}Patterns* | Adds an exclude pattern that will disable tracing for Camel messages that matches the pattern. Multiple patterns can be separated by comma. | | String | *{zwsp}camel.opentelemetry.instrumentation{zwsp}Name* | A name uniquely identifying the instrumentation scope, such as the instrumentation library, package, or fully qualified class name. Must not be null. | camel | String @@ -345,11 +346,12 @@ The camel.opentelemetry supports 3 options, which are listed below. === Camel Micrometer Metrics configurations -The camel.metrics supports 4 options, which are listed below. +The camel.metrics supports 5 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type +| *camel.metrics.enabled* | To enable Micrometer metrics. | false | boolean | *camel.metrics.enableExchange{zwsp}EventNotifier* | Set whether to enable the MicrometerExchangeEventNotifier for capturing metrics on exchange processing times. | true | boolean | *camel.metrics.enableMessage{zwsp}History* | Set whether to enable the MicrometerMessageHistoryFactory for capturing metrics on individual route node processing times. Depending on the number of configured route nodes, there is the potential to create a large volume of metrics. Therefore, this option is disabled by default. | false | boolean | *camel.metrics.enableRouteEvent{zwsp}Notifier* | Set whether to enable the MicrometerRouteEventNotifier for capturing metrics on the total number of routes and total number of routes running. | true | boolean @@ -409,13 +411,14 @@ The camel.resilience4j supports 20 options, which are listed below. === Camel Saga EIP (Long Running Actions) configurations -The camel.lra supports 4 options, which are listed below. +The camel.lra supports 5 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type | *camel.lra.coordinatorContext{zwsp}Path* | The context-path for the LRA coordinator. Is default /lra-coordinator | /lra-coordinator | String | *camel.lra.coordinatorUrl* | The URL for the LRA coordinator service that orchestrates the transactions | | String +| *camel.lra.enabled* | To enable Saga LRA | false | boolean | *camel.lra.localParticipant{zwsp}ContextPath* | The context-path for the local participant. Is default /lra-participant | /lra-participant | String | *camel.lra.localParticipantUrl* | The URL for the local participant | | String |=== diff --git a/core/camel-main/src/main/java/org/apache/camel/main/LraConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/LraConfigurationProperties.java index c0106ddbcac..0246b724b0b 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/LraConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/LraConfigurationProperties.java @@ -28,6 +28,8 @@ public class LraConfigurationProperties implements BootstrapCloseable { private MainConfigurationProperties parent; + @Metadata(defaultValue = "false") + private boolean enabled; private String coordinatorUrl; @Metadata(defaultValue = "/lra-coordinator") private String coordinatorContextPath = "/lra-coordinator"; @@ -48,6 +50,17 @@ public class LraConfigurationProperties implements BootstrapCloseable { parent = null; } + public boolean isEnabled() { + return enabled; + } + + /** + * To enable Saga LRA + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public String getCoordinatorUrl() { return coordinatorUrl; } @@ -104,6 +117,14 @@ public class LraConfigurationProperties implements BootstrapCloseable { return this; } + /** + * To enable Saga LRA + */ + public LraConfigurationProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + /** * The context-path for the LRA coordinator. */ diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java index ca54f8122c6..d9985fcf26f 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java @@ -28,6 +28,7 @@ public class MetricsConfigurationProperties implements BootstrapCloseable { private MainConfigurationProperties parent; + private boolean enabled; @Metadata(defaultValue = "true") private boolean enableRoutePolicy = true; private boolean enableMessageHistory; @@ -44,6 +45,17 @@ public class MetricsConfigurationProperties implements BootstrapCloseable { return parent; } + public boolean isEnabled() { + return enabled; + } + + /** + * To enable Micrometer metrics. + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public boolean isEnableRoutePolicy() { return enableRoutePolicy; } @@ -106,6 +118,14 @@ public class MetricsConfigurationProperties implements BootstrapCloseable { return this; } + /** + * To enable Micrometer metrics. + */ + public MetricsConfigurationProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + /** * Set whether to enable the MicrometerMessageHistoryFactory for capturing metrics on individual route node * processing times. diff --git a/core/camel-main/src/main/java/org/apache/camel/main/OtelConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/OtelConfigurationProperties.java index a41c23a1694..567356d5d02 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/OtelConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/OtelConfigurationProperties.java @@ -28,6 +28,7 @@ public class OtelConfigurationProperties implements BootstrapCloseable { private MainConfigurationProperties parent; + private boolean enabled; @Metadata(defaultValue = "camel", required = true) private String instrumentationName = "camel"; private boolean encoding; @@ -46,6 +47,17 @@ public class OtelConfigurationProperties implements BootstrapCloseable { parent = null; } + public boolean isEnabled() { + return enabled; + } + + /** + * To enable OpenTelemetry + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public String getInstrumentationName() { return instrumentationName; } @@ -91,6 +103,14 @@ public class OtelConfigurationProperties implements BootstrapCloseable { return this; } + /** + * To enable OpenTelemetry + */ + public OtelConfigurationProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + /** * Sets whether the header keys need to be encoded (connector specific) or not. The value is a boolean. Dashes need * for instances to be encoded for JMS property keys.