This is an automated email from the ASF dual-hosted git repository.

squakez 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 25d45bea132 feat(starters): micrometer support 
logMetricsOnShutdownFormat
25d45bea132 is described below

commit 25d45bea1329c8fc07669214ecdf47913e0bf1dc
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Aug 11 12:06:06 2026 +0200

    feat(starters): micrometer support logMetricsOnShutdownFormat
    
    Ref CAMEL-24356
---
 .../camel-micrometer-starter/src/main/docs/micrometer.json  |  6 ++++++
 .../springboot/metrics/CamelMetricsAutoConfiguration.java   |  3 +++
 .../springboot/metrics/CamelMetricsConfiguration.java       | 13 +++++++++++++
 .../ObservabilityServicesEnvironmentPostProcessor.java      |  3 ++-
 .../ObservabilityServicesEnvironmentPostProcessorTest.java  |  4 +++-
 .../spring-boot/modules/ROOT/pages/starters/micrometer.adoc |  3 ++-
 6 files changed, 29 insertions(+), 3 deletions(-)

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 f38154a4dce..f2ffa87891d 100644
--- a/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
+++ b/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
@@ -104,6 +104,12 @@
       "description": "List of metrics (comma separated) to log when 
application is shutting down. You can use `*` character to log any metrics 
containing the wildcard, for example `camel.exchanges.*` (default to all 
metrics available).",
       "sourceType": 
"org.apache.camel.component.micrometer.springboot.metrics.CamelMetricsConfiguration"
     },
+    {
+      "name": "camel.metrics.log-metrics-on-shutdown-format",
+      "type": "java.lang.String",
+      "description": "Format used to log metrics when application is shutting 
down. Either json (default) or prometheus format.",
+      "sourceType": 
"org.apache.camel.component.micrometer.springboot.metrics.CamelMetricsConfiguration"
+    },
     {
       "name": "camel.metrics.naming-strategy",
       "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 76f25d11f4a..daec6968df3 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
@@ -80,6 +80,9 @@ public class CamelMetricsAutoConfiguration {
                 String[] shutdownFilters = 
configuration.getLogMetricsOnShutdownFilters().split(",");
                 notifier.setLogMetricsOnShutdownFilters(shutdownFilters);
             }
+            if (configuration.getLogMetricsOnShutdownFormat() != null){
+                
notifier.setLogMetricsOnShutdownFormat(configuration.getLogMetricsOnShutdownFormat());
+            }
             if ("legacy".equalsIgnoreCase(configuration.getNamingStrategy())) {
                 notifier.setNamingStrategy(new 
MicrometerExchangeEventNotifierNamingStrategyLegacy(
                     configuration.isBaseEndpointUriExchangeEventNotifier()
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 71499c70383..787adee4876 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
@@ -106,6 +106,11 @@ public class CamelMetricsConfiguration {
     */
     private String logMetricsOnShutdownFilters;
 
+    /**
+     * Format used to log metrics when application is shutting down. Either 
json (default) or prometheus format.
+    */
+    private String logMetricsOnShutdownFormat;
+
     public boolean isUriTagEnabled() {
         return uriTagEnabled;
     }
@@ -209,4 +214,12 @@ public class CamelMetricsConfiguration {
     public void setLogMetricsOnShutdownFilters(String 
logMetricsOnShutdownFilters) {
         this.logMetricsOnShutdownFilters = logMetricsOnShutdownFilters;
     }
+
+    public String getLogMetricsOnShutdownFormat() {
+        return logMetricsOnShutdownFormat;
+    }
+
+    public void setLogMetricsOnShutdownFormat(String 
logMetricsOnShutdownFormat) {
+        this.logMetricsOnShutdownFormat = logMetricsOnShutdownFormat;
+    }
 }
diff --git 
a/components-starter/camel-observability-services-starter/src/main/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessor.java
 
b/components-starter/camel-observability-services-starter/src/main/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessor.java
index 498bf024b23..cea919ed3a8 100644
--- 
a/components-starter/camel-observability-services-starter/src/main/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessor.java
+++ 
b/components-starter/camel-observability-services-starter/src/main/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessor.java
@@ -43,7 +43,8 @@ public class ObservabilityServicesEnvironmentPostProcessor 
implements Environmen
         defaults.put("management.endpoints.web.path-mapping.prometheus", 
"metrics");
         // Metrics
         defaults.put("camel.metrics.log-metrics-on-shutdown", "true");
-        defaults.put("camel.metrics.log-metrics-on-shutdown-filters", 
"app.info,camel.exchanges.*");
+        defaults.put("camel.metrics.log-metrics-on-shutdown-filters", 
"app.info,camel.exchanges.*,process.cpu.usage,jvm.memory.max,jvm.memory.used");
+        defaults.put("camel.metrics.log-metrics-on-shutdown-format", 
"prometheus");
         // Opentelemetry
         defaults.put("camel.opentelemetry2.enabled", "true");
         // Health
diff --git 
a/components-starter/camel-observability-services-starter/src/test/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessorTest.java
 
b/components-starter/camel-observability-services-starter/src/test/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessorTest.java
index 5b41c9a510c..77c4c623960 100644
--- 
a/components-starter/camel-observability-services-starter/src/test/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessorTest.java
+++ 
b/components-starter/camel-observability-services-starter/src/test/java/org/apache/camel/observability/services/springboot/ObservabilityServicesEnvironmentPostProcessorTest.java
@@ -38,8 +38,10 @@ public class 
ObservabilityServicesEnvironmentPostProcessorTest {
         assertEquals("health,prometheus", 
environment.getProperty("management.endpoints.web.exposure.include"));
         assertEquals("metrics", 
environment.getProperty("management.endpoints.web.path-mapping.prometheus"));
         assertEquals("true", 
environment.getProperty("camel.metrics.log-metrics-on-shutdown"));
-        assertEquals("app.info,camel.exchanges.*",
+        
assertEquals("app.info,camel.exchanges.*,process.cpu.usage,jvm.memory.max,jvm.memory.used",
                 
environment.getProperty("camel.metrics.log-metrics-on-shutdown-filters"));
+        assertEquals("prometheus",
+                
environment.getProperty("camel.metrics.log-metrics-on-shutdown-format"));
         assertEquals("full", 
environment.getProperty("camel.health.exposure-level"));
         assertEquals("true", 
environment.getProperty("management.endpoint.health.probes.enabled"));
         assertEquals("true", 
environment.getProperty("management.health.readinessState.enabled"));
diff --git a/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc 
b/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
index 8b9ef721603..2f252165459 100644
--- a/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
@@ -23,7 +23,7 @@ Please refer to the above links for usage and configuration 
details.
 
 == Spring Boot Auto-Configuration
 
-The starter supports 17 options, which are listed below.
+The starter supports 18 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
@@ -40,6 +40,7 @@ The starter supports 17 options, which are listed below.
 | camel.metrics.enable-route-policy | Set whether to enable the 
MicrometerRoutePolicyFactory for capturing metrics on route processing times. | 
true | Boolean
 | camel.metrics.log-metrics-on-shutdown | Log metrics when application is 
shutting down. (default, `false`). | false | Boolean
 | camel.metrics.log-metrics-on-shutdown-filters | List of metrics (comma 
separated) to log when application is shutting down. You can use `*` character 
to log any metrics containing the wildcard, for example `camel.exchanges.*` 
(default to all metrics available). |  | String
+| camel.metrics.log-metrics-on-shutdown-format | Format used to log metrics 
when application is shutting down. Either json (default) or prometheus format. 
|  | String
 | camel.metrics.naming-strategy | Controls the name style to use for metrics. 
Default = uses micrometer naming convention. Legacy = uses the classic naming 
style (camelCase) | default | String
 | camel.metrics.route-policy-exclude-pattern | Pattern to exclude routes (by 
id) to capture. Multiple route ids can be separated by comma. |  | String
 | camel.metrics.route-policy-level | Sets the level of information to capture. 
Possible values are all,route,context. all = both context and routes. route = 
routes only. context = camel context only. | all | String

Reply via email to