feat(plugin): add urllib3 2.x support for Python 3.12+#387
Merged
Conversation
urllib3 2.x removed `urllib3.request.RequestMethods` which the existing plugin hooks. Add a new plugin `sw_urllib3_v2` that hooks `PoolManager.request` directly (the 2.x entry point). Auto-detection logic: - sw_urllib3: tries `from urllib3.request import RequestMethods`. Succeeds on 1.x, fails on 2.x (skipped). - sw_urllib3_v2: checks if `RequestMethods` exists. If yes (1.x), returns early. If no (2.x), hooks PoolManager. Both plugins share the same test directory. The test merges version vectors from both plugins' support_matrix. Verified locally on Python 3.13: - urllib3==2.3 PASSED (span validation) - urllib3==2.0 PASSED (span validation) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Author
|
As new skills are ready, I could forward the plugin support scope faster and nearly no human involved. |
kezhenxu94
approved these changes
Apr 12, 2026
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
sw_urllib3_v2plugin for urllib3 2.x, which removedurllib3.request.RequestMethodsthat the existingsw_urllib3plugin hooks.Changes
skywalking/plugins/sw_urllib3_v2.py: hooksPoolManager.request(urllib3 2.x entry point)sw_urllib3.py: add>=3.12: []to skip testing 1.x on Python 3.12+ (can't install)tests/plugin/http/sw_urllib3/test_urllib3.pymerges version vectors from both pluginsAuto-detection
Both plugins are discovered by the agent. Only one activates based on the installed urllib3 version:
sw_urllib3succeeds (importsRequestMethods).sw_urllib3_v2detects 1.x and returns early.sw_urllib3fails (ImportError, skipped).sw_urllib3_v2hooksPoolManager.request.Verified locally (Python 3.13, span data validated)
urllib3==2.3— PASSEDurllib3==2.0— PASSEDTest plan
🤖 Generated with Claude Code