Skip to content

Agnosticize integrations HTTP error handling (batch 1 of 3)#24546

Open
mwdd146980 wants to merge 3 commits into
mwdd146980/http-agnostic-protocol-surfacefrom
mwdd146980/agnosticize-integrations-batch-a
Open

Agnosticize integrations HTTP error handling (batch 1 of 3)#24546
mwdd146980 wants to merge 3 commits into
mwdd146980/http-agnostic-protocol-surfacefrom
mwdd146980/agnosticize-integrations-batch-a

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 first 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:

  • activemq_xml, ambari, arangodb, citrix_hypervisor, cloud_foundry_api, consul, control_m, couch, couchbase, druid, ecs_fargate, elastic, envoy

The backend stays requests. Behavior is unchanged. This is part of the migration to a backend-agnostic HTTP layer and stacks 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

Narrow self.http catch sites to backend-agnostic http_exceptions and swap
interception-path tests to the agnostic surface for: activemq_xml, ambari,
arangodb, citrix_hypervisor, cloud_foundry_api, consul.
Same agnosticization for: control_m, couch, couchbase, druid, ecs_fargate,
elastic, envoy.
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 79.59%
Overall Coverage: 91.46% (+3.08%)

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

…eview)

Address review findings on #24546 where narrowed catch sites changed
behavior versus master:

- couchbase: the agnostic ResponseWrapper.json() raises a stdlib
  json.JSONDecodeError (ValueError), not an HTTPError, so a 200 with a
  non-JSON body escaped `except HTTPError` and aborted the run. Master
  caught it via the broad RequestException. Also catch json.JSONDecodeError
  at the three sync-gateway/query-monitoring/index-stats sites.
- activemq_xml: ConnectTimeout translates to HTTPTimeoutError (a sibling of
  HTTPConnectionError), so connect timeouts escaped `except
  HTTPConnectionError` and defeated suppress_errors. Catch HTTPTimeoutError
  as well.
- druid: add explicit parametrize ids to the can-connect failure test.
@mwdd146980 mwdd146980 marked this pull request as ready for review July 14, 2026 17:52
@mwdd146980 mwdd146980 requested review from a team as code owners July 14, 2026 17:52
@mwdd146980 mwdd146980 changed the title Agnosticize integrations HTTP error handling (batch A) Agnosticize integrations HTTP error handling (batch 1 of 3) Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b445464b01

ℹ️ 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".

Comment thread citrix_hypervisor/datadog_checks/citrix_hypervisor/check.py
Comment thread couchbase/datadog_checks/couchbase/couchbase.py

@sarah-witt sarah-witt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you bump the minimum checks base requirement for these integrations?

Comment thread cloud_foundry_api/changelog.d/22676.fixed
@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 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