Opentelemetry.Interval_limiterUtility to limit the frequency of some event
Interval limiter. This is a form of rate limiting where an event cannot be followed by another event until a given interval of time has passed.
val create : min_interval:Mtime.span -> unit -> tval create_atomic :
min_interval:Mtime.span Opentelemetry_atomic.Atomic.t ->
unit ->
tLike create, but the interval is read from the given atomic at each attempt, so it can be changed later by whoever holds the atomic.
val min_interval : t -> Mtime.spanCurrent minimum interval
val set_min_interval : t -> Mtime.span -> unitChange the minimum interval. Takes effect on the next attempt.
val make_attempt : t -> boolmake_attempt lim returns true if the last successful attempt was more than min_interval ago, as measured by mtime. If so, this counts as the new latest attempt; otherwise false is returned and the state is not updated.