MINOR - Pass Airflow host on every failed /status call (#19022)

This commit is contained in:
Pere Miquel Brull 2024-12-13 08:14:24 +01:00 committed by GitHub
parent 79b2888bb5
commit 15e64b5a12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -287,27 +287,30 @@ public class AirflowRESTClient extends PipelineServiceClient {
if (response.statusCode() == 401 || response.statusCode() == 403) { if (response.statusCode() == 401 || response.statusCode() == 403) {
return buildUnhealthyStatus( return buildUnhealthyStatus(
String.format( String.format(
"Authentication failed for user [%s] trying to access the Airflow APIs.", "Authentication failed for user [%s] trying to access the Airflow APIs at [%s]",
this.username)); this.username, serviceURL.toString()));
} }
// APIs URL not found // APIs URL not found
if (response.statusCode() == 404) { if (response.statusCode() == 404) {
return buildUnhealthyStatus( return buildUnhealthyStatus(
String.format( String.format(
"Airflow APIs not found. Please validate if the OpenMetadata Airflow plugin is installed correctly. %s", "Airflow APIs not found at [%s]. Please validate if the OpenMetadata Airflow plugin is installed correctly. %s",
DOCS_LINK)); serviceURL.toString(), DOCS_LINK));
} }
return buildUnhealthyStatus( return buildUnhealthyStatus(
String.format( String.format(
"Unexpected status response: code [%s] - [%s]", "Unexpected status response at [%s]: code [%s] - [%s]",
response.statusCode(), response.body())); serviceURL.toString(), response.statusCode(), response.body()));
} catch (IOException | URISyntaxException e) { } catch (IOException | URISyntaxException e) {
String exceptionMsg; String exceptionMsg;
if (e.getMessage() != null) { if (e.getMessage() != null) {
exceptionMsg = String.format("Failed to get Airflow status due to [%s].", e.getMessage()); exceptionMsg =
String.format(
"Failed to get Airflow status at [%s] due to [%s].",
serviceURL.toString(), e.getMessage());
} else { } else {
exceptionMsg = exceptionMsg =
String.format( String.format(