Skip to content

Fix metric reading race conditions

Arran Walker requested to merge ajwalker/fix-metrics-races into master

What does this MR do?

Fixes several races that occur because we have different go routines writing and reading statuses (stage, state, executor state) from the job.

Why was this MR needed?

The prometheus metric collection reads this state periodically. We also need to guard these variables for !2342 (merged).

What's the best way to test this MR?

cd commands
go test -race -run TestBuildsHelperCollect

Without the mutexes in place, running this is sure to find a race condition. If you get lucky enough that it doesn't, pass -count 100.

What are the relevant issue numbers?

closes #26787 (closed)

Edited by Steve Xuereb

Merge request reports