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
Release files for applipy-healthcheck 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| applipy_healthcheck-0.2.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| applipy_healthcheck-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:8.8 kB
Release files / applipy_healthcheck-0.2.0.tar.gz
| Download URL | applipy_healthcheck-0.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77f9021da710d51acb18cba1c27990a724544c217951c7cfe2ef5e3fa0c05a2a
|
|
BLAKE2b-256 checksum How to use checksums |
f70087bdbeb9cb660a45d9cf8d9dd37109bb55a986dda5af62770b17b7898fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / applipy_healthcheck-0.2.0-py3-none-any.whl
| Download URL | applipy_healthcheck-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8465f46d7c694f992b51db4726014e12901ad5710001ae768927dd46bcfeaba9
|
|
BLAKE2b-256 checksum How to use checksums |
fda5cfa8df369dd3a9c840d01a6376bfe6dcb6769679380c9d48298722ec9cbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|