Forward instance config (auth, TLS, timeout, proxy, headers) to HTTPXWrapper#22705
Forward instance config (auth, TLS, timeout, proxy, headers) to HTTPXWrapper#22705mwdd146980 wants to merge 1 commit intomwdd146980/phase2-httpx-wrapperfrom
Conversation
|
✨ Fix all issues with BitsAI or with Cursor
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39234c0c01
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if config['username'] is not None: | ||
| auth = httpx.DigestAuth(config['username'], config['password'] or '') | ||
| elif auth_type == 'kerberos': | ||
| from datadog_checks.base.utils.httpx_auth import KerberosAuth |
There was a problem hiding this comment.
Ship httpx_auth before enabling Kerberos/NTLM in HTTPXWrapper
When use_httpx: true is combined with auth_type: kerberos or auth_type: ntlm, this code imports datadog_checks.base.utils.httpx_auth, but that module is not present in this repository tree (datadog_checks_base/datadog_checks/base/utils/ has no httpx_auth module). That means client construction fails with ModuleNotFoundError at runtime for those auth modes, so checks cannot start with those configurations.
Useful? React with 👍 / 👎.
| if config['username'] is not None: | ||
| auth = httpx.BasicAuth(config['username'], config['password'] or '') |
There was a problem hiding this comment.
Require both username and password for basic auth
This enables BasicAuth whenever username is set and silently substitutes an empty string for a missing password. RequestsWrapper only enables basic auth when both username and password are provided, so on the HTTPX path a partially configured instance now sends an Authorization header that was previously omitted, which can cause unexpected authentication failures (for example, 401s) when use_httpx is turned on.
Useful? React with 👍 / 👎.
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
39234c0 to
baef5ae
Compare
d4075a6 to
df634c5
Compare
baef5ae to
f3d3b4d
Compare
c95925b to
cdd0d69
Compare
f3d3b4d to
db8c5bd
Compare
db8c5bd to
77875b8
Compare
cdd0d69 to
654cd59
Compare
77875b8 to
ce64c85
Compare
654cd59 to
6cc127d
Compare
…Wrapper - Add _build_httpx_client() that reads instance/init_config with the same field names, remapper, and priority rules as RequestsWrapper - Update HTTPXWrapper.__init__ to accept (instance, init_config, remapper, logger) instead of a pre-built httpx.Client - Update AgentCheck.http property to pass instance config through - Wire basic/digest auth, TLS verify/cert, timeouts, headers, redirects, and proxy mounts; skip_proxy disables trust_env - Update test_http_httpx.py and test_http_backend_equivalence.py for the new constructor; add TestBuildHttpxClient config-parity tests - Add test_config_httpx to nginx unit tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6cc127d to
3cf3aa0
Compare
ce64c85 to
3901269
Compare

Summary
_build_httpx_client()that reads instance/init_config with the same field names, remapper, and priority rules asRequestsWrapperHTTPXWrapper.__init__to accept(instance, init_config, remapper, logger)instead of a pre-builthttpx.Clientskip_proxydisablestrust_envAgentCheck.httpproperty to pass instance config through toHTTPXWrapperTestBuildHttpxClientconfig-parity tests andtest_config_httpxto nginx unit testsTest plan
ddev test datadog_checks_base -- tests/base/utils/http/test_http_httpx.py -vddev test datadog_checks_base -- tests/base/utils/http/test_http_backend_equivalence.py -vddev test nginx -- tests/test_unit.py -v🤖 Generated with Claude Code