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_r242238701
##########
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:
Should this return something other than a 200 in this case? I'm not suer
what is "typical" for a health check URL.
----------------------------------------------------------------
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