-
Notifications
You must be signed in to change notification settings - Fork 186
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
Fix httpx.get
exception handling while emitting telemetry
#1439
Conversation
Closes: #1438 A user reported httpx raised an exception while trying to emit telemetry, leading the DAG to not being successful. This PR aims to solve the issue: ``` File "/usr/local/lib/python3.12/site-packages/cosmos/listeners/dag_run_listener.py", line 60, in on_dag_run_success telemetry.emit_usage_metrics_if_enabled(DAG_RUN, additional_telemetry_metrics) File "/usr/local/lib/python3.12/site-packages/cosmos/telemetry.py", line 73, in emit_usage_metrics_if_enabled is_success = emit_usage_metrics(metrics) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/cosmos/telemetry.py", line 50, in emit_usage_metrics response = httpx.get(telemetry_url, timeout=constants.TELEMETRY_TIMEOUT, follow_redirects=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_api.py", line 198, in get return request( ^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_api.py", line 106, in request return client.request( ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 827, in request return self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 914, in send response = self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth response = self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 979, in _send_handling_redirects response = self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1015, in _send_single_request response = transport.handle_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 232, in handle_request with map_httpcore_exceptions(): ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__ self.gen.throw(value) File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1000) ```
✅ Deploy Preview for sunny-pastelito-5ecb04 canceled.
|
httpx.get
exceptions while emitting telemetry
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.
LGTM. Thanks for the quick fix!
Deploying astronomer-cosmos with Cloudflare Pages
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1439 +/- ##
=======================================
Coverage 96.94% 96.94%
=======================================
Files 73 73
Lines 4350 4355 +5
=======================================
+ Hits 4217 4222 +5
Misses 133 133 ☔ View full report in Codecov by Sentry. |
httpx.get
exceptions while emitting telemetryhttpx.get
exception handling while emitting telemetry
Bug Fixes * Fix ``httpx.get`` exception handling while emitting telemetry by @tatiana in #1439 * Fix (not) rendering detached tests in ``TestBehavior.NONE`` and ``AFTER_ALL`` by @tatiana in #1463 * Fix detached test tasks names so they do not exceed 250 chars by @tatiana in #1464 Enhancement * Allow users to opt-in or out (default) of detached test nodes by @tatiana in #1470. Learn more about this [here](https://astronomer.github.io/astronomer-cosmos/configuration/testing-behavior.html). Docs * Docs: Fix broken links and rendering by @pankajastro in #1437 * Update ``operator args`` docs to include ``install_deps`` by @tatiana in #1456 * Improve Cosmos ``select`` docs to include latest graph operator support by @tatiana in #1467 Others * Upgrade GitHub action artifacts upload-artifact & download-artifact to v4 by @pankajkoti in #1445 * Enable Depandabot to scan outdated Github Actions dependencies by @tatiana in #1446 * Pre-commit hook updates in #1459, #1441 * Dependabot Github action updates in #1451, #1452, #1453, #1454, #1455
I think there might be a slight regression here. Since our containers updated to cosmos 1.8.2 we have started getting the above error message and now need to set Our proxy shows we've only been trying to phone out to Reverting to 1.8.1 we do not have to set that variable and our proxy shows we aren't hitting the Worth mentioning, this is only affecting our airflow scheduler pods which are crash looping because of the SSL error. |
Closes: #1438
A user reported httpx raised an exception while trying to emit telemetry, leading the DAG to not being successful. This PR aims to solve the issue: