@stephen-shopopop/node-metrics
    Preparing search index...

    A plugin that monitors and records the event loop delay using a histogram.

    The EventLoopDelayPlugin utilizes Node.js's monitorEventLoopDelay to track the event loop's responsiveness. On each capture, it records the mean event loop delay (in milliseconds, adjusted by the resolution) into the provided context. If the delay cannot be determined, it sets the value to Infinity.

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Creates an instance of the class and initializes the event loop delay histogram.

      Parameters

      • resolution: number = DEFAULT_RESOLUTION

        The sampling resolution in milliseconds for monitoring the event loop delay. Defaults to DEFAULT_RESOLUTION if not provided.

      Returns EventLoopDelayPlugin

    Properties

    name: string = EventLoopDelayPlugin.name

    Methods

    • Captures the current event loop delay statistics and stores the computed value in the provided context.

      The event loop delay is calculated as the mean value from the internal histogram (converted from nanoseconds to milliseconds) minus the configured resolution. If the computed delay is not a number (NaN), it is set to positive infinity. After capturing, the histogram is reset for the next measurement cycle.

      Parameters

      • ctx: MetricsContext

        The context object where the event loop delay metric will be set.

      Returns void