Skip to main content

Health Check API for multi-thread python apps

Project description

A Health Check API Library for Multi Thread Python Apps

This library adds a health check REST API to your multithread apps. You can add decorators to your periodic running functions and library will track the function calls. This library supports multiprocessing threads. You can fetch a single overall app status by fetching http://<ip>:<port>/health or detailed statuses of all service with fetching http://<ip>:<port>/health?v


Set PY_HEALTH_CHECK_HOST and PY_HEALTH_CHECK_PORT environment variable and add the appropriate decorator to your periodic functions or class methods

def run_continuously():
	while continue_running:

@healthcheck_python.periodic(service="my_service1", timeout=10)
def run_once():

class MyProcess(mp.Process):
	def run(self):
		while self.continue_running:

	@healthcheck_python.periodic(service="MyProcessService", timeout=5)
	def do_the_thing_once(self):

With these wrappers, run_once() has to called every 10 seconds and MyProcess.do_the_thing_once() has to be called every 5 seconds. If at least one fails, the app status will be down.

$ curl http://localhost:8080/health
$ curl http://localhost:8080/health?v
{"status": true, "data": {"my_service1": {"latest_start": 1611137135.3203568, "latest_end": 1611137135.3203998, "timeout": 10},"MyProcessService": {"latest_start": 1611137135.3203568, "latest_end": 1611137135.3203998, "timeout": 5}}}


  • Unit tests
  • Support different types of checks

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

healthcheck-python-0.1.2.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

healthcheck_python-0.1.2-py3-none-any.whl (17.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page