You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/11 07:20:11 UTC

[GitHub] [airflow] gitruhul opened a new issue, #22895: Airflow health API is returning always 200

gitruhul opened a new issue, #22895:
URL: https://github.com/apache/airflow/issues/22895

   ### 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](https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/check-health.html?msclkid=33d4cc33b96611ec8aea45c673e864e7) 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
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094708235

   We should create a NEW health endpoint for that not change the existing one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] mik-laj closed issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
mik-laj closed issue #22895: Airflow health API is returning always 200
URL: https://github.com/apache/airflow/issues/22895


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] gitruhul commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
gitruhul commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094652723

   Creating a template for the health response will help with different standards. 
   
   For example, some organizations prefer health responses as 
   
   ```
   {
   "status": "unhealth",
   "results": {
   	"metadatabase": {
   		"status": "healthy"
   	},
   	"scheduler": {
   		"latest_scheduler_heartbeat": "2022-04-07T13:13:41.102804+00:00",
   		"status": "unhealthy"
   	}
   }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1095053074

   As mentioned elsevhere - I believe each of our components should have a health endpoint (HTTP) - even if currently only webserver implements API.
   
   I know there are differing opinions on that, but having a standardized /health check (that you can call over the HTTP) and returns "200 OK" when component is ready seems to be the only universal approach that we can use. 
   
   And yes it means that you have to have a "small" webserver running in each component (but this is almost no resources if we use the built-in http python server). 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] rbiegacz commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
rbiegacz commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1102759720

   Indeed, it would be great to have other API-based methods for checking the health of other components (e.g. Scheduler).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094709511

   @uranusjr is right - this is a breaking change and changing it to fit someone's standard (even if it's a reasonable and desired state) does not justify breaking existing endpoint's behaviour.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] gitruhul commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
gitruhul commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094663558

   Hi @uranusjr , Thanks for your response.
   Current health API is just like API ping. whereas health checks should be superior to that.
   When I see some standards (Including my organization's) the expectation was a non 200 code for an unhealthy signal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] mik-laj commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1095273375

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094642017

   Thanks for opening your first issue here! Be sure to follow the issue template!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] michaelmicheal commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
michaelmicheal commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1104129592

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] uranusjr commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094648857

   I don’t think we can change this, if we return anything other than 200 it risks breaking existing usages. Also, what would you propose using instead? Honestly 200 feels like the most appropriate code to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] mik-laj commented on issue #22895: Airflow health API is returning always 200

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #22895:
URL: https://github.com/apache/airflow/issues/22895#issuecomment-1094920008

   We shouldn't change the code when the scheduler isn't working. This endpoint should only checks health of webserver and required components - metabase. Otherwise the web server will be restarted much more often than necessary.
   
   We have a related note in doc.
   
   > For this check to work, at least one working web server is required. Suppose you use this check for scheduler monitoring, then in case of failure of the web server, you will lose the ability to monitor scheduler, which means that it can be restarted even if it is in good condition. For greater confidence, consider using [CLI Check for Scheduler](https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/check-health.html#check-health-cli-checks-for-scheduler).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org