|
13 | 13 | import logging |
14 | 14 | import re |
15 | 15 | import time |
16 | | -import traceback |
17 | 16 | import uuid |
18 | 17 | from collections import OrderedDict |
19 | 18 | from threading import Lock |
|
92 | 91 | SQLSTATE_CONNECTION_NOT_EXISTS, |
93 | 92 | SQLSTATE_CONNECTION_REJECTED, |
94 | 93 | SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED, |
95 | | - SQLSTATE_IO_ERROR, |
96 | 94 | ) |
97 | | -from .telemetry_oob import TelemetryService |
98 | 95 | from .time_util import ( |
99 | 96 | DEFAULT_MASTER_VALIDITY_IN_SECONDS, |
100 | 97 | TimeoutBackoffCtx, |
@@ -230,14 +227,6 @@ def raise_failed_request_error( |
230 | 227 | method: str, |
231 | 228 | response: Response, |
232 | 229 | ) -> None: |
233 | | - TelemetryService.get_instance().log_http_request_error( |
234 | | - f"HttpError{response.status_code}", |
235 | | - url, |
236 | | - method, |
237 | | - SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED, |
238 | | - ER_FAILED_TO_REQUEST, |
239 | | - response=response, |
240 | | - ) |
241 | 230 | Error.errorhandler_wrapper( |
242 | 231 | connection, |
243 | 232 | None, |
@@ -902,32 +891,8 @@ def _request_exec_wrapper( |
902 | 891 | if return_object is not None: |
903 | 892 | return return_object |
904 | 893 | self._handle_unknown_error(method, full_url, headers, data, conn) |
905 | | - TelemetryService.get_instance().log_http_request_error( |
906 | | - "HttpRequestUnknownError", |
907 | | - full_url, |
908 | | - method, |
909 | | - SQLSTATE_IO_ERROR, |
910 | | - ER_FAILED_TO_REQUEST, |
911 | | - retry_timeout=retry_ctx.timeout, |
912 | | - retry_count=retry_ctx.current_retry_count, |
913 | | - ) |
914 | 894 | return {} |
915 | 895 | except RetryRequest as e: |
916 | | - if ( |
917 | | - retry_ctx.current_retry_count |
918 | | - == TelemetryService.get_instance().num_of_retry_to_trigger_telemetry |
919 | | - ): |
920 | | - TelemetryService.get_instance().log_http_request_error( |
921 | | - "HttpRequestRetry%dTimes" % retry_ctx.current_retry_count, |
922 | | - full_url, |
923 | | - method, |
924 | | - SQLSTATE_IO_ERROR, |
925 | | - ER_FAILED_TO_REQUEST, |
926 | | - retry_timeout=retry_ctx.timeout, |
927 | | - retry_count=retry_ctx.current_retry_count, |
928 | | - exception=str(e), |
929 | | - stack_trace=traceback.format_exc(), |
930 | | - ) |
931 | 896 | cause = e.args[0] |
932 | 897 | if no_retry: |
933 | 898 | self.log_and_handle_http_error_with_cause( |
@@ -1001,17 +966,6 @@ def log_and_handle_http_error_with_cause( |
1001 | 966 | ) -> None: |
1002 | 967 | cause = e.args[0] |
1003 | 968 | logger.error(cause, exc_info=True) |
1004 | | - TelemetryService.get_instance().log_http_request_error( |
1005 | | - "HttpRequestRetryTimeout" if timed_out else f"HttpRequestError: {cause}", |
1006 | | - full_url, |
1007 | | - method, |
1008 | | - SQLSTATE_IO_ERROR, |
1009 | | - ER_FAILED_TO_REQUEST, |
1010 | | - retry_timeout=retry_timeout, |
1011 | | - retry_count=retry_count, |
1012 | | - exception=str(e), |
1013 | | - stack_trace=traceback.format_exc(), |
1014 | | - ) |
1015 | 969 | if isinstance(cause, Error): |
1016 | 970 | Error.errorhandler_wrapper_from_cause(conn, cause) |
1017 | 971 | else: |
@@ -1149,15 +1103,6 @@ def _request_exec( |
1149 | 1103 | raw_ret.close() # ensure response is closed |
1150 | 1104 | except SSLError as se: |
1151 | 1105 | logger.debug("Hit non-retryable SSL error, %s", str(se)) |
1152 | | - TelemetryService.get_instance().log_http_request_error( |
1153 | | - "CertificateException%s" % str(se), |
1154 | | - full_url, |
1155 | | - method, |
1156 | | - SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED, |
1157 | | - ER_FAILED_TO_REQUEST, |
1158 | | - exception=se, |
1159 | | - stack_trace=traceback.format_exc(), |
1160 | | - ) |
1161 | 1106 |
|
1162 | 1107 | except ( |
1163 | 1108 | BadStatusLine, |
@@ -1190,15 +1135,6 @@ def _request_exec( |
1190 | 1135 | ) |
1191 | 1136 | raise RetryRequest(err) |
1192 | 1137 | except Exception as err: |
1193 | | - TelemetryService.get_instance().log_http_request_error( |
1194 | | - "HttpException%s" % str(err), |
1195 | | - full_url, |
1196 | | - method, |
1197 | | - SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED, |
1198 | | - ER_FAILED_TO_REQUEST, |
1199 | | - exception=err, |
1200 | | - stack_trace=traceback.format_exc(), |
1201 | | - ) |
1202 | 1138 | raise err |
1203 | 1139 |
|
1204 | 1140 | def make_requests_session(self) -> Session: |
|
0 commit comments