{ "info": { "author": "Wouter Lansu, Paylogic International and others", "author_email": "developers@paylogic.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware" ], "description": "wsgi-statsd documentation\n=========================\n\n.. image:: https://api.travis-ci.org/paylogic/wsgi-statsd.png\n :target: https://travis-ci.org/paylogic/wsgi-statsd\n\n.. image:: https://pypip.in/v/wsgi-statsd/badge.png\n :target: https://crate.io/packages/wsgi-statsd/\n\n.. image:: https://coveralls.io/repos/paylogic/wsgi-statsd/badge.svg?branch=master\n :target: https://coveralls.io/r/paylogic/wsgi-statsd?branch=master\n\n.. image:: https://readthedocs.org/projects/wsgi-statsd/badge/?version=latest\n :alt: Documentation Status\n :scale: 100%\n :target: https://readthedocs.org/projects/wsgi-statsd/\n\nwsgi_statsd is a WSGI middleware that provides an easy way to time all requests.\nIntegration is as easy as just wrapping your existing wsgi application.\n\n.. contents::\n\n\nUsage\n-----\n\nIn your wsgi.py file wrap your WSGI application as follows:\n\n.. code-block:: python\n\n import statsd\n from wsgi_statsd import StatsdTimingMiddleware\n\n\n def application(environ, start_response):\n response_body = 'The request method was %s' % environ['REQUEST_METHOD']\n status = '200 OK'\n response_headers = [('Content-Type', 'text/plain'),\n ('Content-Length', str(len(response_body)))]\n\n start_response(status, response_headers)\n\n return [response_body]\n\n client = statsd.StatsClient(\n prefix='your_prefix',\n host='your_host',\n port=8125\n )\n\n application = StatsdTimingMiddleware(application, client)\n\n.. note::\n\n If an unhandled exception happens, it will not be timed by default.\n This is a design decision to separate error reporting and actual statistical measurements.\n To enable exception timing, pass `time_exception=True` to the middleware constructor:\n\n\n.. code-block:: python\n\n application = StatsdTimingMiddleware(application, client, time_exceptions=True)\n\n\nWhat it does\n------------\n\nwsgi-statsd uses the statsd timer function, generates a key and sets the amount of time the request took as the value.\nThe key is constructed as follows:\n\n``....``\n\nUsing the ``foo`` prefix, in your statsd client, and calling the ``www.spam.com/bar/test/`` page will result in ``foo\n.bar_test.GET.200`` having a value equal to the time it took to handle the request.\n\nIf you passed `time_exceptions=True` and any exception occurs during the response, then the key name will be postfixed\nwith the exception class name: ``foo.bar_test.GET.500.ValueError``.\n\n\nCustomizing for your needs\n--------------------------\n\nIt's possible to customize the way ``wsgi_statsd`` generates the key and/or time. ``StatsdTimingMiddleware`` has\n``send_stats`` and ``get_key_name`` which you can override:\n\n.. code-block:: python\n\n class CustomStatsdMiddleware(StatsdTimingMiddleware):\n\n def get_key_name(self, environ, response_interception):\n return super(self, CustomStatsdMiddleware).get_key_name(environ, response_interception) + '.' + environ['Transfer-Encoding']\n\n\n def send_stats(self, start, environ, response_interception):\n super(self, CustomStatsdMiddleware).send_stats(start + 10, environ, response_interception)\n\n\nwsgi-statsd uses underscores as a separator for the path part of the key that is sent to statsd as that makes it\neasy to retrieve the data from graphite. You can override this default by passing a ``separator`` value to the\nmiddleware constructor:\n\n\n.. code-block:: python\n\n StatsdTimingMiddleware(application, client, separator='.')\n\n\nContact\n-------\n\nIf you have questions, bug reports, suggestions, etc. please create an issue on\nthe `GitHub project page `_.\n\n\nLicense\n-------\n\nThis software is licensed under the `MIT license `_.\n\nPlease refer to the `license file `_.\n\n\n\u00a9 2015 Wouter Lansu, Paylogic International and others.\n\nChangelog\n=========\n\n0.3.1\n-----\n\n* Added clean target to Makefile.\n* Added the changes for the 0.2.6 version.\n\n0.2.6\n-----\n\n* Updated documentation.\n\n0.2.5\n-----\n\n* Fixed issue with the separator parameter. It now functions as expected and documented.\n\n0.2.4\n-----\n\n* Add separator parameter to StatsdTimingMiddleware.__init__().\n\n0.2.3\n-----\n\n* Add exception class name to the key when exception happens (bubenkoff)\n\n0.2.1\n-----\n\n* ensure close() is properly called from the response (bubenkoff, GrahamDumpleton)\n* optionally time exceptions (bubenkoff)\n* code readability improvements (bubenkoff)\n\n0.2.0\n-----\n\n* Fixed version numbers\n* Added support for WSGI applications returning generators\n* Added a test to verify that the response body remains the same after passing through the middleware\n\n0.1.0\n-----\n\n* Initial public release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/paylogic/wsgi-statsd", "keywords": null, "license": "MIT license", "maintainer": null, "maintainer_email": null, "name": "wsgi-statsd", "package_url": "https://pypi.org/project/wsgi-statsd/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/wsgi-statsd/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/paylogic/wsgi-statsd" }, "release_url": "https://pypi.org/project/wsgi-statsd/0.3.1/", "requires_dist": null, "requires_python": null, "summary": "WSGI middleware for statsd timing", "version": "0.3.1" }, "last_serial": 1391877, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "add81a43637c145349dfb5e3a5527a83", "sha256": "817ff60d134a563ea242258251c777726ec19005a6189445a921c664d76f2ed5" }, "downloads": -1, "filename": "wsgi-statsd-0.1.0.tar.gz", "has_sig": false, "md5_digest": "add81a43637c145349dfb5e3a5527a83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4478, "upload_time": "2015-01-14T10:59:42", "url": "https://files.pythonhosted.org/packages/0f/8b/3bca8e740a4b9276ac47c5cd6c0446205bf25976a745ae2b84bd0c6a569b/wsgi-statsd-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "c35ee8d050726ba70e9bb79cc2ec0130", "sha256": "932602c0e080e89cee1dbec0f5db959ab5059245b5cee6c55cac4938212086cf" }, "downloads": -1, "filename": "wsgi-statsd-0.2.0.tar.gz", "has_sig": false, "md5_digest": "c35ee8d050726ba70e9bb79cc2ec0130", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4567, "upload_time": "2015-01-14T12:51:16", "url": "https://files.pythonhosted.org/packages/c3/e2/99144c3d84a1043f69e33157cb4ac9b4885886e922b2e23746c0018f585b/wsgi-statsd-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "468606416e2de509dc0fc7ae5d15b4ad", "sha256": "0e6ee0a9e0ff04443ed5c64dfbd4e76cdfb6978f90178434ea0df1ec6f0b46ff" }, "downloads": -1, "filename": "wsgi-statsd-0.2.1.tar.gz", "has_sig": false, "md5_digest": "468606416e2de509dc0fc7ae5d15b4ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5522, "upload_time": "2015-01-16T08:50:44", "url": "https://files.pythonhosted.org/packages/99/10/673086a0e3923830f20892c6720f5d61e3171ce453890af3c40f23ef3ffd/wsgi-statsd-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "0db9d65b2fe2b3fbfc11e740b7ab9961", "sha256": "0647fc9326386de9ab34c3e69a1d77644fd044d76dee54bafdba76ce175d6044" }, "downloads": -1, "filename": "wsgi-statsd-0.2.2.tar.gz", "has_sig": false, "md5_digest": "0db9d65b2fe2b3fbfc11e740b7ab9961", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5693, "upload_time": "2015-01-16T09:21:35", "url": "https://files.pythonhosted.org/packages/ff/aa/0405952dd47645d83beb86ad7d9f961b936c4ab38c7db47164a20e553f60/wsgi-statsd-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "ed0912d67068f030a5ab68874bee7a77", "sha256": "a76dba42cf70b87b1ba8ac85486b67c4d91af914bd31893ad22e61d472e5adb3" }, "downloads": -1, "filename": "wsgi-statsd-0.2.3.tar.gz", "has_sig": false, "md5_digest": "ed0912d67068f030a5ab68874bee7a77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5700, "upload_time": "2015-01-16T12:22:09", "url": "https://files.pythonhosted.org/packages/37/2b/77ca6201c30996b14969f09a0ab6d78afe4fca70c9f724e9194f89c6afb0/wsgi-statsd-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "6e520a42c4dd44a2594618ea5def05d4", "sha256": "d48a7b360aa77721868c0fd2cd5cc43d5ba946e8ca871a6746b8de0ca055ab95" }, "downloads": -1, "filename": "wsgi-statsd-0.2.4.tar.gz", "has_sig": false, "md5_digest": "6e520a42c4dd44a2594618ea5def05d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5974, "upload_time": "2015-01-22T08:10:43", "url": "https://files.pythonhosted.org/packages/0a/c4/c7432c82cd3ec19b7ed8ab7ba5804a986d97a499065100c50745d74f77e3/wsgi-statsd-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "48f6c484b9e86fdef757bdf8304dc663", "sha256": "403e5789cbd1bc0baf8ae43728b60a3c74ffcee8b8029da97f6d011559660413" }, "downloads": -1, "filename": "wsgi-statsd-0.2.5.tar.gz", "has_sig": false, "md5_digest": "48f6c484b9e86fdef757bdf8304dc663", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6067, "upload_time": "2015-01-22T08:59:39", "url": "https://files.pythonhosted.org/packages/dc/c2/6ec794763fb2318bf82b5551f5af24da57289ef0a278f4ba80d38c2ea187/wsgi-statsd-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "6e0abc877eb4069b763cc4ead2e3d465", "sha256": "30d93ec520b17caf138920194c4f6c7ffffd8ddf1845e818ea79ff6e57931062" }, "downloads": -1, "filename": "wsgi-statsd-0.2.6.tar.gz", "has_sig": false, "md5_digest": "6e0abc877eb4069b763cc4ead2e3d465", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6045, "upload_time": "2015-01-22T11:40:53", "url": "https://files.pythonhosted.org/packages/c5/ca/6ab6fae5e9f4fbe0f1041336c957af0da071626b9c7756a05ad4987204a3/wsgi-statsd-0.2.6.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "b0e1c3efe2026b567f8237f38a1d96cc", "sha256": "640591348da99525c847e7d21b13d649e9f3ca83e187c52b7545c68840f8a805" }, "downloads": -1, "filename": "wsgi-statsd-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b0e1c3efe2026b567f8237f38a1d96cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6115, "upload_time": "2015-01-22T12:41:21", "url": "https://files.pythonhosted.org/packages/15/92/d6bb135ecea99ea609474d1355167179ca9313ffdc6bdd96f70663e7b757/wsgi-statsd-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "5d74f90e27ca7e6c9432584cd6df3067", "sha256": "57216790da03261b9ad77c5429d039a643e24383ab145d5f9e3e1cc4d0292458" }, "downloads": -1, "filename": "wsgi-statsd-0.3.1.tar.gz", "has_sig": false, "md5_digest": "5d74f90e27ca7e6c9432584cd6df3067", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6116, "upload_time": "2015-01-22T14:46:35", "url": "https://files.pythonhosted.org/packages/90/90/12ab5fd2b86deb018c7afe570ca5d652d22429f69ca1e9bcaaf60145c7f9/wsgi-statsd-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d74f90e27ca7e6c9432584cd6df3067", "sha256": "57216790da03261b9ad77c5429d039a643e24383ab145d5f9e3e1cc4d0292458" }, "downloads": -1, "filename": "wsgi-statsd-0.3.1.tar.gz", "has_sig": false, "md5_digest": "5d74f90e27ca7e6c9432584cd6df3067", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6116, "upload_time": "2015-01-22T14:46:35", "url": "https://files.pythonhosted.org/packages/90/90/12ab5fd2b86deb018c7afe570ca5d652d22429f69ca1e9bcaaf60145c7f9/wsgi-statsd-0.3.1.tar.gz" } ] }