You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Log RunQueries and ReportMetrics errors and the real -query-type error
Summary:
https://www.internalfb.com/monitoring/oncall_operator?board=2597931527298631&workItem=30401988492724438
Please Accept the diff and let Oncall Operator's auto-lander attempt to land it. Shipping it yourself can make you the commit's pusher, and Phabricator doesn't allow the pusher to close the post-land owner review.
---
## The issue
- Three error checks in `main.go` test the function-scope `err`, which is nil at that point, instead of the error the call just returned. A bad `-query-type` exits with `FATA <nil>`. A `RunQueries` failure (its connection could not be set up, for example an unusable `-host` or `-port`) is dropped, so the run ends with 0 queries, no error and exit 0. Every periodic (`-sample`) `ReportMetrics` failure is dropped too.
- The two goroutines also read that shared `err` while `main` writes it for the final report: `go build -race` reports a data race on every `-sample` run.
## The fix
- Log `qtypeErr`, and test `qErr` and `repErr`, the values those calls returned. The goroutines no longer touch the shared `err`, which removes the race.
- The `RunQueries` goroutine now starts with `wg.Go`, which the extra lint engine's `modernize` (`waitgroupgo`) asks for on that block. It behaves the same; it needs Go 1.25 and goose's `go.mod` is at 1.26.
- Left as is: goose still exits 0 when every connection fails to start. Making that fatal would change what callers see, so it is the owners' call.
- The unpublished stack D116776854, D116776853, D116776852 still applies on top of this (one 2-line offset), and the stacked `main.go` builds.
Reviewed By: lima1756
Differential Revision: D133170669
fbshipit-source-id: 9105590ef3f6103f7d2c0658c315e655b3d66268