Skip to content

Commit 67a8497

Browse files
committed
added multithreaded tests, exeception handling tests
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent 380b0b9 commit 67a8497

File tree

2 files changed

+407
-9
lines changed

2 files changed

+407
-9
lines changed

src/databricks/sql/telemetry/telemetry_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class TelemetryClient(BaseTelemetryClient):
149149
# Telemetry endpoint paths
150150
TELEMETRY_AUTHENTICATED_PATH = "/telemetry-ext"
151151
TELEMETRY_UNAUTHENTICATED_PATH = "/telemetry-unauth"
152+
DEFAULT_BATCH_SIZE = 10
152153

153154
def __init__(
154155
self,
@@ -160,7 +161,7 @@ def __init__(
160161
):
161162
logger.debug("Initializing TelemetryClient for connection: %s", session_id_hex)
162163
self._telemetry_enabled = telemetry_enabled
163-
self._batch_size = 10 # TODO: Decide on batch size
164+
self._batch_size = self.DEFAULT_BATCH_SIZE # TODO: Decide on batch size
164165
self._session_id_hex = session_id_hex
165166
self._auth_provider = auth_provider
166167
self._user_agent = None
@@ -431,6 +432,9 @@ def close(session_id_hex):
431432
logger.debug(
432433
"No more telemetry clients, shutting down thread pool executor"
433434
)
434-
TelemetryClientFactory._executor.shutdown(wait=True)
435+
try:
436+
TelemetryClientFactory._executor.shutdown(wait=True)
437+
except Exception as e:
438+
logger.debug("Failed to shutdown thread pool executor: %s", e)
435439
TelemetryClientFactory._executor = None
436440
TelemetryClientFactory._initialized = False

0 commit comments

Comments
 (0)