Skip to content

highlight/otel-fastapi-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (or your vendor's specific config) in o11y.py

  3. Install dependencies:

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

    poetry run uvicorn main:app --reload

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages