File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -267,10 +267,19 @@ def request_context(
267267
268268 # Try to extract HTTP status code from the MaxRetryError
269269 http_code = None
270- if hasattr (e , "reason" ) and hasattr (e .reason , "response" ):
270+ if (
271+ hasattr (e , "reason" )
272+ and e .reason is not None
273+ and hasattr (e .reason , "response" )
274+ and e .reason .response is not None
275+ ):
271276 # The reason may contain a response object with status
272277 http_code = getattr (e .reason .response , "status" , None )
273- elif hasattr (e , "response" ) and hasattr (e .response , "status" ):
278+ elif (
279+ hasattr (e , "response" )
280+ and e .response is not None
281+ and hasattr (e .response , "status" )
282+ ):
274283 # Or the error itself may have a response
275284 http_code = e .response .status
276285
Original file line number Diff line number Diff line change @@ -171,21 +171,21 @@ class TelemetryClient(BaseTelemetryClient):
171171
172172 def __init__ (
173173 self ,
174- telemetry_enabled ,
175- session_id_hex ,
174+ telemetry_enabled : bool ,
175+ session_id_hex : str ,
176176 auth_provider ,
177- host_url ,
177+ host_url : str ,
178178 executor ,
179- batch_size ,
179+ batch_size : int ,
180180 client_context ,
181- ):
181+ ) -> None :
182182 logger .debug ("Initializing TelemetryClient for connection: %s" , session_id_hex )
183183 self ._telemetry_enabled = telemetry_enabled
184184 self ._batch_size = batch_size
185185 self ._session_id_hex = session_id_hex
186186 self ._auth_provider = auth_provider
187187 self ._user_agent = None
188- self ._events_batch = []
188+ self ._events_batch : list = []
189189 self ._lock = threading .RLock ()
190190 self ._driver_connection_params = None
191191 self ._host_url = host_url
@@ -205,9 +205,7 @@ def __init__(
205205 )
206206 else :
207207 # Circuit breaker disabled - use direct telemetry push client
208- self ._telemetry_push_client : ITelemetryPushClient = TelemetryPushClient (
209- self ._http_client
210- )
208+ self ._telemetry_push_client = TelemetryPushClient (self ._http_client )
211209
212210 def _export_event (self , event ):
213211 """Add an event to the batch queue and flush if batch is full"""
You can’t perform that action at this time.
0 commit comments