Skip to main content

Exposes an http endpoint exposing the health status of the app

Project description

pipeline status coverage report PyPI Status PyPI Version PyPI Python PyPI License PyPI Format

Applipy HealthCheck Metrics

pip install applipy_healthcheck

Exposes the health status of the applipy application through an HTTP endpoint with path /health.

Usage

Add the applipy_healthcheck.HealthCheckModule to your application. Optionally, define through which http server to expose the /health endpoint, if no name is given it defaults to the anonymous server:

# dev.yaml

app:
    name: demo
    modules:
        - applipy_healthcheck.HealthCheckModule

http.servers:
- name: internal
  host: 0.0.0.0
  port: 8080

healthcheck.server_name: internal

To run this test just install applipy_healthcheck and pyyaml and run the applipy application:

pip install applipy_healthcheck pyyaml
python -m applipy

You can now query http://0.0.0.0:8080/health and you should see OK being returned.

Custom health checks

applipy_healthcheck exposes the HealthChecker interface. You can implement your own and the health check endpoint will use it to determine the health of the system.

Example

Full healthcheck module config

All keys and their default values:

healthcheck:
  server_name: null
  verbose: false

Usage with custom HealthChecker

# mymodule.py

from applipy import Module
from applipy_healthcheck import HealthChecker


class MyHealthChecker(HealthChecker):

    async def check(self):
        is_healthy = True
        status_message = 'All OK'
        return is_healthy, status_message


class MyModule(Module):
    def configure(self, bind, register):
        bind(HealthChecker, MyHealthChecker)

    @classmethod
    def depends_on(cls):
        return HealthCheckModule,
# dev.yaml

app:
  name: test
  modules: [mymodule.MyModule]

http.servers:
- host: 0.0.0.0
  port: 8080

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

applipy_healthcheck-0.2.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

applipy_healthcheck-0.2.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file applipy_healthcheck-0.2.0.tar.gz.

File metadata

  • Download URL: applipy_healthcheck-0.2.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for applipy_healthcheck-0.2.0.tar.gz
Algorithm Hash digest
SHA256 77f9021da710d51acb18cba1c27990a724544c217951c7cfe2ef5e3fa0c05a2a
MD5 9fecca16e68cd499a7ceeb92e1d6b8dd
BLAKE2b-256 f70087bdbeb9cb660a45d9cf8d9dd37109bb55a986dda5af62770b17b7898fd0

See more details on using hashes here.

File details

Details for the file applipy_healthcheck-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: applipy_healthcheck-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for applipy_healthcheck-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8465f46d7c694f992b51db4726014e12901ad5710001ae768927dd46bcfeaba9
MD5 efc228baaef9166448cd3952aad00419
BLAKE2b-256 fda5cfa8df369dd3a9c840d01a6376bfe6dcb6769679380c9d48298722ec9cbe

See more details on using hashes here.

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