Skip to content

Agnosticize integrations HTTP error handling (batch 2 of 3)#24547

Merged
mwdd146980 merged 4 commits into
mwdd146980/http-agnostic-protocol-surfacefrom
mwdd146980/agnosticize-integrations-batch-b
Jul 17, 2026
Merged

Agnosticize integrations HTTP error handling (batch 2 of 3)#24547
mwdd146980 merged 4 commits into
mwdd146980/http-agnostic-protocol-surfacefrom
mwdd146980/agnosticize-integrations-batch-b

Conversation

@mwdd146980

@mwdd146980 mwdd146980 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes backend-specific requests references from the next set of integrations, leaving each on the HTTP-agnostic surface only. Per integration it narrows self.http catch sites to datadog_checks.base.utils.http_exceptions.* (no dual-catch), swaps bare from requests import ... to agnostic names, drops now-unused requests imports, and updates the interception-path tests (agnostic exceptions, MockHTTPResponse, and the mock_http/mock_openmetrics_http fixtures).

Integrations covered (batch 2 of 3): fly_io, gitlab, harbor, hdfs_datanode, hdfs_namenode, ibm_db2, kubelet, kyototycoon, mapreduce, marathon, marklogic, mesos_master.

The backend stays requests. Behavior is unchanged. This PR is based directly on #24516 for now. When #24516 is approved, it will be merged into #22676, and then this PR will be stacked on #22676.

Motivation

Checks and their tests should depend only on the agnostic HTTP surface (http_exceptions.*), never on requests-specific APIs, so the backend can later be swapped without touching consumers.

Verification

  • Touched production packages are free of requests imports/attribute use.
  • Catch sites reference only http_exceptions.*. No (RequestException, HTTPError) dual-catch remains.
  • Per-integration unit tests were run and pass in the source work. ddev test --lint is green across the touched integrations.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • 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-official

datadog-official Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7edd6bc | Docs | Datadog PR Page | Give us feedback!

@mwdd146980
mwdd146980 force-pushed the mwdd146980/agnosticize-integrations-batch-b branch from 8677a25 to 633eb98 Compare July 14, 2026 16:15
@mwdd146980
mwdd146980 changed the base branch from mwdd146980/agnosticize-integrations-batch-a to mwdd146980/http-agnostic-protocol-surface July 14, 2026 16:15
@mwdd146980 mwdd146980 changed the title Agnosticize integrations HTTP error handling (batch B) Agnosticize integrations HTTP error handling (batch 2 of 3) Jul 14, 2026
@mwdd146980
mwdd146980 marked this pull request as ready for review July 14, 2026 18:52
@mwdd146980
mwdd146980 requested review from a team as code owners July 14, 2026 18:52

@NouemanKHAL NouemanKHAL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the code!
Blocker: changelog entries should either by a .added or omitted in this PR and only generated when merging to master as this is a dev change, we only want a changelog for the user-facing changes (when merging to master)

Narrow self.http catch sites to backend-agnostic http_exceptions and swap
interception-path tests to the agnostic surface for: fly_io, gitlab, harbor,
hdfs_datanode, hdfs_namenode, ibm_db2, kubelet, kyototycoon, mapreduce,
marathon, marklogic, mesos_master.
… review)

ConnectTimeout translates to HTTPTimeoutError, a sibling of
HTTPConnectionError, so it escaped `except (HTTPStatusError,
HTTPConnectionError)` and skipped the CRITICAL connect service check that
master emitted (master caught it via requests ConnectionError). Add
HTTPTimeoutError to the catch.
… review)

The test body raises HTTPStatusError, not a requests HTTPError, so rename
test_report_node_metrics_kubernetes1_18_requests_httperror to
..._httpstatuserror. Test-only, no behavior change.
@mwdd146980
mwdd146980 force-pushed the mwdd146980/agnosticize-integrations-batch-b branch from 25fcd34 to 9f74134 Compare July 17, 2026 13:17
This PR merges into a feature branch, not master, so changelog
entries aren't needed until the feature branch itself ships.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mwdd146980
mwdd146980 requested a review from NouemanKHAL July 17, 2026 13:19
@mwdd146980
mwdd146980 merged commit 3204547 into mwdd146980/http-agnostic-protocol-surface Jul 17, 2026
44 of 63 checks passed
@mwdd146980
mwdd146980 deleted the mwdd146980/agnosticize-integrations-batch-b branch July 17, 2026 13:22
@dd-octo-sts

dd-octo-sts Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

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