Automatically trace your Django application to Zipkin

pip install django-zipkin-trace-nonspecialist==1.1.2



License PyPi

Automatically trace your Django application with py_zipkin


Trace running in Zipkin:


Trace running in Stackdriver Trace using Zipkin adapter:

Stackdriver Trace

Stackdriver Trace Analysis


Install this from pip:

$ pip install django-zipkin-trace

(you may want to write this in your requirements.txt)

Then add zipkin_trace.ZipkinMiddleware as your topmost middleware and set ZIPKIN_SERVER to your Zipkin URL (eg. http://zipkin:9411)

Supported tracers

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

Configuration options

These options can be set in

  • 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

Overriding transport

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.

Support policy

This library will be deprecated once opentracing-python ships a Zipkin-compatible tracer.


Licensed under the MIT License. Contains code adapted from django-speedbar.