Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
wants to merge 9 commits into
base: telemetry
Choose a base branch
from

Conversation

saishreeeee
Copy link
Collaborator

@saishreeeee saishreeeee commented Jun 25, 2025

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • Other

Description

Retry mechanism for telemetry requests

How is this tested?

  • Unit tests
  • E2E Tests
  • Manually
  • N/A

Related Tickets & Documents

PECOBLR-586

Signed-off-by: Sai Shree Pradhan <[email protected]>
@saishreeeee saishreeeee marked this pull request as draft June 25, 2025 06:28
@saishreeeee saishreeeee self-assigned this Jun 25, 2025
@saishreeeee saishreeeee changed the title Add retry mechanism for telemetry requests Fit and finish of telemetry (retries and server side flag integration) Jun 25, 2025
@saishreeeee saishreeeee changed the title Fit and finish of telemetry (retries and server side flag integration) Add retry mechanism to telemetry requests Jun 25, 2025
Signed-off-by: Sai Shree Pradhan <[email protected]>
@saishreeeee saishreeeee marked this pull request as ready for review June 25, 2025 12:40
@saishreeeee saishreeeee marked this pull request as draft June 26, 2025 05:06
@saishreeeee saishreeeee marked this pull request as ready for review June 27, 2025 07:14
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
Signed-off-by: Sai Shree Pradhan <[email protected]>
Copy link

@Copilot Copilot AI left a 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants