Registry / observability / logfire

logfire

JSON →
library4.41.0pypypi✓ verified 31d ago

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.

pip install logfire
INSTALL
IMPORT
SIG · LOGFIRE
L
logfire
observabilitypythonv4.41.0
Install
5.4s avg
Import
1346ms
Disk
56MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.41.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
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 1.538s · 65.5MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 5.4s · import 1.153s · 49MB
56MB installed
● package 56MB
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.
fix
Call 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.
fix
Replace: 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.
fix
Always 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.
fix
pip 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.
fix
Check 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.
fix
Set 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
Upgrade
Version history
4.41.0latest on PyPI · released Aug 20, 2026
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.
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
2
Resources
logfire — pip install logfire · libregistry