Trait ScalingObserver

Source
pub trait ScalingObserver: Send + Sync {
    // Provided methods
    fn on_scaling_decision<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _action: &'life1 ScaleAction,
        _context: &'life2 CallbackContext,
    ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_scaling_executed<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _action: &'life1 ScaleAction,
        _success: bool,
        _context: &'life2 CallbackContext,
    ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_scaling_skipped<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _action: &'life1 ScaleAction,
        _reason: &'life2 str,
        _context: &'life3 CallbackContext,
    ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn on_scaling_error<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _action: &'life1 ScaleAction,
        _error: &'life2 LighthouseError,
        _context: &'life3 CallbackContext,
    ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Trait for receiving scaling events and decisions

Implement this to get notified about scaling decisions. Useful for logging, alerting, or custom business logic.

Provided Methods§

Source

fn on_scaling_decision<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _action: &'life1 ScaleAction, _context: &'life2 CallbackContext, ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called when a scaling decision is made (before execution)

Source

fn on_scaling_executed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _action: &'life1 ScaleAction, _success: bool, _context: &'life2 CallbackContext, ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called after a scaling action is executed

Source

fn on_scaling_skipped<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _action: &'life1 ScaleAction, _reason: &'life2 str, _context: &'life3 CallbackContext, ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Called when scaling is skipped (e.g., due to cooldown)

Source

fn on_scaling_error<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _action: &'life1 ScaleAction, _error: &'life2 LighthouseError, _context: &'life3 CallbackContext, ) -> Pin<Box<dyn Future<Output = LighthouseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Called when an error occurs during scaling

Implementors§