The RequestMetricsMixin mixin will automatically instrument requests by sending statsd increment and timing values as each request finishes.
Deprecation Notice
This project has been replaced by sprockets-statsd and wil no longer be maintained. If you are currently using it, please migrate away from it.
Installation
sprockets.mixins.statsd is available on the Python Package Index and can be installed via pip or easy_install:
pip install sprockets.mixins.statsd
Documentation
Requirements
Example
The following RequestHandler will automatically increment a request counter and add a request duration timing value to statsd when the request finishes.
from sprockets.mixins import statsd
from tornado import web
class MyRequestHandler(statsd.RequestMetricsMixin,
web.RequestHandler):
def prepare(self):
self.statsd_prefix = 'some.overriden.value'
super(MyRequestHandler, self).prepare()
def get(self, *args, **kwargs):
self.finish({'hello': 'world'})
def on_finish(self):
super(MyRequestHandler, self).on_finish()
self.do_cleanup_things()
When the request has finished, the following keys would be used:
Counter: sprockets.counter.example.RequestHandler.GET.200
Timing: sprockets.timers.example.RequestHandler.GET.200
Mixin Behavior
Whenever you mix in a class in Python always ensure that the mixins, which should inherit from object, are the first ones in the inheritance list. The concrete class, in this case web.RequestHandler should be the final class inherited.
Should your Request Handler extend the finish or the prepare methods ensure that your call super otherwise you may run into strange behavior.
Version History
Available at https://sprocketsmixinsstatsd.readthedocs.org/en/latest/history.html
Metadata
Release files for sprockets.mixins.statsd 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sprockets.mixins.statsd-1.4.0.tar.gz | 5.1 kB | Without provenance | Details for sprockets.mixins.statsd-1.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sprockets.mixins.statsd-1.4.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for sprockets.mixins.statsd-1.4.0-py2.py3-none-any.whl |
Total release size: 11.2 kB
Release files / sprockets.mixins.statsd-1.4.0.tar.gz
| Download URL | sprockets.mixins.statsd-1.4.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f3e81757524ff4cb740fdee2e204e657e34bd3ecadbb12653e00f5bbde9b5e0
|
|
BLAKE2b-256 checksum How to use checksums |
35bd0e211dcf7ec48d7f8759e13dbfc93fc41d8a8e241c16fef6bdb01eb1d4e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10
|
Release files / sprockets.mixins.statsd-1.4.0-py2.py3-none-any.whl
| Download URL | sprockets.mixins.statsd-1.4.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e56dd5e2ef39709be35762870aab7bf251a1348fce42b7b04e531bc50ac17a05
|
|
BLAKE2b-256 checksum How to use checksums |
e99b81e1c67ad4e8e765bce7e650bb30bd15ab5b67e30f928f3b54e6aaea2cc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10
|
Security for sprockets.mixins.statsd 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.