Description
monitoring.rs records incidents but exposes only counts. Compute and surface rolling Mean Time To Recovery and Mean Time Between Failures over a configurable window so operators can spot deteriorating reliability before it triggers the circuit breaker.
Requirements and Context
- Add
RollingWindow { capacity: u32 } ring buffer
- Compute MTTR/MTBF in seconds as
i128
- Window writes are bounded and replace oldest entries
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/monitoring-mttr-mtbf
- Implement changes
contracts/predictify-hybrid/src/monitoring.rs
contracts/predictify-hybrid/src/tests/monitoring_mttr_tests.rs
- Test and commit
cargo test -p predictify-hybrid mttr_mtbf
- Cover edge cases
- Include test output and notes in the PR
Example commit message
feat: expose rolling MTTR and MTBF metrics from ContractMonitor
Acceptance Criteria
Guidelines
- No
unwrap() in production paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
monitoring.rsrecords incidents but exposes only counts. Compute and surface rolling Mean Time To Recovery and Mean Time Between Failures over a configurable window so operators can spot deteriorating reliability before it triggers the circuit breaker.Requirements and Context
RollingWindow { capacity: u32 }ring bufferi128Suggested Execution
contracts/predictify-hybrid/src/monitoring.rscontracts/predictify-hybrid/src/tests/monitoring_mttr_tests.rscargo test -p predictify-hybrid mttr_mtbfExample commit message
Acceptance Criteria
Guidelines
unwrap()in production paths