Add logfire.instrument_urllib3() integration#1744
Open
Br1an67 wants to merge 2 commits intopydantic:mainfrom
Open
Add logfire.instrument_urllib3() integration#1744Br1an67 wants to merge 2 commits intopydantic:mainfrom
logfire.instrument_urllib3() integration#1744Br1an67 wants to merge 2 commits intopydantic:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
1b97bd1 to
adb39a4
Compare
alexmojaki
requested changes
Mar 2, 2026
Add urllib3 instrumentation support following the existing instrument_* pattern: - New integration module at logfire/_internal/integrations/urllib3.py - Method on Logfire class with excluded_urls, request_hook, response_hook, url_filter params - Public API export and logfire-api stubs - Optional dependency: opentelemetry-instrumentation-urllib3 - Documentation page and mkdocs navigation - Integration tests with mock transport Closes pydantic#1059
adb39a4 to
3ff62fa
Compare
Author
|
Thanks for the review! I've addressed both comments:
All tests pass locally. |
3ff62fa to
a44a5ed
Compare
…ch with VCR - Use RequestInfo from opentelemetry.instrumentation.urllib3 for the request_hook parameter type instead of Any - Replace monkeypatch-based HTTP mocking with pytest-recording (VCR) for more realistic test interactions - Add VCR cassette for urllib3 instrumentation test
a44a5ed to
4b30499
Compare
alexmojaki
reviewed
Mar 4, 2026
| User-Agent: | ||
| - python-urllib3/2.4.0 | ||
| method: GET | ||
| uri: https://example.org:8080/foo |
Contributor
There was a problem hiding this comment.
was this cassette written by AI instead of generated automatically by pytest? https://example.org:8080/foo doesn't return 200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
logfire.instrument_urllib3()method following the existinginstrument_*pattern, wrapping the OpenTelemetry urllib3 instrumentation.Changes
logfire/_internal/integrations/urllib3.pyinstrument_urllib3()method onLogfireclass withexcluded_urls,request_hook,response_hook, andurl_filterparametersopentelemetry-instrumentation-urllib3docs/integrations/http-clients/urllib3.mdCloses #1059