Skip to main content

flask-zipkin

a flask zipkin extension based on py_zipkin.

Installation

pip install flask_zipkin

usage

you can simply use it as other flask extensions.

from flask_zipkin import Zipkin

zipkin = Zipkin(app, sample_rate=10)
app.config['ZIPKIN_DSN'] = "http://127.0.0.1:9411/api/v1/spans"

Advance Usage

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

@bp.route('/')
def hello():
    headers = {}
    headers.update(zipkin.create_http_headers_for_new_span())
    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:

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

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

@zipkin.transport_exception_handler
def default_ex_handler(self, ex):
    raise ex

and also, you could exempt some views, like:

@zipkin.exempt
@bp.route('/')
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

Metadata

Release files for Flask-Zipkin 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Zipkin 0.0.5
File Size Uploaded Provenance Actions
Flask-Zipkin-0.0.5.tar.gz 3.4 kB Without provenance Details for Flask-Zipkin-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Zipkin 0.0.5
File Interpreter ABI Platform Actions
Flask_Zipkin-0.0.5-py3-none-any.whl Python 3 none any Details for Flask_Zipkin-0.0.5-py3-none-any.whl

Total release size: 7.0 kB

Release files / Flask-Zipkin-0.0.5.tar.gz

Download URL Flask-Zipkin-0.0.5.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
90a1052e4be7f6302e7a24709ba46c923ebd4175211ac3616b01577547406e45
BLAKE2b-256 checksum
How to use checksums
c0e60ada1bdf65b0bcf5110cd85b0b66cc0c911c2cb3f668df6f2ec937b521cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

Release files / Flask_Zipkin-0.0.5-py3-none-any.whl

Download URL Flask_Zipkin-0.0.5-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d4fd5216ce412e65468c524c909c9ebcb527ee3c21922c79b027ed218d7f175
BLAKE2b-256 checksum
How to use checksums
d518d53b64c402f1c7e870020d4393c8322a06b6cb22c29faaf26c0a513d1f37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

Security for Flask-Zipkin 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page