kruize / autotune

Autonomous Performance Tuning for Kubernetes!
Apache License 2.0
165 stars 54 forks source link

Datasource Exception Handler #1367

Closed msvinaykumar closed 1 week ago

msvinaykumar commented 1 week ago

Description

Datasource exceptions are being suppressed, preventing notification to the caller. To address this, I made some changes across several files. Next, I plan to create a custom DatasourceException class to specifically handle datasource-related exceptions. This class will help determine if an exception occurred during /up metrics retrieval, fetching metadata at the namespace, workload, or container level, or while obtaining specific metrics

This PR improves error handling for Datasource connections by addressing the suppression of exceptions like SocketTimeoutException and ConnectTimeoutException. These exceptions will now be rethrown, enabling the REST API to return appropriate HTTP status codes:

504 Gateway Timeout: For requests that time out while waiting for a response. 503 Service Unavailable: For connections that cannot be established to the Datasource.

Fixes # (issue)

Type of change

How has this been tested?

Please describe the tests that were run to verify your changes and steps to reproduce. Please specify any test configuration required.

Test Configuration

Checklist :dart:

Additional information

Include any additional information such as links, test results, screenshots here