Class: Amigo::Autoscaler::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/amigo/autoscaler.rb

Instance Method Summary collapse

Instance Method Details

#scale_down(depth:, duration:, **kw) ⇒ Object

Called when a latency of latency_restored_threshold is reached (ie, when we get back to normal latency after a high latency event). Usually this handler will deprovision capacity procured as part of the scale_up.

Parameters:

  • depth (Integer)

    The number of times an alert happened before the latency spike was resolved.

  • duration (Float)

    The number of seconds for the latency spike has been going on.

  • kw (Hash)

    Additional undefined keywords. Handlers should accept additional options, like via ‘**kw` or `opts={}`, for compatibility.

Raises:

  • (NotImplementedError)


285
# File 'lib/amigo/autoscaler.rb', line 285

def scale_down(depth:, duration:, **kw) = raise NotImplementedError

#scale_up(high_latencies:, pool_usage:, depth:, duration:, **kw) ⇒ Array<String,Symbol,Proc,#call>

Called when a latency event starts, and as it fails to resolve.

Parameters:

  • high_latencies (Hash)

    The Hash returned from Amigo::Autoscaler::Handler#check. For Sidekiq, this will look like ‘name => latency in seconds`

  • pool_usage (Float, nil)

    The pool usage value from the checker, or nil.

  • depth (Integer)

    Number of alerts as part of this latency event. For example, the first alert has a depth of 1, and if latency stays high, it’ll be 2 on the next call, etc. depth can be used to incrementally provision additional processing capacity, and stop adding capacity at a certain depth to avoid problems with too many workers (like excessive DB load).

  • duration (Float)

    Number of seconds since this latency spike started.

  • kw (Hash)

    Additional undefined keywords. Handlers should accept additional options, like via ‘**kw` or `opts={}`, for compatibility.

Returns:

  • (Array<String,Symbol,Proc,#call>)

Raises:

  • (NotImplementedError)


275
# File 'lib/amigo/autoscaler.rb', line 275

def scale_up(high_latencies:, pool_usage:, depth:, duration:, **kw) = raise NotImplementedError