gnodet-bot commented on code in PR #29381:
URL: https://github.com/apache/camel/pull/29381#discussion_r4501188180


##########
core/camel-console/src/main/java/org/apache/camel/impl/console/TimelineDevConsole.java:
##########
@@ -176,7 +187,51 @@ protected void doStop() throws Exception {
     }
 
     void sample() {
-        recorder.sample(System.currentTimeMillis(), counters());
+        long now = System.currentTimeMillis();
+        recorder.sample(now, counters());
+        sampleChaos(now);
+    }
+
+    /**
+     * With camel-chaos, the faults per second of its rules and the routes 
they have down, from its dev console (so this
+     * console does not depend on camel-chaos).
+     */
+    private void sampleChaos(long now) {
+        DevConsoleRegistry registry = 
getCamelContext().getCamelContextExtension().getContextPlugin(DevConsoleRegistry.class);
+        DevConsole chaos = registry != null ? registry.resolveById("chaos") : 
null;
+        if (chaos == null) {
+            return;
+        }
+        Object json;
+        try {
+            json = chaos.call(DevConsole.MediaType.JSON, Map.of("report", 
"false"));
+        } catch (Exception e) {
+            return;

Review Comment:
   Silent exception swallow with no logging. `sampleChaos()` is called every 
second from the scheduled executor — if `chaos.call()` consistently throws, 
chaos data disappears silently with no diagnostic trail.
   
   ```suggestion
           } catch (Exception e) {
               if (LOG.isDebugEnabled()) {
                   LOG.debug("Failed to sample chaos console", e);
               }
           }
   ```
   
   A logger will need to be added to this class: `private static final Logger 
LOG = LoggerFactory.getLogger(TimelineDevConsole.class);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to