Claus Ibsen created CAMEL-25296:
-----------------------------------
Summary: camel-jbang - camel_get_log leaves out stack traces by
default, keeping the error line
Key: CAMEL-25296
URL: https://issues.apache.org/jira/browse/CAMEL-25296
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
{{camel_get_log}} (camel-jbang-core {{LogFileReader}}, used by camel-jbang-mcp
and the AI tools of the camel-jbang views) returns each record with a
{{detail}} block of up to 20 continuation lines. For an ERROR record from the
error handler that block is the message history table and the Java stack trace.
Measured on the fail-well/circuit-breaker example (local-model benchmark, round
3):
* one "Failed delivery" ERROR record: 38 lines, about 3,950 characters; its
first line is 364 characters
* the first line already has what is needed: route and node
({{stock-check[throwException1]}}), the source location
({{circuit-breaker.camel.yaml:27}}) and the exception with its message
({{caught: java.net.ConnectException: supplier unreachable}})
* with 20 detail lines kept an ERROR record still costs about 2 KB, so a client
that caps a tool result at 6,000 characters sees about three error records per
call; the model polled the log again and again (44 calls over three steps in
one run) and filled a 64k context
The stack trace is also already available: {{camel_get_errors}} returns it per
failed exchange, with body and headers.
*Proposal:*
* By default {{camel_get_log}} leaves out the detail block of a record. The
record keeps its full first line and level, so an error is still visible as an
ERROR with its exception and message. In place of the block a short marker says
how many lines were left out and that {{camel_get_errors}} has the stack traces.
* A record whose first line does not name the exception (an application that
logs an exception itself) keeps the exception line of the detail (the last
"Caused by", or the first exception line) as a {{cause}} field.
* A parameter {{details}} (boolean, default false) returns the detail blocks as
today.
* Tool description and docs (camel-jbang-mcp.adoc) updated; the repeated-record
folding (CAMEL-24911) keeps working on the shortened records.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)