Repository navigation
[CRE-7344] Observe trigger coordinator gauges at collection time - #24258
Merged
Merged
Conversation
platform_trigger_coordinator_readers read 1-3 per node in staging against 988 coordinated workflows. Each reader deferred the gauge update directly, so Go evaluated readersGauge.Add(-1) when the reader started and recorded that stale value when it exited. Recording on every change is also racy on its own: concurrent updates can record out of order and leave a stale value behind. Make the workflows and readers gauges observable. The coordinator keeps its two atomic counters and registers one callback on start that reports them at collection time, and unregisters it on close. The gauges now always match the counters, and an idle node reports 0 instead of no series. Metric names and labels are unchanged.
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! |
product-security-plaid-production
Bot
requested a review
from prashantkumar1982
November 23, 2026 14:41
Contributor
|
I see you updated files related to
|
Contributor
|
✅ No conflicts with other open PRs targeting |
MStreet3
enabled auto-merge
November 23, 2026 14:49
jmank88
approved these changes
Nov 23, 2026
george-dorin
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CRE-7344
Replaces #24257.
What this fixes
platform_trigger_coordinator_readersshould count the trigger reader goroutines on a node. In staging it read 1–3 per node, whileplatform_trigger_coordinator_workflowsread 988 on the same Zone A nodes.There were two problems:
defer c.deps.Metrics.UpdateTriggerCoordinatorReadersGauge(ctx, c.readersGauge.Add(-1)). Go evaluates a deferred call's arguments when thedeferruns, so the counter dropped when each reader started, and that stale value was recorded when the reader exited.The change
The coordinator's two gauges become observable: the coordinator keeps its atomic counters, and the gauges read them when metrics are collected.
monitoring:platform_trigger_coordinator_workflowsandplatform_trigger_coordinator_readersare nowInt64ObservableGauge.RegisterTriggerCoordinatorGauges(workflows, readers func() int64)replaces the twoUpdateTriggerCoordinator*Gaugemethods. Metric names and labels are unchanged, so dashboards need no change.triggers.coordinator: registers the callback on start, unregisters it on close, and only does atomic adds on the hot path (defer c.readersGauge.Add(-1)in each reader).Metrics only: trigger reading and execution are unchanged.
Tests
TestCoordinator_Gauges: the gauges read 0 on an idle coordinator. It registers one workflow with three triggers and waits on unbuffered channel sends until every reader is in its read loop, so there are no sleeps or polling windows. Then it checks the gauges read 1 workflow and 3 readers, and that both return to 0 after unregistering. It fails every time with the original bug, and passed 200/200 runs with-race.TestCoordinator_GaugesStopOnClose: a closed coordinator stops reporting.monitoring_test.gonow uses the callback.Requires
None.
Supports
None.
Deployment Validation Steps
platform_trigger_coordinator_readersper node should be at leastplatform_trigger_coordinator_workflows, since each workflow has one or more triggers. Nodes with no coordinated workflows should report 0 for both.