{ "info": { "author": "Aaron", "author_email": "AaronBatilo@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# sanic-healthchecks\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![PyPI version](https://badge.fury.io/py/sanic-healthchecks.svg)](https://badge.fury.io/py/sanic-healthchecks)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/sanic-healthchecks.svg)](https://pypi.python.org/pypi/sanic-healthchecks/)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/sanic-healthchecks.svg)\n\nsanic-healthchecks makes it easy for you to start a healthcheck server on a\ndifferent thread than your actual Sanic application.\n\n## Installation\n\n`pip3 install sanic-healthchecks`\n\n## Healthcheck Example\n```python\nfrom sanic import Sanic\nfrom sanic.response import json\n\nfrom sanic_healthchecks import start_healthcheck_server, healthcheck_response\n\nAPP = Sanic()\n\n\nasync def healthcheck_handler(_):\n data = {\"status\": \"ok\"}\n return healthcheck_response(data)\n\n\n@APP.route(\"/\")\nasync def root(_):\n return json({\"example_of\": \"a very simple healthcheck\"})\n\n\nif __name__ == \"__main__\":\n start_healthcheck_server(healthcheck_handler)\n APP.run(host=\"0.0.0.0\", port=8000)\n```\n\nYour Sanic application will now respond on to healthchecks on a different port:\n```\n\u21d2 curl http://localhost:8000 -i\nHTTP/1.1 200 OK\nConnection: keep-alive\nKeep-Alive: 5\nContent-Length: 17\nContent-Type: application/json\n\n{\"hello\":\"world\"}\n\n\u21d2 curl http://localhost:8082 -i\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nContent-Length: 16\nDate: Sun, 03 Mar 2019 20:55:52 GMT\nServer: Python/3.7 aiohttp/3.5.4\n\n{\"status\": \"ok\"}\n```\n\n## Changelog\n[Release Changelogs.](https://github.com/abatilo/sanic-healthchecks/blob/master/CHANGELOG.md)\n\n## License\n[Apache 2.0](https://github.com/abatilo/sanic-healthchecks/blob/master/LICENSE)\n\n## But why?\nWhy would you want to run your healthchecks on a different thread, as opposed to creating another endpoint on your actual Sanic server?\n\nGreat question, internet stranger, and I have a few answers.\n\nBy running your healthchecks separately, we maintain a strong separation of\nconcerns. Since Sanic runs on a single thread, then any time you need to\nrespond to healthchecks, you're actually taking compute time away from the\nevent loop that is powering the actual requests that your application is there\nto serve. Likewise, the state of your actual application is not going to affect\nthe healthchecks. There's a few camps of thought on this subject.\n\nSome people say that if your web service isn't capable of responding to your\nhealthcheck probe, then the service shouldn't be considered healthy. I can\ntotally understand and respect this perspective, and if this is how you feel,\nthen there's no need to use sanic-healthchecks.\n\nOn the other hand, if you're like me, you've convinced yourself that the point\nof healthchecks isn't purely to determine if the service can respond, but also\nto determine if your service has everything that it needs from downstream\ndependencies. If your requests are taking so long that the readiness or\nliveness probes are timing out, that could mean that your service is unhealthy,\nbut it also could be a symptom of services that have long running requests.\n\nSince we can run the healthchecks on a different web server entirely, we have\nthe ability to check that all of the downstream dependencies, like databases\nand other services, are available. This helps narrow the problems with why a\nservice might be in a degraded state.\n\nI would even make an argument that an increase in response latency could be a\nmetric that you use for automatically scaling your service. Treating it as a\nway to kill instances makes it much fuzzier in terms of how to interpret the\nincrease in latency.\n\nAnother great reason to run your healthchecks on a different server is so that\nyou can assign a different port to this new server. This is valuable because\nyour healthchecks might actually have debug information in them that should not\nbe exposed to the same groups of people who are able to consume the main\nservice. By putting healthchecks on a different port, you can make sure to map\nyour load balancer to **not** include this healthcheck port.\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/abatilo/sanic-healthchecks", "keywords": "sanic,health,checks,healthchecks,observability", "license": "", "maintainer": "Aaron", "maintainer_email": "AaronBatilo@gmail.com", "name": "sanic-healthchecks", "package_url": "https://pypi.org/project/sanic-healthchecks/", "platform": "", "project_url": "https://pypi.org/project/sanic-healthchecks/", "project_urls": { "Homepage": "https://github.com/abatilo/sanic-healthchecks", "Repository": "https://github.com/abatilo/sanic-healthchecks" }, "release_url": "https://pypi.org/project/sanic-healthchecks/1.0.1/", "requires_dist": [ "aiohttp (>=3.5,<4.0)" ], "requires_python": ">=3.7,<4.0", "summary": "A small wrapper for making it easy to add a healthcheck server to your Sanic application", "version": "1.0.1" }, "last_serial": 5335278, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d2a87f136ba9daf4556da7ef4e60f5a0", "sha256": "7039622896042f5d4a216fc49e407c5f57027fad60d9be0ba0bf28557180c748" }, "downloads": -1, "filename": "sanic_healthchecks-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d2a87f136ba9daf4556da7ef4e60f5a0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 3468, "upload_time": "2019-03-03T20:29:51", "url": "https://files.pythonhosted.org/packages/a6/50/9ed485b1a7d12713b3aad0676aa37a52a229a67063f992da6028046d1e96/sanic_healthchecks-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af8a888d73db058fc465f33e8ba27ec5", "sha256": "4f2602d9229574cddca00c9f9bce7d07707343daf6a30b4a8d89ebe73873aea6" }, "downloads": -1, "filename": "sanic-healthchecks-0.1.0.tar.gz", "has_sig": false, "md5_digest": "af8a888d73db058fc465f33e8ba27ec5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 1968, "upload_time": "2019-03-03T20:29:50", "url": "https://files.pythonhosted.org/packages/f5/8a/55b0c6e606ce212e5aa77fbe7107df7399ee432f745edb4dcf0416f6f8d5/sanic-healthchecks-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "dfbe33ad53385a4510a6766d5fafee2a", "sha256": "05d63f56a9557d98d48b816caf038e621303f03c7bbd1ac5910387c008919847" }, "downloads": -1, "filename": "sanic_healthchecks-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dfbe33ad53385a4510a6766d5fafee2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 16321, "upload_time": "2019-03-03T21:14:24", "url": "https://files.pythonhosted.org/packages/e5/24/d5914950cd3e802a15481b8897ead928933c646c38ed1dc699a0766237ca/sanic_healthchecks-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e539ab58bab680d1b0b819fd85b4408f", "sha256": "5a6c16b1923d1a43e03ceac35b56b21887c88262e1963778b727643c850e6f74" }, "downloads": -1, "filename": "sanic-healthchecks-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e539ab58bab680d1b0b819fd85b4408f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7929, "upload_time": "2019-03-03T21:14:23", "url": "https://files.pythonhosted.org/packages/43/4a/8caf24abc702d6cd7d6be456935c5b8fa9a5ca395ab165c8d18122f754c5/sanic-healthchecks-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "909024e6d1d4760c08a5dc22314f41ff", "sha256": "6b25984a5983d2ce36e4ef4460a06992524825758de8ba3946bd365852097ae5" }, "downloads": -1, "filename": "sanic_healthchecks-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "909024e6d1d4760c08a5dc22314f41ff", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 16997, "upload_time": "2019-03-09T16:44:50", "url": "https://files.pythonhosted.org/packages/5e/7d/129d624e0a89a9e8ee2bd1c9180aa50792c8f3e560dd10817b625d1b186a/sanic_healthchecks-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13f3ffd5bb8766bdeb8c46e0bcde74d0", "sha256": "3fb576efa0e9cd1716f8779799e36c57697996978958572eca54f551a2715240" }, "downloads": -1, "filename": "sanic-healthchecks-0.2.0.tar.gz", "has_sig": false, "md5_digest": "13f3ffd5bb8766bdeb8c46e0bcde74d0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 8192, "upload_time": "2019-03-09T16:44:49", "url": "https://files.pythonhosted.org/packages/ee/3e/1468dcd43e702b34cc993907b68ac0ff43e9c91031b72e1509fe88a5d2ff/sanic-healthchecks-0.2.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "d4ea0ecc8f7a2388e98cda7ff9c0003d", "sha256": "9e8ff9db0e03caed3bacb821a1ff38464416855cb0e11ed1ccacb39a094ac911" }, "downloads": -1, "filename": "sanic_healthchecks-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d4ea0ecc8f7a2388e98cda7ff9c0003d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8520, "upload_time": "2019-05-30T01:59:25", "url": "https://files.pythonhosted.org/packages/15/34/c71b8dc792ae0797bc46c59be869c9cf6d04de76c5ad98d0e27275823159/sanic_healthchecks-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c3a757ab0be9af8b2da7dc7539bacd7c", "sha256": "4a0180e25135c4fd806ac5ff4cf0952683d623d445a20ab56afc647b7b52eed1" }, "downloads": -1, "filename": "sanic-healthchecks-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c3a757ab0be9af8b2da7dc7539bacd7c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 8306, "upload_time": "2019-05-30T01:59:24", "url": "https://files.pythonhosted.org/packages/87/71/3083c46e53d5234df54dcdcee4629780f335d68a6f51f42a39ddbddd3438/sanic-healthchecks-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "45212ade7a4beb99ad57aba652f35772", "sha256": "09c181506d3e11377090e538b4251272b4f672df3575cd29873137b0db75665a" }, "downloads": -1, "filename": "sanic_healthchecks-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "45212ade7a4beb99ad57aba652f35772", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8488, "upload_time": "2019-05-30T02:24:40", "url": "https://files.pythonhosted.org/packages/55/0c/b9b82755d2cfc9aa5f711b3423cf4e1342045d17443f14920cd8d67cd780/sanic_healthchecks-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "767da823cb8ae5b9c69eb25f6b313247", "sha256": "40c2fc586bf50977138a0ab27aa1458ceee0acc0ef5f05ed79d72d61ebb048cf" }, "downloads": -1, "filename": "sanic-healthchecks-1.0.1.tar.gz", "has_sig": false, "md5_digest": "767da823cb8ae5b9c69eb25f6b313247", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 8197, "upload_time": "2019-05-30T02:24:38", "url": "https://files.pythonhosted.org/packages/a1/70/481f16f43210a70e27ef32ea3414dee107fff6cc2d9bf8f2ffeead6b34bb/sanic-healthchecks-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "45212ade7a4beb99ad57aba652f35772", "sha256": "09c181506d3e11377090e538b4251272b4f672df3575cd29873137b0db75665a" }, "downloads": -1, "filename": "sanic_healthchecks-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "45212ade7a4beb99ad57aba652f35772", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8488, "upload_time": "2019-05-30T02:24:40", "url": "https://files.pythonhosted.org/packages/55/0c/b9b82755d2cfc9aa5f711b3423cf4e1342045d17443f14920cd8d67cd780/sanic_healthchecks-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "767da823cb8ae5b9c69eb25f6b313247", "sha256": "40c2fc586bf50977138a0ab27aa1458ceee0acc0ef5f05ed79d72d61ebb048cf" }, "downloads": -1, "filename": "sanic-healthchecks-1.0.1.tar.gz", "has_sig": false, "md5_digest": "767da823cb8ae5b9c69eb25f6b313247", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 8197, "upload_time": "2019-05-30T02:24:38", "url": "https://files.pythonhosted.org/packages/a1/70/481f16f43210a70e27ef32ea3414dee107fff6cc2d9bf8f2ffeead6b34bb/sanic-healthchecks-1.0.1.tar.gz" } ] }