{"id":13424730,"url":"https://github.com/wesdu/fastapi-opentracing","last_synced_at":"2025-07-11T05:41:37.857Z","repository":{"id":41439169,"uuid":"299216829","full_name":"wesdu/fastapi-opentracing","owner":"wesdu","description":"fastapi opentracing middleware works on k8s","archived":false,"fork":false,"pushed_at":"2023-02-06T03:09:19.000Z","size":103,"stargazers_count":24,"open_issues_count":7,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T15:22:17.438Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wesdu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2020-09-28T06:56:37.000Z","updated_at":"2024-10-03T12:20:56.000Z","dependencies_parsed_at":"2024-01-03T02:29:58.280Z","dependency_job_id":"d483c667-e85f-4ae5-a156-6983abe9804d","html_url":"https://github.com/wesdu/fastapi-opentracing","commit_stats":{"total_commits":28,"total_committers":5,"mean_commits":5.6,"dds":0.5714285714285714,"last_synced_commit":"a5067d424dea19d9a082b16ff554d7864376adaf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesdu%2Ffastapi-opentracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesdu%2Ffastapi-opentracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesdu%2Ffastapi-opentracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesdu%2Ffastapi-opentracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wesdu","download_url":"https://codeload.github.com/wesdu/fastapi-opentracing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238662692,"owners_count":19509650,"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":[],"created_at":"2024-07-31T00:00:58.492Z","updated_at":"2025-02-13T13:33:06.272Z","avatar_url":"https://github.com/wesdu.png","language":"Python","funding_links":[],"categories":["Third-Party Extensions"],"sub_categories":["Utils"],"readme":"# fastapi-opentracing\nfastapi opentracing middleware works with istio\n\ninstall:\n\n```\npip install fastapi-opentracing\n```\n   \nexample:\n\n```python\nfrom fastapi import FastAPI\nimport uvicorn\nfrom fastapi_opentracing import get_opentracing_span_headers\nfrom fastapi_opentracing.middleware import OpenTracingMiddleware\n\napp = FastAPI()\n\napp.add_middleware(OpenTracingMiddleware)\n\n\n@app.get(\"/\")\nasync def root():\n    carrier = await get_opentracing_span_headers()\n    return {'span': carrier}\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n```\n\nif your application uses tortoise-orm, you can execute the `install_all_patch` \nor specify the client `mysql_client.install_patch` to patch you SQLClient\n\nexample:\n\n```python\nfrom fastapi import FastAPI\nimport uvicorn\nfrom fastapi_opentracing import get_opentracing_span_headers\nfrom fastapi_opentracing.middleware import OpenTracingMiddleware\nfrom fastapi_opentracing.client_hooks.mysql_client import install_patch\nfrom fastapi_opentracing.client_hooks import install_all_patch\n\n\napp = FastAPI()\n\napp.add_middleware(OpenTracingMiddleware)\nTORTOISE_ORM = {\n    \"connections\": {\"default\": \"mysql://root:123456@127.0.0.1:3306/test\"},\n    \"apps\": {\n        \"models\": {\n            \"models\": [\"tests.models\", \"aerich.models\"],\n            \"default_connection\": \"default\",\n        },\n    },\n}\nregister_tortoise(\n    app,\n    config=TORTOISE_ORM,\n    generate_schemas=True\n)\n\ninstall_all_patch()\n\n@app.get(\"/\")\nasync def root():\n    carrier = await get_opentracing_span_headers()\n    return {'span': carrier}\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n```\n\n\nContributing and Developing\n\nTo install all dependencies, run:\n```shell\npython3 -m venv venv\nsource venv/bin/activate\nmake bootstrap\n```\n\nRunning Tests\n```shell\nmake test\n```\n\nCheck the style and quality of python code\n```shell\nmake lint\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesdu%2Ffastapi-opentracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesdu%2Ffastapi-opentracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesdu%2Ffastapi-opentracing/lists"}