Skip to main content

Stuff to correlate requests, logs, and the like

Project description

Version Downloads Status Coverage License Documentation

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

sprockets.mixins.correlation-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

sprockets.mixins.correlation-1.0.0-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sprockets.mixins.correlation-1.0.0.tar.gz.

File metadata

File hashes

Hashes for sprockets.mixins.correlation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cc3b13664f0b2547c947a417a9f2a2d3bab276f0afcd22cd8d26b0036d4782d9
MD5 cfa1a016325aa1df39ede566f1af533d
BLAKE2b-256 e3c87649b8951cdde46f32303fbbae62221ed67b797f5f60a1416c82db312f4b

See more details on using hashes here.

File details

Details for the file sprockets.mixins.correlation-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sprockets.mixins.correlation-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bbf4cca66907fdb5deb4ec7a02f1451f26a21e58a7a587a0f9748cb4d2bd20a2
MD5 c01296f0716c9c589daf0e1e7a166197
BLAKE2b-256 8d65a5aa3654656899f79a3f9df30a433bf317a814e5e4e67786626e191544d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page