-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Follow-up to #70 and PR #404. Now that we have log streaming implemented, we can expand streaming support to other monitoring and operational use cases.
Completed in PR #404
- ✅ Log streaming with
--followflag - ✅ Configurable poll intervals
- ✅ Graceful Ctrl+C handling
- ✅ JMESPath filtering on streams
Remaining Opportunities
1. Real-time Metrics Streaming (High Priority)
Endpoints:
- Enterprise:
/v1/cluster/stats - Enterprise:
/v1/bdbs/{id}/stats - Enterprise:
/v1/nodes/{id}/stats
Use Cases:
- Monitor cluster health in real-time
- Watch database performance metrics
- Track node resource utilization
Implementation:
# Stream cluster metrics
redisctl enterprise stats get --follow --poll-interval 5
# Stream database metrics
redisctl enterprise database stats get <id> --follow
# With filtering
redisctl enterprise stats get --follow -q 'cpu_usage'2. Database Lifecycle Event Monitoring (Medium Priority)
Approach:
- Poll database status changes
- Detect and report state transitions
- Useful during migrations, backups, scaling
Implementation:
# Watch database status
redisctl enterprise database watch <id> --follow
# Example output
[10:30:00] Database 1: active
[10:30:15] Database 1: active -> updating
[10:32:30] Database 1: updating -> active3. Cluster Event Stream (Medium Priority)
Different from logs:
- Logs = historical events
- Events = real-time notifications
- Could combine logs + alerts for comprehensive monitoring
Implementation:
# Stream cluster events (logs + alerts)
redisctl enterprise cluster events --follow
# Filter by severity
redisctl enterprise cluster events --follow --severity warning4. Task Progress Streaming Enhancement (Low Priority)
Current state:
- Task waiting already has progress spinner
- Could add more detailed progress info if API provides it
Possible Enhancement:
# Current (already works)
redisctl cloud database create --wait
# Enhanced (show detailed progress)
redisctl cloud database create --wait --verbose
# Output:
# [0%] Validating configuration...
# [20%] Creating database instance...
# [60%] Configuring networking...
# [100%] Database ready5. Multi-Resource Monitoring (Future)
Advanced use case:
- Monitor multiple databases simultaneously
- Aggregate metrics from multiple sources
- Dashboard-like experience in terminal
Implementation:
# Watch multiple databases
redisctl enterprise database watch 1,2,3 --follow
# Example output (refreshing display)
DB1: active | CPU: 45% | Mem: 2.1GB | Ops: 1.2K/s
DB2: active | CPU: 23% | Mem: 1.5GB | Ops: 800/s
DB3: updating| CPU: 15% | Mem: 3.2GB | Ops: 0/sImplementation Strategy
Phase 1: Stats Streaming (Recommended First)
- Add
stream_stats()method to StatsHandler - Add
--followflag to stats commands - Format metrics for terminal display
- Support both cluster and database stats
Phase 2: Database Watching
- Add
watch_database()method - Track status changes
- Alert on state transitions
- Show relevant metrics during transitions
Phase 3: Event Aggregation
- Combine logs and alerts
- Filter by severity/type
- Unified event stream
Technical Approach
Reuse Streaming Infrastructure
- Follow pattern from logs_impl.rs
- Use same async-stream approach
- Consistent CLI flags (
--follow,--poll-interval) - Same Ctrl+C handling
Display Considerations
Single Value Streams (like logs):
- Line-by-line output
- Scrolling terminal
- JMESPath filtering
Metrics Streams:
- Could use refreshing display (like
top) - Or line-by-line with timestamps
- Consider terminal size
Multi-Resource:
- TUI library like ratatui/tui-rs
- Or simple table with ANSI cursor control
Dependencies
Might need:
crossterm- Terminal control (cursor positioning, clear screen)ratatui- Full TUI framework (if doing dashboard-like displays)- Or stick with simple line-by-line output
Priority Recommendation
- High: Stats streaming - Most valuable for operational monitoring
- Medium: Database watching - Useful during operations
- Low: Enhanced task progress - Current implementation is good
- Future: Multi-resource dashboard - Nice to have, complex
Success Metrics
- Real-time monitoring without separate tools
- Reduced time to detect issues
- Better operational visibility
- Positive user feedback
Related
- Add streaming support for real-time data endpoints #70 - Original streaming support issue
- PR feat: Add streaming logs support with --follow flag (Issue #70) #404 - Log streaming implementation (foundation)
Notes
- All streaming uses polling since APIs don't support SSE/WebSockets
- Poll intervals should be configurable (balance freshness vs load)
- Follow established patterns from log streaming
- Maintain consistency in CLI flags and behavior
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request