question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Airflow health API is returning always 200

See original GitHub issue

Apache 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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
mik-lajcommented, Apr 11, 2022

I agree. We can add separate health checks for other components that will be independent of the webserver.

1reaction
michaelmichealcommented, Apr 20, 2022

Feel free to assign this to me, I can start by adding a healthcheck endpoint to the scheduler

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checking Airflow Health Status - Apache Airflow
The response code of "/health" endpoint is not used to label the health status of the application (it would always be 200). Hence...
Read more >
AirFlow sends exception wrapped with HTTP 200 OK
This is the intended behavior, assuming that you're using the 'get DAG run' endpoint. You should reference the state field that is returned....
Read more >
Google Cloud metrics - Monitoring
The "total" latency type will always be populated. ... k8s_container, Total number of faults returned by the Apigee server application.
Read more >
Release Notes - Apache Airflow documentation - Amazon AWS
Always return a response in TI's action_clear view (#15980) ... Add airflow jobs check CLI command to check health of jobs (Scheduler etc)...
Read more >
Using Ansible to interact with web endpoints | Enable Sysadmin
I'm always looking for clever things to do with Ansible. ... Checks to ensure that a health check API endpoint returns an HTTP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found