[
https://issues.apache.org/jira/browse/CAMEL-25296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-25296.
---------------------------------
Fix Version/s: 4.23.0
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/27317 (3e9a8b3b5671). Local-model
benchmark, circuit-breaker k=5 at 64k: peak prompt 35.8k (was 65.5k),
camel_get_log calls 66 (was 131), steps 14/15 (was 13/15).
> 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
> Priority: Minor
> Fix For: 4.23.0
>
>
> {{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)