No description or website provided.
Latest commit a0f3495 Jan 11, 2017 @killpanda killpanda committed on GitHub Merge pull request #7 from santtu/patch-1
guard against _zipkin_span not set in g
Failed to load latest commit information.
.gitignore init commit Oct 25, 2016 add logging fuc Nov 19, 2016 guard against _zipkin_span not set in g Jan 11, 2017 init commit Oct 25, 2016


a flask zipkin extesion based on py_zipkin.


pip install flask_zipkin


you can simply use it as other flask extensions.

from flask_zipkin import Zipkin

zipkin = Zipkin(sample_rate=10)

Advance Usage

you could gen a header to pass it to other services, the downstream service will recieve this header.

def hello():
    headers = {}
    r = requests.get('http://localhost:5001', headers=headers)
    return r.text

flask_zipkin will use http transport by default. You could define a transport, like:

def default_handler(self, encoded_span):
    body = str.encode('\x0c\x00\x00\x00\x01') + encoded_span
        'your transport dsn',
        headers={'Content-Type': 'application/x-thrift'},

flask_zipkin eats all transport exception by default. You could define an exception handler, like:

def default_ex_handler(self, ex):
    raise ex

and also, you could exempt some views, like:

def hello():
    return 'hello world'

add key, value for your tracing record, like:

zipkin.logging(id=1, user_id=2)

app configs

ZIPKIN_DISABLE disable zipkin tracking if value is True

ZIPKIN_DSN http transport dsn: such as http://localhost:9411/api/v1/spans