Durable.Activity (Durable v2.0.2)
View SourceOperational events worth an operator's attention, kept for a week in
durable.activity — the record behind "what happened to my queues?".
| kind | recorded when |
|---|---|
"stale_recovered" | runs whose node stopped heartbeating went back on the queue |
"zombie_recovered" | runs left running with no live worker were failed |
"worker_fenced" | a worker found its run reclaimed by another node and stopped |
"rollback_interrupted" | a run being rolled back lost its worker; details.reason says how |
"ack_failed" | a worker couldn't release a finished run's lock |
"queue_paused" | Durable.pause_queue/2 (details.by when given) |
"queue_resumed" | Durable.resume_queue/2 |
"schedule_disabled" | a schedule was turned off after failing repeatedly |
"schedule_removed" | schedules were turned off for no longer having an @schedule |
"pruned" | the retention pruner deleted finished runs |
"key_duplicate" | a start found its key taken and returned the holder or an error |
"key_handed_off" | a start took a key from a closed run that reuse: let go |
"key_released" | Durable.release_key/2 (details.by when given) |
"key_retaken" | a retry took its key back from a closed run |
Key events carry details.key and details.workflow, and their
:workflow_id is the run they're about: the holder for "key_duplicate",
the new holder for "key_handed_off" (with replaced: true when it
cancelled the holder) and "key_retaken". A
"key_duplicate" also has outcome (use_existing, error,
cancel_existing, send_event with the event name, or debounced),
holder_status and input_changed, plus the new input when it differed
(up to 16 KB; input_truncated when larger).
Each row has :at, :kind, the :node_id that recorded it, and where it
applies :queue, :workflow_id, a :count and :details.
Recording never raises: losing an activity row must not break the recovery or the action it describes. Inside a transaction the insert runs under a savepoint, so a failed insert doesn't abort the caller's transaction either.
Summary
Functions
Recent activity, newest first.
Like list/1, but returns the events or raises ArgumentError.
Functions
@spec list(keyword()) :: {:ok, [Durable.Storage.Schemas.ActivityEvent.t()]} | {:error, Durable.Query.Opts.reason()}
Recent activity, newest first.
Options
:since- only events at or after this time (default: 24 hours ago):limit- at most this many (default: 100):workflow_id- only events about this run:kinds- only these kinds (strings):durable- the Durable instance (default:Durable)
Returns {:ok, events}, or {:error, {:invalid_option, key}} for an option
of the wrong type (a negative :limit, a :workflow_id that isn't a UUID).
list!/1 returns the events or raises ArgumentError. See
Durable.Query.Opts.
{:ok, events} = Durable.Activity.list(kinds: ["queue_paused"], limit: 20)
events = Durable.Activity.list!(kinds: ["queue_paused"], limit: 20)
@spec list!(keyword()) :: [Durable.Storage.Schemas.ActivityEvent.t()]
Like list/1, but returns the events or raises ArgumentError.