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

Ensure httpx non-client methods are instrumented #2538

Merged
merged 5 commits into from
May 30, 2024

Conversation

rbagd
Copy link
Contributor

@rbagd rbagd commented May 21, 2024

Description

This is an update of previous MR for which the original author unfortunately didn't submit the updates required for merging into main. We actively use this instrumentation and this instrumentation gap is quite annoying to deal with.

Quote from MR

The httpx.get, httpx.post, etc. methods ultimately use httpx._api.request, which makes instantiates httpx._api.Client. But httpx.Client is modified during instrumentation without updating the value imported in the httpx._api module.

Fixing this was as easy as also patching the Client value in httpx._api.

All credit for the fix goes to @dmontagu.

Fixes #1742

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit test which tests instrumentation of various ways to make a request in httpx without httpx.Client. Uninstrumentation is also tested.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented May 21, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@rbagd rbagd requested a review from a team as a code owner May 21, 2024 17:33
@rbagd
Copy link
Contributor Author

rbagd commented May 21, 2024

@aabmass @xrmx As you were involved in the original MR, could you take a look at this one please?

@xrmx
Copy link
Contributor

xrmx commented May 21, 2024

If you want to share credits you can add a "Co-authored-by: <email>" in a commit message

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

Other than the CHANGELOG nit, LGTM

@rbagd
Copy link
Contributor Author

rbagd commented May 21, 2024

If you want to share credits you can add a "Co-authored-by: <email>" in a commit message

It was a great idea until I tried to implement it by looking at the previous MR (+ .patch) for the author's e-mail, except that it's a hidden github e-mail which doesn't have the CLA signed. 🤣 Let's just leave it as is, I hope I'll be forgiven. 😅

ocelotl
ocelotl previously approved these changes May 22, 2024
Copy link
Contributor

@ocelotl ocelotl left a comment

Choose a reason for hiding this comment

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

I have a question regarding a private attribute.

Copy link
Contributor

@ocelotl ocelotl left a comment

Choose a reason for hiding this comment

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

I have a question regarding a private attribute.

@ocelotl ocelotl enabled auto-merge (squash) May 30, 2024 22:45
@ocelotl ocelotl merged commit dc711e8 into open-telemetry:main May 30, 2024
314 checks passed
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.

httpx instrumentation doesn't work for httpx.get, httpx.post, etc.
3 participants