-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
transport: re-think user agents - change from replace to prepend? #494
Comments
Worth mentioning that with the current setup, there is an inherent difference between calling |
Also related: #320. |
As the author of #320, I am in favor of prepending and not allowing replacement. |
I am wondering why we don't use the User-Agent in the caller's request. Below is an example from iamcredentials/v1/iamcredentials-gen.go.
The caller can specify c.header_.UserAgent. But it's abandoned. Can we make it something like
|
@wyuan1704 are you referring to if you had used c := s.Method()
c.Header().Set("User-Agent", "...")
resp, err := c.Do() ? |
Hi Chris, We have a user case in GKE. In a GKE cluster, customers can run multiple pods. Let's say POD1 has UserAgent POD1-UA. POD1 makes requests to a system daemon-set DS1 to get something. DS1 has UserAgent DS1-UA. DS1 uses google-api-go-client to makes requests to a google internal service SRV1. At SRV1 side, they want to know POD1-UA, which is the real end clients, so that they do some analysis. Why not collect data at DS1? The logs belong to individual cluster and are not centralized. If using metrics, its cardinality is unbounded. |
@broady What do you think about my last comment? Thanks. |
Side note: if a custom HTTP client is provided the user agent isn't used.
|
Currently, we allow users to set the User-Agent header via the
WithUserAgent
client option.There's also the "UserAgent" field in the JSON/REST generated clients (this repo) which is appended to the default user agent (
googleapi.UserAgent
).This option sets the User-Agent in its entirety, which means the client doesn't send its default User-Agent. It also makes it a bit more difficult for intermediary libraries to allow their users to set the User-Agent (think about a terraform library, for instance, you could end up with three user agents: end user, terraform, api client).
We might need some way to prepend user agent strings.
Questions:
see PR #490
google-api-go-client/transport/http/dial.go
Lines 144 to 147 in 8ecc69f
The text was updated successfully, but these errors were encountered: