Skip to content

feat(metrics): record workflow and processing lifecycle counters (#44) - #67

Merged
oreofeolurin merged 1 commit into
devfrom
fix/44-processing-workflow-metrics
Aug 30, 2026
Merged

feat(metrics): record workflow and processing lifecycle counters (#44)#67
oreofeolurin merged 1 commit into
devfrom
fix/44-processing-workflow-metrics

Conversation

@oreofeolurin

@oreofeolurin oreofeolurin commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Completes the instrumentation started in #64. Both families exported 0 regardless of traffic because neither handler ever touched the registry.

Completes the instrumentation started in #64. Both families exported 0
regardless of traffic because neither handler ever touched the registry.

Contrary to the note in #64, no plumbing was needed: every dispatch function in
both handlers already receives `shard: *Shard`, which carries the registry. The
counters go in at the points every transition already passes through:

- workflow: `completeRun` is the single terminal transition, so completed /
  failed / cancelled / timed_out all record there; started in `handleStart`,
  signal delivery in `handleSignal`, and step execution at the four
  `step_completed` history sites (all four have `shard` in scope).
- processing: submitted in `handleSubmit`, and `persistStatusChange` covers
  cancelled and stopped.

## A crash this surfaced

Eight workflow unit tests began aborting. Their test shard is built as
`var shard: Shard = undefined` with fields assigned one at a time, so
`metrics_registry` held garbage and the new read dereferenced it. The tests
passed before only because nothing in the workflow path read that field.

Both fields are now assigned in the helper. This is the third instance of the
same hazard today — `allocator.create` and `= undefined` both leave field
defaults inapplicable, and the compiler cannot see it.

## Tests

Two more value-asserting e2e tests: start two workflows and assert
`flo_workflow_started_total` is 2; submit a job and assert
`flo_processing_jobs_submitted_total` is 1. Both fail with the instrumentation
stashed.

test-unit, test-integration, and the metrics / workflow / processing e2e
filters all pass.

## Still open on #44

KVMetrics and TieredLogMetrics remain unexported and unregistered. Whether to
emit or delete them is a product decision, so #44 stays open for that alone.
@oreofeolurin
oreofeolurin merged commit 6316f8c into dev Aug 30, 2026
4 of 5 checks passed
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.

1 participant