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

Add more useful header info on HTTP requests #3006

Closed
dhermes opened this issue Feb 13, 2017 · 6 comments
Closed

Add more useful header info on HTTP requests #3006

dhermes opened this issue Feb 13, 2017 · 6 comments
Assignees

Comments

@dhermes
Copy link
Contributor

dhermes commented Feb 13, 2017

Most relevant place: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/9619004959def22ad2084691f382dc1cada46afd/core/google/cloud/_http.py#L177

May want to make this easier to use upstream

/cc @lukesneeringer

@tseaver
Copy link
Contributor

tseaver commented Feb 13, 2017

Seems like we could override the USER_AGENT class attribute for the APIs which use JSONConnection, and derive it from pkg_resources (maybe add a helper for that?). E.g.:

from pkg_resources import get_distribution

from google.cloud._http import JSONConnection


class Connection(JSONConnection):
    USER_AGENT = 'google-cloud-foo-python/{0}'.format(
        get_distribution('google-cloud-foo').version)

I don't know whether the -python suffix should be there. @lukesneeringer can you confirm?

@lukesneeringer
Copy link
Contributor

lukesneeringer commented Feb 13, 2017

It is actually moving to a new header, X-Goog-API-Client, and the client library is going to be abbreviated gccl (google cloud client library).

We also intend to track the language via gl-python/{v}, which should appear at the beginning of the string. GAX already does this, but the HTTP base client will need to add it, too.

We probably still need to set a User-Agent string (just because it is considered good practice), and it does not matter what it is. google-cloud-core/{v} seems appropriate for that but I will defer to whatever you folks want (provided it is sane).

@dhermes
Copy link
Contributor Author

dhermes commented Feb 13, 2017

@lukesneeringer The value of gcloud-python used to be deemed "sacred" to preserve some reporting internal to Google. That may no longer be true.

@lukesneeringer
Copy link
Contributor

This is no longer true. The new header is superceding the old one.

@dhermes
Copy link
Contributor Author

dhermes commented Feb 17, 2017

#3035 is most of the "intellectual conceptual way" towards this

@dhermes
Copy link
Contributor Author

dhermes commented Feb 21, 2017

Remaining APIs:

  • bigquery
  • datastore
  • dns
  • error_reporting
  • language
  • logging
  • monitoring
  • pubsub
  • resource_manager
  • runtimeconfig
  • speech
  • storage
  • translate
  • vision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants