{"id":16543651,"url":"https://github.com/florimondmanca/ddtrace-asgi","last_synced_at":"2025-09-20T20:31:29.526Z","repository":{"id":55717486,"uuid":"214875493","full_name":"florimondmanca/ddtrace-asgi","owner":"florimondmanca","description":"Unofficial Datadog tracing integration for ASGI apps and frameworks","archived":false,"fork":false,"pushed_at":"2020-12-12T23:08:21.000Z","size":96,"stargazers_count":30,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-16T18:51:25.365Z","etag":null,"topics":["asgi","datadog","python","tracing"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/ddtrace-asgi","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/florimondmanca.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-13T18:51:53.000Z","updated_at":"2023-04-28T11:22:18.000Z","dependencies_parsed_at":"2022-08-15T06:31:20.239Z","dependency_job_id":null,"html_url":"https://github.com/florimondmanca/ddtrace-asgi","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/florimondmanca/ddtrace-asgi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florimondmanca%2Fddtrace-asgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florimondmanca%2Fddtrace-asgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florimondmanca%2Fddtrace-asgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florimondmanca%2Fddtrace-asgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florimondmanca","download_url":"https://codeload.github.com/florimondmanca/ddtrace-asgi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florimondmanca%2Fddtrace-asgi/sbom","scorecard":{"id":404080,"data":{"date":"2025-08-11","repo":{"name":"github.com/florimondmanca/ddtrace-asgi","commit":"78936f2556dc3df906d40fcf78a2e64907eb301f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2021-100 / GHSA-8h2j-cgx8-6xv7","Warn: Project is vulnerable to: PYSEC-2024-38","Warn: Project is vulnerable to: PYSEC-2022-183 / GHSA-h8pj-cxx2-jfg2"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T20:46:01.096Z","repository_id":55717486,"created_at":"2025-08-18T20:46:01.096Z","updated_at":"2025-08-18T20:46:01.096Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275870935,"owners_count":25543467,"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","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asgi","datadog","python","tracing"],"created_at":"2024-10-11T19:00:37.695Z","updated_at":"2025-09-20T20:31:29.242Z","avatar_url":"https://github.com/florimondmanca.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ddtrace-asgi\n\n[![Build Status](https://dev.azure.com/florimondmanca/public/_apis/build/status/florimondmanca.ddtrace-asgi?branchName=master)](https://dev.azure.com/florimondmanca/public/_build/latest?definitionId=2\u0026branchName=master)\n[![Coverage](https://codecov.io/gh/florimondmanca/ddtrace-asgi/branch/master/graph/badge.svg)](https://codecov.io/gh/florimondmanca/ddtrace-asgi)\n[![Package version](https://badge.fury.io/py/ddtrace-asgi.svg)](https://pypi.org/project/ddtrace-asgi)\n\nUnofficial `ddtrace` integration for ASGI apps and frameworks.\n\nShould work seamlessly for any ASGI web framework, e.g. Starlette, FastAPI, Quart, etc.\n\n**Note**: This project is in alpha stage.\n\n## Requirements\n\n- Python 3.6+.\n- [`ddtrace`](https://github.com/DataDog/dd-trace-py) must be installed to use the `ddtrace-run` command.\n- The [Datadog Agent](https://docs.datadoghq.com/agent/) must be installed and running for traces to be effectively sent to Datadog APM.\n\n## Installation\n\n```bash\npip install ddtrace-asgi\n```\n\n## Quickstart\n\nTo automatically send traces to [Datadog APM](https://docs.datadoghq.com/tracing/) on each HTTP request, wrap your ASGI application around `TraceMiddleware`:\n\n```python\n# app.py\nfrom ddtrace_asgi import TraceMiddleware\n\nasync def app(scope, receive, send):\n    assert scope[\"type\"] == \"http\"\n    headers = [[b\"content-type\", b\"text/plain\"]]\n    await send({\"type\": \"http.response.start\", \"status\": 200, \"headers\": headers})\n    await send({\"type\": \"http.response.body\", \"body\": b\"Hello, world!\"})\n\napp = TraceMiddleware(app)\n```\n\nThen use `ddtrace-run` when serving your application. For example, if serving with Uvicorn:\n\n```bash\nddtrace-run uvicorn app:app\n```\n\nFor more information on using `ddtrace`, please see the official [`dd-trace-py`](https://github.com/DataDog/dd-trace-py) repository.\n\n## Examples\n\n### Starlette\n\n```python\nfrom ddtrace_asgi import TraceMiddleware\nfrom starlette.applications import Starlette\n\napp = Starlette()\napp.add_middleware(TraceMiddleware, service=\"my-starlette-app\")\n```\n\n### FastAPI\n\n```python\nfrom ddtrace_asgi import TraceMiddleware\nfrom fastapi import FastAPI\n\napp = FastAPI()\napp.add_middleware(TraceMiddleware, service=\"my-fastapi-app\")\n```\n\n## API Reference\n\n### `TracingMiddleware`\n\n```python\nclass TracingMiddleware:\n    def __init__(self, app, tracer=None, service=\"asgi\", tags=None, distributed_tracing=True):\n        ...\n```\n\nAn ASGI middleware that sends traces of HTTP requests to Datadog APM.\n\n**Parameters**\n\n- **app** - An [ASGI](https://asgi.readthedocs.io) application.\n- **tracer** - _(optional)_ A [`Tracer`](http://pypi.datadoghq.com/trace/docs/advanced_usage.html#tracer) object. Defaults to the global `ddtrace.tracer` object.\n- **service** - _(optional)_ Name of the service as it will appear on Datadog.\n- **tags** - _(optional)_ Constant tags to apply to all traces. Either a dictionary, or a list of `\"\u003cNAME\u003e:\u003cVALUE\u003e\"` strings. See also [Tagging](https://docs.datadoghq.com/tagging/).\n- **distributed_tracing** - _(optional)_ Whether to enable [distributed tracing](http://pypi.datadoghq.com/trace/docs/advanced_usage.html#distributed-tracing).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorimondmanca%2Fddtrace-asgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorimondmanca%2Fddtrace-asgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorimondmanca%2Fddtrace-asgi/lists"}