[
https://issues.apache.org/jira/browse/CAMEL-24592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110667#comment-18110667
]
Federico Mariani commented on CAMEL-24592:
------------------------------------------
Correction to the description: camel-microprofile-health does emit
error.stacktrace at the default exposure level
(CamelMicroProfileHealthHelper.applyHealthDetail, asserted by
CamelMicroProfileHealthCheckTest.testExposureLevelDefault), and Camel Quarkus
builds its health responses through that module. The earlier statement that the
MicroProfile runtime never emits a trace was wrong. The gating on the full
level is applied to both camel-spring-boot (PR
https://github.com/apache/camel-spring-boot/pull/1929) and
camel-microprofile-health in a companion apache/camel change, so the runtimes
stay aligned.
_Comment added by Claude Code on behalf of Federico Mariani._
> camel-spring-boot - health check details include the full error stack trace
> at the default exposure level
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24592
> URL: https://issues.apache.org/jira/browse/CAMEL-24592
> Project: Camel
> Issue Type: Bug
> Components: camel-spring-boot
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
> Fix For: 4.23.0
>
>
> {{CamelHealthHelper.applyHealthDetail}} adds the full stack trace of a failed
> health check to the actuator output at every exposure level except
> {{oneline}}:
> {code:java}
> result.getError().ifPresent(error -> {
> if (error.getMessage() != null) {
> builder.withDetail("error.message", error.getMessage());
> }
> final StringWriter stackTraceWriter = new StringWriter();
> try (final PrintWriter pw = new PrintWriter(stackTraceWriter, true)) {
> error.printStackTrace(pw);
> data.put("error.stacktrace", stackTraceWriter.toString());
> }
> });
> {code}
> (core/camel-spring-boot: CamelHealthHelper.java:62-71)
> So with the default {{camel.health.exposure-level=default}}, any DOWN check
> whose result carries an exception - a JMS consumer that lost its broker, a
> JDBC pool that cannot connect - serialises the whole cause chain, including
> internal host names and ports from the connection exception, into
> {{/actuator/health}} for any caller allowed to see details.
> This is stricter everywhere else:
> * Spring Boot's own health indicators expose at most the exception class and
> message, never a trace.
> * camel-main's management endpoint ({{ManagementHttpServer}}) includes
> {{error-stacktrace}} only when the caller explicitly asks with
> {{?stackTrace=true}}; the {{full}} level alone adds only the message.
> * camel-microprofile-health, through which Camel Quarkus builds its health
> responses, emits the trace at the {{default}} level as well, so the same
> gating is applied there in a companion change to keep the runtimes aligned.
> The user manual describes {{full}} as "all details and status from all the
> invoked health checks" and {{default}} as detailed information only for
> checks that are DOWN. The stack trace is the most verbose detail there is and
> belongs to {{full}}.
> The trace was added together with the exposure-level handling in CAMEL-18832
> (2022) to align the output with microprofile-health, and that module still
> carries the trace at the {{default}} level; gating both on {{full}} keeps the
> alignment while removing the trace from the default output.
> *Proposal*
> * Emit {{error.stacktrace}} only when the exposure level is {{full}}.
> * Keep {{error.message}} at the {{default}} level, which mirrors what Spring
> Boot's own indicators do.
> * Keep the full trace in the application log, where it is today.
> * Add a test with a DOWN check that carries an exception, asserting that
> {{error.stacktrace}} is absent at {{default}} and present at {{full}}.
> Note that this touches the same method as CAMEL-24512 ({{error.message}}
> overwritten when several checks are DOWN); the two are best done in one pass.
> Anyone relying on the trace at the default level can set
> {{camel.health.exposure-level=full}}. Worth a line in the upgrade guide.
> ----
> _This issue was drafted by Claude Code on behalf of Federico Mariani._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)