Raxol.Core.ErrorRecovery.EnhancedPatternLearner (Raxol v2.0.1)
View SourceEnhanced error pattern learning specifically for recovery scenarios.
This module extends the existing ErrorPatternLearner with recovery-specific features like success rate tracking for different recovery strategies, integration with the recovery supervisor, and adaptive strategy selection.
Features
- Recovery strategy success rate tracking
- Context-aware pattern analysis
- Integration with RecoverySupervisor
- Adaptive strategy recommendation
- Performance impact correlation
Usage
# Record a recovery attempt
EnhancedPatternLearner.record_recovery_attempt(
error_signature,
:circuit_break,
:success,
%{recovery_time_ms: 2500}
)
# Get recommended recovery strategy
strategy = EnhancedPatternLearner.recommend_recovery_strategy(
error_signature,
%{restart_count: 3, performance_impact: :high}
)
Summary
Functions
Returns a specification to start this module under a supervisor.
Export recovery learning data.
Get recovery patterns that correlate with performance issues.
Get learning statistics for recovery patterns.
Get success rates for all recovery strategies for a given error.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Get the recommended recovery strategy for an error.
Record a recovery attempt and its outcome.
Update adaptive thresholds based on system performance.
Types
@type recovery_context() :: map()
@type recovery_outcome() :: :success | :failure | :partial_success
@type recovery_pattern() :: %{ error_signature: String.t(), strategy: recovery_strategy(), success_rate: float(), avg_recovery_time_ms: float(), performance_impact: atom(), context_correlations: map(), last_updated: DateTime.t() }
@type recovery_strategy() :: atom()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Export recovery learning data.
Get recovery patterns that correlate with performance issues.
Get learning statistics for recovery patterns.
Get success rates for all recovery strategies for a given error.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Get the recommended recovery strategy for an error.
Record a recovery attempt and its outcome.
Update adaptive thresholds based on system performance.