Skip to main content

Zipkin tracing for nameko framework

Project description


Zipkin tracing for nameko framework


pip install emplocity-nameko-zipkin



from nameko_zipkin import Zipkin
from nameko.rpc import rpc

class Service:
    name = 'service'
    zipkin = Zipkin() # Dependency provider injects py_zipkin.zipkin.zipkin_span object
    def method(self):
        assert self.zipkin.service_name ==
        assert self.zipkin.span_name == Service.method.__name__

Standalone rpc

from py_zipkin import zipkin
from nameko_zipkin import monkey_patch
from nameko_zipkin.transport import HttpHandler
from nameko.standalone.rpc import ClusterRpcProxy

handler = HttpHandler('http://localhost:9411/api/v1/spans').handle

with zipkin.zipkin_server_span('RootService',
    with ClusterRpcProxy({'AMQP_URI': "pyamqp://guest:guest@localhost"}) as proxy:

How it works

  • monkey_patch patches MethodProxy class to initialize a client span, it's called in dependency provider setup method
  • On service method call a server span is created
  • Trace parameters (trace_id, parent_span_id, etc.) are passed through context data and are accessible in py_zipkin.thread_local.get_zipkin_attrs
  • If there are no parameters, request isn't traced
  • Child service calls are also supported
  • Trace results are reported through handler classes in nameko_zipkin.transport


ZIPKIN section must be added to nameko service config.yaml

    HANDLER: HttpHandler
      url: http://localhost:9411/api/v1/spans

Planed changes

  • Trace initialization on trace attrs absence in context data
  • Kafka transport support
  • Custom handlers support in config.yaml ('my_module.MyHandler')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for emplo-nameko-zipkin, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size emplo-nameko-zipkin-0.1.7.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page