OpenTelemetry Python SDK

The reference implementation of the OpenTelemetry API for Python - traces, metrics, and logs

Library
PyPI
v1.45.0
2,649 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
93 /100 Excellent
Development Activity 96
Maintenance 96
Community 80
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
89 /100 Excellent
Architecture 92
Code Quality 90
Innovation 85
Learning Curve 72

OpenTelemetry Python SDK is the official reference implementation of the OpenTelemetry API for Python. It turns the no-op API that libraries instrument against into a fully working telemetry pipeline, capturing distributed traces, metrics, and logs and exporting them to any OpenTelemetry-compatible backend such as the OTLP Collector, Jaeger, or Prometheus.

Applications install the SDK to configure providers, processors, samplers, resource attributes, and exporters, while the libraries they depend on stay coupled only to the lightweight API. This clean split lets you standardize observability across services and vendors without rewriting instrumentation, and it is governed as a CNCF project under the vendor-neutral OpenTelemetry specification.

What You Get

  • Production-ready TracerProvider, MeterProvider, and LoggerProvider implementations of the OpenTelemetry API
  • Batch and simple span/log processors plus metric readers with configurable export intervals
  • Built-in samplers (always-on/off, trace-ID ratio, parent-based) and metric views for aggregation control
  • Resource detection and semantic-convention attributes that describe the emitting service and environment
  • Environment-variable and entry-point based auto-configuration for exporters, propagators, and samplers

Common Use Cases

  • Instrumenting a Python web service to emit distributed traces to an OTLP Collector
  • Collecting and exporting application and runtime metrics for Prometheus or a vendor backend
  • Standardizing observability across microservices without vendor lock-in
  • Correlating logs, traces, and metrics through shared context and resource attributes

Under The Hood

Architecture

The SDK is organized under src/opentelemetry/sdk into three signal pipelines - trace, metrics, and _logs - each exposing a concrete provider (TracerProvider in trace/__init__.py, MeterProvider, LoggerProvider) that implements the corresponding abstract API type. Each provider fans records out to pluggable processors/readers, which in turn hand batches to exporters; the trace/export and metrics/_internal/export packages supply batch and in-memory implementations. Cross-cutting concerns live in resources (service/environment attributes), _configuration (env-var and entry-point driven auto-setup), and _shared_internal, while samplers and metric views gate what data is recorded before it reaches an exporter. Providers register atexit and shutdown hooks so buffered spans and metrics flush cleanly on process exit.

Tech Stack

Pure Python targeting 3.10+ and marked Production/Stable. It is built with Hatchling, depends only on opentelemetry-api, opentelemetry-semantic-conventions, and typing-extensions, and ships as a PEP 561 typed package. Entry points expose environment-variable handlers, id generators, samplers, and exporters for discovery-based configuration, keeping the core dependency footprint minimal.

Code Quality

The repository is a mature, well-tested monorepo with roughly 75 test modules covering the SDK alone, benchmarks, and CI enforced via GitHub Actions and tox. Code is fully type-annotated, follows semantic-convention constants rather than magic strings, and uses bounded attribute collections and explicit limits to guard against unbounded memory growth. As a CNCF project it carries an OpenSSF Best Practices badge and a large, active contributor base.

API Design

The public API mirrors the OpenTelemetry specification, so provider/processor/exporter names are consistent across languages and signals. Getting started requires deliberate wiring - create a provider, attach a processor, register an exporter - which is more boilerplate than a single-call helper, but that explicitness gives fine-grained control. Extensive online documentation, getting-started guides, and entry-point auto-configuration reduce the ceremony for common setups.

Used by 33 apps in this directory

Python
67%
Apache 2.0

Agent Control

AI Agents

314

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
74
Repo Health
71
Technical
67
Dependency
Built with
Python 67%
TypeScript 32%
Updated 4 days ago
Python
99%
MIT

Agent Lightning

AI Development

18,515

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
85
Repo Health
68
Technical
69
Dependency
Built with
Python 99%
Updated 4 days ago
TypeScript
56%
Other

agenta

AI Development · Developer Tools · Devops

4,788

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript 56%
Python 39%
Updated 5 days ago
Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,358

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 4 days ago
TypeScript
54%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,404

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
68
Dependency
Built with
TypeScript 54%
Rust 34%
Updated 4 days ago
Python
62%
MIT

AutoGen

AI Development · Automation

61,194

Build autonomous and human-in-the-loop multi-agent AI systems with a layered, event-driven Python and .NET framework pioneered at Microsoft Research.

View details
56
Repo Health
78
Technical
73
Dependency
Built with
Python 62%
C# 25%
TypeScript 12%
Updated 5 months ago
Python
68%
Other

Baserow

Databases · No Code Platforms

6,012

Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.

View details
89
Repo Health
84
Technical
68
Dependency
Built with
Python 68%
JavaScript 16%
Vue 11%
Updated 5 days ago
Go
59%
Apache 2.0

Cog

AI Development · Developer Tools · Devops

9,484

An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.

View details
85
Repo Health
88
Technical
69
Dependency
Built with
Go 59%
Rust 17%
HTML 13%
Updated 1 weeks ago
TypeScript
50%
Other

Dify

AI Development · Design Tools · Developer Tools

157,364

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
66
Dependency
Built with
TypeScript 50%
Python 47%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers