Skip to content

Add HTTP protocol types, exception hierarchy, and MockHTTPResponse#23299

Closed
mwdd146980 wants to merge 1 commit intomasterfrom
mwdd146980/base-http-modules
Closed

Add HTTP protocol types, exception hierarchy, and MockHTTPResponse#23299
mwdd146980 wants to merge 1 commit intomasterfrom
mwdd146980/base-http-modules

Conversation

@mwdd146980
Copy link
Copy Markdown
Contributor

What does this PR do?

Add three new utility modules to datadog_checks_base:

  • http_exceptions: Transport-agnostic HTTP exception hierarchy (HTTPError, HTTPStatusError, HTTPTimeoutError, etc.)
  • http_protocol: Protocol classes defining the HTTP client interface (HTTPClientProtocol, HTTPResponseProtocol)
  • http_testing: MockHTTPResponse for use in integration tests, replacing the requests-specific MockResponse from datadog_checks_dev

These modules are purely additive and have no dependencies on existing code. They enable the ongoing httpx migration by providing library- agnostic abstractions that work with both requests and httpx backends.

Motivation

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@datadog-prod-us1-4
Copy link
Copy Markdown
Contributor

datadog-prod-us1-4 Bot commented Apr 13, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 82.82%
Overall Coverage: 87.02%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6686cd3 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 82.81938% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.54%. Comparing base (94024ce) to head (6686cd3).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add three new utility modules to datadog_checks_base:

- http_exceptions: Transport-agnostic HTTP exception hierarchy
  (HTTPError, HTTPStatusError, HTTPTimeoutError, etc.)
- http_protocol: Protocol classes defining the HTTP client interface
  (HTTPClientProtocol, HTTPResponseProtocol)
- http_testing: MockHTTPResponse for use in integration tests,
  replacing the requests-specific MockResponse from datadog_checks_dev

These modules are purely additive and have no dependencies on existing
code. They enable the ongoing httpx migration by providing library-
agnostic abstractions that work with both requests and httpx backends.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mwdd146980 mwdd146980 force-pushed the mwdd146980/base-http-modules branch from f2eaf69 to 6686cd3 Compare April 13, 2026 20:47
@dd-octo-sts dd-octo-sts Bot removed the dev_package label Apr 13, 2026
mwdd146980 added a commit that referenced this pull request Apr 13, 2026
Remaining changes from the httpx migration feature branch (#22676),
split out from the base modules PR (#23299).

Includes:
- mock_http fixture in datadog_checks_dev (pytest plugin)
- test_mock_http_patches_agentcheck test (depends on mock_http)
- AgentCheck.http property update for mock_http support
- MockResponse → MockHTTPResponse migration across ~40 test files
- vault and traefik_mesh production code updates
- OpenMetrics scraper updates for http_protocol compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Apr 13, 2026

Validation Report

Validation Status
agent-reqs
ci
codeowners
config
dep
http
imports
integration-style
jmx-metrics
labeler
legacy-signature
license-headers
licenses
metadata
models
openmetrics
package
readmes
saved-views
version

View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant