Automatically trace your Django application with py_zipkin
Trace running in Zipkin:
Install this from pip:
$ pip install django-zipkin-trace
(you may want to write this in your requirements.txt)
zipkin_trace.ZipkinMiddleware as your topmost middleware and set
ZIPKIN_SERVER to your Zipkin URL (eg. http://zipkin:9411)
These tracers are provided out of the box. No configuration is needed.
- Database query (SQL are logged, but parameters are not)
- urllib3 requests (including the requests module)
- Template rendering
These options can be set in settings.py:
- ZIPKIN_SERVER: HTTP URL of Zipkin server
- ZIPKIN_SERVICE_NAME: Service name, default to Django
- ZIPKIN_SAMPLE_RATE: Sampling rate in percent from 0 - 100, default to 100
If you use other Zipkin transport, override
transport_handler(self, span) in
zipkin_trace.ZipkinMiddleware to your transport code. See py_zipkin docs for example.
By default, py_zipkin will batch 100 traces before sending. This will make traces slow to appear in Zipkin as it needs to collect 100 traces first. If Django debug mode is on, the middleware will disable this buffer.
This library will be deprecated once opentracing-python ships a Zipkin-compatible tracer.