Airflow health API is returning always 200
See original GitHub issueApache Airflow version
2.2.4
What happened
The health endpoint of airflow (base_url/health) is always returning 200 in all the scenarios (healthy+unhealthy).
Same information is mentioned here that
Please keep in mind that the HTTP response code of /health endpoint should not be used to determine the health status of the application. The return code is only indicative of the state of the rest call (200 for success).
Scenario-1: (Scheduler and Metadatabase are healthy) - Status Code = 200
{
  "metadatabase": {
   "status": "healthy"
  },
  "scheduler": {
   "latest_scheduler_heartbeat": "2022-04-07T13:13:41.102804+00:00",
   "status": "healthy"
  }
}
Scenario-2: (Scheduler is unhealthy) - Status Code = 200
{
  "metadatabase": {
   "status": "healthy"
  },
  "scheduler": {
   "latest_scheduler_heartbeat": "2022-04-07T13:13:41.102804+00:00",
   "status": "unhealthy"
  }
}
The only way to get unhealthy information is by parsing the JSON response.
What you think should happen instead
The status code of scenario-2 (Something is unhealthy) should return a status code other than 200.
How to reproduce
Install airflow and hit the URL base_url/health
Operating System
Linux
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
 
Code of Conduct
- I agree to follow this project’s Code of Conduct
 
Issue Analytics
- State:
 - Created a year ago
 - Comments:11 (9 by maintainers)
 

Top Related StackOverflow Question
I agree. We can add separate health checks for other components that will be independent of the webserver.
Feel free to assign this to me, I can start by adding a healthcheck endpoint to the scheduler