Skip to content

[CRE-7344] Fix trigger coordinator readers gauge - #24257

Closed
MStreet3 wants to merge 1 commit into
developfrom
CRE-7344-fix-trigger-readers-gauge
Closed

MStreet3 wants to merge 1 commit into
developfrom
CRE-7344-fix-trigger-readers-gauge

Conversation

@MStreet3

@MStreet3 MStreet3 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

CRE-7344

What this fixes

platform_trigger_coordinator_readers should count the trigger reader goroutines on a node. In staging it read 1–3 per node, while platform_trigger_coordinator_workflows read 988 on the same Zone A nodes.

Each reader goroutine (added in #23945) deferred the gauge update directly:

defer c.deps.Metrics.UpdateTriggerCoordinatorReadersGauge(ctx, c.readersGauge.Add(-1))

Go evaluates a deferred call's arguments when the defer runs. So the counter dropped when each reader started, and that stale value was recorded when the reader exited. Every exit pushed the gauge to a small, wrong number. The fix defers a closure, so the decrement and the record both happen on exit.

Metrics only: readersGauge feeds nothing but this gauge, and trigger reading and execution are unchanged.

Test

TestCoordinator_ReadersGauge registers a workflow with three triggers. It holds for 100ms and checks that both the internal counter and the exported gauge read 3 while the readers run, then checks that the gauge returns to 0 after unregistering. It fails on every run against the old code and passes with -race.

Requires

None.

Supports

None.

Deployment Validation Steps

  • After deploy, platform_trigger_coordinator_readers per node should be at least platform_trigger_coordinator_workflows, since each workflow has one or more triggers.
  • Follow-up: add a "Trigger readers per node" panel to the Coordinated Engine – Trigger Queue dashboard in chainlink-observability.

The reader goroutine deferred the gauge update directly, so Go
evaluated readersGauge.Add(-1) when each reader started and recorded
that stale value when it exited. platform_trigger_coordinator_readers
read 1-3 per node in staging against 988 coordinated workflows.

Defer a closure so the decrement and the record both happen on exit.
Add a regression test that registers three triggers, holds the gauge
and counter at three while the readers run, and expects zero after
unregistering.
@MStreet3
MStreet3 requested a review from a team as a code owner November 23, 2026 14:26
@github-actions

Copy link
Copy Markdown
Contributor

👋 MStreet3, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@MStreet3

Copy link
Copy Markdown
Contributor Author

Superseded by #24258, which makes the coordinator gauges observable to also fix a race in recording them.

@MStreet3 MStreet3 closed this Nov 23, 2026
@MStreet3
MStreet3 deleted the CRE-7344-fix-trigger-readers-gauge branch November 23, 2026 14:41
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