Skip to content

Getting Started with OpenTelemetry Python

Test Python Snippets Minimum Python Version

Snippets that will guide you through instrumenting Python applications with OpenTelemetry Python API and SDK. You'll learn how to implement both manual and automatic instrumentation to emit traces, metrics, and logs to console/OTLP backends.

OpenTelemetry Python in a nutshell

Prerequisites

Before starting with this tutorial, ensure you have the following tools installed on your system:

  • uv - Fast Python package installer and resolver (recommended alternative to pip)

    • Install via curl: curl -LsSf https://astral.sh/uv/install.sh | sh
    • Or via pip: pip install uv
  • Docker - For running OpenTelemetry Collector and observability backends

List of snippets

Following is a list of all available OpenTelemetry Python snippets:

basics

fastapi

flask

requests


Congratulations! You now have a solid foundation for instrumenting Python applications with OpenTelemetry. Start with the simple examples and gradually add more sophisticated instrumentation as your observability needs grow.