ashb commented on a change in pull request #4309: [AIRFLOW-3504] Extend/refine
the functionality of "/health" endpoint
URL: https://github.com/apache/incubator-airflow/pull/4309#discussion_r242840957
##########
File path: airflow/www/blueprints.py
##########
@@ -32,6 +35,22 @@ def index():
@routes.route('/health')
def health():
- """ We can add an array of tests here to check the server's health """
- content = Markup(markdown.markdown("The server is healthy!"))
- return content
+ session = settings.Session()
+ DM = models.DagModel
+ payload = {}
+
+ payload['webserver'] = "The server is healthy!"
+
+ payload['database'] = "available"
+ try:
+ session.query(DM).count()
+ except Exception as _:
+ payload['database'] = "unavailable"
Review comment:
I can see arguments both ways, but which ever we choose needs to be clearly
documented, and also probably make it clear this is not designed to be hooked
up to a Kubernetes healthcheck (as it will never return anything other than
200< so won't ever "fail" as far as kube is concerned)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services