buildkite / buildkite-agent-metrics

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

Metrics are not sending to specific region #281

Closed jtran0721 closed 3 months ago

jtran0721 commented 3 months ago

Hi, I would like some help with sending metrics to different region rather than us-east-1. I ran this command

docker run -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_DEFAULT_REGION="ap-southeast-1" --rm bk-agent-metrics -token $token -interval 30s -queue mac:build -backend cloudwatch -cloudwatch-region "ap-southeast-1”

I couldn't see metrics in "ap-southeast-1" but they exist in "us-east-1". Do you know why is this happening?

Thank you

DrJosh9000 commented 3 months ago

Hi @jtran0721, I think you found a bug!

https://github.com/buildkite/buildkite-agent-metrics/blob/7ffd2908b482274286e01b8f9dce899707ee9ff8/main.go#L75-L81

Since you're passing -cloudwatch-region, region != "", so the code ends up in the else, which overrides it with us-east-1. That's pretty clearly wrong, and has been since that code was added!