{ "info": { "author": "Frank Wiles", "author_email": "frank@revsys.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "django-tracer\n========================\n[![Build Status](https://travis-ci.org/revsys/django-tracer.svg?branch=master)](https://travis-ci.org/revsys/django-tracer)\n\nGenerate a UUID for all requests to Django to be used in logging and error reporting for traceability. \n\n# Why? \n\nWhy would you want to use this silly little thing? Well in a containerized, orchestrated, microservice world with centralized logging it's often hard to figure out where things have gone wrong. \n\nThis little middleware adds a UUID to the normal Django request object which you can use to add to add to things like: \n\n- All of your log messages\n- Error reports to Sentry/Rollbar/etc\n- Pass along to other internal services\n\nAlong with generating and attaching a UUID to each request, the middleware also automatically adds the UUID to the response headers as `X-Request-ID` so anyone consuming your responses, say as an API, can use that as a reference point for reporting errors back to you. \n\n# Installation\n\nFirst you need to install it via pip: \n\n```shell\npip install django-tracer\n```\n\nThen just add `tracer` to `INSTALLED_APPS` in your settings. \n\nThen add `tracer.middleware.RequestID` to the top of your `MIDDLEWARE` settings. \n\n# Usage with standard logging\n\n```python\nimport logging\n\nfrom django.http import HttpResponse\n\nlogger = logging.getLogger(__name__)\n\ndef some_view(request):\n \"\"\" simple log example \"\"\"\n logger.info(\"Whee!\", extra={'request_id': request.id})\n return HttpResponse(\"example content\")\n```\n\n## Other ways to use this Request ID\n\nThere are several other places you may consider wanting to use the ID to improve traceability: \n\n- Pass it as an argument to any Celery tasks you generate so there is a clear path between the incoming request and the tasks that were generated from it\n- Pass it as a header or argument to other internal APIs or services \n- Attach it to a bound [structlog](http://www.structlog.org/) object so it is always included in your log output\n\n# Thanks! \n\nSpecial thanks to [Rolf H\u00e5vard Blindheim](https://github.com/rhblind) for graciously turning over the name `django-tracer` to us to be able to use it for this project. \n\n## Need help?\n\n[REVSYS](http://www.revsys.com?utm_medium=github&utm_source=django-tracer) can help with your Python, Django, and infrastructure projects. If you have a question about this project, please open a GitHub issue. If you love us and want to keep track of our goings-on, here's where you can find us online:\n\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/revsys/django-tracer/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-tracer", "package_url": "https://pypi.org/project/django-tracer/", "platform": "", "project_url": "https://pypi.org/project/django-tracer/", "project_urls": { "Homepage": "https://github.com/revsys/django-tracer/" }, "release_url": "https://pypi.org/project/django-tracer/0.9.3/", "requires_dist": null, "requires_python": "", "summary": "django-tracer gives you an easy way to generate and use a UUID per request", "version": "0.9.3" }, "last_serial": 4539487, "releases": { "0.0.1": [], "0.9.1": [ { "comment_text": "", "digests": { "md5": "4c17f1f84bdab4a6f508b0744fe1cb3b", "sha256": "4c5fc9e1e28f7503e0ce3d2f0a85cbc39fdc94abe7a754c3572d994e6b921cb1" }, "downloads": -1, "filename": "django-tracer-0.9.1.tar.gz", "has_sig": false, "md5_digest": "4c17f1f84bdab4a6f508b0744fe1cb3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4194, "upload_time": "2018-07-31T16:00:27", "url": "https://files.pythonhosted.org/packages/42/87/a99d9b3fdf72934fb9c1917a4a1598eb13b9240fb4ef583b5a01c5ffd18c/django-tracer-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "83d3b1c66895b8483961c3559a31e4db", "sha256": "f0d7f88dfe2ea73751a3fcd6c5c390ce2a417c7637229b8467ca17515c0aa09c" }, "downloads": -1, "filename": "django-tracer-0.9.2.tar.gz", "has_sig": false, "md5_digest": "83d3b1c66895b8483961c3559a31e4db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4236, "upload_time": "2018-07-31T16:02:23", "url": "https://files.pythonhosted.org/packages/1c/17/d78d0f995a4bc86c8ae829f822aab5c9c2bfb75771182bf574f0f7a2ae53/django-tracer-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "1822c275a56d563cb8901823be2738bc", "sha256": "1f1b6dc228a45992b0df966cf348208e30254ecf3c188641fbb3671b90698374" }, "downloads": -1, "filename": "django-tracer-0.9.3.tar.gz", "has_sig": false, "md5_digest": "1822c275a56d563cb8901823be2738bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3454, "upload_time": "2018-11-28T16:56:05", "url": "https://files.pythonhosted.org/packages/de/9b/48f604ba67aa0ef4bc118ae573a934682264f3c86d61aef1a682173bdc35/django-tracer-0.9.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1822c275a56d563cb8901823be2738bc", "sha256": "1f1b6dc228a45992b0df966cf348208e30254ecf3c188641fbb3671b90698374" }, "downloads": -1, "filename": "django-tracer-0.9.3.tar.gz", "has_sig": false, "md5_digest": "1822c275a56d563cb8901823be2738bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3454, "upload_time": "2018-11-28T16:56:05", "url": "https://files.pythonhosted.org/packages/de/9b/48f604ba67aa0ef4bc118ae573a934682264f3c86d61aef1a682173bdc35/django-tracer-0.9.3.tar.gz" } ] }