buildkite / buildkite-agent-metrics

A command-line tool (and Lambda) for collecting Buildkite agent metrics
MIT License
66 stars 53 forks source link

fix(collector): exit on 401 when queues specified #211

Closed NotArpit closed 1 year ago

NotArpit commented 1 year ago

Context

In https://github.com/buildkite/buildkite-agent-metrics/pull/203 in //collector/collector.go we used error wrapping to exit with code 4 on a 401 response from the agent metrics API. However this was only done in the conditional branch when no queues are specified (i.e. ingest metrics for all queues). Hence when specifying a queue via -queue CLI flag, we do not get the exit on status code 401.

Intent

Exit on 401 response in the conditional branch where len(c.Queues) != 0 for parity with len(c.Queues) == 0.

Reviewers

@triarius @DrJosh9000 PTAL.