{"id":13482244,"url":"https://github.com/aio-libs/aiozipkin","last_synced_at":"2025-03-27T12:32:38.941Z","repository":{"id":38814422,"uuid":"105470666","full_name":"aio-libs/aiozipkin","owner":"aio-libs","description":"Distributed tracing instrumentation for asyncio with zipkin","archived":false,"fork":false,"pushed_at":"2025-03-03T16:26:00.000Z","size":5665,"stargazers_count":188,"open_issues_count":23,"forks_count":31,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-17T11:04:18.015Z","etag":null,"topics":["aiohttp","async-await","asyncio","dapper","distributed-tracing","jaeger","mypy","stackdriver","zipkin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aio-libs.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-01T20:05:13.000Z","updated_at":"2025-03-16T06:18:04.000Z","dependencies_parsed_at":"2023-12-25T17:44:20.182Z","dependency_job_id":"7695d391-46ac-47e9-87c9-4330f7ac5962","html_url":"https://github.com/aio-libs/aiozipkin","commit_stats":{"total_commits":581,"total_committers":23,"mean_commits":25.26086956521739,"dds":0.5266781411359724,"last_synced_commit":"0f15660507ffd8a0229fb5053ef55383a7580d7b"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiozipkin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiozipkin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiozipkin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiozipkin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aio-libs","download_url":"https://codeload.github.com/aio-libs/aiozipkin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245845395,"owners_count":20681905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohttp","async-await","asyncio","dapper","distributed-tracing","jaeger","mypy","stackdriver","zipkin"],"created_at":"2024-07-31T17:01:00.256Z","updated_at":"2025-03-27T12:32:38.419Z","avatar_url":"https://github.com/aio-libs.png","language":"Python","funding_links":[],"categories":["Python","Misc","其他"],"sub_categories":[],"readme":"aiozipkin\n=========\n.. image:: https://github.com/aio-libs/aiozipkin/workflows/CI/badge.svg\n    :target: https://github.com/aio-libs/aiozipkin/actions?query=workflow%3ACI\n.. image:: https://codecov.io/gh/aio-libs/aiozipkin/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/aio-libs/aiozipkin\n.. image:: https://api.codeclimate.com/v1/badges/1ff813d5cad2d702cbf1/maintainability\n   :target: https://codeclimate.com/github/aio-libs/aiozipkin/maintainability\n   :alt: Maintainability\n.. image:: https://img.shields.io/pypi/v/aiozipkin.svg\n    :target: https://pypi.python.org/pypi/aiozipkin\n.. image:: https://readthedocs.org/projects/aiozipkin/badge/?version=latest\n    :target: http://aiozipkin.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n    :target: https://gitter.im/aio-libs/Lobby\n    :alt: Chat on Gitter\n\n**aiozipkin** is Python 3.6+ module that adds distributed tracing capabilities\nfrom asyncio_ applications with zipkin (http://zipkin.io) server instrumentation.\n\nzipkin_ is a distributed tracing system. It helps gather timing data needed\nto troubleshoot latency problems in microservice architectures. It manages\nboth the collection and lookup of this data. Zipkin’s design is based on\nthe Google Dapper paper.\n\nApplications are instrumented with  **aiozipkin** report timing data to zipkin_.\nThe Zipkin UI also presents a Dependency diagram showing how many traced\nrequests went through each application. If you are troubleshooting latency\nproblems or errors, you can filter or sort all traces based on the\napplication, length of trace, annotation, or timestamp.\n\n.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/zipkin_animation2.gif\n    :alt: zipkin ui animation\n\n\nFeatures\n========\n* Distributed tracing capabilities to **asyncio** applications.\n* Support zipkin_ ``v2`` protocol.\n* Easy to use API.\n* Explicit context handling, no thread local variables.\n* Can work with jaeger_ and stackdriver_ through zipkin compatible API.\n\n\nzipkin vocabulary\n-----------------\nBefore code lets learn important zipkin_ vocabulary, for more detailed\ninformation please visit https://zipkin.io/pages/instrumenting\n\n.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/zipkin_glossary.png\n    :alt: zipkin ui glossary\n\n* **Span** represents one specific method (RPC) call\n* **Annotation** string data associated with a particular timestamp in span\n* **Tag** - key and value associated with given span\n* **Trace** - collection of spans, related to serving particular request\n\n\nSimple example\n--------------\n\n.. code:: python\n\n    import asyncio\n    import aiozipkin as az\n\n\n    async def run():\n        # setup zipkin client\n        zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'\n        endpoint = az.create_endpoint(\n            \"simple_service\", ipv4=\"127.0.0.1\", port=8080)\n        tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)\n\n        # create and setup new trace\n        with tracer.new_trace(sampled=True) as span:\n            # give a name for the span\n            span.name(\"Slow SQL\")\n            # tag with relevant information\n            span.tag(\"span_type\", \"root\")\n            # indicate that this is client span\n            span.kind(az.CLIENT)\n            # make timestamp and name it with START SQL query\n            span.annotate(\"START SQL SELECT * FROM\")\n            # imitate long SQL query\n            await asyncio.sleep(0.1)\n            # make other timestamp and name it \"END SQL\"\n            span.annotate(\"END SQL\")\n\n        await tracer.close()\n\n    if __name__ == \"__main__\":\n        loop = asyncio.get_event_loop()\n        loop.run_until_complete(run())\n\n\naiohttp example\n---------------\n\n*aiozipkin* includes *aiohttp* server instrumentation, for this create\n`web.Application()` as usual and install aiozipkin plugin:\n\n\n.. code:: python\n\n    import aiozipkin as az\n\n    def init_app():\n        host, port = \"127.0.0.1\", 8080\n        app = web.Application()\n        endpoint = az.create_endpoint(\"AIOHTTP_SERVER\", ipv4=host, port=port)\n        tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)\n        az.setup(app, tracer)\n\n\nThat is it, plugin adds middleware that tries to fetch context from headers,\nand create/join new trace. Optionally on client side you can add propagation\nheaders in order to force tracing and to see network latency between client and\nserver.\n\n.. code:: python\n\n    import aiozipkin as az\n\n    endpoint = az.create_endpoint(\"AIOHTTP_CLIENT\")\n    tracer = await az.create(zipkin_address, endpoint)\n\n    with tracer.new_trace() as span:\n        span.kind(az.CLIENT)\n        headers = span.context.make_headers()\n        host = \"http://127.0.0.1:8080/api/v1/posts/{}\".format(i)\n        resp = await session.get(host, headers=headers)\n        await resp.text()\n\n\nDocumentation\n-------------\nhttp://aiozipkin.readthedocs.io/\n\n\nInstallation\n------------\nInstallation process is simple, just::\n\n    $ pip install aiozipkin\n\n\nSupport of other collectors\n===========================\n**aiozipkin** can work with any other zipkin_ compatible service, currently we\ntested it with jaeger_ and stackdriver_.\n\n\nJaeger support\n--------------\njaeger_ supports zipkin_ span format as result it is possible to use *aiozipkin*\nwith jaeger_ server. You just need to specify *jaeger* server address and it\nshould work out of the box. Not need to run local zipkin server.\nFor more informations see tests and jaeger_ documentation.\n\n.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/jaeger.png\n    :alt: jaeger ui animation\n\n\nStackdriver support\n-------------------\nGoogle stackdriver_ supports zipkin_ span format as result it is possible to\nuse *aiozipkin* with this google_ service. In order to make this work you\nneed to setup zipkin service locally, that will send trace to the cloud. See\ngoogle_ cloud documentation how to setup make zipkin collector:\n\n.. image:: https://raw.githubusercontent.com/aio-libs/aiozipkin/master/docs/stackdriver.png\n    :alt: jaeger ui animation\n\n\nRequirements\n------------\n\n* Python_ 3.6+\n* aiohttp_\n\n\n.. _PEP492: https://www.python.org/dev/peps/pep-0492/\n.. _Python: https://www.python.org\n.. _aiohttp: https://github.com/KeepSafe/aiohttp\n.. _asyncio: http://docs.python.org/3.5/library/asyncio.html\n.. _uvloop: https://github.com/MagicStack/uvloop\n.. _zipkin: http://zipkin.io\n.. _jaeger: http://jaeger.readthedocs.io/en/latest/\n.. _stackdriver: https://cloud.google.com/stackdriver/\n.. _google: https://cloud.google.com/trace/docs/zipkin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faio-libs%2Faiozipkin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faio-libs%2Faiozipkin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faio-libs%2Faiozipkin/lists"}