-
Notifications
You must be signed in to change notification settings - Fork 113
Add retry mechanism to telemetry requests #617
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: telemetry
Are you sure you want to change the base?
Conversation
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
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.
Pull Request Overview
Adds a retry mechanism to telemetry requests by integrating a custom HTTP adapter and retry policy, updates client methods to use a session with retries, and adjusts tests accordingly.
- Introduce TelemetryHTTPAdapter to apply DatabricksRetryPolicy before each request
- Update TelemetryClient to use requests.Session with mounted retry adapter and replace direct requests.post
- Adjust unit and E2E tests to mock Session.post and verify retry behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/unit/test_telemetry.py | Updated mocks and assertions to patch and verify Session.post calls |
tests/e2e/test_telemetry_retry.py | New E2E tests for retry scenarios, mocking HTTPSConnectionPool |
src/databricks/sql/telemetry/telemetry_client.py | Added TelemetryHTTPAdapter, retry policy setup, session usage, session close, and log level tweak for uninitialized client |
src/databricks/sql/exc.py | Removed top‐level telemetry import and added a lazy import inside the constructor |
Comments suppressed due to low confidence (2)
src/databricks/sql/telemetry/telemetry_client.py:438
- The fallback log when the client isn’t initialized is set to debug, which may suppress important errors; consider using warning level to surface misconfiguration.
logger.debug(
src/databricks/sql/telemetry/telemetry_client.py:203
- [nitpick] Currently the retry adapter is only mounted for HTTPS; if future tests or endpoints use HTTP, consider mounting on "http://" as well to ensure consistency.
self._session.mount("https://", adapter)
Signed-off-by: Sai Shree Pradhan <[email protected]>
What type of PR is this?
Description
Retry mechanism for telemetry requests
How is this tested?
Related Tickets & Documents
PECOBLR-586