Stuff to correlate requests, logs, and the like
Project description
This sprocket provides a single mix-in that imbues your RequestHandler with a unique correlation ID. If a correlation ID is present upon input then it will be preserved in the output. It is also available for your use as the correlation_id property.
Installation
sprockets.mixins.correlation is available on the Python Package Index and can be installed via pip:
$ pip install sprockets.mixins.correlation
Example
from sprockets.mixins import correlation
from tornado import ioloop, web
class Handler(correlation.HandlerMixin, web.RequestHandler):
def get(self):
self.finish('my id is {0}'.format(self.correlation_id)
if __name__ == '__main__':
application = web.Application([('/', Handler)])
application.listen(8888)
ioloop.IOLoop.instance().start()
Generated Correlation ID
GET / HTTP/1.1
Host: localhost:8888
Connection: keep-alive
HTTP/1.1 200 OK
Correlation-ID: 0a2b6080-e4da-43bf-a2a5-38d861846cb9
Content-Length: 44
my id is 0a2b6080-e4da-43bf-a2a5-38d861846cb9
Relayed Correlation ID
GET / HTTP/1.1
Host: localhost:8888
Connection: keep-alive
Correlation-Id: 4676922073c4c59b1f5e6b4a18894bd46f867316
HTTP/1.1 200 OK
Correlation-ID: 4676922073c4c59b1f5e6b4a18894bd46f867316
Connection: close
Content-Length: 48
my id is 4676922073c4c59b1f5e6b4a18894bd46f867316
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sprockets.mixins.correlation-3.0.0.tar.gz
.
File metadata
- Download URL: sprockets.mixins.correlation-3.0.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f13ad20b2b74b84656f526d14d75dad12a4672a7d2752511164c6dee8ca28def |
|
MD5 | 74fdd40e42863085c77701638534ec14 |
|
BLAKE2b-256 | 13f202aaf228dc9ef23ae6767dbb01d9c620ed69aa2eac2b254df19654b21d1d |
File details
Details for the file sprockets.mixins.correlation-3.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: sprockets.mixins.correlation-3.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61d1455e4af80bf85f219d6135b5726d1eb45c42ca31ea7297255339d199e53c |
|
MD5 | f449ad120914583abc485b8fef3e4583 |
|
BLAKE2b-256 | 64e67e9ccead4fc94dd30db12dcf8d1ca6bc10e61e7e79f58c23d8abb1b6f64e |