{"id":18930028,"url":"https://github.com/labd/django-healthchecks","last_synced_at":"2025-06-28T07:32:46.119Z","repository":{"id":28466278,"uuid":"31982114","full_name":"labd/django-healthchecks","owner":"labd","description":"Simple Django app/framework to publish health check for monitoring purposes","archived":false,"fork":false,"pushed_at":"2022-06-12T20:16:03.000Z","size":106,"stargazers_count":60,"open_issues_count":2,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T22:51:10.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://django-healthchecks.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/labd.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-10T21:13:05.000Z","updated_at":"2025-03-21T21:33:35.000Z","dependencies_parsed_at":"2022-09-15T02:42:38.945Z","dependency_job_id":null,"html_url":"https://github.com/labd/django-healthchecks","commit_stats":null,"previous_names":["mvantellingen/django-healthchecks"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-healthchecks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-healthchecks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-healthchecks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-healthchecks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labd","download_url":"https://codeload.github.com/labd/django-healthchecks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249097890,"owners_count":21212371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:36:16.381Z","updated_at":"2025-04-15T15:31:13.540Z","avatar_url":"https://github.com/labd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===================\ndjango-healthchecks\n===================\n\nSimple Django app/framework to publish health check for monitoring purposes\n\nFeatures:\n\n* Custom checks via Python functions\n* Remote healthchecks\n* Heartbeat monitoring\n\n\nStatus\n======\n.. image:: https://github.com/mvantellingen/django-healthchecks/workflows/Python%20Tests/badge.svg\n    :target: https://github.com/mvantellingen/django-healthchecks/actions?query=workflow%3A%22Python+Tests%22\n\n.. image:: http://codecov.io/github/mvantellingen/django-healthchecks/coverage.svg?branch=master\n    :target: http://codecov.io/github/mvantellingen/django-healthchecks?branch=master\n\n.. image:: https://img.shields.io/pypi/v/django-healthchecks.svg\n    :target: https://pypi.python.org/pypi/django-healthchecks/\n\nInstallation\n============\n\n.. code-block:: shell\n\n   pip install django_healthchecks\n\n\nUsage\n=====\n\nAdd the following to your urls.py:\n\n\n.. code-block:: python\n\n    url(r'^healthchecks/', include('django_healthchecks.urls')),\n\n\nAdd a setting with the available healthchecks:\n\n.. code-block:: python\n\n    HEALTH_CHECKS = {\n        'postgresql': 'django_healthchecks.contrib.check_database',\n        'cache_default': 'django_healthchecks.contrib.check_cache_default',\n        'solr': 'your_project.lib.healthchecks.check_solr',\n    }\n\n\nYou can also include healthchecks over http. This is useful when you want to\nmonitor if depending services are up:\n\n.. code-block:: python\n\n    HEALTH_CHECKS = {\n        ...\n        'my_microservice': 'https://my-service.services.internal/healthchecks/',\n        ...\n    }\n\n\nBy default, http health checks will time out after 500ms. You can override this\nas follows:\n\n.. code-block:: python\n\n    HEALTH_CHECKS_HTTP_TIMEOUT = 0.5\n\n\nBy default the status code is always 200, you can change this to something\nelse by using the `HEALTH_CHECKS_ERROR_CODE` setting:\n\n.. code-block:: python\n\n    HEALTH_CHECKS_ERROR_CODE = 503\n\n\nYou can also add some simple protection to your healthchecks via basic auth.\nThis can be specified per check or a wildcard can be used `*`.\n\n.. code-block:: python\n\n    HEALTH_CHECKS_BASIC_AUTH = {\n        '*': [('admin', 'pass')],\n        'solr': [],\n    }\n\n\nUsing heartbeats\n================\n\nHeartbeats give a periodic update, to see whether an service was recently active.\nWhen the service doesn't report back within timeout, a healthcheck can be triggered.\nTo use heartbeats, add the application to the ``INSTALLED_APPS``:\n\n.. code-block:: python\n\n    INSTALLED_APPS = [\n        ...\n        \"django_healthchecks\",\n    ]\n\nInclude one of these checks:\n\n.. code-block:: python\n\n    HEALTH_CHECKS = {\n        ...\n        'heartbeats': 'django_healthchecks.contrib.check_heartbeats'\n        ...\n        'expired_heartbeats': 'django_healthchecks.contrib.check_expired_heartbeats',\n        ...\n    }\n\nOptionally, define an initial timeout:\n\n.. code-block:: python\n\n    HEALTHCHECKS_DEFAULT_HEARTBEAT_TIMEOUT = timedelta(days=1)\n\nLet your code track the beats:\n\n.. code-block:: python\n\n    from datetime import timedelta\n    from django_healthchecks.heartbeats import update_heartbeat\n\n    update_heartbeat(\"myservice.name\", default_timeout=timedelta(days=2))\n\nOr use the decorator:\n\n.. code-block:: python\n\n    from django_healthchecks.heartbeats import update_heartbeat_on_success\n\n    @update_heartbeat_on_success(\"myservice.name\", default_timeout=...)\n    def long_running_task():\n        ....\n\nEach time ``update_heartbeat()`` is called, the heartbeat is reset.\nWhen a heartbeat didn't receive an update before it's ``timeout``,\nthe service name be mentioned in the ``check_expired_heartbeats`` check.\n\nUpdating timeouts\n~~~~~~~~~~~~~~~~~\n\nThe ``default_timeout`` parameter is only assigned upon creation. Any updates\nhappen through the Django admin. To update the timeout automatically on\ncode deployment, use the ``timeout`` parameter instead. This will replace the\nstored timeout value each time the ``update_heartbeat()`` function\nis called, erasing any changes made in the Django admin.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fdjango-healthchecks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabd%2Fdjango-healthchecks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fdjango-healthchecks/lists"}