Skip to content

Set gRPC user-agent when calling google APIs#216

Merged
aabmass merged 2 commits intoGoogleCloudPlatform:mainfrom
aabmass:useragents
Dec 5, 2022
Merged

Set gRPC user-agent when calling google APIs#216
aabmass merged 2 commits intoGoogleCloudPlatform:mainfrom
aabmass:useragents

Conversation

@aabmass
Copy link
Copy Markdown
Collaborator

@aabmass aabmass commented Nov 16, 2022

Fixes googleapis/python-api-core#63

Adds user-agent to gRPC calls. Note this will not work if the user overrides the client on their own.

Added an integration test which checks the actual user-agent metadata sent in gRPC requests

Comment thread opentelemetry-exporter-gcp-monitoring/tests/test_user_agent.py
@aabmass aabmass requested a review from a team November 16, 2022 23:28
Copy link
Copy Markdown
Contributor

@punya punya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to simplify this change by proposing changes to make gax and/or python-monitoring more configurable? Overriding user-agent seems like a common enough use case that they shouldn't make it this hard.

@aabmass
Copy link
Copy Markdown
Collaborator Author

aabmass commented Nov 17, 2022

I dropped a comment here googleapis/google-cloud-python#15081 (comment). What are your thoughts here in terms of submitting this vs pushing on upstream libraries @punya?

@punya
Copy link
Copy Markdown
Contributor

punya commented Nov 17, 2022

I'd like us to start by proposing the upstream change that we'd ideally want. If we encounter resistance, we should fall back to this approach.

@jsuereth and @dashpole, curious to hear your thoughts too.

@dashpole
Copy link
Copy Markdown
Contributor

I'd prefer the reverse. Make it work here, and open issues (here and upstream, if one doesn't already exist) to track making it cleaner/easier upstream.

@aabmass
Copy link
Copy Markdown
Collaborator Author

aabmass commented Nov 30, 2022

@punya @dashpole can we go ahead with this PR?

@aabmass aabmass requested review from dashpole and punya December 5, 2022 16:22
Copy link
Copy Markdown
Contributor

@punya punya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aabmass aabmass merged commit 4d581e9 into GoogleCloudPlatform:main Dec 5, 2022
@aabmass aabmass deleted the useragents branch December 5, 2022 16:57
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

Successfully merging this pull request may close these issues.

TypeError: 'float' object is not callable

3 participants