Health check for Panel applications

I was curious re: healthchecks. I am trying to deploy a Panel app, and can’t seem to use the same URL for Panel app as a healthcheck. Reason perhaps is because whenever load balancer hits that link, it causes the app to load with default parameters, and that action takes ~5-10 seconds.

Is there a fast / convenient way to introduce an extension endpoint that could just check whether my Panel server is alive ?

I am thinking to basically add a dummy Dashboard class somehow, and have it be the endpoint for healthcheck, but not sure how to implement in within Panel python code…

I have a suspicion just adding another panel_healthcheck.py and then panel serve *.py could solve it… But then I am not checking the health of the script running the dashboard, so that’s a problem.

Hi @AntonBiryukovUofC

I have not tried this but solutions I can come up with are

  1. Serve a panel .py application
  2. Serve a panel .py Template application (could be faster)
  3. Serve a static file. See Static file hosting section of https://pyviz-dev.github.io/panel/user_guide/Deploy_and_Export.html
  4. Add a rest api endpoint http://blog.holoviz.org/panel_0.10.0.html#Tranquilizer-REST-Provider.

Hope it helps. Report back what works for you if possible :slight_smile: Thanks.

1 Like

Panel also supports enabling an inbuilt REST endpoint with:

panel serve ... --rest-session-info --session-history=-1

This will record information about user sessions and serve it up at hostname:port/rest/session_info. That should provide a reasonbable liveness check.

2 Likes

Thanks everyone for suggestions, really appreciated !

I ll go with the easy route of session-history for now as a test, but adding REST point is exactly what is needed.