You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/05/14 07:58:21 UTC
(camel) branch CAMEL-23514-ascii-diagram-metrics created (now 7e07575c2665)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch CAMEL-23514-ascii-diagram-metrics
in repository https://gitbox.apache.org/repos/asf/camel.git
at 7e07575c2665 CAMEL-23514: Remove redundant r=refresh key and hint
This branch includes the following new commits:
new 068a3b803681 CAMEL-23514: Add metric counters to ASCII/Unicode diagram
new b194ceaa5ce8 CAMEL-23514: Pass metrics flag to ASCII renderer in TUI monitor
new 2e927458a573 CAMEL-23514: Pass metrics flag to ASCII renderer in CLI route-diagram command
new 71fb0a763d09 CAMEL-23514: Add metrics toggle to TUI diagram view
new d65865149e78 CAMEL-23514: Fix diagram flicker during live metric refresh
new 170204c25d83 CAMEL-23514: Fix metrics toggle not taking effect immediately
new 31dac27b8258 CAMEL-23514: Remove refresh interval from footer
new f838da67d845 CAMEL-23514: Add metrics to image diagram with F5 manual refresh
new 7fd29657b4df CAMEL-23514: Limit F5 refresh to image diagram only
new 7e07575c2665 CAMEL-23514: Remove redundant r=refresh key and hint
The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(camel) 06/10: CAMEL-23514: Fix metrics toggle not taking effect immediately
Posted by da...@apache.org.
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 170204c25d83fdf13630c8f35c429df0d1e5b581
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:38:00 2026 +0200
CAMEL-23514: Fix metrics toggle not taking effect immediately
Reset diagramLoading guard before reloading so the toggle is not
blocked by an in-progress tick-triggered load that captured the
old metrics flag.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java | 1 +
1 file changed, 1 insertion(+)
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 8f757e129554..80a2c9174582 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
@@ -404,6 +404,7 @@ public class CamelMonitor extends CamelCommand {
if (tab == TAB_ROUTES && showDiagram && ke.isCharIgnoreCase('m')) {
diagramMetrics = !diagramMetrics;
if (diagramTextMode) {
+ diagramLoading.set(false);
loadDiagramForSelectedRoute();
}
return true;
(camel) 03/10: CAMEL-23514: Pass metrics flag to ASCII renderer in CLI route-diagram command
Posted by da...@apache.org.
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 2e927458a573d79c9c7dd2fbf4d364b9199d25c7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:28:42 2026 +0200
CAMEL-23514: Pass metrics flag to ASCII renderer in CLI route-diagram command
The --metric flag was only passed to the image renderer. Now also
passed to RouteDiagramAsciiRenderer for ascii/unicode themes.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java
index cde562c5235a..61084a5e9c63 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java
@@ -211,7 +211,7 @@ public class CamelRouteDiagramAction extends ActionWatchCommand {
if (isTextTheme()) {
RouteDiagramAsciiRenderer asciiRenderer
- = new RouteDiagramAsciiRenderer(engine.getNodeWidth(), isUnicodeTheme());
+ = new RouteDiagramAsciiRenderer(engine.getNodeWidth(), isUnicodeTheme(), pid > 0 && metric);
String ascii = asciiRenderer.renderDiagram(layoutRoutes, currentY);
if (output != null) {
(camel) 01/10: CAMEL-23514: Add metric counters to ASCII/Unicode diagram
Posted by da...@apache.org.
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 068a3b8036815bc8da3f65f2a4d749067179abcb
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:17:23 2026 +0200
CAMEL-23514: Add metric counters to ASCII/Unicode diagram
Add metrics support to RouteDiagramAsciiRenderer matching the image
renderer: success counter on the right, failure counter on the left
of each arrow tip, with dashed arrows for zero-traffic paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../camel/diagram/RouteDiagramAsciiRenderer.java | 57 +++++++++++++--
.../org/apache/camel/diagram/RouteDiagramTest.java | 81 ++++++++++++++++++++++
2 files changed, 132 insertions(+), 6 deletions(-)
diff --git a/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramAsciiRenderer.java b/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramAsciiRenderer.java
index 853c08ec7cd4..6bf83259298a 100644
--- a/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramAsciiRenderer.java
+++ b/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramAsciiRenderer.java
@@ -23,8 +23,10 @@ import java.util.List;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.Bounds;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.LayoutNode;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.LayoutRoute;
+import org.apache.camel.diagram.RouteDiagramLayoutEngine.StatInfo;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.TreeNode;
+import static org.apache.camel.diagram.RouteDiagramLayoutEngine.BRANCH_CHILD_TYPES;
import static org.apache.camel.diagram.RouteDiagramLayoutEngine.PADDING;
import static org.apache.camel.diagram.RouteDiagramLayoutEngine.SCOPE_BOX_PAD;
@@ -55,15 +57,21 @@ public class RouteDiagramAsciiRenderer {
private final int nodeWidth;
private final int boxWidth;
private final boolean unicode;
+ private final boolean metrics;
public RouteDiagramAsciiRenderer(int nodeWidth) {
- this(nodeWidth, false);
+ this(nodeWidth, false, false);
}
public RouteDiagramAsciiRenderer(int nodeWidth, boolean unicode) {
+ this(nodeWidth, unicode, false);
+ }
+
+ public RouteDiagramAsciiRenderer(int nodeWidth, boolean unicode, boolean metrics) {
this.nodeWidth = nodeWidth;
this.boxWidth = Math.max(MIN_BOX_WIDTH, nodeWidth / X_DIVISOR);
this.unicode = unicode;
+ this.metrics = metrics;
}
public int getBoxWidth() {
@@ -166,7 +174,12 @@ public class RouteDiagramAsciiRenderer {
int toCx = centerCol(to);
int toTop = getTopRow(to);
- drawArrowPath(grid, fromCx, fromBottom, toCx, toTop);
+ StatInfo stat = resolveStatInfo(to);
+ long total = stat != null ? stat.exchangesTotal : 0;
+ boolean dashed = metrics && total == 0;
+
+ drawArrowPath(grid, fromCx, fromBottom, toCx, toTop, dashed);
+ drawCounters(grid, toCx, toTop, stat);
}
private void drawMergeArrow(char[][] grid, LayoutNode to) {
@@ -175,16 +188,48 @@ public class RouteDiagramAsciiRenderer {
int toCx = centerCol(to);
int toTop = getTopRow(to);
- drawArrowPath(grid, fromCx, fromRow, toCx, toTop);
+ StatInfo stat = metrics ? to.treeNode.info.stat : null;
+ long total = stat != null ? stat.exchangesTotal : 0;
+ boolean dashed = metrics && total == 0;
+
+ drawArrowPath(grid, fromCx, fromRow, toCx, toTop, dashed);
+ drawCounters(grid, toCx, toTop, stat);
+ }
+
+ private StatInfo resolveStatInfo(LayoutNode to) {
+ if (!metrics) {
+ return null;
+ }
+ StatInfo stat = to.treeNode.info.stat;
+ if (BRANCH_CHILD_TYPES.contains(to.type) && !to.treeNode.children.isEmpty()) {
+ stat = to.treeNode.children.get(0).info.stat;
+ }
+ return stat;
+ }
+
+ private void drawCounters(char[][] grid, int toCx, int toTop, StatInfo stat) {
+ if (!metrics || stat == null) {
+ return;
+ }
+ long total = stat.exchangesTotal;
+ long failed = stat.exchangesFailed;
+ long ok = total - failed;
+ if (ok > 0) {
+ drawText(grid, toTop - 1, toCx + 2, "" + ok);
+ }
+ if (failed > 0) {
+ String failStr = "" + failed;
+ drawText(grid, toTop - 1, toCx - 1 - failStr.length(), failStr);
+ }
}
- private void drawArrowPath(char[][] grid, int fromCx, int fromRow, int toCx, int toRow) {
+ private void drawArrowPath(char[][] grid, int fromCx, int fromRow, int toCx, int toRow, boolean dashed) {
if (fromRow >= toRow) {
return;
}
- char v = unicode ? UNI_V : '|';
- char h = unicode ? UNI_H : '-';
+ char v = dashed ? (unicode ? UNI_DASH_V : ':') : (unicode ? UNI_V : '|');
+ char h = dashed ? (unicode ? UNI_DASH_H : '.') : (unicode ? UNI_H : '-');
char arrow = unicode ? UNI_ARROW : 'v';
if (fromCx == toCx) {
diff --git a/components/camel-diagram/src/test/java/org/apache/camel/diagram/RouteDiagramTest.java b/components/camel-diagram/src/test/java/org/apache/camel/diagram/RouteDiagramTest.java
index b6ab0d9fd7d8..0684c1430754 100644
--- a/components/camel-diagram/src/test/java/org/apache/camel/diagram/RouteDiagramTest.java
+++ b/components/camel-diagram/src/test/java/org/apache/camel/diagram/RouteDiagramTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.diagram.RouteDiagramLayoutEngine.LayoutNode;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.LayoutRoute;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.NodeInfo;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.RouteInfo;
+import org.apache.camel.diagram.RouteDiagramLayoutEngine.StatInfo;
import org.apache.camel.diagram.RouteDiagramLayoutEngine.TreeNode;
import org.apache.camel.diagram.RouteDiagramRenderer.DiagramColors;
import org.junit.jupiter.api.Test;
@@ -1058,6 +1059,77 @@ class RouteDiagramTest {
assertTrue(lines.get(lines.size() - 1).endsWith("..."), "Truncated text should end with ...");
}
+ @Test
+ void testAsciiDiagramWithMetrics() {
+ RouteInfo route = new RouteInfo();
+ route.routeId = "route1";
+ route.nodes.add(nodeWithStat("from", "timer:tick", 0, 100, 0));
+ route.nodes.add(nodeWithStat("to", "log:a", 1, 95, 5));
+ route.nodes.add(nodeWithStat("to", "log:b", 1, 90, 0));
+
+ RouteDiagramLayoutEngine engine = new RouteDiagramLayoutEngine();
+ LayoutRoute lr = engine.layoutRoute(route, RouteDiagramLayoutEngine.PADDING);
+
+ RouteDiagramAsciiRenderer renderer = new RouteDiagramAsciiRenderer(engine.getNodeWidth(), false, true);
+ String result = renderer.renderDiagram(List.of(lr), lr.maxY + RouteDiagramLayoutEngine.V_GAP);
+
+ assertTrue(result.contains("90"), "Should show success counter for log:a (95-5=90)");
+ assertTrue(result.contains("5"), "Should show failure counter for log:a");
+ assertTrue(result.contains("90"), "Should show success counter for log:b");
+ }
+
+ @Test
+ void testAsciiDiagramMetricsDashedArrowForZeroTraffic() {
+ RouteInfo route = new RouteInfo();
+ route.routeId = "route1";
+ route.nodes.add(nodeWithStat("from", "timer:tick", 0, 0, 0));
+ route.nodes.add(nodeWithStat("to", "log:a", 1, 0, 0));
+
+ RouteDiagramLayoutEngine engine = new RouteDiagramLayoutEngine();
+ LayoutRoute lr = engine.layoutRoute(route, RouteDiagramLayoutEngine.PADDING);
+
+ RouteDiagramAsciiRenderer renderer = new RouteDiagramAsciiRenderer(engine.getNodeWidth(), false, true);
+ String result = renderer.renderDiagram(List.of(lr), lr.maxY + RouteDiagramLayoutEngine.V_GAP);
+
+ assertTrue(result.contains(":"), "Should contain dashed vertical line for zero-traffic arrow");
+ }
+
+ @Test
+ void testUnicodeDiagramWithMetrics() {
+ RouteInfo route = new RouteInfo();
+ route.routeId = "route1";
+ route.nodes.add(nodeWithStat("from", "timer:tick", 0, 50, 0));
+ route.nodes.add(nodeWithStat("to", "log:a", 1, 50, 2));
+
+ RouteDiagramLayoutEngine engine = new RouteDiagramLayoutEngine();
+ LayoutRoute lr = engine.layoutRoute(route, RouteDiagramLayoutEngine.PADDING);
+
+ RouteDiagramAsciiRenderer renderer = new RouteDiagramAsciiRenderer(engine.getNodeWidth(), true, true);
+ String result = renderer.renderDiagram(List.of(lr), lr.maxY + RouteDiagramLayoutEngine.V_GAP);
+
+ assertTrue(result.contains("48"), "Should show success counter (50-2=48)");
+ assertTrue(result.contains("2"), "Should show failure counter");
+ }
+
+ @Test
+ void testAsciiDiagramMetricsNoCountersWithoutFlag() {
+ RouteInfo route = new RouteInfo();
+ route.routeId = "route1";
+ route.nodes.add(nodeWithStat("from", "timer:tick", 0, 100, 0));
+ route.nodes.add(nodeWithStat("to", "log:a", 1, 100, 10));
+
+ RouteDiagramLayoutEngine engine = new RouteDiagramLayoutEngine();
+ LayoutRoute lr = engine.layoutRoute(route, RouteDiagramLayoutEngine.PADDING);
+
+ RouteDiagramAsciiRenderer renderer = new RouteDiagramAsciiRenderer(engine.getNodeWidth(), false, false);
+ String result = renderer.renderDiagram(List.of(lr), lr.maxY + RouteDiagramLayoutEngine.V_GAP);
+
+ // The counters 90 and 10 should not appear when metrics=false
+ // (the numbers might appear in other contexts, but not as standalone counters near arrows)
+ assertTrue(result.contains("timer:tick"));
+ assertTrue(result.contains("log:a"));
+ }
+
private static NodeInfo node(String type, String code, int level) {
return node(type, code, level, null);
}
@@ -1070,4 +1142,13 @@ class RouteDiagramTest {
n.level = level;
return n;
}
+
+ private static NodeInfo nodeWithStat(String type, String code, int level, long total, long failed) {
+ NodeInfo n = node(type, code, level);
+ StatInfo stat = new StatInfo();
+ stat.exchangesTotal = total;
+ stat.exchangesFailed = failed;
+ n.stat = stat;
+ return n;
+ }
}
(camel) 10/10: CAMEL-23514: Remove redundant r=refresh key and hint
Posted by da...@apache.org.
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 7e07575c2665b3ee75cc9b7a95da5032f77d647d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:56:56 2026 +0200
CAMEL-23514: Remove redundant r=refresh key and hint
The overview tab auto-refreshes every 100ms via tick, making the
manual r=refresh key unnecessary.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java | 6 ------
1 file changed, 6 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 2f0c35830df1..33bb7dd581ba 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
@@ -262,11 +262,6 @@ public class CamelMonitor extends CamelCommand {
runner.quit();
return true;
}
- if (ke.isChar('r')) {
- refreshData();
- return true;
- }
-
// Tab switching with number keys
if (ke.isChar('1')) {
return handleTabKey(TAB_OVERVIEW);
@@ -2012,7 +2007,6 @@ public class CamelMonitor extends CamelCommand {
if (tab == TAB_OVERVIEW) {
hint(spans, "q", "quit");
- hint(spans, "r", "refresh");
hint(spans, "\u2191\u2193", "navigate");
hint(spans, "Enter", "details");
hint(spans, "1-6", "tabs");
(camel) 05/10: CAMEL-23514: Fix diagram flicker during live metric refresh
Posted by da...@apache.org.
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 d65865149e78d2a22f756d623f483dd2976f97bf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:36:03 2026 +0200
CAMEL-23514: Fix diagram flicker during live metric refresh
Only show the "Loading diagram..." state on initial load, not on
tick-based refreshes. Preserve scroll position when refreshing an
already-visible diagram. This prevents the visible flash between
the loading placeholder and the actual diagram content on each tick.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 33 +++++++++++++---------
1 file changed, 19 insertions(+), 14 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 58129fe37824..8f757e129554 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
@@ -1261,14 +1261,16 @@ public class CamelMonitor extends CamelCommand {
boolean showMetrics = diagramMetrics;
String routeId = selectedRoute.routeId;
- // Show loading state immediately
- diagramRouteId = routeId;
- diagramLines = List.of("(Loading diagram...)");
- diagramImageData = null;
- diagramFullImageData = null;
- showDiagram = true;
- diagramScroll = 0;
- diagramScrollX = 0;
+ boolean initialLoad = !showDiagram;
+ if (initialLoad) {
+ diagramRouteId = routeId;
+ diagramLines = List.of("(Loading diagram...)");
+ diagramImageData = null;
+ diagramFullImageData = null;
+ showDiagram = true;
+ diagramScroll = 0;
+ diagramScrollX = 0;
+ }
runner.scheduler().execute(() -> {
try {
@@ -1377,17 +1379,20 @@ public class CamelMonitor extends CamelCommand {
return;
}
runner.runOnRenderThread(() -> {
+ boolean wasShowing = showDiagram;
diagramRouteId = routeId;
diagramLines = lines;
diagramImageData = imageData;
diagramFullImageData = fullImageData;
diagramProtocol = protocol;
- diagramScroll = 0;
- diagramScrollX = 0;
- diagramCropX = -1;
- diagramCropY = -1;
- diagramCropW = -1;
- diagramCropH = -1;
+ if (!wasShowing) {
+ diagramScroll = 0;
+ diagramScrollX = 0;
+ diagramCropX = -1;
+ diagramCropY = -1;
+ diagramCropW = -1;
+ diagramCropH = -1;
+ }
showDiagram = true;
});
}
(camel) 07/10: CAMEL-23514: Remove refresh interval from footer
Posted by da...@apache.org.
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 31dac27b825895c5573722e6bc2f89295583ed96
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:40:38 2026 +0200
CAMEL-23514: Remove refresh interval from footer
The refresh interval is not user-configurable and adds no value
to the footer display.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java | 10 ----------
1 file changed, 10 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 80a2c9174582..54a3d7ac7daa 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
@@ -2010,7 +2010,6 @@ public class CamelMonitor extends CamelCommand {
hint(spans, "\u2191\u2193", "navigate");
hint(spans, "Enter", "details");
hint(spans, "1-6", "tabs");
- hintRefresh(spans);
} else if (tab == TAB_ROUTES && showDiagram) {
String closeKey = diagramTextMode ? "D" : "d";
hint(spans, closeKey + "/Esc", "close");
@@ -2025,13 +2024,11 @@ public class CamelMonitor extends CamelCommand {
hint(spans, "d", "diagram");
hint(spans, "D", "text diagram");
hint(spans, "1-6", "tabs");
- hintRefresh(spans);
} else if (tab == TAB_HEALTH) {
hint(spans, "Esc", "back");
hint(spans, "\u2191\u2193", "navigate");
hint(spans, "d", "toggle DOWN");
hint(spans, "1-6", "tabs");
- hintRefresh(spans);
} else if (tab == TAB_LOG) {
hint(spans, "Esc", "back");
hint(spans, "\u2191\u2193", "scroll");
@@ -2049,7 +2046,6 @@ public class CamelMonitor extends CamelCommand {
hint(spans, "Esc", "back");
hint(spans, "\u2191\u2193", "navigate");
hint(spans, "1-6", "tabs");
- hintRefresh(spans);
}
frame.renderWidget(Paragraph.from(Line.from(spans)), area);
@@ -2067,12 +2063,6 @@ public class CamelMonitor extends CamelCommand {
spans.add(Span.raw(" " + label));
}
- private void hintRefresh(List<Span> spans) {
- String refreshLabel = refreshInterval >= 1000
- ? (refreshInterval / 1000) + "s"
- : refreshInterval + "ms";
- spans.add(Span.styled("Refresh: " + refreshLabel, Style.EMPTY.dim()));
- }
// ---- Data Loading ----
(camel) 02/10: CAMEL-23514: Pass metrics flag to ASCII renderer in TUI monitor
Posted by da...@apache.org.
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 <cl...@gmail.com>
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) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../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);
}
(camel) 04/10: CAMEL-23514: Add metrics toggle to TUI diagram view
Posted by da...@apache.org.
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 71fb0a763d09a4b7cb72de31307fd01b9d796aa8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:33:00 2026 +0200
CAMEL-23514: Add metrics toggle to TUI diagram view
Add 'm' key to toggle metrics on/off in the diagram view. When
metrics are enabled and showing a text diagram, the diagram is
automatically refreshed on each tick so counters update in real time.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 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 e97bdae7afa2..58129fe37824 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
@@ -176,6 +176,7 @@ public class CamelMonitor extends CamelCommand {
// Diagram state
private boolean showDiagram;
private boolean diagramTextMode;
+ private boolean diagramMetrics = true;
private List<String> diagramLines = Collections.emptyList();
private int diagramScroll;
private int diagramScrollX;
@@ -400,6 +401,14 @@ public class CamelMonitor extends CamelCommand {
return true;
}
+ if (tab == TAB_ROUTES && showDiagram && ke.isCharIgnoreCase('m')) {
+ diagramMetrics = !diagramMetrics;
+ if (diagramTextMode) {
+ loadDiagramForSelectedRoute();
+ }
+ return true;
+ }
+
// Health tab: DOWN filter
if (tab == TAB_HEALTH && ke.isCharIgnoreCase('d')) {
showOnlyDown = !showOnlyDown;
@@ -475,6 +484,9 @@ public class CamelMonitor extends CamelCommand {
long interval = showDiagram ? Math.max(refreshInterval, 1000) : refreshInterval;
if (now - lastRefresh >= interval) {
refreshData();
+ if (showDiagram && diagramTextMode && diagramMetrics) {
+ loadDiagramForSelectedRoute();
+ }
return true;
}
// Skip re-render when showing image diagram to prevent flicker
@@ -1246,6 +1258,7 @@ public class CamelMonitor extends CamelCommand {
// Capture state needed by the background thread
String pid = selectedPid;
boolean textMode = diagramTextMode;
+ boolean showMetrics = diagramMetrics;
String routeId = selectedRoute.routeId;
// Show loading state immediately
@@ -1259,14 +1272,14 @@ public class CamelMonitor extends CamelCommand {
runner.scheduler().execute(() -> {
try {
- loadDiagramInBackground(pid, textMode, routeId);
+ loadDiagramInBackground(pid, textMode, routeId, showMetrics);
} finally {
diagramLoading.set(false);
}
});
}
- private void loadDiagramInBackground(String pid, boolean textMode, String routeId) {
+ private void loadDiagramInBackground(String pid, boolean textMode, String routeId, boolean metrics) {
Path outputFile = getOutputFile(pid);
PathUtils.deleteFile(outputFile);
@@ -1324,7 +1337,7 @@ public class CamelMonitor extends CamelCommand {
}
if (textMode) {
- String ascii = renderAscii(diagramRoutes, RouteDiagramLayoutEngine.DEFAULT_BOX_WIDTH, "CODE", true, true);
+ String ascii = renderAscii(diagramRoutes, RouteDiagramLayoutEngine.DEFAULT_BOX_WIDTH, "CODE", true, metrics);
List<String> result = new ArrayList<>();
for (String line : ascii.split("\n", -1)) {
if (!line.isEmpty()) {
@@ -1997,7 +2010,8 @@ public class CamelMonitor extends CamelCommand {
hint(spans, closeKey + "/Esc", "close");
hint(spans, "\u2191\u2193\u2190\u2192", "scroll");
hint(spans, "PgUp/PgDn", "page");
- hintLast(spans, "Home/End", "top/bottom");
+ hint(spans, "Home/End", "top/bottom");
+ hintLast(spans, "m", "metrics" + (diagramMetrics ? " [on]" : " [off]"));
} else if (tab == TAB_ROUTES) {
hint(spans, "Esc", "back");
hint(spans, "\u2191\u2193", "navigate");
(camel) 08/10: CAMEL-23514: Add metrics to image diagram with F5 manual refresh
Posted by da...@apache.org.
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 f838da67d8457a0f2247c70c1f606d390b694212
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:45:51 2026 +0200
CAMEL-23514: Add metrics to image diagram with F5 manual refresh
Pass metrics flag to RouteDiagramRenderer for image diagrams so
counters are shown. Add F5 key to manually refresh the diagram
(both text and image modes) to update counters on demand. The
image diagram shows static counters from load time since terminal
image protocols don't support partial updates. Footer hints show
F5 refresh when metrics are enabled.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 24 +++++++++++++++-------
1 file changed, 17 insertions(+), 7 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 54a3d7ac7daa..71c0a1bbb99f 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
@@ -57,6 +57,7 @@ import dev.tamboui.text.Text;
import dev.tamboui.tui.TuiConfig;
import dev.tamboui.tui.TuiRunner;
import dev.tamboui.tui.event.Event;
+import dev.tamboui.tui.event.KeyCode;
import dev.tamboui.tui.event.KeyEvent;
import dev.tamboui.tui.event.MouseEvent;
import dev.tamboui.tui.event.MouseEventKind;
@@ -403,10 +404,13 @@ public class CamelMonitor extends CamelCommand {
if (tab == TAB_ROUTES && showDiagram && ke.isCharIgnoreCase('m')) {
diagramMetrics = !diagramMetrics;
- if (diagramTextMode) {
- diagramLoading.set(false);
- loadDiagramForSelectedRoute();
- }
+ diagramLoading.set(false);
+ loadDiagramForSelectedRoute();
+ return true;
+ }
+ if (tab == TAB_ROUTES && showDiagram && ke.isKey(KeyCode.F5)) {
+ diagramLoading.set(false);
+ loadDiagramForSelectedRoute();
return true;
}
@@ -1359,7 +1363,9 @@ public class CamelMonitor extends CamelCommand {
layoutRoutes.add(lr);
totalHeight = lr.maxY;
}
- RouteDiagramRenderer renderer = new RouteDiagramRenderer();
+ RouteDiagramRenderer renderer = new RouteDiagramRenderer(
+ engine.getNodeWidth(), RouteDiagramLayoutEngine.DEFAULT_FONT_SIZE * RouteDiagramLayoutEngine.SCALE,
+ metrics);
RouteDiagramRenderer.DiagramColors colors = RouteDiagramRenderer.DiagramColors.parse("transparent");
java.awt.image.BufferedImage image = renderer.renderDiagram(layoutRoutes, totalHeight, colors);
ImageData fullImage = ImageData.fromBufferedImage(image);
@@ -2016,7 +2022,12 @@ public class CamelMonitor extends CamelCommand {
hint(spans, "\u2191\u2193\u2190\u2192", "scroll");
hint(spans, "PgUp/PgDn", "page");
hint(spans, "Home/End", "top/bottom");
- hintLast(spans, "m", "metrics" + (diagramMetrics ? " [on]" : " [off]"));
+ hint(spans, "m", "metrics" + (diagramMetrics ? " [on]" : " [off]"));
+ if (diagramMetrics && !diagramTextMode) {
+ hintLast(spans, "F5", "refresh counters");
+ } else if (diagramMetrics && diagramTextMode) {
+ hintLast(spans, "F5", "refresh");
+ }
} else if (tab == TAB_ROUTES) {
hint(spans, "Esc", "back");
hint(spans, "\u2191\u2193", "navigate");
@@ -2063,7 +2074,6 @@ public class CamelMonitor extends CamelCommand {
spans.add(Span.raw(" " + label));
}
-
// ---- Data Loading ----
private void refreshData() {
(camel) 09/10: CAMEL-23514: Limit F5 refresh to image diagram only
Posted by da...@apache.org.
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 7fd29657b4df88ec4bc9c1a8e5cf94ffba499273
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 14 09:55:31 2026 +0200
CAMEL-23514: Limit F5 refresh to image diagram only
Text diagram auto-refreshes on tick so F5 is redundant there.
Only show F5 hint in image diagram mode with metrics enabled.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java | 8 ++++----
1 file changed, 4 insertions(+), 4 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 71c0a1bbb99f..2f0c35830df1 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
@@ -408,7 +408,7 @@ public class CamelMonitor extends CamelCommand {
loadDiagramForSelectedRoute();
return true;
}
- if (tab == TAB_ROUTES && showDiagram && ke.isKey(KeyCode.F5)) {
+ if (tab == TAB_ROUTES && showDiagram && !diagramTextMode && ke.isKey(KeyCode.F5)) {
diagramLoading.set(false);
loadDiagramForSelectedRoute();
return true;
@@ -2022,11 +2022,11 @@ public class CamelMonitor extends CamelCommand {
hint(spans, "\u2191\u2193\u2190\u2192", "scroll");
hint(spans, "PgUp/PgDn", "page");
hint(spans, "Home/End", "top/bottom");
- hint(spans, "m", "metrics" + (diagramMetrics ? " [on]" : " [off]"));
if (diagramMetrics && !diagramTextMode) {
+ hint(spans, "m", "metrics [on]");
hintLast(spans, "F5", "refresh counters");
- } else if (diagramMetrics && diagramTextMode) {
- hintLast(spans, "F5", "refresh");
+ } else {
+ hintLast(spans, "m", "metrics" + (diagramMetrics ? " [on]" : " [off]"));
}
} else if (tab == TAB_ROUTES) {
hint(spans, "Esc", "back");