|
26 | 26 | import uuid
|
27 | 27 | import locale
|
28 | 28 |
|
29 |
| -logger = logging.getLogger(__name__) |
30 |
| - |
31 | 29 |
|
32 | 30 | class BaseTelemetryClient(ABC):
|
33 | 31 | """Abstract base class for telemetry clients."""
|
@@ -90,34 +88,23 @@ def flush(self):
|
90 | 88 |
|
91 | 89 | def _send_telemetry(self, events):
|
92 | 90 | # Send telemetry events to the server
|
93 |
| - try: |
94 |
| - request = { |
95 |
| - "uploadTime": int(time.time() * 1000), |
96 |
| - "items": [], |
97 |
| - "protoLogs": [event.to_json() for event in events], |
98 |
| - } |
99 |
| - |
100 |
| - path = "/telemetry-ext" if self.is_authenticated else "/telemetry-unauth" |
101 |
| - url = f"https://{self.host_url}{path}" |
102 |
| - |
103 |
| - headers = {"Accept": "application/json", "Content-Type": "application/json"} |
| 91 | + request = { |
| 92 | + "uploadTime": int(time.time() * 1000), |
| 93 | + "items": [], |
| 94 | + "protoLogs": [event.to_json() for event in events], |
| 95 | + } |
104 | 96 |
|
105 |
| - if self.is_authenticated and self.auth_provider: |
106 |
| - self.auth_provider.add_headers(headers) |
| 97 | + path = "/telemetry-ext" if self.is_authenticated else "/telemetry-unauth" |
| 98 | + url = f"https://{self.host_url}{path}" |
107 | 99 |
|
108 |
| - response = requests.post( |
109 |
| - url, data=json.dumps(request), headers=headers, timeout=10 |
110 |
| - ) |
| 100 | + headers = {"Accept": "application/json", "Content-Type": "application/json"} |
111 | 101 |
|
112 |
| - if response.status_code != 200: |
113 |
| - logger.debug( |
114 |
| - "Failed to send telemetry: HTTP %d - %s", |
115 |
| - response.status_code, |
116 |
| - response.text, |
117 |
| - ) |
| 102 | + if self.is_authenticated and self.auth_provider: |
| 103 | + self.auth_provider.add_headers(headers) |
118 | 104 |
|
119 |
| - except Exception as e: |
120 |
| - logger.debug("Failed to send telemetry: %s", str(e)) |
| 105 | + response = requests.post( |
| 106 | + url, data=json.dumps(request), headers=headers, timeout=10 |
| 107 | + ) |
121 | 108 |
|
122 | 109 | def close(self):
|
123 | 110 | # Flush remaining events and shut down executor
|
|
0 commit comments