OpenTelemetry Python SDK

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

Library
PyPI
v1.45.1
2,687 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
94 /100 Excellent
Development Activity 100
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
87%
Apache 2.0

PrivateGPT

AI Development

57,611

The open-source API layer that turns local LLMs into production private AI applications with full Claude API compatibility

View details
88
Repo Health
83
Technical
70
Dependency
Built with
Python 87%
Updated 6 days ago
TypeScript
98%
MIT

Promptfoo

AI Development

26,358

An open-source CLI and library for evaluating and red-teaming LLM applications — replace trial-and-error prompt engineering with systematic evals, vulnerability scanning, and CI/CD integration.

View details
90
Repo Health
73
Technical
67
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
47%
Other

Stirling PDF

Digital Signiture · Productivity

94,824

The open-source PDF platform you can run anywhere — edit, convert, sign, and automate PDFs without sending files to external servers.

View details
92
Repo Health
86
Technical
68
Dependency
Built with
TypeScript 47%
Java 44%
Updated 5 days ago
Python
71%
Apache 2.0

SurfSense

AI Assistants · Search

16,586

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
88
Repo Health
71
Technical
66
Dependency
Built with
Python 71%
TypeScript 27%
Updated 5 days ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated 6 days ago
Python
92%
GPL 3.0

Weblate

Developer Tools

6,124

Continuous localization platform that commits translations directly into your version control system with full translator attribution.

View details
95
Repo Health
86
Technical
67
Dependency
Built with
Python 92%
Updated 5 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