Fixed window rate limiter for logging.

Synopsis

Declared in <logging.h>

class LogRateLimiter;

Types

Name

Description

Stats

Keeps track of an individual source location and how many available bytes are left for logging from it.

Type Aliases

Name

Description

SchedulerFunction

Callback type used to schedule the periodic reset of the rate‐limit window.

Enums

Name

Description

Status

Suppression status of a source log location.

Member Functions

Name

Description

Consume

Consumes source_loc's available bytes corresponding to the size of the (formatted) str and returns its status.

Reset

Resets all usage to zero. Called periodically by the scheduler.

SuppressionsActive

Returns true if any log locations are currently being suppressed.

Static Member Functions

Name

Description

Create

Create a shared rate limiter and schedule its periodic window reset.

Data Members

Name

Description

m_max_bytes

Maximum number of bytes logged per location per window.

m_reset_window

Interval after which the window is reset.

Created with MrDocs