Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most fields in /v2/org/agents are nil #28

Closed
smarthall opened this issue Sep 5, 2018 · 7 comments
Closed

Most fields in /v2/org/agents are nil #28

smarthall opened this issue Sep 5, 2018 · 7 comments

Comments

@smarthall
Copy link

So suddenly this morning the go-buildkite library randomly stopped working. The issue appears as most fields in the agent list appearing as nil.

curl -s -H 'Authorization: Bearer <token>' "https://api.buildkite.com/v2/organizations/org/agents" - worked
curl -s -H 'Authorization: Bearer <token>' --user-agent 'go-buildkite/2.0.0' "https://api.buildkite.com/v2/organizations/org/agents" - was missing information

It looks like the server is sending a different response when the user agent is go-buildkite/2.0.0, not sure why that would be, but I assume you have your reasons.

That said I thought I was using v2.1.0 of the library!

Then I found this: https://github.com/buildkite/go-buildkite/blob/v2.1.0/buildkite/version.go

It looks like the version number wasn't updated in the latest release.

So, can we please get a new release of go-buildkite with a working user agent? The one in master seems fine ...

@JensRantil
Copy link

I experienced this last week, too. It took me at least an hour to figure out that the API was User-Agent dependent.

Firstly, I think that's very bad-practise from an API standpoint. That said, I propose that at least

userAgent = "go-buildkite/" + Version
doesn't default to something yielding a limited subset of fields.

Workaround is to change

UserAgent string
(UserAgent) to something specific to you.

@smarthall Your description above is actually two issues; One regarding nil fields, and another regarding version not set correctly for the library. Could you please create a separate issue (and update description) for the version issue?

@toolmantim
Copy link
Contributor

Sorry we never commented here about the change in returned data! Unfortunately the agent metrics tool, which uses this library, was causing a disruptive amount of load. It also didn’t set a custom user agent.

In order to stop service problems, we had to selectively return JSON fields for the existing agent metrics daemons based on a generic user agent pattern used here. It won’t happen for future versions, and setting a different user agent is the workaround for now.

Sorry for missing this issue, and the problems it might have caused you!

@lox
Copy link
Contributor

lox commented Feb 3, 2019

Firstly, I think that's very bad-practise from an API standpoint.

Apologies folks! We totally agree that user-agent specific behaviour is terrible and would avoid it at almost any cost. 😢 We should have done a better job of documenting this nuance in this library.

@JensRantil
Copy link

JensRantil commented Feb 4, 2019

Have you set a custom user-agent on all new agents installed now?

@toolmantim
Copy link
Contributor

Yep, that was done in buildkite/buildkite-agent-metrics#34

@nhooyr
Copy link

nhooyr commented Feb 12, 2019

Could you guys cut a new release for 9d8a7ff

Would prefer to not have to use master.

@lox
Copy link
Contributor

lox commented Feb 14, 2019

We've cut a new release for v2.2.0. I'm going to close this as it shouldn't happen with more recent user agents!

@lox lox closed this as completed Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants