riemann.expiration

Many places in Riemann need to understand whether the events they’re working with are currently valid, and whether a given host/service combo has expired. The expiration tracker provides a stateful data structure for tracking new events, figuring out when expirations should be emitted, and calling back when they need to occur.

expiration-time

(expiration-time event)

When will an event expire?

expired?

(expired? event)

Is this event expired? Events are expired if their state is “expired” and time is past, if their time + ttl is less than the current time.

Tracker

protocol

members

expired-events!

(expired-events! t)

Returns a seq of expired events, which are deleted from the tracker as they’re yielded.

shutdown!

(shutdown! t)

Release resources associated with the tracker.

update!

(update! t event)

Update a tracker with a new event.

tracker!

(tracker! expired-sink)(tracker! expired-sink expiration-interval)

Constructs a new expiration tracker which expires events every expiration-interval seconds, calling (expired-sink event) with each.