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.get etc. get instrumented #2011

Closed

Conversation

dmontagu
Copy link

@dmontagu dmontagu commented Oct 20, 2023

Description

This closes #1742 — "httpx instrumentation doesn't work for httpx.get, httpx.post, etc.".

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.

Fixes #1742

Type of change

I am not sure if it counts as a feature or bug fix. I'm sure it could be argued both ways, but I decided to call it a bug fix.

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

How Has This Been Tested?

I made this change and confirmed that it caused spans from the HTTPX instrumentation to be nested properly in my observability backend. I can add tests with a bit of guidance about where to look/modify/what would be desired. But I'd like to get confirmation that this is likely to be accepted before putting in the effort.

Does This PR Require a Core Repo Change?

  • 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

I don't think a documentation change is necessary; I'll update changelogs after adding unit tests once confirmed this is desirable.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dmontagu / name: David Montague (fa69a65)
  • ✅ login: xrmx / name: Riccardo Magliocchetti (e3353ac)

@rbagd
Copy link
Contributor

rbagd commented Apr 24, 2024

Could this patch be considered for merging? We hit this gap in instrumentation in our deployments which relied on httpx.request method.

@xrmx
Copy link
Contributor

xrmx commented Apr 26, 2024

At least a CHANGELOG entry is required.

@aabmass
Copy link
Member

aabmass commented Apr 26, 2024

Possibly related to #2364 cc @jeremydvoss

I can add tests with a bit of guidance about where to look/modify/what would be desired. But I'd like to get confirmation that this is likely to be accepted before putting in the effort.

I would accept this PR with a test 😄

@xrmx
Copy link
Contributor

xrmx commented May 30, 2024

Closing as superseded by #2538

@xrmx xrmx closed this May 30, 2024
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.
4 participants