Observability platform from Pydantic — structured logging, tracing, and metrics built on OpenTelemetry. Current version is 4.30.0. Must call logfire.configure() before any instrumentation or spans. Requires LOGFIRE_TOKEN env var for cloud backend. The old pydantic-logfire package is a deprecated stub — use logfire directly. Pricing changed January 2026.
Install & Compatibility
Where this runs
tested against v4.35.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
18/20 runs
18/20 runs
py 3.11
18/20 runs
18/20 runs
py 3.12
18/20 runs
18/20 runs
py 3.13
18/20 runs
18/20 runs
py 3.9
18/20 runs
18/20 runs
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Logfire
✓ from logfire import Logfire
✗ import logfire
configure
✓ from logfire import configure
✗ import logfire
span
✓ from logfire import span
✗ import logfire
Always call logfire.configure() first. LOGFIRE_TOKEN from env. Free tier: 1 seat, 3 projects.
import logfire
import os
# Set env var: export LOGFIRE_TOKEN='your-token'
# Or pass directly (not recommended for production):
logfire.configure(
token=os.environ.get('LOGFIRE_TOKEN'),
service_name='my-service',
environment='production'
)
# Structured log with attributes
logfire.info('Processing request', user_id=42, endpoint='/api/data')
logfire.warning('Rate limit approaching', limit=100, current=95)
logfire.error('Database error', error_type='ConnectionTimeout', db='postgres')
# Span (traces an operation)
with logfire.span('Fetch user data {user_id}', user_id=42):
# Code here is traced
data = fetch_user(42)
logfire.info('Fetched {record_count} records', record_count=len(data))
# FastAPI integration
from fastapi import FastAPI
app = FastAPI()
logfire.instrument_fastapi(app) # auto-traces all routes
logfire --version
Debug
Known issues
breakinglogfire.configure() must be called before any spans, logs, or instrument_*() calls. Omitting it causes all telemetry to be silently dropped — no error is raised.fixCall logfire.configure() at application startup, before importing or initializing any instrumented libraries. For FastAPI: call it before app = FastAPI().
affects: all
breakinginstrument_httpx() parameters changed: capture_request_json_body, capture_request_text_body, capture_request_form_data, and capture_response_json_body were removed and replaced by capture_request_body and capture_response_body.fixReplace: logfire.instrument_httpx(capture_request_json_body=True) with logfire.instrument_httpx(capture_request_body=True, capture_response_body=True)
affects: breaking in 0.x series
breakinginstall_auto_tracing() requires explicit modules parameter — there is no default. Calling it without modules raises TypeError.fixAlways specify modules: logfire.install_auto_tracing(modules=['myapp', 'myapp.services'])
affects: all
gotchapydantic-logfire on PyPI is a deprecated stub package that just depends on logfire. Use pip install logfire directly.fixpip install logfire. Remove pydantic-logfire from requirements. import logfire not from pydantic_logfire import ...
affects: all
gotchaLogfire pricing changed January 2026. Free Personal plan now limited to 1 seat and 3 projects. Teams exceeding these limits needed to upgrade by February 1, 2026 or be auto-upgraded.fixCheck current plan at logfire.pydantic.dev. Team plan ($49/mo) for 5 seats/5 projects. Growth plan ($249/mo) for unlimited.
affects: cloud service
breakinglogfire.configure() raises LogfireConfigError if LOGFIRE_TOKEN is missing or invalid, or `logfire auth` has not been run, preventing cloud export and application startup. It does not silently default to local console output.fixSet LOGFIRE_TOKEN environment variable in production, or run `logfire auth` to authenticate. Verify export is working: logfire.configure() logs the dashboard URL if the token is valid.
affects: all
Audit
Dependencies
opentelemetry-sdk>=1.39.0requiredRequired. OpenTelemetry SDK. Installed automatically.
opentelemetry-exporter-otlp-proto-httprequiredRequired for cloud export. Installed automatically.
executingrequiredRequired for source code introspection. Installed automatically.