Skip to content

Narrow HTTP exception catches in kube_* and openstack legacy#24604

Draft
mwdd146980 wants to merge 2 commits into
mwdd146980/http-agnostic-protocol-surfacefrom
mwdd146980/http-agnostic-catch-narrowing
Draft

Narrow HTTP exception catches in kube_* and openstack legacy#24604
mwdd146980 wants to merge 2 commits into
mwdd146980/http-agnostic-protocol-surfacefrom
mwdd146980/http-agnostic-catch-narrowing

Conversation

@mwdd146980

Copy link
Copy Markdown
Contributor

What does this PR do?

Narrows the requests.exceptions.* exception catches in the five kube_* checks and the openstack_controller legacy path to the backend-agnostic HTTP exception family (datadog_checks.base.utils.http_exceptions), and drops the now-unused import requests from those modules.

  • kube_dns, kube_proxy, kube_scheduler, kube_controller_manager, kube_metrics_server: except requests.exceptions.RequestException becomes except HTTPError (the agnostic base, same breadth).
  • openstack_controller legacy: precise per-type mapping (HTTPError to HTTPStatusError, Timeout to HTTPTimeoutError, ConnectionError to HTTPConnectionError), preserving the non-requests catch members and the .response.status_code handling.

Motivation

The base branch (#24516) makes RequestsWrapper raise only the agnostic HTTPError family, never raw requests.exceptions.*. On that base these remaining requests.exceptions.* catches are dead code: the agnostic exception escapes uncaught, so the CRITICAL service check no longer fires on HTTP errors. Narrowing the catches restores that behavior and removes concrete-backend coupling from shipped integration code.

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

@dd-octo-sts

dd-octo-sts Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Validation Report

Validation Description Status
qa-label Validate the pull request declares whether it needs QA for the next Agent release

Run ddev validate all changed --fix to attempt to auto-fix supported validations.

Passed validations (20)
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
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

@datadog-datadog-prod-us1

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 88.00%
Overall Coverage: 94.95% (+6.66%)

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

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