Struct prometheus_utils::Windowing [−][src]
pub struct Windowing<P> { /* fields omitted */ }
Expand description
Windowing
is a mechanism for rotating between different observations.
It provides an accessor Windowing::current
for the current
observation, and a method Windowing::cycle_windows
which makes the
next observation in the ring current, and returns the observation which
was current prior to the call.
Implementations
Constructor. Initializes its owned ring of P
s using Default::default()
.
Get the current collection. The underling P
is expected to be
cycled on some regular interval.
Data integrity guarantees are weak. In some circumstances, the
returned P
window may be for the prior interval, if whatever wants
to write a datapoint races with something replacing the current P
.
It is even possible (if extremely unlikely) for a value to be written
into an old P
collection, if the writer races with a reader and
writes after the reader has emptied the collection and released its
lock.
Cycle to the next window. Returns the window which was active before the call.