Skip to main content

Monitoring & Debugging

This guide covers everything you need to monitor, debug, and troubleshoot your OmniDaemon system in production.

Overview

What You’ll Learn:
  • ✅ Real-time health monitoring
  • ✅ Metrics collection and analysis
  • ✅ Agent monitoring (status, performance)
  • ✅ Event bus monitoring (streams, consumers, DLQ)
  • ✅ Storage monitoring (health, capacity)
  • ✅ Debugging failed events
  • ✅ Performance optimization
  • ✅ Production best practices

Health Monitoring

Check Overall System Health

Output:
What It Shows:
  • System Status: RUNNING, READY, DEGRADED, or DOWN
  • Runner ID: Unique identifier for this runner instance
  • Uptime: How long the runner has been active
  • Event Bus: Connection status and type
  • Storage: Connection status and backend type

Health Status Meanings

Programmatic Health Check

Use Cases:
  • ✅ Kubernetes liveness probes
  • ✅ Load balancer health checks
  • ✅ Monitoring dashboards
  • ✅ Alerting systems

Agent Monitoring

List All Agents

Output:
Tree View (default):
  • Shows topic hierarchy
  • Agent details nested under topics
  • Easy to scan
Alternative Formats:

Get Agent Details

Output:

Programmatic Agent Monitoring


Metrics Monitoring

View All Metrics

Output:
What It Shows:
  • Received: Tasks delivered to agent
  • Processed: Tasks completed successfully
  • Failed: Tasks that errored (sent to DLQ)
  • Avg Time: Average processing time per task
  • Success Rate: (Processed / Received) × 100%

Filter Metrics by Topic

Export Metrics

Programmatic Metrics

Use Cases:
  • ✅ Performance dashboards
  • ✅ SLA monitoring
  • ✅ Capacity planning
  • ✅ Bottleneck identification

Event Bus Monitoring

List All Streams

Output:

Inspect Stream Messages

Output:

List Consumer Groups

Output:
What It Shows:
  • Group: Consumer group name
  • Consumers: Number of active consumers
  • Pending: Messages in Pending Entries List (not ack’d)

Check Dead Letter Queue (DLQ)

Output:
Why Messages Go to DLQ:
  • ❌ Max retries exceeded (default: 3)
  • ❌ Callback raised exception repeatedly
  • ❌ Message processing timeout
  • ❌ Invalid message format

Get Bus Statistics

Output:

Storage Monitoring

Check Storage Health

Output (Redis backend):
Output (JSON backend):

Programmatic Storage Monitoring


Debugging Failed Events

Step 1: Check Metrics

Look for:
  • ❌ High “Failed” count
  • ❌ Low success rate (< 95%)
  • ⏱️ High average processing time

Step 2: Inspect DLQ

Analyze:
  • error: Why it failed
  • retry_count: How many times it was tried
  • failed_message: Original payload

Step 3: Identify Root Cause

Common Failure Patterns: 1. Invalid Data
Fix: Add validation in callback 2. External Service Down
Fix: Increase max_retries for transient errors 3. Timeout
Fix: Increase reclaim_idle_ms or optimize callback 4. Bad Logic
Fix: Fix callback logic

Step 4: Test Fix

Step 5: Republish (if needed)


Performance Optimization

1. Monitor Processing Times

Targets:
  • ✅ Fast tasks: < 1 second
  • ✅ Medium tasks: 1-10 seconds
  • ⚠️ Slow tasks: > 10 seconds
If slow:
  • Optimize callback logic
  • Reduce external API calls
  • Use caching
  • Process asynchronously

2. Monitor Pending Messages

High pending (> 100)?
  • ⚠️ Agents can’t keep up with load
  • Fix: Increase consumer_count

3. Monitor DLQ Growth

Growing DLQ?
  • ❌ Systematic failures
  • Fix: Identify and fix root cause (see Debugging section)

4. Monitor Memory Usage

High memory (> 80% of limit)?
  • Clear old data
  • Reduce result TTL
  • Trim metrics

Production Monitoring Best Practices

1. Set Up Continuous Monitoring

2. Alert on Anomalies

3. Log Aggregation

4. Dashboards

Grafana/Prometheus Example:

5. Regular Maintenance


Troubleshooting Checklist

System Not Starting

Agents Not Processing

High Latency

DLQ Growing


Further Reading


Summary

Key Monitoring Commands:
Key Metrics to Watch:
  • ✅ Success rate (> 95%)
  • ✅ Processing time (< 10s)
  • ✅ Pending messages (< 100)
  • ✅ DLQ growth (near 0)
  • ✅ Memory usage (< 80%)
Production Best Practices:
  • Monitor continuously (cron/systemd timers)
  • Alert on anomalies
  • Aggregate logs
  • Create dashboards
  • Regular maintenance
Debugging Workflow:
  1. Check metrics (identify problem topic)
  2. Inspect DLQ (identify failure pattern)
  3. Analyze root cause
  4. Test fix locally
  5. Deploy and monitor
Monitoring is key to production success! 📊✨