{"id":21870774,"url":"https://github.com/digma-ai/otel-sample-fastapi","last_synced_at":"2026-05-04T08:38:28.590Z","repository":{"id":41843374,"uuid":"485183160","full_name":"digma-ai/otel-sample-fastapi","owner":"digma-ai","description":"Simple FastAPI example with OpenTelemetry and Digma instrumentation","archived":false,"fork":false,"pushed_at":"2022-11-29T07:47:10.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-31T15:11:14.831Z","etag":null,"topics":["fastapi","observability","opentelemetry","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digma-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-25T01:18:58.000Z","updated_at":"2022-05-14T23:26:22.000Z","dependencies_parsed_at":"2023-01-21T09:45:34.207Z","dependency_job_id":null,"html_url":"https://github.com/digma-ai/otel-sample-fastapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/digma-ai/otel-sample-fastapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digma-ai%2Fotel-sample-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digma-ai%2Fotel-sample-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digma-ai%2Fotel-sample-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digma-ai%2Fotel-sample-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digma-ai","download_url":"https://codeload.github.com/digma-ai/otel-sample-fastapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digma-ai%2Fotel-sample-fastapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275456631,"owners_count":25468224,"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-16T02:00:10.229Z","response_time":65,"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":["fastapi","observability","opentelemetry","python"],"created_at":"2024-11-28T06:12:35.159Z","updated_at":"2025-09-16T17:07:37.987Z","avatar_url":"https://github.com/digma-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenTelemetry Sample: FastAPI simple API instrumented with OTEL and Digma\n\nThe following code is a sample application used to test various scenarios, performance bottlenecks and runtime errors with [Digma](https://github.com/digma-ai/digma). This sample uses the standard OTEL instrumentation library as well as the [Digma instrumentation](https://github.com/digma-ai/opentelemetry-instrumentation-digma) helper library.\n\n## Preqrequisites\n- [Python 3.8+](https://www.python.org/downloads/)\n- [vsCode](https://code.visualstudio.com/download)\n\n## Running the app with Digma\n\n### Install the IDE extension\n\n1. Install the [Digma Extension](https://marketplace.visualstudio.com/items?itemName=digma.digma) into the vsCode IDE\n2. Open the 'Settings' tab of the extension\n\n![image](https://user-images.githubusercontent.com/93863/165008075-96fa40cd-a566-4c69-9481-195f69f3c425.png)\n\n3. Set the 'Digma URL' to your Digma Account URL on the User/Workspace level, leave the port as 5051. \n\n\u003cimg width=\"810\" alt=\"image\" src=\"https://user-images.githubusercontent.com/93863/202889680-1aa7363f-dea0-49b2-a2f8-1aee4c9399e7.png\"\u003e\n\n### Prepare the FastAPI app environment\n\n1. Clone the repo and switch to the repo folder. \n2. Optionally create and activate a virtualenv for the project, for example:\n```bash\npython3 -m venv ./venv\nsource venv/bin/activate\n```\n\n3. Install all dependencies:\n```bash\npip install -r requirements.txt\n```\n\n4. In main.py, modify the OTEL exporter to use the Digma backend as well. For the 'backend_url' parameter in the Digma instrumentation (line 33) replace 'localhost' with the URL provided to your account, like so (do not include any brackets in the URL):\n\n```python\ndigma_opentelemetry_boostrap(service_name='server-ms', digma_backend=\"http://[ACCOUNT_URL]:5050\",\n                             configuration=DigmaConfiguration().trace_this_package()\n                            .set_environment('dev'))\n```\n\n4. Run the main file.\n\n```bash\npython main.py\n```\n\n### Use the application\n\nPlay around to trigger some API calls. You can try visiting some of the API urls. \nFor example:\n\n- http://localhost:8000\n- http://localhost:8000/login\n- http://localhost:8000/validate\n- http://localhost:8000/process\n- http://localhost:8000/validateuser/2\n\n### Troubleshooting\n\nIf you've encountered any issue, open the 'output' panel for the digma extension, it may contain more information about the issue:\n\n![image](https://user-images.githubusercontent.com/93863/165012583-9d154ea5-7378-466b-a6cc-686d4b5261e3.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigma-ai%2Fotel-sample-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigma-ai%2Fotel-sample-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigma-ai%2Fotel-sample-fastapi/lists"}