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-1.0.1.tar.gz
.
File metadata
- Download URL: sprockets.mixins.correlation-1.0.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3383c1c13ac8cd9f7aa1b9b13c405985836e3bbb9fb64100cf0f95bbd4111a4d |
|
MD5 | 0f578be64135c69351374140a2449cdd |
|
BLAKE2b-256 | 1c958126eec84a2245df86003421a3e21cd8696f1836841b8627cfae28206661 |
File details
Details for the file sprockets.mixins.correlation-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: sprockets.mixins.correlation-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef62d8eff5a9c5e8ec18599b0ca9cd9c882cfefc2e406784b68f42dd3d5abea |
|
MD5 | f77c42436a880ae843dd0766696c3665 |
|
BLAKE2b-256 | 0f386722ed3e121a3f18ee3adef5b702c50459955cf7497cf0deae73bb073e3d |