CAMEL-24592: only expose health check stack traces in full exposure level - #1929
Conversation
797a586 to
bf808c2
Compare
|
Hi @Croway — I looked at this because I had implemented the same change a week ago (as part of CAMEL-24499) and then reverted it in review. Most of your rationale holds up, but one load-bearing part of it does not, and I think it's worth settling before this merges. The camel-main point is correct. The microprofile point is not. On current camel result.getError().ifPresent(error -> {
builder.withData("error.message", error.getMessage());
final String s = ExceptionHelper.stackTraceToString(error);
builder.withData("error.stacktrace", s);
});The error block sits outside the assertEquals("Forced exception", result.getString("error.message"));
assertNotNull(result.getString("error.stacktrace"));I think the confusion is That doesn't make the change wrong. My reading is that the current behaviour is too verbose for a default and your instinct is right — but as written this PR diverges camel-spring-boot from camel-microprofile-health rather than matching it, which is the opposite of what the description claims, and it leaves a passing test in the other runtime asserting the behaviour you're removing here. Two ways I can see to resolve it:
Either is fine by me; I just don't think it should land on the current wording. Happy to do the microprofile half if option 1 is the direction — the change there is the same three lines. For what it's worth, I also think the bigger exposure problem is CAMEL-24498 (your #1927): at Spring Boot's own default of cc @davsclaus |
|
Thanks Andrea, you are right and the mistake is on our side: Let's go with option 1. I'll implement the Agreed on CAMEL-24498 being the larger exposure: #1927 removes the forced |
…evel CamelHealthHelper.applyHealthDetail added the full stack trace of a failed health check as error.stacktrace to the per-check data at every exposure level except oneline, so a DOWN check whose result carries an exception serialised the whole cause chain into /actuator/health at the default exposure level. error.stacktrace is now emitted only when the exposure level is full. error.message is still reported at the default level, which is what Spring Boot's own health indicators expose; camel-main's management endpoint is stricter still and includes error-stacktrace only when the caller asks with ?stackTrace=true. It also matches the documented meaning of the levels, where full is the level that includes all details from the invoked health checks. camel-microprofile-health, through which Camel Quarkus builds its health responses, gates the trace the same way in a companion change so the runtimes stay aligned. The trace is unchanged in the application log. Adds CamelHealthHelperTest covering a DOWN check carrying an exception at the default, full and oneline levels, and regenerates spring-boot.json for the clarified exposure-level description. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bf808c2 to
512ae49
Compare
|
The companion change for Claude Code on behalf of Federico Mariani |
What
CamelHealthHelper.applyHealthDetailadded the full stack trace of a failed health check aserror.stacktraceto the per-check data at every exposure level exceptoneline. With the defaultcamel.health.exposure-level=default, any DOWN check whose result carries an exception — a consumer thatlost its broker, a pool that cannot connect — serialised the whole cause chain into
/actuator/health.error.stacktraceis now emitted only when the exposure level isfull.Why
error.messageis still reported at thedefaultlevel, which is what Spring Boot's own healthindicators expose (class and message, never a trace).
ManagementHttpServeris stricter still: it includeserror-stacktraceonly when thecaller asks for it with
?stackTrace=true.fullis described as including all details from allthe invoked health checks, and the stack trace is the most verbose detail there is.
camel-microprofile-health(and therefore Camel Quarkus, which builds its health responses through thatmodule) currently emits
error.stacktraceat thedefaultlevel as well; that is the behaviour CAMEL-18832aligned this module to. The same gating is applied there in apache/camel#26046 so the two
runtimes stay aligned, and this PR should merge together with, or after, that change.
The trace is unchanged in the application log; no logging was added or removed.
Behaviour change and how to opt back in
At
camel.health.exposure-level=default(the default) the actuator response no longer contains<check-id>.data.error.stacktrace.error.messageis unchanged. To get the trace back:camel.health.exposure-level = fullNote that
fullalso stops filtering health check metadata out of the per-check data, so it is moreverbose than the previous default in other respects too. An upgrade guide entry for this will be proposed
separately against
apache/camel.The diff is deliberately confined to the stack-trace gating, since CAMEL-24512 changes the same method
(
error.messageoverwritten when several checks are DOWN) under a different assignee.Tests
New
CamelHealthHelperTestbuilds a DOWN result carrying an exception plus a detail and asserts:default—error.messagepresent,error.stacktraceabsent from the check data;full— both present, the trace containing the exception message and frames;oneline— no details at all.mvn test -pl core/camel-spring-boot -Dtest='CamelHealthHelperTest,CamelHealthTest,CamelProbesTest'→Tests run: 5, Failures: 0, Errors: 0.
core/camel-spring-boot/src/main/docs/spring-boot.jsonwas regenerated for the clarifiedcamel.health.exposure-leveldescription.Claude Code (Opus 5) on behalf of Federico Mariani