-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Catch agnostic HTTP error types in yarn and swap the SSL test #24281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mwdd146980/httpx-migration-base
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Catch the backend-agnostic HTTP error types when querying the YARN ResourceManager API so the check stays correct after the httpx migration. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,13 @@ | |
|
|
||
| from datadog_checks.base import AgentCheck, is_affirmative | ||
| from datadog_checks.base.errors import ConfigurationError | ||
| from datadog_checks.base.utils.http_exceptions import ( | ||
| HTTPConnectionError, | ||
| HTTPInvalidURLError, | ||
| HTTPSSLError, | ||
| HTTPStatusError, | ||
| HTTPTimeoutError, | ||
| ) | ||
|
|
||
| # Default settings | ||
| DEFAULT_RM_URI = 'http://localhost:8088' | ||
|
|
@@ -472,7 +479,7 @@ def _rest_request_to_json(self, url, object_path, tags, *args, **kwargs): | |
| response.raise_for_status() | ||
| response_json = response.json() | ||
|
|
||
| except Timeout as e: | ||
| except (Timeout, HTTPTimeoutError) as e: | ||
| self.service_check( | ||
| SERVICE_CHECK_NAME, | ||
| AgentCheck.CRITICAL, | ||
|
|
@@ -481,7 +488,16 @@ def _rest_request_to_json(self, url, object_path, tags, *args, **kwargs): | |
| ) | ||
| raise | ||
|
|
||
| except (HTTPError, InvalidURL, ConnectionError, SSLError) as e: | ||
| except ( | ||
| HTTPError, | ||
| InvalidURL, | ||
| ConnectionError, | ||
| SSLError, | ||
| HTTPStatusError, | ||
| HTTPInvalidURLError, | ||
| HTTPConnectionError, | ||
| HTTPSSLError, | ||
|
Comment on lines
+496
to
+499
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the check runs with the httpx2 backend and httpx raises a protocol/generic request failure, the wrapper maps it to Useful? React with 👍 / 👎. |
||
| ) as e: | ||
| self.service_check( | ||
| SERVICE_CHECK_NAME, | ||
| AgentCheck.CRITICAL, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entry describes restoring correct behavior after the httpx migration, but
.changedentries are reserved for breaking/significant changes and bump the integration's major version per the repo instructions. Shipping this aschangedcan publish an unnecessary major YARN release; please use a.fixedentry for this patch-level compatibility fix.Useful? React with 👍 / 👎.