Skip to content

Set gRPC user-agent when calling google APIs - #216

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

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

Conversation

@aabmass

@aabmass aabmass commented Nov 16, 2022

Copy link
Copy Markdown
Collaborator

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

@punya punya left a comment

Copy link
Copy Markdown
Contributor

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

aabmass commented Nov 17, 2022

Copy link
Copy Markdown
Collaborator Author

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

punya commented Nov 17, 2022

Copy link
Copy Markdown
Contributor

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

aabmass commented Nov 30, 2022

Copy link
Copy Markdown
Collaborator Author

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

@aabmass
aabmass requested review from dashpole and punya December 5, 2022 16:22

@punya punya left a comment

Copy link
Copy Markdown
Contributor

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