Skip to content

Where do we set the user agent in the request? #278

Closed

Description

@jgeewax

Do we set it as gcloud-java/[version] ?

Activity

  1. added
    type: questionRequest for information or clarification. Not an issue.
    on Oct 21, 2015
  2. aozarov commented on Oct 22, 2015

    @aozarov
    Contributor

    It is now hard-coded as "gcloud-java".

    Adding the version would be nice and as we already include it in the jar's manifest that would not be hard. We should probably have this logic for getting the "application name" in the core module
    as a utility or as part of the ServiceOptions.

    Note, setting it for the datastore would be a little tricky as we don't use the apiary client directly but rather use the datastore-protobuf client which does not seem to expose it. /cc @pcostell

  3. circy9 commented on Oct 22, 2015

    @circy9

    Is it possible to set a header in datastore calls?
    A separate question, do you have access to the headers of the incoming HTTP requests?

    For example, a user makes a HTTP request, say ListMyContacts, to the app and then the app makes a bunch of datastore call to handle the HTTP request. I am interested in extracting headers from this user issued HTTP request.

  4. aozarov commented on Oct 22, 2015

    @aozarov
    Contributor

    I think we will be able to set it also in the Datastore calls, but I cc @pcostell for some advice (so we will do it the right way).

    The app which uses gcloud-java could be a stand-alone, servlet, or anything else. The app does not pass any context information to the gcloud-java api and therefore we are not aware if a call is triggered by some HTTP request or have any information about it.

  5. aozarov commented on Oct 23, 2015

    @aozarov
    Contributor

    @mziccard Do you want to take care of this? Ajay has already few outstanding issues to take care of.

  6. pcostell commented on Oct 26, 2015

    @pcostell
    Contributor

    It looks like you could do this either by continuing to use the Datastore clients and override RemoteRpc.java (which then gets passed in when you create a Datastore), or you could just stop using the client (may be better long term since you replicate a lot of the work anyways for the other APIs).

  7. aozarov commented on Oct 26, 2015

    @aozarov
    Contributor

    I don't think we can override RemoteRpc.java as it is package protected.

    Right, we could avoid using the Datastore protobuf client and instead use the apiary client directly but I wonder if it is worth the effort considering the future migration to gRPC. Also, do you have this client available for v1beta3?

    /cc @ajkannan

  8. pcostell commented on Oct 26, 2015

    @pcostell
    Contributor

    Ah good point -- we could probably add some extra handling to push headers onto the call.

    If you are planning a grpc migration soon you could do that too -- v1beta3 does work with grpc.

    We have a v1beta3 implementation but it hasn't made it onto github yet. If you ping me privately I can send you a link.

  9. ajkannan commented on Oct 26, 2015

    @ajkannan

    Looking at what we use within the Datastore client, I think we could decouple gcloud-java from the Datastore client without too much effort now and then maintain it without too much additional work. It looks like we would only need to replace the functionality of the client's RemoteRpc.java, DatastoreFactory.java, Datastore.java, and DatastoreOptions.java. Most of the work in the client's DatastoreHelper.java is done by our gcloud-java-core module.

  10. ajkannan commented on Oct 27, 2015

    @ajkannan

    I spent some time trying to use the apiary client, and that necessitated a lot of superficial changes that would be more trouble than its worth, especially when merging in the v1beta3 branch. I can look into using gRPC after the v1beta3 branch is merged in and we're ready to migrate to gRPC.

  11. aozarov commented on Oct 29, 2015

    @aozarov
    Contributor

    I think we should consider #307 as a fix for this issue. I opened a separate issue, #308, for just Datastore.

  12. 14 remaining items

  13. added a commit that references this issue on Feb 1, 2023
  14. added a commit that references this issue on Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: coretype: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Sponsor
    SponsoredKunjungi sekarang
    Promo