[python] Add SDK version to REST User-Agent - #10106
hutiefang76 wants to merge 3 commits into
Conversation
JingsongLi
left a comment
There was a problem hiding this comment.
The linked #8543 is a concrete observability need, and the default version string now reaches real REST requests. I ran the four affected Python suites: 41 tests passed after allowing the local REST test server to bind its port. I also checked the prepared HTTP request, not only the in-memory header map.
[P2] Preserve explicitly configured User-Agent regardless of header casing. HTTP header names are case-insensitive, but base_headers.setdefault("User-Agent", ...) and PVFS's options.contains("header.User-Agent") are exact-case checks. With a valid configuration header.user-agent=custom-client/1.0, RESTApi keeps both user-agent: custom-client/1.0 and User-Agent: PyPaimon/...; requests.Session.prepare_request(...) sends the latter, silently overriding the explicit value. PVFS also inserts both keys. This violates the preservation requirement in #8543. Please detect existing User-Agent headers case-insensitively (also after REST config merge) and add a test that inspects a prepared request for a lowercase configured key.
Requirement fit: SUPPORTED. Requesting changes for the configuration contract before production use.
|
Addressed the case-insensitive The latest CI's flake8 check passes. Python Tests and Native CI still report the same two failures in |
|
Synced with master in d615576 to pick up the merged #10169 fix for the unrelated interval-partition CI failure. The targeted User-Agent, build-info, REST, PVFS and interval-partition tests pass locally (39 tests), and flake8 passes with the project config. The local Ray integration case was excluded because Ray is not installed. Fresh CI is now pending. |
What is changed
Adds PyPaimon and Python version information to the default REST User-Agent. PVFS uses the standard
header.User-Agentkey and adds itsPythonPVFSprefix without replacing an explicitly configured value.The REST client now treats configured User-Agent keys case-insensitively, so
header.user-agentis respected even when a request is prepared byrequests. An explicit server override takes precedence over a client value, followed by server defaults and the SDK default. PVFS applies the same case-insensitive check before adding its own value.Version metadata that cannot be read or parsed falls back to
unknown, so requests continue normally.Verification
user_agent_test.py,build_info_test.py,rest/api_test.py, andpvfs_oss_filesystem_test.py, including prepared-request and precedence regressions.Closes #8543