Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.4 KB

File metadata and controls

31 lines (23 loc) · 1.4 KB

OpenTelemetry FastAPI Example

This repository is built by highlight.io, an open source observability platform that has both a cloud service and a self-hosted offering. OpenTelemetry is a spec supported by many observability providers, but if you want an opinionated, easy to use, and fully featured observability platform, you can head over to highlight.io.

What is this repository?

This repository is a simple FastAPI application that demonstrates how to use OpenTelemetry to instrument a FastAPI application. For the full guide, see this blog post.

This repository covers:

  • Setting up basic logs, traces, and metrics and how to forward this over to an OTEL backend (see o11y.py)
  • Catching every incoming request using the standard traceparent header, and creating a span for each request
  • Instrumenting outgoing requests using the requests library

Development Setup

Prerequisites

Installation Steps

  1. Clone the repository

  2. Configure your HIGHLIGHT_PROJECT_ID in the .env file (or your vendor's specific config) or in o11y.py

  3. Install dependencies:

    poetry install --no-root
  4. Run the app:

    poetry run uvicorn main:app --reload