OpenTelemetry Instrumentation for Requests

Automatic distributed tracing for Python's requests HTTP library

Library
PyPI
v0.65b0
1,091stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
96/100Excellent
Development Activity96
Maintenance100
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture82
Code Quality87
Innovation70
Learning Curve76

opentelemetry-instrumentation-requests automatically wraps the popular requests HTTP client library so every outbound HTTP call creates an OpenTelemetry span, with no changes needed at each call site. It captures HTTP method, URL, status code, and (optionally) request/response headers as span attributes following OpenTelemetry’s HTTP semantic conventions.

The instrumentation supports request/response hooks for adding custom span attributes, configurable header capture via environment variables, IP address recording, and User-Agent synthetic-request filtering — making it a drop-in way to get distributed tracing across services that call out over HTTP via requests.

What You Get

  • A RequestsInstrumentor that patches requests.Session globally with one .instrument() call
  • Automatic HTTP client spans with method, URL, and status code attributes
  • Request/response hooks for adding custom span attributes per call
  • Configurable capture of specific request/response headers via environment variables
  • Support for excluding URLs from tracing and recording client IP addresses

Common Use Cases

  • Adding distributed tracing to any service that calls external APIs via requests
  • Correlating outbound HTTP calls with the rest of a request’s trace in a microservices architecture
  • Auditing and debugging slow or failing third-party API calls with span-level timing
  • Capturing custom request/response metadata (headers, hooks) for domain-specific observability needs

Under The Hood

Architecture — the instrumentor subclasses BaseInstrumentor and, on _instrument(), wraps requests.Session.send (the single choke point every requests API funnels through) with a traced version that starts a client span, injects trace context into outgoing headers via the configured propagator, records HTTP semantic-convention attributes, invokes optional request/response hooks, and records the span status from the HTTP response code, restoring the original send on _uninstrument(). Tech Stack — pure Python (src/opentelemetry/instrumentation/requests/__init__.py, ~630 lines), depending on opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions, and opentelemetry-util-http from the same monorepo, plus requests itself as the instrumented target; built with hatchling. Code Quality — extensively tested with over 1,400 lines across three test files (test_requests_integration.py, test_requests_ip_support.py, test_user_agent_synthetic.py) covering header capture, IP recording, and synthetic User-Agent filtering, plus a benchmarks/ suite measuring instrumentation overhead. API Design — a single RequestsInstrumentor().instrument() call instruments every requests call in the process; request/response hooks and header-capture environment variables let teams add custom attributes without subclassing or wrapping the instrumentor.

Used by 8 apps in this directory

Python
68%
Other

Baserow

No Code Platforms · Databases

5,830

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
Python68%
JavaScript16%
Vue12%
Updated yesterday
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,133

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
69
Repo Health
81
Technical
65
Dependency
Built with
TypeScript91%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,372

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
65
Dependency
Built with
TypeScript71%
Go16%
Updated 2 weeks ago
Python
64%
Other

Keep

Devops · Automation · Monitoring

12,290

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
91
Repo Health
79
Technical
66
Dependency
Built with
Python64%
TypeScript36%
Updated yesterday
Python
68%
MIT

Langflow

AI Agents · AI Development

154,349

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today
Python
37%
Other

Open WebUI

AI Assistants · AI Agents

151,143

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python37%
Svelte34%
JavaScript21%
Updated yesterday
Python
54%
Other

PostHog

Analytics · Monitoring · Developer Tools

39,612

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python54%
TypeScript36%
Updated today
Python
91%
GPL 3.0

Weblate

Developer Tools

6,057

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

View details
95
Repo Health
86
Technical
71
Dependency
Built with
Python91%
Updated yesterday

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

Search