django-heartbeat


Namedjango-heartbeat JSON
Version 2.2.2 PyPI version JSON
download
home_page
SummaryA simple reusable app that checks and lists various information about your project and its dependencies
upload_time2023-11-14 15:24:54
maintainer
docs_urlNone
author
requires_python>=3.8
licenseThe MIT License (MIT) Copyright (c) 2016 Public Broadcasting Service (PBS) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords django heartbeat health check dependency status
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Django-heartbeat is a simple reusable app that checks and lists various information
about your project and its dependencies

# Requirements

* Python >=3.8 (tested with Python 3.8, 3.10)
* Django >=4 < 5

# Installation

Install using pip:

```
pip install django-heartbeat
```

Next, add 'heartbeat' to your settings.py INSTALLED_APPS:

```
INSTALLED_APPS = (
  ...
  'heartbeat',
)
```

Configure urls.py

```Python
if 'heartbeat' in settings.INSTALLED_APPS:
    from heartbeat.urls import urlpatterns as heartbeat_urls

    urlpatterns += [
        url(r'^heartbeat/', include(heartbeat_urls))
    ]
```

# Usage

- `/heartbeat/`

  After this point you can access the /heartbeat/ endpoint and receive a 200 OK.


- `/heartbeat/1337/`

  If you want a more detailed view of some custom checkers you MUST configure a
  custom profile for heartbeat in your settings.py. The profile should be
  a dictionary containing at least the basic auth credentials or the key `disable`
  set to `True` to disable basic authentication.

e.g.:

  ```Python
HEARTBEAT = {
    'package_name': 'foo_project',
    'checkers': [
        'heartbeat.checkers.build',
        'heartbeat.checkers.distribution_list',
        'heartbeat.checkers.debug_mode',
    ],
    'auth': {
        'username': 'foo',
        'password': 'bar',
    },
}
  ```

If no checkers are defined, heartbeat will default to the following:

- `heartbeat.checkers.distribution_list`
- `heartbeat.checkers.debug_mode`
- `heartbeat.checkers.python`

# Available checkers

Please make sure you have the latest version of django-heartbeat since checker names changed in versions 1.0.8 and
2.0.0.
If for some reason you cannot install the latest version, read the release notes for the version you have and the
versions mentioned above.

`heartbeat.checkers.build`

- lists information about installed package
- Please be aware that in order for this checker to work you have to add the
  'package_name': 'foo_package' key, value pair in the HEARTBEAT settings

`heartbeat.checkers.databases`

- displays information about the connection with your configured databases

`heartbeat.checkers.debug_mode`

- displays whether the DEBUG mode is set to True or False

`heartbeat.checkers.distribution_list`

- lists all installed dependencies

`heartbeat.checkers.host`

- displays various information about your system
  (e.g. hostname, number of CPUs, uptime, used/free memory, etc.)

`heartbeat.checkers.memcached_status`

- displays stats about your Memcached.
- Before enabling this checker please make sure that you have installed the appropriate Memcached binding (the two most
  common are [python-memcached](https://pypi.python.org/pypi/python-memcached)
  and [pylibmc](https://pypi.python.org/pypi/pylibmc))

`heartbeat.checkers.python`

- lists the current python version

`heartbeat.checkers.redis_status`

- checks your connection with the Redis server
- Make sure that you have CACHEOPS_REDIS configured properly in your settings.py

# Implementing your own checker

- my_checker.py:
  ```Python
  def check(request):
    """
    :param request: HttpRequest object
    :return: dict
    """

    # Checker logic goes here

    return {'ping': 'pong'}
  ```

Note: The function name of your checker MUST be 'check' and has to return a JSON-serializable object

- add it to the settings.HEARTBEAT config
  ```Python
  HEARTBEAT = {
      'checkers': [
          'heartbeat.checkers.distribution_list',
          'my_project.my_checker'
          ...

      ],
      ...
  }
  ```

Simple, huh?

If you would like to contribute to this library with a new checker (or any other
functionality), feel free to make a pull request.

# Contributors

- Andrei Prădan
- Dan Claudiu Pop

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-heartbeat",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "django,heartbeat,health check,dependency status",
    "author": "",
    "author_email": "PBS Core Services <pbsi-team-core-services@pbs.org>",
    "download_url": "https://files.pythonhosted.org/packages/b6/9c/3537c619f00b870df8e54b57df900b2aaa3180a3b31079fd586c5b969728/django-heartbeat-2.2.2.tar.gz",
    "platform": null,
    "description": "Django-heartbeat is a simple reusable app that checks and lists various information\nabout your project and its dependencies\n\n# Requirements\n\n* Python >=3.8 (tested with Python 3.8, 3.10)\n* Django >=4 < 5\n\n# Installation\n\nInstall using pip:\n\n```\npip install django-heartbeat\n```\n\nNext, add 'heartbeat' to your settings.py INSTALLED_APPS:\n\n```\nINSTALLED_APPS = (\n  ...\n  'heartbeat',\n)\n```\n\nConfigure urls.py\n\n```Python\nif 'heartbeat' in settings.INSTALLED_APPS:\n    from heartbeat.urls import urlpatterns as heartbeat_urls\n\n    urlpatterns += [\n        url(r'^heartbeat/', include(heartbeat_urls))\n    ]\n```\n\n# Usage\n\n- `/heartbeat/`\n\n  After this point you can access the /heartbeat/ endpoint and receive a 200 OK.\n\n\n- `/heartbeat/1337/`\n\n  If you want a more detailed view of some custom checkers you MUST configure a\n  custom profile for heartbeat in your settings.py. The profile should be\n  a dictionary containing at least the basic auth credentials or the key `disable`\n  set to `True` to disable basic authentication.\n\ne.g.:\n\n  ```Python\nHEARTBEAT = {\n    'package_name': 'foo_project',\n    'checkers': [\n        'heartbeat.checkers.build',\n        'heartbeat.checkers.distribution_list',\n        'heartbeat.checkers.debug_mode',\n    ],\n    'auth': {\n        'username': 'foo',\n        'password': 'bar',\n    },\n}\n  ```\n\nIf no checkers are defined, heartbeat will default to the following:\n\n- `heartbeat.checkers.distribution_list`\n- `heartbeat.checkers.debug_mode`\n- `heartbeat.checkers.python`\n\n# Available checkers\n\nPlease make sure you have the latest version of django-heartbeat since checker names changed in versions 1.0.8 and\n2.0.0.\nIf for some reason you cannot install the latest version, read the release notes for the version you have and the\nversions mentioned above.\n\n`heartbeat.checkers.build`\n\n- lists information about installed package\n- Please be aware that in order for this checker to work you have to add the\n  'package_name': 'foo_package' key, value pair in the HEARTBEAT settings\n\n`heartbeat.checkers.databases`\n\n- displays information about the connection with your configured databases\n\n`heartbeat.checkers.debug_mode`\n\n- displays whether the DEBUG mode is set to True or False\n\n`heartbeat.checkers.distribution_list`\n\n- lists all installed dependencies\n\n`heartbeat.checkers.host`\n\n- displays various information about your system\n  (e.g. hostname, number of CPUs, uptime, used/free memory, etc.)\n\n`heartbeat.checkers.memcached_status`\n\n- displays stats about your Memcached.\n- Before enabling this checker please make sure that you have installed the appropriate Memcached binding (the two most\n  common are [python-memcached](https://pypi.python.org/pypi/python-memcached)\n  and [pylibmc](https://pypi.python.org/pypi/pylibmc))\n\n`heartbeat.checkers.python`\n\n- lists the current python version\n\n`heartbeat.checkers.redis_status`\n\n- checks your connection with the Redis server\n- Make sure that you have CACHEOPS_REDIS configured properly in your settings.py\n\n# Implementing your own checker\n\n- my_checker.py:\n  ```Python\n  def check(request):\n    \"\"\"\n    :param request: HttpRequest object\n    :return: dict\n    \"\"\"\n\n    # Checker logic goes here\n\n    return {'ping': 'pong'}\n  ```\n\nNote: The function name of your checker MUST be 'check' and has to return a JSON-serializable object\n\n- add it to the settings.HEARTBEAT config\n  ```Python\n  HEARTBEAT = {\n      'checkers': [\n          'heartbeat.checkers.distribution_list',\n          'my_project.my_checker'\n          ...\n\n      ],\n      ...\n  }\n  ```\n\nSimple, huh?\n\nIf you would like to contribute to this library with a new checker (or any other\nfunctionality), feel free to make a pull request.\n\n# Contributors\n\n- Andrei Pr\u0103dan\n- Dan Claudiu Pop\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)  Copyright (c) 2016 Public Broadcasting Service (PBS)  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A simple reusable app that checks and lists various information about your project and its dependencies",
    "version": "2.2.2",
    "project_urls": {
        "Homepage": "https://github.com/pbs/django-heartbeat"
    },
    "split_keywords": [
        "django",
        "heartbeat",
        "health check",
        "dependency status"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cfa4b3b41b72e63d8ca74d55a73135ffcd75276b7f1a8f435b69ff3a50be61f8",
                "md5": "80002b3498555ec1e38c6fc6db2a8f60",
                "sha256": "a259a9c112d8ca0067c089c5818dfa4374bda4c8dd833711e412751ac6b9664a"
            },
            "downloads": -1,
            "filename": "django_heartbeat-2.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "80002b3498555ec1e38c6fc6db2a8f60",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11480,
            "upload_time": "2023-11-14T15:24:53",
            "upload_time_iso_8601": "2023-11-14T15:24:53.530051Z",
            "url": "https://files.pythonhosted.org/packages/cf/a4/b3b41b72e63d8ca74d55a73135ffcd75276b7f1a8f435b69ff3a50be61f8/django_heartbeat-2.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b69c3537c619f00b870df8e54b57df900b2aaa3180a3b31079fd586c5b969728",
                "md5": "0432f460c4f2a152f9aae29d686c3818",
                "sha256": "a9d2ecfdd15e3adf12ba2f89683846dfc4b5316ab9c64174a46918fc9e9fc4d2"
            },
            "downloads": -1,
            "filename": "django-heartbeat-2.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0432f460c4f2a152f9aae29d686c3818",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8141,
            "upload_time": "2023-11-14T15:24:54",
            "upload_time_iso_8601": "2023-11-14T15:24:54.678761Z",
            "url": "https://files.pythonhosted.org/packages/b6/9c/3537c619f00b870df8e54b57df900b2aaa3180a3b31079fd586c5b969728/django-heartbeat-2.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-14 15:24:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pbs",
    "github_project": "django-heartbeat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-heartbeat"
}
        
Elapsed time: 0.13417s