{ "info": { "author": "Mobify Research & Develpment Inc.", "author_email": "ops@mobify.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython" ], "description": "python-panopticon\n#################\n\n\n.. image:: https://travis-ci.org/elbaschid/python-panopticon.svg?branch=master\n :target: https://travis-ci.org/elbaschid/python-panopticon\n\nPanopticon is a collection of health check and monitoring helpers that we use\nat `Mobify `_ for our services.\n\n\nInstallation\n------------\n\nThe easiest way to install it is from PyPI::\n\n $ pip install python-panopticon\n\n\nYou can also install it straight from the repo:: \n\n $ pip install https://github.com/elbaschid/python-panopticon/archive/master.zip\n\n\nSetup with Django\n-----------------\n\npanopticon comes with a Django integration app that simplifies the setup. Make\nsure you have the ``python-panopticon`` package installed.\n\nAdd the ``panopticon.django`` app into you ``INSTALLED_APPS`` settings and\nconfigure the API key for Datadog by specifying ``DATADOG_API_KEY`` in your\nsettings. You are all done!\n\nIf you want your healthcheck to be automatically exposed on ``/healthcheck/`` you\ncan simply add the following line to your main project ``urls.py``:\n\n.. code:: python\n\n #urls.py\n urlpatterns = [\n # all your other URLs\n\n url(r'', include('panopticon.django.urls', namespace='panopticon')),\n ]\n\nUsing this view at this point requires ``django-rest-framework`` (DRF) to be\ninstalled as a dependency. We'll probably changes it in the future but for now,\nwe are using DRF in our projects and it provides some additional features.\n\nIf you don't hook up ``panopticon.urls``, you can simply build your own view and\nignore this dependency.\n\n\nAvailable Settings\n------------------\n\n* ``DATADOG_STATS_ENABLED`` : Enables or disables the Datadog wrapper in\n panopticon. If you disable panopticon, it'll use a ``mock.Mock`` object as\n the stats client. It is disabled by default.\n* ``DATADOG_STATS_PREFIX`` : The prefix used for **all** Datadog metrics when\n submitted to the Datadog API. The default is ``panopticon``.\n\n\nAdding a custom healthcheck in Django\n-------------------------------------\n\nIf you are using the Django app to integrate it with Django, adding new health\nchecks is easy. Every application in ``INSTALLED_APPS`` will be checked for a \n``healthchecks.py`` module on startup. Loading each of these modules will\nautomatically register all health checks in that module. This is similar to how\n``models.py`` and ``tasks.py`` (Celery) work.\n\nLet's assume we have a ``monitoring`` Django app that should contain some simple\nhealth checks. The first thing to do is creating a ``healthchecks.py`` file.\nWithin this file, we can now create a simple function that test the database\nconnection. All we have to do to hook it up is register it as a health check\nand provide details about its success:\n\n.. code:: python \n\n from django.db import connection, DatabaseError\n\n @HealthCheck.register_healthcheck\n def database(data):\n cursor = connection.cursor()\n\n healthy = True\n status = 'database is available.'\n\n try:\n cursor.execute('SELECT 1;')\n except DatabaseError as exc:\n status = 'error connecting to the database: {}'.format(str(exc))\n finally:\n cursor.close()\n\n data[HealthCheck.HEALTHY] = healthy\n data[HealthCheck.STATUS_MESSAGE] = status\n\n return data\n\nThe name of the function, i.e. ``database`` in this case, will be used as the\ncomponent name for the health check result as defined in the response format\nbelow.\n\n\nThe Response Format\n-------------------\n\nThe health check format that we use makes sure that all health checks return an\nagreed upon JSON response. This ensure that certain properties are always\npresent and can be relied upon for external processing, e.g. ``service_healthy``,\n``timestamp``, ``components`` and ``healthy`` within each of the components.\n\n.. code:: javascript\n\n {\n // This represents the overall health of the service\n // If all of the components are healthy this should be true, false otherwise.\n \"service_healthy\": true,\n\n // The instant when the response was generated. This is useful to determine\n // if the health check response is up to date or stale, for example because it\n // was cached. This is in ISO8601 format.\n \"timestamp\": \"2014-09-03T23:09:38.702Z\",\n\n // We also expose the health status for each internal component\n // of the service. Besides a \u201chealthy\u201d flag this can also include\n // metadata like the number of queued jobs or average processing times.\n // We expose this information in a list so that monitoring tools can parse\n // and visualize this information easily.\n \"components\": {\n \"database\": {\n \"healthy\": true,\n \"response_time\": 0.00123,\n \"friendly_status\": \"The database is working awesomely great!\"\n },\n \"background_jobs\": {\n \"healthy\": true,\n \"response_time\": 0.00123,\n \"queued_jobs\": 423\n }\n }\n }\n\n\nSetup Development\n-----------------\n\nThe development setup is using `tox `_\nfor testing against various versions of Python. Running tox tests is quit\nsimple for a given Python version that you have installed locally. For instance\nrunning tox for Python 3.5::\n\n $ tox -e py35\n\n\nIf you prefer to install and run the tests inside a virtualenv, you can install\nall the test and release requirements inside a virtualenv using::\n\n $ pip install -e \".[test]\"\n $ pip install -e \".[dev]\"\n\n\nCreating a Release\n------------------\n\nCreating a new release is simple. We use `bumpversion\n`_ which ensures that naming tags and\nupdating *all* version numbers in the Python code is ensured. To create a new\nversion specify the type of version bump (either *major*, *minor* or *patch*)\nand bumpversion will do the rest. For a patch it looks like this::\n\n $ bumpversion patch\n\nThis will do the following:\n\n* Change all version strings defined in ``bumpversion.cfg``.\n* Create a new commit.\n* Create a new tag with the given version number.\n\n**Note** A new release should only be created on the ``master`` branch after\none or more changes have been merged and tested.\n\nAfter releasing a new version, the commit and tag have to be pushed to github::\n\n $ git push \n $ git push --tags\n\nYou can now release this version to PyPI using the Makefile. This requires\nthe password for the ``mobify`` user to be exported in your shell. You can find\nit in LastPass::\n\n $ PYPI_PASSWORD= make release\n\n\nLicense\n-------\n\nThis code is licensed under the `MIT License`_.\n\n.. _`MIT License`: https://github.com/elbaschid/python-panopticon/blob/master/LICENSE\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://python-panopticon.readthedocs.org", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "python-panopticon", "package_url": "https://pypi.org/project/python-panopticon/", "platform": "", "project_url": "https://pypi.org/project/python-panopticon/", "project_urls": { "Homepage": "https://python-panopticon.readthedocs.org" }, "release_url": "https://pypi.org/project/python-panopticon/0.4.0/", "requires_dist": [ "six", "requests", "datadog", "tox; extra == 'dev'", "bumpversion; extra == 'dev'", "twine; extra == 'dev'", "wheel; extra == 'dev'", "pytest; extra == 'test'", "pytest-cache; extra == 'test'", "pytest-cov; extra == 'test'", "mock; extra == 'test'" ], "requires_python": "", "summary": "A collection of healthcheck and monitoring helpers.", "version": "0.4.0" }, "last_serial": 5827354, "releases": { "0.0.0": [], "0.1.0": [ { "comment_text": "", "digests": { "md5": "73d931f492b3cfb690e124f05ab733a3", "sha256": "9fc28c9fdc57dbf2f708c0b962c68cb5f3c6fec21b4f82365ea959b9babf36df" }, "downloads": -1, "filename": "python_panopticon-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "73d931f492b3cfb690e124f05ab733a3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15179, "upload_time": "2016-03-28T18:59:43", "url": "https://files.pythonhosted.org/packages/9f/89/f7662ce82d41188dff9a9c5565d941248970c31f3832a3e2d29dd4e88721/python_panopticon-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8e5011dc4b7a15635264e23b243e6d08", "sha256": "befdff0b46df4f294c264c7ff02a961b1a218b5b1846a48d514eba224cb7860c" }, "downloads": -1, "filename": "python-panopticon-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8e5011dc4b7a15635264e23b243e6d08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9029, "upload_time": "2016-03-28T18:59:56", "url": "https://files.pythonhosted.org/packages/80/ba/eae978f98c49e9a8370bff3c1c5880462d928c2b419264d56b17f2956bcf/python-panopticon-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c0e67cc31277a69a01e9edcd4dc73724", "sha256": "847f65dd915a012d4d176bdc089e9999b0601fe60cd3acb76138762323dfaeb5" }, "downloads": -1, "filename": "python_panopticon-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c0e67cc31277a69a01e9edcd4dc73724", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15194, "upload_time": "2016-05-26T23:00:21", "url": "https://files.pythonhosted.org/packages/f8/18/19cb29b439020b4a6cf38258f36e8f300627fe0fb4b61692b3fb144f0644/python_panopticon-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75d65ba5b99ad2bde4cb594547165516", "sha256": "6688e5eb53c4be834cb36543d9f6f1b2f53d90ce45422ba901c6c2f2c2593ae3" }, "downloads": -1, "filename": "python-panopticon-0.1.1.tar.gz", "has_sig": false, "md5_digest": "75d65ba5b99ad2bde4cb594547165516", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9038, "upload_time": "2016-05-26T23:00:25", "url": "https://files.pythonhosted.org/packages/35/ac/b4b59a7259bc5a085e38e0366e051e4913baa29bcb27417fd1179b6682a5/python-panopticon-0.1.1.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a4b325e064c69127d0332d0a892bc280", "sha256": "c6c9ff18ef3b3c9b7276bcbcb6d17018b31fdabfb4e6323d506469dde0a057dc" }, "downloads": -1, "filename": "python_panopticon-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a4b325e064c69127d0332d0a892bc280", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16753, "upload_time": "2016-06-22T21:55:37", "url": "https://files.pythonhosted.org/packages/bf/1f/3bcff2c1a16f26121f54d8164a98b2a175e9373d44628c1bd404b77b9ca6/python_panopticon-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c460e76aa64a245158cc5d55d9aa70af", "sha256": "f424234d055e3bbb6bc6e048d64f0ff1269afb692622a9ddd93fbf36f1eb7733" }, "downloads": -1, "filename": "python-panopticon-0.2.1.tar.gz", "has_sig": false, "md5_digest": "c460e76aa64a245158cc5d55d9aa70af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10515, "upload_time": "2016-06-22T21:55:42", "url": "https://files.pythonhosted.org/packages/c5/45/6dab174e21ca1c886cec3a4a5bd66b83ae790020a1000dcdde7a1f61ecd1/python-panopticon-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "ed7edea22c38b0a335ffc6f7e2746708", "sha256": "f08af98317bd93efe5abb463a29b8de8a63a869ea1fa154e94dc37a3a75f4ed2" }, "downloads": -1, "filename": "python_panopticon-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ed7edea22c38b0a335ffc6f7e2746708", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17681, "upload_time": "2016-06-22T22:06:13", "url": "https://files.pythonhosted.org/packages/97/29/c115150b4196bb1a9aa240f530e9df6d7fcc42b8dd91ac45f664f19c5a71/python_panopticon-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9ca4523735164bf1bac1880581a4423", "sha256": "bc0153c0f7272bf6169f315f95fe58d9ba747d52b63f2385c605cb47f4eb215b" }, "downloads": -1, "filename": "python-panopticon-0.2.2.tar.gz", "has_sig": false, "md5_digest": "b9ca4523735164bf1bac1880581a4423", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11100, "upload_time": "2016-06-22T22:06:17", "url": "https://files.pythonhosted.org/packages/57/25/2c507eec173ed0bf92d35aa2653b9ef021738bc30da6e41c79bbc2fdc57a/python-panopticon-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "fd0467872344e85d95397fc949572ee3", "sha256": "8b9c26e4fcc1b7791e1b207e2659fa68c6c58dc3c7148c16f4cdaed6b5359bea" }, "downloads": -1, "filename": "python_panopticon-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fd0467872344e85d95397fc949572ee3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16203, "upload_time": "2016-06-22T22:11:59", "url": "https://files.pythonhosted.org/packages/a3/31/c5549477f3ea3c4ad5f44d414a7f783f8af17bacbd34054864bec79248b7/python_panopticon-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ca0a0f38f21257ea8fa08c47ed6f5d0a", "sha256": "675b5a96d59e9711fa6b151830362e717054a1e8f474367ff008ee8cee451562" }, "downloads": -1, "filename": "python-panopticon-0.2.3.tar.gz", "has_sig": false, "md5_digest": "ca0a0f38f21257ea8fa08c47ed6f5d0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11097, "upload_time": "2016-06-22T22:12:03", "url": "https://files.pythonhosted.org/packages/c1/26/d0798c3c65a3e074ecfa874797f6971688d3fe0da24fa8e792b61034d0b5/python-panopticon-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "617ade8f18bf44580dde8449b7524402", "sha256": "c009a1a49804db9be4fdace43f5279551fabe3f766fb13adfc60ba7c2a3b8367" }, "downloads": -1, "filename": "python_panopticon-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "617ade8f18bf44580dde8449b7524402", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16260, "upload_time": "2016-06-23T21:53:06", "url": "https://files.pythonhosted.org/packages/bf/47/3029a5d41b3e589de4442302e753a71a3b819f3218dc4d63f63f84b8cc17/python_panopticon-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2cca3906005e33f99345cef0661cf954", "sha256": "7bd346f13b1d0ffe15ad871dd85d72f52ffd62f333ba38c38d4d5fb79dec0f97" }, "downloads": -1, "filename": "python-panopticon-0.3.0.tar.gz", "has_sig": false, "md5_digest": "2cca3906005e33f99345cef0661cf954", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11105, "upload_time": "2016-06-23T21:53:10", "url": "https://files.pythonhosted.org/packages/f8/0b/ef046ecc1c1b8d7188d0686c27056ec9ae06b3d71664df6789521348069a/python-panopticon-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "f35a4b541cf7076468b0c697fb52e24c", "sha256": "9e7b13085c7837fcbb74cb89bc5d78e70295316c5bf04a31874222ce4ef45f34" }, "downloads": -1, "filename": "python_panopticon-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f35a4b541cf7076468b0c697fb52e24c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12431, "upload_time": "2019-09-13T19:04:51", "url": "https://files.pythonhosted.org/packages/a5/77/45a939b6275c91d134706c3d88b2b1d746200a496a268916fd005eba41be/python_panopticon-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7705c94e9a82bc82686445cf8631b519", "sha256": "007f67286d9ba9aa602c2a490d1e70da60b6b00d78b4b8397e7325659f958d80" }, "downloads": -1, "filename": "python-panopticon-0.4.0.tar.gz", "has_sig": false, "md5_digest": "7705c94e9a82bc82686445cf8631b519", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14007, "upload_time": "2019-09-13T19:04:53", "url": "https://files.pythonhosted.org/packages/77/a1/89c5eefed9fc1ea447cb239d4021db3cc01666b2287e9f3dd3cc8d3c88c1/python-panopticon-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f35a4b541cf7076468b0c697fb52e24c", "sha256": "9e7b13085c7837fcbb74cb89bc5d78e70295316c5bf04a31874222ce4ef45f34" }, "downloads": -1, "filename": "python_panopticon-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f35a4b541cf7076468b0c697fb52e24c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12431, "upload_time": "2019-09-13T19:04:51", "url": "https://files.pythonhosted.org/packages/a5/77/45a939b6275c91d134706c3d88b2b1d746200a496a268916fd005eba41be/python_panopticon-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7705c94e9a82bc82686445cf8631b519", "sha256": "007f67286d9ba9aa602c2a490d1e70da60b6b00d78b4b8397e7325659f958d80" }, "downloads": -1, "filename": "python-panopticon-0.4.0.tar.gz", "has_sig": false, "md5_digest": "7705c94e9a82bc82686445cf8631b519", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14007, "upload_time": "2019-09-13T19:04:53", "url": "https://files.pythonhosted.org/packages/77/a1/89c5eefed9fc1ea447cb239d4021db3cc01666b2287e9f3dd3cc8d3c88c1/python-panopticon-0.4.0.tar.gz" } ] }