shigoto_telemetry (shigoto v1.9.10)

View Source

Telemetry events for Shigoto job lifecycle, queue operations, and resilience.

Every event is emitted through telemetry:execute/3. The tables below are the stable event contract: attach a handler to any of these event names to feed a metrics reporter (telemetry_metrics, Prometheus, StatsD, ...). See the Telemetry guide for a worked telemetry_metrics example.

Measurement units:

  • count is always 1 (increment a counter/sum).
  • duration is in native time units (erlang:monotonic_time/0 deltas).
  • duration_ms, queue_wait_ms, retry_after_ms are milliseconds.
  • progress is a percentage (0..100).
  • claimed is a job count (jobs claimed by that poll).

Every event carries domain => [shigoto] in its metadata (used by the OTP logger for filtering); it is omitted from the tables below for brevity.

Job Events

EventMeasurementsMetadata
[shigoto, job, inserted]countjob_id, worker, queue, attempt, priority
[shigoto, job, claimed]count, queue_wait_msjob_id, worker, queue, attempt, priority
[shigoto, job, completed]count, duration, duration_ms, queue_wait_msjob_id, worker, queue, attempt, priority
[shigoto, job, failed]count, duration, duration_ms, queue_wait_msjob_id, worker, queue, attempt, priority, reason
[shigoto, job, snoozed]countjob_id, worker, queue, attempt, priority, snooze_reason
[shigoto, job, discarded]countjob_id, worker, queue, attempt, priority
[shigoto, job, cancelled]countjob_id, worker, queue, attempt, priority
[shigoto, job, progress]progressjob_id, worker, queue, attempt, priority, progress

Queue Events

EventMeasurementsMetadata
[shigoto, queue, poll]count, claimedqueue
[shigoto, queue, paused]countqueue
[shigoto, queue, resumed]countqueue

Resilience Events

EventMeasurementsMetadata
[shigoto, resilience, rate_limited]count, retry_after_msworker
[shigoto, resilience, circuit_open]countworker
[shigoto, resilience, bulkhead_full]countworker
[shigoto, resilience, load_shed]countpriority

Batch Events

EventMeasurementsMetadata
[shigoto, batch, completed]countbatch_id, total_jobs, completed_jobs, discarded_jobs

Cron Events

EventMeasurementsMetadata
[shigoto, cron, scheduled]countname, worker, schedule

Testing Events

EventMeasurementsMetadata
[shigoto, testing, mode_armed]countmode

Emitted once at boot when a non-production testing mode (inline/manual) is armed. Its presence in a production metrics stream is a red flag — test-only insert behaviour is active. See shigoto_config:testing_mode/0.

Summary

Functions

batch_completed(Batch)

-spec batch_completed(map()) -> ok.

cron_scheduled(Name, Worker, Schedule)

-spec cron_scheduled(atom() | binary(), module(), binary()) -> ok.

job_cancelled(Job)

-spec job_cancelled(map()) -> ok.

job_claimed(Job)

-spec job_claimed(map()) -> ok.

job_completed(Job, Duration)

-spec job_completed(map(), integer()) -> ok.

job_discarded(Job)

-spec job_discarded(map()) -> ok.

job_failed(Job, Reason, Duration)

-spec job_failed(map(), term(), integer()) -> ok.

job_inserted(Job)

-spec job_inserted(map()) -> ok.

job_progress(Job, Progress)

-spec job_progress(map(), 0..100) -> ok.

job_snoozed(Job, Reason)

-spec job_snoozed(map(), binary()) -> ok.

queue_paused(Queue)

-spec queue_paused(binary()) -> ok.

queue_poll(Queue, Claimed)

-spec queue_poll(binary(), non_neg_integer()) -> ok.

queue_resumed(Queue)

-spec queue_resumed(binary()) -> ok.

resilience_bulkhead_full(Worker)

-spec resilience_bulkhead_full(module()) -> ok.

resilience_circuit_open(Worker)

-spec resilience_circuit_open(module()) -> ok.

resilience_load_shed(Priority)

-spec resilience_load_shed(integer()) -> ok.

resilience_rate_limited(Worker, RetryAfterMs)

-spec resilience_rate_limited(module(), non_neg_integer()) -> ok.

testing_mode_armed(Mode)

-spec testing_mode_armed(inline | manual) -> ok.