Skip to content

feat: add worker domain events and processing metrics#109

Merged
AKogut merged 1 commit into
mainfrom
feat/102-worker-observability
Jul 18, 2026
Merged

feat: add worker domain events and processing metrics#109
AKogut merged 1 commit into
mainfrom
feat/102-worker-observability

Conversation

@AKogut

@AKogut AKogut commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Closes #102

Summary

Closes the #17 scope items that were never built: the worker emitted no domain events for downstream stages and exposed no processing metrics.

Changes

  • Domain events (events.ts): a small typed bus emitting run.processed, identity.created, identity.moved, and score.updated. Identity events are collected during the transaction and emitted after it commits, so subscribers never observe uncommitted state. A throwing subscriber is isolated and reported rather than failing the job. This is the seam downstream stages (signature clustering, AI RCA) will subscribe to.
  • Metrics (telemetry.ts): jobs_processed / jobs_failed / jobs_dead_lettered counters, processing_lag (enqueue → pickup) and processing_duration histograms, and a queue_depth observable gauge. All no-op until FLAKEMETRY_SELF_OTEL_ENDPOINT registers an OTLP metrics exporter, matching the API's self-instrumentation.
  • queue.dequeue now returns createdAt — required to compute processing lag.

Testing

  • worker: 9 tests (up from 3) — event bus unit tests (delivery, per-event isolation, unsubscribe, throwing subscriber) and processor tests asserting emitted identity.created / score.updated / run.processed plus identity.moved on a file move
  • full turbo pipeline green, 38/38 tasks
  • worker env vars documented in docs/configuration.md

@AKogut AKogut self-assigned this Jul 18, 2026
@AKogut
AKogut merged commit 1793fc8 into main Jul 18, 2026
2 checks passed
@AKogut
AKogut deleted the feat/102-worker-observability branch July 18, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker observability: domain events + processing metrics

1 participant