Skip to content

Requests

The logfire.instrument_requests() method can be used to instrument requests with Logfire.

Installation

Install logfire with the requests extra:

pip install 'logfire[requests]'
uv add 'logfire[requests]'
rye add logfire -E requests
poetry add 'logfire[requests]'

Usage

main.py
import logfire
import requests

logfire.configure()
logfire.instrument_requests()

requests.get("https://httpbin.org/get")

logfire.instrument_requests() uses the OpenTelemetry requests Instrumentation package, which you can find more information about here.