This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch man in repository https://gitbox.apache.org/repos/asf/camel.git
commit ab6ee2e99bf2f8c0e370631c91f28cf18500d79e Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jul 29 17:01:38 2025 +0200 CAMEL-22285: platform-http-main - Dev consoles should be registered as management endpoints --- .../main/camel-main-configuration-metadata.json | 11 ++++---- .../src/main/docs/observability-services.adoc | 4 +-- .../resources/observability-services.properties | 7 ------ .../src/main/docs/platform-http-jolokia.adoc | 19 +++++++------- .../src/main/docs/platform-http-main.adoc | 17 +++++++------ .../http/main/DefaultMainHttpServerFactory.java | 1 + .../platform/http/main/ManagementHttpServer.java | 14 +++++++++-- ...entServerConfigurationPropertiesConfigurer.java | 7 ++++++ .../camel-main-configuration-metadata.json | 11 ++++---- core/camel-main/src/main/docs/main.adoc | 13 +++++----- ...ttpManagementServerConfigurationProperties.java | 29 +++++++++++++++++++--- .../camel/main/MetricsConfigurationProperties.java | 4 +-- .../modules/ROOT/pages/camel-jbang.adoc | 14 +++++------ .../camel/main/download/MainHttpServerFactory.java | 9 ++++--- 14 files changed, 99 insertions(+), 61 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json index 66eff52bf6b..8d0e74e0888 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json @@ -197,16 +197,17 @@ { "name": "camel.management.devConsoleEnabled", "description": "Whether to enable developer console (not intended for production use). Dev console must also be enabled on CamelContext. For example by setting camel.context.dev-console=true in application.properties, or via code camelContext.setDevConsole(true); If enabled then you can access a basic developer console on context-path: \/q\/dev.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": [...] { "name": "camel.management.downloadEnabled", "description": "Whether to enable file download via HTTP. This makes it possible to browse and download resource source files such as Camel XML or YAML routes. Only enable this for development, troubleshooting or special situations for management and monitoring.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.enabled", "description": "Whether embedded HTTP server is enabled. By default, the server is not enabled.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, - { "name": "camel.management.healthCheckEnabled", "description": "Whether to enable health-check console. If enabled then you can access health-check status on context-path: \/q\/health (default)", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.healthCheckEnabled", "description": "Whether to enable health-check console. If enabled then you can access health-check status on context-path: \/observe\/health", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.healthPath", "description": "The path endpoint used to expose the health status", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/health" }, { "name": "camel.management.host", "description": "Hostname to use for binding embedded HTTP server", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "0.0.0.0" }, - { "name": "camel.management.infoEnabled", "description": "Whether to enable info console. If enabled then you can see some basic Camel information at \/q\/info", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, - { "name": "camel.management.jolokiaEnabled", "description": "Whether to enable jolokia. If enabled then you can access jolokia api on context-path: \/q\/jolokia", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.infoEnabled", "description": "Whether to enable info console. If enabled then you can see some basic Camel information at \/observe\/info", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.infoPath", "description": "The path endpoint used to expose the info status", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/info" }, + { "name": "camel.management.jolokiaEnabled", "description": "Whether to enable jolokia. If enabled then you can access jolokia api on context-path: \/observe\/jolokia", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.jolokiaPath", "description": "The path endpoint used to expose the jolokia data.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/jolokia" }, { "name": "camel.management.jwtKeystorePassword", "description": "Password from the keystore used for JWT tokens validation.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.management.jwtKeystorePath", "description": "Path to the keystore file used for JWT tokens validation.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.management.jwtKeystoreType", "description": "Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, - { "name": "camel.management.metricsEnabled", "description": "Whether to enable metrics. If enabled then you can access metrics on context-path: \/q\/metrics (default)", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.metricsEnabled", "description": "Whether to enable metrics. If enabled then you can access metrics on context-path: \/observe\/metrics", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.path", "description": "Context-path to use for embedded HTTP server", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/" }, { "name": "camel.management.port", "description": "Port to use for binding embedded HTTP server", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 8080 }, { "name": "camel.management.sendEnabled", "description": "Whether to enable sending messages to Camel via HTTP. This makes it possible to use Camel to send messages to Camel endpoint URIs via HTTP.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, @@ -223,7 +224,7 @@ { "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.metrics.namingStrategy", "description": "Controls the name style to use for metrics. Default = uses micrometer naming convention. Legacy = uses the classic naming style (camelCase)", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "default", "enum": [ "default", "legacy" ] }, - { "name": "camel.metrics.path", "description": "The path endpoint used to expose the metrics.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/q\/metrics" }, + { "name": "camel.metrics.path", "description": "The path endpoint used to expose the metrics.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/metrics" }, { "name": "camel.metrics.routePolicyLevel", "description": "Sets the level of information to capture. all = both context and routes.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "all", "enum": [ "all", "route", "context" ] }, { "name": "camel.metrics.skipCamelInfo", "description": "Skip the evaluation of app.info metric which contains runtime provider information (default, false).", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false }, { "name": "camel.metrics.textFormatVersion", "description": "The text-format version to use with Prometheus scraping. 0.0.4 = text\/plain; version=0.0.4; charset=utf-8 1.0.0 = application\/openmetrics-text; version=1.0.0; charset=utf-8", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "0.0.4", "enum": [ "0.0.4", "1.0.0" ] }, diff --git a/components/camel-observability-services/src/main/docs/observability-services.adoc b/components/camel-observability-services/src/main/docs/observability-services.adoc index 04613c5249d..ba73bee1faa 100644 --- a/components/camel-observability-services/src/main/docs/observability-services.adoc +++ b/components/camel-observability-services/src/main/docs/observability-services.adoc @@ -119,9 +119,9 @@ In this case, it is recommended the usage of a JSR 160 compatible Java agent. ==== JMX Agent configuration -When dealing with JMX, -you may want +When dealing with JMX, you may want to expose the information available via HTTP(S) protocol which would make JMX more suitable to cloud-based development. A possible way to expose the information is to use a JSR 160 compatible Java agent, whose goal is to interact as an adapter interface towards JMX, exposing an HTTP-based service instead. + Follow the instructions provided in xref:manual::jmx.adoc#_how_to_use_a_java_agent[JMX Java Agent configuration]. diff --git a/components/camel-observability-services/src/main/resources/observability-services.properties b/components/camel-observability-services/src/main/resources/observability-services.properties index 75315d5e351..614b57a73b0 100644 --- a/components/camel-observability-services/src/main/resources/observability-services.properties +++ b/components/camel-observability-services/src/main/resources/observability-services.properties @@ -15,13 +15,6 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -# Enable server -# Deprecated: camel.server properties should be removed in future releases -camel.server.enabled=true -camel.server.metricsEnabled=true -camel.server.healthCheckEnabled=true -camel.server.healthPath=/observe/health - # Enable management server camel.management.enabled=true camel.management.metricsEnabled=true diff --git a/components/camel-platform-http-jolokia/src/main/docs/platform-http-jolokia.adoc b/components/camel-platform-http-jolokia/src/main/docs/platform-http-jolokia.adoc index bec7528f151..40065b2cade 100644 --- a/components/camel-platform-http-jolokia/src/main/docs/platform-http-jolokia.adoc +++ b/components/camel-platform-http-jolokia/src/main/docs/platform-http-jolokia.adoc @@ -10,21 +10,21 @@ *Since Camel {since}* The Platform HTTP Jolokia component is used for Camel standalone to expose Jolokia over HTTP -using the embedded HTTP server. +using the embedded management HTTP server. Jolokia can be enabled as follows in `application.properties`: [source,properties] ---- -camel.server.enabled = true -camel.server.jolokiaEnabled = true +camel.management.enabled = true +camel.management.jolokiaEnabled = true ---- -After the application is started, you can query the Jolokia endpoint (default `/q/jolokia`) as in this example: - -``` -$ curl http://localhost:8080/q/jolokia/list/org.apache.camel | jq +After the application is started, you can query the Jolokia endpoint (default `/observe/jolokia`) as in this example: +[source,bash] +==== +$ curl http://localhost:8080/observe/jolokia/list/org.apache.camel | jq { "request": { "path": "org.apache.camel", @@ -38,12 +38,11 @@ $ curl http://localhost:8080/q/jolokia/list/org.apache.camel | jq "ret": "java.lang.String", "desc": "EndpointUri" }, -... -``` +==== == How to use it -This components acts as a Jolokia agent exposing HTTP endpoints to access JMX services. It looks for default restrictor policies located in `classpath:/jolokia-access.xml`, allowing by default access to all MBeans if no policy is found. +This component acts as a Jolokia agent exposing HTTP endpoints to access JMX services. It looks for default restrictor policies located in `classpath:/jolokia-access.xml`, allowing by default access to all MBeans if no policy is found. WARNING: this may be exposing sensitive information, make sure to protect the access to the endpoints accurately. diff --git a/components/camel-platform-http-main/src/main/docs/platform-http-main.adoc b/components/camel-platform-http-main/src/main/docs/platform-http-main.adoc index a026d5b9b5b..2992696a0b3 100644 --- a/components/camel-platform-http-main/src/main/docs/platform-http-main.adoc +++ b/components/camel-platform-http-main/src/main/docs/platform-http-main.adoc @@ -25,21 +25,22 @@ Then, the platform http component should auto-detect this. == Uploading and downloading files -The embedded HTTP server comes with a set of features out of the box, that can be enabled. +The embedded HTTP server comes with a set of features out of the box (management, development and user services), +that can be enabled. These features are as follows: -- `/q/info` - Report basic information about Camel -- `/dev/console` - Developer console that provides a lot of statistics and information -- `/q/health (default)` - Health checks -- `/q/jolokia` - To use Jolokia to expose JMX over HTTP REST -- `/q/metrics (default)` - To provide otel metrics in prometheus format +- `/` - Serving static content such as html, javascript, css, and images to make it easy to embed very small web applications. +- `/observe/info` - Report basic information about Camel +- `/observe/health` - Health checks +- `/observe/jolokia` - To use Jolokia to expose JMX over HTTP REST +- `/observe/metrics` - To provide OTEL metrics in prometheus format +- `/q/dev` - Developer console that provides a lot of statistics and information - `/q/upload` - Uploading source files, to allow hot reloading. - `/q/download` - Downloading source files, to allow inspecting - `/q/send` - Sending messages to the Camel application via HTTP -- `/` - Serving static content such as html, javascript, css, and images to make it easy to embed very small web applications. -You configure these features in the `application.properties` file using the `camel.server.xxx` options. +You configure these features in the `application.properties` file using the `camel.server.xxx` and `camel.management.xxx` options. == See More diff --git a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java index 0ae2a43f927..c995da8a065 100644 --- a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java +++ b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java @@ -93,6 +93,7 @@ public class DefaultMainHttpServerFactory implements CamelContextAware, MainHttp server.setDevConsoleEnabled(configuration.isDevConsoleEnabled()); server.setHealthCheckEnabled(configuration.isHealthCheckEnabled()); server.setHealthPath(configuration.getHealthPath()); + server.setInfoPath(configuration.getInfoPath()); server.setJolokiaEnabled(configuration.isJolokiaEnabled()); server.setJolokiaPath(configuration.getJolokiaPath()); server.setMetricsEnabled(configuration.isMetricsEnabled()); diff --git a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/ManagementHttpServer.java b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/ManagementHttpServer.java index a4dc1104dbd..a09f4a56227 100644 --- a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/ManagementHttpServer.java +++ b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/ManagementHttpServer.java @@ -121,6 +121,7 @@ public class ManagementHttpServer extends ServiceSupport implements CamelContext private boolean healthCheckEnabled; private boolean jolokiaEnabled; private boolean metricsEnabled; + private String infoPath; private String healthPath; private String jolokiaPath; private boolean uploadEnabled; @@ -209,6 +210,15 @@ public class ManagementHttpServer extends ServiceSupport implements CamelContext this.jolokiaEnabled = jolokiaEnabledEnabled; } + @ManagedAttribute(description = "The context-path for serving info status") + public String getInfoPath() { + return infoPath; + } + + public void setInfoPath(String infoPath) { + this.infoPath = infoPath; + } + @ManagedAttribute(description = "The context-path for serving health check status") public String getHealthPath() { return healthPath; @@ -447,7 +457,7 @@ public class ManagementHttpServer extends ServiceSupport implements CamelContext } protected void setupInfo() { - final Route info = router.route("/q/info"); + final Route info = router.route(this.infoPath); info.method(HttpMethod.GET); info.produces("application/json"); @@ -563,7 +573,7 @@ public class ManagementHttpServer extends ServiceSupport implements CamelContext // use blocking handler as the task can take longer time to complete info.handler(new BlockingHandlerDecorator(handler, true)); - platformHttpComponent.addHttpManagementEndpoint("/q/info", "GET", null, + platformHttpComponent.addHttpManagementEndpoint(this.infoPath, "GET", null, "application/json", null); } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/HttpManagementServerConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/HttpManagementServerConfigurationPropertiesConfigurer.java index 97418f57cfa..069888b08fa 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/HttpManagementServerConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/HttpManagementServerConfigurationPropertiesConfigurer.java @@ -32,6 +32,7 @@ public class HttpManagementServerConfigurationPropertiesConfigurer extends org.a map.put("HealthPath", java.lang.String.class); map.put("Host", java.lang.String.class); map.put("InfoEnabled", boolean.class); + map.put("InfoPath", java.lang.String.class); map.put("JolokiaEnabled", boolean.class); map.put("JolokiaPath", java.lang.String.class); map.put("JwtKeystorePassword", java.lang.String.class); @@ -69,6 +70,8 @@ public class HttpManagementServerConfigurationPropertiesConfigurer extends org.a case "host": target.setHost(property(camelContext, java.lang.String.class, value)); return true; case "infoenabled": case "infoEnabled": target.setInfoEnabled(property(camelContext, boolean.class, value)); return true; + case "infopath": + case "infoPath": target.setInfoPath(property(camelContext, java.lang.String.class, value)); return true; case "jolokiaenabled": case "jolokiaEnabled": target.setJolokiaEnabled(property(camelContext, boolean.class, value)); return true; case "jolokiapath": @@ -121,6 +124,8 @@ public class HttpManagementServerConfigurationPropertiesConfigurer extends org.a case "host": return java.lang.String.class; case "infoenabled": case "infoEnabled": return boolean.class; + case "infopath": + case "infoPath": return java.lang.String.class; case "jolokiaenabled": case "jolokiaEnabled": return boolean.class; case "jolokiapath": @@ -169,6 +174,8 @@ public class HttpManagementServerConfigurationPropertiesConfigurer extends org.a case "host": return target.getHost(); case "infoenabled": case "infoEnabled": return target.isInfoEnabled(); + case "infopath": + case "infoPath": return target.getInfoPath(); case "jolokiaenabled": case "jolokiaEnabled": return target.isJolokiaEnabled(); case "jolokiapath": 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 66eff52bf6b..8d0e74e0888 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 @@ -197,16 +197,17 @@ { "name": "camel.management.devConsoleEnabled", "description": "Whether to enable developer console (not intended for production use). Dev console must also be enabled on CamelContext. For example by setting camel.context.dev-console=true in application.properties, or via code camelContext.setDevConsole(true); If enabled then you can access a basic developer console on context-path: \/q\/dev.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": [...] { "name": "camel.management.downloadEnabled", "description": "Whether to enable file download via HTTP. This makes it possible to browse and download resource source files such as Camel XML or YAML routes. Only enable this for development, troubleshooting or special situations for management and monitoring.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.enabled", "description": "Whether embedded HTTP server is enabled. By default, the server is not enabled.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, - { "name": "camel.management.healthCheckEnabled", "description": "Whether to enable health-check console. If enabled then you can access health-check status on context-path: \/q\/health (default)", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.healthCheckEnabled", "description": "Whether to enable health-check console. If enabled then you can access health-check status on context-path: \/observe\/health", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.healthPath", "description": "The path endpoint used to expose the health status", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/health" }, { "name": "camel.management.host", "description": "Hostname to use for binding embedded HTTP server", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "0.0.0.0" }, - { "name": "camel.management.infoEnabled", "description": "Whether to enable info console. If enabled then you can see some basic Camel information at \/q\/info", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, - { "name": "camel.management.jolokiaEnabled", "description": "Whether to enable jolokia. If enabled then you can access jolokia api on context-path: \/q\/jolokia", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.infoEnabled", "description": "Whether to enable info console. If enabled then you can see some basic Camel information at \/observe\/info", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.infoPath", "description": "The path endpoint used to expose the info status", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/info" }, + { "name": "camel.management.jolokiaEnabled", "description": "Whether to enable jolokia. If enabled then you can access jolokia api on context-path: \/observe\/jolokia", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.jolokiaPath", "description": "The path endpoint used to expose the jolokia data.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/jolokia" }, { "name": "camel.management.jwtKeystorePassword", "description": "Password from the keystore used for JWT tokens validation.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.management.jwtKeystorePath", "description": "Path to the keystore file used for JWT tokens validation.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.management.jwtKeystoreType", "description": "Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String" }, - { "name": "camel.management.metricsEnabled", "description": "Whether to enable metrics. If enabled then you can access metrics on context-path: \/q\/metrics (default)", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.management.metricsEnabled", "description": "Whether to enable metrics. If enabled then you can access metrics on context-path: \/observe\/metrics", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.management.path", "description": "Context-path to use for embedded HTTP server", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/" }, { "name": "camel.management.port", "description": "Port to use for binding embedded HTTP server", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 8080 }, { "name": "camel.management.sendEnabled", "description": "Whether to enable sending messages to Camel via HTTP. This makes it possible to use Camel to send messages to Camel endpoint URIs via HTTP.", "sourceType": "org.apache.camel.main.HttpManagementServerConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, @@ -223,7 +224,7 @@ { "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.metrics.namingStrategy", "description": "Controls the name style to use for metrics. Default = uses micrometer naming convention. Legacy = uses the classic naming style (camelCase)", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "default", "enum": [ "default", "legacy" ] }, - { "name": "camel.metrics.path", "description": "The path endpoint used to expose the metrics.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/q\/metrics" }, + { "name": "camel.metrics.path", "description": "The path endpoint used to expose the metrics.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "\/observe\/metrics" }, { "name": "camel.metrics.routePolicyLevel", "description": "Sets the level of information to capture. all = both context and routes.", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "all", "enum": [ "all", "route", "context" ] }, { "name": "camel.metrics.skipCamelInfo", "description": "Skip the evaluation of app.info metric which contains runtime provider information (default, false).", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false }, { "name": "camel.metrics.textFormatVersion", "description": "The text-format version to use with Prometheus scraping. 0.0.4 = text\/plain; version=0.0.4; charset=utf-8 1.0.0 = application\/openmetrics-text; version=1.0.0; charset=utf-8", "sourceType": "org.apache.camel.main.MetricsConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "0.0.4", "enum": [ "0.0.4", "1.0.0" ] }, diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc index fdeffb691d2..f61092f5ab7 100644 --- a/core/camel-main/src/main/docs/main.adoc +++ b/core/camel-main/src/main/docs/main.adoc @@ -215,7 +215,7 @@ The camel.server supports 17 options, which are listed below. === Camel Embedded HTTP management Server (only for standalone; not Spring Boot or Quarkus) configurations -The camel.management supports 22 options, which are listed below. +The camel.management supports 23 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -226,16 +226,17 @@ The camel.management supports 22 options, which are listed below. | *camel.management.devConsole{zwsp}Enabled* | Whether to enable developer console (not intended for production use). Dev console must also be enabled on CamelContext. For example by setting camel.context.dev-console=true in application.properties, or via code camelContext.setDevConsole(true); If enabled then you can access a basic developer console on context-path: /q/dev. | false | boolean | *camel.management.download{zwsp}Enabled* | Whether to enable file download via HTTP. This makes it possible to browse and download resource source files such as Camel XML or YAML routes. Only enable this for development, troubleshooting or special situations for management and monitoring. | false | boolean | *camel.management.enabled* | Whether embedded HTTP server is enabled. By default, the server is not enabled. | false | boolean -| *camel.management.healthCheck{zwsp}Enabled* | Whether to enable health-check console. If enabled then you can access health-check status on context-path: /q/health (default) | false | boolean +| *camel.management.healthCheck{zwsp}Enabled* | Whether to enable health-check console. If enabled then you can access health-check status on context-path: /observe/health | false | boolean | *camel.management.healthPath* | The path endpoint used to expose the health status | /observe/health | String | *camel.management.host* | Hostname to use for binding embedded HTTP server | 0.0.0.0 | String -| *camel.management.infoEnabled* | Whether to enable info console. If enabled then you can see some basic Camel information at /q/info | false | boolean -| *camel.management.jolokia{zwsp}Enabled* | Whether to enable jolokia. If enabled then you can access jolokia api on context-path: /q/jolokia | false | boolean +| *camel.management.infoEnabled* | Whether to enable info console. If enabled then you can see some basic Camel information at /observe/info | false | boolean +| *camel.management.infoPath* | The path endpoint used to expose the info status | /observe/info | String +| *camel.management.jolokia{zwsp}Enabled* | Whether to enable jolokia. If enabled then you can access jolokia api on context-path: /observe/jolokia | false | boolean | *camel.management.jolokiaPath* | The path endpoint used to expose the jolokia data. | /observe/jolokia | String | *camel.management.jwtKeystore{zwsp}Password* | Password from the keystore used for JWT tokens validation. | | String | *camel.management.jwtKeystore{zwsp}Path* | Path to the keystore file used for JWT tokens validation. | | String | *camel.management.jwtKeystore{zwsp}Type* | Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.). | | String -| *camel.management.metrics{zwsp}Enabled* | Whether to enable metrics. If enabled then you can access metrics on context-path: /q/metrics (default) | false | boolean +| *camel.management.metrics{zwsp}Enabled* | Whether to enable metrics. If enabled then you can access metrics on context-path: /observe/metrics | false | boolean | *camel.management.path* | Context-path to use for embedded HTTP server | / | String | *camel.management.port* | Port to use for binding embedded HTTP server | 8080 | int | *camel.management.sendEnabled* | Whether to enable sending messages to Camel via HTTP. This makes it possible to use Camel to send messages to Camel endpoint URIs via HTTP. | false | boolean @@ -574,7 +575,7 @@ The camel.metrics supports 14 options, which are listed below. | *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 | *camel.metrics.enableRoute{zwsp}Policy* | Set whether to enable the MicrometerRoutePolicyFactory for capturing metrics on route processing times. | true | boolean | *camel.metrics.namingStrategy* | Controls the name style to use for metrics. Default = uses micrometer naming convention. Legacy = uses the classic naming style (camelCase) | default | String -| *camel.metrics.path* | The path endpoint used to expose the metrics. | /q/metrics | String +| *camel.metrics.path* | The path endpoint used to expose the metrics. | /observe/metrics | String | *camel.metrics.routePolicyLevel* | Sets the level of information to capture. all = both context and routes. | all | String | *camel.metrics.skipCamelInfo* | Skip the evaluation of app.info metric which contains runtime provider information (default, false). | false | boolean | *camel.metrics.textFormat{zwsp}Version* | The text-format version to use with Prometheus scraping. 0.0.4 = text/plain; version=0.0.4; charset=utf-8 1.0.0 = application/openmetrics-text; version=1.0.0; charset=utf-8 | 0.0.4 | String diff --git a/core/camel-main/src/main/java/org/apache/camel/main/HttpManagementServerConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/HttpManagementServerConfigurationProperties.java index a18d01e078c..ef78f494f09 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/HttpManagementServerConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/HttpManagementServerConfigurationProperties.java @@ -36,6 +36,8 @@ public class HttpManagementServerConfigurationProperties implements BootstrapClo private int port = 8080; @Metadata(defaultValue = "/") private String path = "/"; + @Metadata(defaultValue = "/observe/info") + private String infoPath = "/observe/info"; @Metadata(defaultValue = "/observe/health") private String healthPath = "/observe/health"; @Metadata(defaultValue = "/observe/jolokia") @@ -139,7 +141,7 @@ public class HttpManagementServerConfigurationProperties implements BootstrapClo } /** - * Whether to enable info console. If enabled then you can see some basic Camel information at /q/info + * Whether to enable info console. If enabled then you can see some basic Camel information at /observe/info */ public void setInfoEnabled(boolean infoEnabled) { this.infoEnabled = infoEnabled; @@ -165,7 +167,7 @@ public class HttpManagementServerConfigurationProperties implements BootstrapClo /** * Whether to enable health-check console. If enabled then you can access health-check status on context-path: - * /q/health (default) + * /observe/health */ public void setHealthCheckEnabled(boolean healthCheckEnabled) { this.healthCheckEnabled = healthCheckEnabled; @@ -176,7 +178,7 @@ public class HttpManagementServerConfigurationProperties implements BootstrapClo } /** - * Whether to enable jolokia. If enabled then you can access jolokia api on context-path: /q/jolokia + * Whether to enable jolokia. If enabled then you can access jolokia api on context-path: /observe/jolokia */ public void setJolokiaEnabled(boolean jolokiaEnabled) { this.jolokiaEnabled = jolokiaEnabled; @@ -187,12 +189,23 @@ public class HttpManagementServerConfigurationProperties implements BootstrapClo } /** - * Whether to enable metrics. If enabled then you can access metrics on context-path: /q/metrics (default) + * Whether to enable metrics. If enabled then you can access metrics on context-path: /observe/metrics */ public void setMetricsEnabled(boolean metricsEnabled) { this.metricsEnabled = metricsEnabled; } + public String getInfoPath() { + return infoPath; + } + + /** + * The path endpoint used to expose the info status + */ + public void setInfoPath(String infoPath) { + this.infoPath = infoPath; + } + public String getHealthPath() { return healthPath; } @@ -504,6 +517,14 @@ public class HttpManagementServerConfigurationProperties implements BootstrapClo return this; } + /** + * The path endpoint used to expose the info status + */ + public HttpManagementServerConfigurationProperties withInfoPath(String infoPath) { + this.infoPath = infoPath; + return this; + } + /** * The path endpoint used to expose the health status */ 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 d2590b431ea..b4241cec676 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 @@ -52,8 +52,8 @@ public class MetricsConfigurationProperties implements BootstrapCloseable { private String textFormatVersion = "0.0.4"; @Metadata private String binders; - @Metadata(defaultValue = "/q/metrics") - private String path = "/q/metrics"; + @Metadata(defaultValue = "/observe/metrics") + private String path = "/observe/metrics"; public MetricsConfigurationProperties(MainConfigurationProperties parent) { this.parent = parent; diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc index ecb691af98b..d9b6c2dd77d 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc @@ -2018,9 +2018,9 @@ You simply either run with `--metrics` option, or enable and have more control o [source,properties] ---- -# enable HTTP server with metrics -camel.server.enabled=true -camel.server.metricsEnabled=true +# enable HTTP management server with metrics +camel.management.enabled=true +camel.management.metricsEnabled=true # turn on micrometer metrics camel.metrics.enabled=true @@ -2030,7 +2030,7 @@ camel.metrics.enableMessageHistory=true camel.metrics.binders=processor,jvm-info,file-descriptor ---- -Then you can access metrics from the web browser at: http://localhost:8080/q/metrics[http://localhost:8080/q/metrics] +Then you can access metrics from the web browser at: http://localhost:8080/observe/metrics[http://localhost:8080/observe/metrics] You can also see metrics from the CLI as shown below: @@ -3920,13 +3920,13 @@ The follow options related to _exporting_, can be configured in `application.pro | Developer console at /q/dev on local HTTP server (port 8080 by default) when running standalone Camel |`camel.jbang.info` -| Info console at /q/info on local HTTP server (port 8080 by default) when running standalone Camel +| Info console at /observe/info on local HTTP server (port 8080 by default) when running standalone Camel |`camel.jbang.health` -| Health check at /q/health on local HTTP server (port 8080 by default) when running standalone Camel +| Health check at /observe/health on local HTTP server (port 8080 by default) when running standalone Camel |`camel.jbang.metrics` -| Metrics (Micrometer and Prometheus) at /q/metrics on local HTTP server (port 8080 by default) when running standalone Camel +| Metrics (Micrometer and Prometheus) at /observe/metrics on local HTTP server (port 8080 by default) when running standalone Camel |`camel.jbang.open-api` | File name of open-api spec file (JSON or YAML) that are used when using `--open-api` to generate routes from the swagger/openapi API spec file. diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MainHttpServerFactory.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MainHttpServerFactory.java index 7f76d5722c0..6907d8e62bf 100644 --- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MainHttpServerFactory.java +++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MainHttpServerFactory.java @@ -19,6 +19,7 @@ package org.apache.camel.main.download; import org.apache.camel.CamelContext; import org.apache.camel.Service; import org.apache.camel.component.platform.http.main.MainHttpServer; +import org.apache.camel.component.platform.http.main.ManagementHttpServer; import org.apache.camel.main.HttpServerConfigurationProperties; import org.apache.camel.main.MainConstants; import org.apache.camel.main.util.CamelJBangSettingsHelper; @@ -26,10 +27,12 @@ import org.apache.camel.main.util.CamelJBangSettingsHelper; public class MainHttpServerFactory { public static MainHttpServer setupHttpServer(CamelContext camelContext, boolean silent) { - // set up a default http server on configured port if not already done + // if we only use management then there is no main server already MainHttpServer server = camelContext.hasService(MainHttpServer.class); - if (server == null) { - // need to capture that we use a http-server + ManagementHttpServer managementHttpServer = camelContext.hasService(ManagementHttpServer.class); + // but if none has already been created, and we are using platform-http, then we need an embedded default http server + if (server == null && managementHttpServer == null) { + // set up a default http server on configured port if not already done HttpServerConfigurationProperties config = new HttpServerConfigurationProperties(null); CamelJBangSettingsHelper.writeSettingsIfNotExists("camel.server.port", String.valueOf(config.getPort()));
