Raxol.Core.ErrorRecovery.RecoverySupervisor (Raxol v2.0.1)
View SourceEnhanced supervisor with intelligent error recovery strategies.
This supervisor extends the standard OTP supervisor with:
- Adaptive restart strategies based on error patterns
- Context preservation across restarts
- Dependency-aware restart ordering
- Performance impact awareness
- Self-healing mechanisms
Features
- Smart restart strategies that adapt to error frequency
- Graceful degradation when components repeatedly fail
- Context preservation to maintain state across restarts
- Integration with error pattern learning
- Performance monitoring integration
Usage
children = [
{MyWorker, [context_key: :worker1]},
{AnotherWorker, [depends_on: [:worker1]]}
]
RecoverySupervisor.start_link(
children: children,
strategy: :adaptive_one_for_one,
max_restarts: 5,
max_seconds: 60
)
Summary
Functions
Returns a specification to start this module under a supervisor.
Get recovery statistics for monitoring.
Preserve context for a child before restart.
Manually trigger recovery for a specific child.
Enable or disable degradation mode.
Types
@type recovery_strategy() ::
:adaptive_one_for_one
| :adaptive_one_for_all
| :adaptive_rest_for_one
| :circuit_breaker
@type restart_info() :: %{ child_id: term(), timestamp: DateTime.t(), error: term(), restart_count: non_neg_integer(), recovery_time_ms: non_neg_integer() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Get recovery statistics for monitoring.
Preserve context for a child before restart.
Manually trigger recovery for a specific child.
Enable or disable degradation mode.