Change feed
The change feed records ResourceShark events in order, including supply arrivals, hold resolutions, and recorded movements. Your server reads it with the project’s secret key to react to those changes. Each project environment has its own feed.
Events
Each entry is a CloudEvent 1.0 in JSON with source: '/resourceshark'. Its full type starts with tools.agentpost.resources., as in tools.agentpost.resources.hold.placed. The subject identifies the record the event is about. Its data.context names the actor and, when the actor acted under a delegation, onBehalfOf, as Who acted describes. Your secret key’s actor is key: and the key’s name, and a ResourceShark sweep’s is the service principal resourceshark.
A change and its events commit together. A hold commit that takes stock records the movement events and hold.committed in the same transaction.
Cursors
Each event has an increasing seq. Start at after=0 to read from the oldest event kept, or at after=latest to read only what happens from now on. Then pass each answer’s next as after for the next read. A full page sets next to its last event’s seq. A page with fewer events than limit has caught up, so its next is the newest seq, past any events the types filter skipped. The optional types filter takes full event type names separated by commas.
Retention
An event gets its expiry from retention.events when written, and never expires before the event written before it. Once an event’s expiry passes, the feed no longer returns it, and the database removes it soon after. A lower retention.events applies once the events written before the change expire.
A cursor from before the oldest event kept would skip removed history, so ResourceShark refuses it with cursor_expired. The error’s details.oldest is the first seq still kept and details.latest the newest. Rebuild what your app keeps from the feed from the records themselves, then read on from details.latest.
Limits
- Agentpost’s starting event retention is
30d. The config accepts up to3650d.
Where to act on it
- Change ResourceShark’s config changes retention for newly written events.
- Config has the retention settings. Events has the feed query.