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

davsclaus pushed a commit to branch CAMEL-23514-ascii-diagram-metrics
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b194ceaa5ce813abcc92f011b3010b7ee2efa72e
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu May 14 09:22:24 2026 +0200

    CAMEL-23514: Pass metrics flag to ASCII renderer in TUI monitor
    
    Parse statistics from route-structure JSON response and pass
    metrics=true to RouteDiagramAsciiRenderer so counters are shown
    in the text diagram view.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/dsl/jbang/core/commands/tui/CamelMonitor.java    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
index 0984a3e65fff..e97bdae7afa2 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
@@ -1310,6 +1310,13 @@ public class CamelMonitor extends CamelCommand {
                     node.code = Jsoner.unescape(objToString(line.get("code")));
                     Integer level = line.getInteger("level");
                     node.level = level != null ? level : 0;
+                    JsonObject stats = (JsonObject) line.get("statistics");
+                    if (stats != null) {
+                        RouteDiagramLayoutEngine.StatInfo stat = new 
RouteDiagramLayoutEngine.StatInfo();
+                        stat.exchangesTotal = 
stats.getLongOrDefault("exchangesTotal", 0);
+                        stat.exchangesFailed = 
stats.getLongOrDefault("exchangesFailed", 0);
+                        node.stat = stat;
+                    }
                     route.nodes.add(node);
                 }
             }
@@ -1317,7 +1324,7 @@ public class CamelMonitor extends CamelCommand {
         }
 
         if (textMode) {
-            String ascii = renderAscii(diagramRoutes, 
RouteDiagramLayoutEngine.DEFAULT_BOX_WIDTH, "CODE", true);
+            String ascii = renderAscii(diagramRoutes, 
RouteDiagramLayoutEngine.DEFAULT_BOX_WIDTH, "CODE", true, true);
             List<String> result = new ArrayList<>();
             for (String line : ascii.split("\n", -1)) {
                 if (!line.isEmpty()) {
@@ -1373,7 +1380,8 @@ public class CamelMonitor extends CamelCommand {
     }
 
     private static String renderAscii(
-            List<RouteDiagramLayoutEngine.RouteInfo> routes, int nodeWidth, 
String nodeLabel, boolean unicode) {
+            List<RouteDiagramLayoutEngine.RouteInfo> routes, int nodeWidth, 
String nodeLabel, boolean unicode,
+            boolean metrics) {
         RouteDiagramLayoutEngine engine = new RouteDiagramLayoutEngine(
                 nodeWidth, RouteDiagramLayoutEngine.DEFAULT_FONT_SIZE,
                 
RouteDiagramLayoutEngine.NodeLabelMode.valueOf(nodeLabel.toUpperCase()));
@@ -1387,7 +1395,7 @@ public class CamelMonitor extends CamelCommand {
         }
 
         RouteDiagramAsciiRenderer renderer = new RouteDiagramAsciiRenderer(
-                nodeWidth * RouteDiagramLayoutEngine.SCALE, unicode);
+                nodeWidth * RouteDiagramLayoutEngine.SCALE, unicode, metrics);
         return renderer.renderDiagram(layoutRoutes, currentY);
     }
 

Reply via email to