ark::debuglog::TupleLogThrottle
Defined in header “ark/debuglog/tuple_log_throttle.hh”.
Throttles repeated events keyed by a tuple.
This class tracks, per tuple key, the last emitted timestamp and the number of events that were throttled since that emission. Calling returns a throttled-count only when the caller should emit. If the event should be suppressed, it returns std::nullopt and the per-key throttled counter is incremented. Any tracked tuple whose most recent emission is older than the configured period is pruned during , which keeps the map bounded by active keys.
Typedefs
-
using duration = typename Clock::duration
-
using time_point = typename Clock::time_point
-
using key_type = std::tuple< std::decay_t< Values >… >
Methods
-
TupleLogThrottle(duration period)
Constructs a new throttler using the given period. -
std::optional< std::size_t > record(const key_type & key)
Registers an event at the current clock time.Returns the number of throttled events for this key when the caller should emit now, or std::nullopt if this event should be throttled.
-
std::optional< std::size_t > record(const key_type & key, time_point now)
Registers an event at the provided time point.Returns the number of throttled events for this key when the caller should emit now, or std::nullopt if this event should be throttled.
-
std::size_t tracked_keys()
Returns the number of currently tracked keys.