Skip to main content
Version: 3.5

SystemStatus

Provides a simple interface to reading system status from a Snapshotter instance. It only exposes two functions SystemStatus.getCurrentStatus and SystemStatus.getHistoricalStatus. The system status is calculated using a weighted average of overloaded messages in the snapshots, with the weights being the time intervals between the snapshots. Each resource is calculated separately and the system is overloaded whenever at least one resource is overloaded. The class is used by the AutoscaledPool class.

SystemStatus.getCurrentStatus returns a boolean that represents the current status of the system. The length of the current timeframe in seconds is configurable by the currentHistorySecs option and represents the max age of snapshots to be considered for the calculation.

SystemStatus.getHistoricalStatus returns a boolean that represents the long-term status of the system. It considers the full snapshot history available in the Snapshotter instance.

Index

Constructors

constructor

  • new SystemStatus(options?: SystemStatusOptions): SystemStatus
  • Parameters

    • options: SystemStatusOptions = {}

    Returns SystemStatus

Methods

getCurrentStatus

  • getCurrentStatus(): SystemInfo
  • Returns an SystemInfo object with the following structure:

    {
    isSystemIdle: Boolean,
    memInfo: Object,
    eventLoopInfo: Object,
    cpuInfo: Object
    }

    Where the isSystemIdle property is set to false if the system has been overloaded in the last options.currentHistorySecs seconds, and true otherwise.


    Returns SystemInfo

getHistoricalStatus

  • getHistoricalStatus(): SystemInfo
  • Returns an SystemInfo object with the following structure:

    {
    isSystemIdle: Boolean,
    memInfo: Object,
    eventLoopInfo: Object,
    cpuInfo: Object
    }

    Where the isSystemIdle property is set to false if the system has been overloaded in the full history of the Snapshotter (which is configurable in the Snapshotter) and true otherwise.


    Returns SystemInfo