Skip to content

Caching of auth client regressed by #705 #822

Closed

Description

@ofrobots

I believe that PR #705 regressed the earlier fix to cache the auth client I contributed in #661. This means that a new cache client is created on each API request we make, adding an unnecessary performance overhead. Here's some Cloud Trace output I get:

image

Note the extra 141ms added to this request, and every other request.

The cause is that the function makeAuthorizedRequest now passes a brand new object to util.makeRequest each time. We cache the authClient on that object, which is temporary and not available the next time through.

Would it be possible add a test for this to make sure this doesn't get regressed?

Activity

  1. stephenplusplus commented on Aug 26, 2015

    @stephenplusplus
    Contributor

    Good catch, sorry to introduce the regression. This is a good time to incorporate https://github.com/stephenplusplus/google-auto-auth into gcloud, which will cache the client for us.

  2. ofrobots commented on Aug 26, 2015

    @ofrobots
    ContributorAuthor

    Ooh, google-auto-auth looks interesting. Let me see if we can use it in @google/cloud-trace.

  3. added a commit that references this issue on Nov 11, 2022
    2ef30fa
  4. added a commit that references this issue on Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions