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

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 4bb91e7eb254 CAMEL-24592: camel-microprofile-health - only expose 
health check stack traces in full exposure level
4bb91e7eb254 is described below

commit 4bb91e7eb254154c4c81f5567218cf665c596ee8
Author: croway <[email protected]>
AuthorDate: Wed Sep 2 16:17:38 2026 +0200

    CAMEL-24592: camel-microprofile-health - only expose health check stack 
traces in full exposure level
    
    CamelMicroProfileHealthHelper.applyHealthDetail added the full stack trace 
of
    a failed health check as error.stacktrace at every exposure level except
    oneline, so a DOWN check whose result carries an exception serialised the 
whole
    cause chain into the health response at the default level.
    
    error.stacktrace is now added only when the exposure level is full, matching
    the documented meaning of the levels, where full is the level that includes
    all details from the invoked health checks. error.message is still reported 
at
    the default level and the trace is unchanged in the application log.
    
    The same gating is applied to the Spring Boot actuator in camel-spring-boot 
so
    the runtimes stay aligned; Camel Quarkus builds its health responses through
    this module and inherits the change.
    
    Co-Authored-By: Claude Fable 5.1 <[email protected]>
---
 .../health/CamelMicroProfileHealthHelper.java            |  7 +++++--
 .../health/CamelMicroProfileHealthCheckTest.java         |  6 ++++--
 .../modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc  | 16 ++++++++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
 
b/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
index 4ab85f354329..9af1cc0adc1e 100644
--- 
a/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
+++ 
b/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
@@ -60,8 +60,11 @@ final class CamelMicroProfileHealthHelper {
             result.getError().ifPresent(error -> {
                 builder.withData("error.message", error.getMessage());
 
-                final String s = ExceptionHelper.stackTraceToString(error);
-                builder.withData("error.stacktrace", s);
+                // the stack trace is the most verbose detail there is, so 
only expose it in the full level
+                if (exposureLevel.equals("full")) {
+                    final String s = ExceptionHelper.stackTraceToString(error);
+                    builder.withData("error.stacktrace", s);
+                }
             });
         }
     }
diff --git 
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
 
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
index acb2459e2d9b..1b6fb7ece8ae 100644
--- 
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
+++ 
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
@@ -317,7 +317,8 @@ public class CamelMicroProfileHealthCheckTest extends 
CamelMicroProfileHealthTes
 
         assertHealthCheckOutput("exception-check", Status.DOWN, 
checks.getJsonObject(0), jsonObject -> {
             assertEquals(errorMessage, jsonObject.getString("error.message"));
-            assertNotNull(jsonObject.getString("error.stacktrace"));
+            // the stack trace is only exposed in the full level
+            assertFalse(jsonObject.containsKey("error.stacktrace"));
         });
     }
 
@@ -359,7 +360,8 @@ public class CamelMicroProfileHealthCheckTest extends 
CamelMicroProfileHealthTes
         assertHealthCheckOutput("failing-check", 
HealthCheckResponse.Status.DOWN, failedCheck, result -> {
             assertNotNull(result);
             assertEquals("Forced exception", 
result.getString("error.message"));
-            assertNotNull(result.getString("error.stacktrace"));
+            // the stack trace is only exposed in the full level
+            assertFalse(result.containsKey("error.stacktrace"));
         });
     }
 
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
index 39ac96390335..c37677941b5d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
@@ -1145,6 +1145,22 @@ A custom `CamelSagaService` that relies on the header to 
join sagas started by a
 override the new method. Everything else is unaffected: the header is still 
set on the exchange, and
 routes reading it continue to work.
 
+=== camel-microprofile-health
+
+The `error.stacktrace` entry of a failed health check is now only included in 
the response when
+`camel.health.exposure-level` is `full`. At the `default` level the check 
still reports `error.message`, but no
+longer serialises the whole cause chain of the exception into the health 
response. The trace is unchanged in the
+application log.
+
+This aligns the MicroProfile health output (and therefore Camel Quarkus, which 
builds its health responses through
+this module) with the Spring Boot actuator and with the documented meaning of 
the levels, where `full` is the
+level that includes all details from the invoked health checks. To get the 
trace back in the response:
+
+[source,properties]
+----
+camel.health.exposure-level = full
+----
+
 === camel-spring-boot
 
 A set of starter defaults changed in this release. Each is a deliberate change 
to what an application gets

Reply via email to