@@ -85,48 +85,6 @@ def get_chunk_id(self):
8585 return None
8686
8787
88- class ResultSetExtractor (TelemetryExtractor ):
89- """
90- Telemetry extractor specialized for ResultSet objects.
91-
92- Extracts telemetry information from database result set objects, including
93- operation IDs, session information, compression settings, and result formats.
94- """
95-
96- def get_statement_id (self ) -> Optional [str ]:
97- if self .command_id :
98- return str (UUID (bytes = self .command_id .operationId .guid ))
99- return None
100-
101- def get_session_id_hex (self ) -> Optional [str ]:
102- return self .connection .get_session_id_hex ()
103-
104- def get_is_compressed (self ) -> bool :
105- return self .lz4_compressed
106-
107- def get_execution_result (self ) -> ExecutionResultFormat :
108- from databricks .sql .utils import ColumnQueue , CloudFetchQueue , ArrowQueue
109-
110- if isinstance (self .results , ColumnQueue ):
111- return ExecutionResultFormat .COLUMNAR_INLINE
112- elif isinstance (self .results , CloudFetchQueue ):
113- return ExecutionResultFormat .EXTERNAL_LINKS
114- elif isinstance (self .results , ArrowQueue ):
115- return ExecutionResultFormat .INLINE_ARROW
116- return ExecutionResultFormat .FORMAT_UNSPECIFIED
117-
118- def get_retry_count (self ) -> int :
119- if (
120- hasattr (self .thrift_backend , "retry_policy" )
121- and self .thrift_backend .retry_policy
122- ):
123- return len (self .thrift_backend .retry_policy .history )
124- return 0
125-
126- def get_chunk_id (self ):
127- return None
128-
129-
13088class ResultSetDownloadHandlerExtractor (TelemetryExtractor ):
13189 """
13290 Telemetry extractor specialized for ResultSetDownloadHandler objects.
@@ -160,20 +118,17 @@ def get_extractor(obj):
160118 that can extract telemetry information from that object type.
161119
162120 Args:
163- obj: The object to create an extractor for. Can be a Cursor, ResultSet,
164- or any other object.
121+ obj: The object to create an extractor for. Can be a Cursor,
122+ ResultSetDownloadHandler, or any other object.
165123
166124 Returns:
167125 TelemetryExtractor: A specialized extractor instance:
168126 - CursorExtractor for Cursor objects
169- - ResultSetExtractor for ResultSet objects
170127 - ResultSetDownloadHandlerExtractor for ResultSetDownloadHandler objects
171128 - None for all other objects
172129 """
173130 if obj .__class__ .__name__ == "Cursor" :
174131 return CursorExtractor (obj )
175- elif obj .__class__ .__name__ == "ResultSet" :
176- return ResultSetExtractor (obj )
177132 elif obj .__class__ .__name__ == "ResultSetDownloadHandler" :
178133 return ResultSetDownloadHandlerExtractor (obj )
179134 else :
@@ -233,17 +188,6 @@ def _safe_call(func_to_call):
233188 duration_ms = int ((end_time - start_time ) * 1000 )
234189
235190 extractor = get_extractor (self )
236- print (
237- "function name" ,
238- func .__name__ ,
239- "latency" ,
240- duration_ms ,
241- "session_id_hex" ,
242- extractor .get_session_id_hex (),
243- "statement_id" ,
244- extractor .get_statement_id (),
245- flush = True ,
246- )
247191
248192 if extractor is not None :
249193 session_id_hex = _safe_call (extractor .get_session_id_hex )
0 commit comments