Skip to main content

An zipkin extension for Flask based on py_zipkin.

Project description


a flask zipkin extension based on py_zipkin.


pip install flask_zipkin


you can simply use it as other flask extensions.

from flask_zipkin import Zipkin

zipkin = Zipkin(app, sample_rate=10)
app.config['ZIPKIN_DSN'] = ""

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.update_tags(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

Project details

Download files

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

Source Distribution

Flask-Zipkin-0.0.5.tar.gz (3.4 kB view hashes)

Uploaded source

Built Distribution

Flask_Zipkin-0.0.5-py3-none-any.whl (3.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page