{"id":196,"library":"logfire","title":"Logfire","description":"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.","status":"active","version":"4.30.0","language":"python","source_language":"en","source_url":"https://logfire.pydantic.dev/docs/","tags":["observability","logging","tracing","opentelemetry","monitoring","pydantic","llm"],"install":[{"cmd":"pip install logfire","lang":"bash","label":"Core SDK"},{"cmd":"pip install logfire[fastapi]","lang":"bash","label":"With FastAPI auto-instrumentation"},{"cmd":"pip install logfire[httpx,requests,sqlalchemy,asyncpg]","lang":"bash","label":"With common integrations"},{"cmd":"pip install pydantic-logfire","lang":"bash","label":"DEPRECATED stub — installs logfire automatically"}],"dependencies":[{"reason":"Required. OpenTelemetry SDK. Installed automatically.","package":"opentelemetry-sdk>=1.39.0","optional":false},{"reason":"Required for cloud export. Installed automatically.","package":"opentelemetry-exporter-otlp-proto-http","optional":false},{"reason":"Required for source code introspection. Installed automatically.","package":"executing","optional":false}],"imports":[{"wrong":"import logfire","symbol":"Logfire","correct":"from logfire import Logfire"},{"wrong":"import logfire","symbol":"configure","correct":"from logfire import configure"},{"wrong":"import logfire","symbol":"span","correct":"from logfire import span"}],"quickstart":{"code":"import logfire\nimport os\n\n# Set env var: export LOGFIRE_TOKEN='your-token'\n# Or pass directly (not recommended for production):\nlogfire.configure(\n    token=os.environ.get('LOGFIRE_TOKEN'),\n    service_name='my-service',\n    environment='production'\n)\n\n# Structured log with attributes\nlogfire.info('Processing request', user_id=42, endpoint='/api/data')\nlogfire.warning('Rate limit approaching', limit=100, current=95)\nlogfire.error('Database error', error_type='ConnectionTimeout', db='postgres')\n\n# Span (traces an operation)\nwith logfire.span('Fetch user data {user_id}', user_id=42):\n    # Code here is traced\n    data = fetch_user(42)\n    logfire.info('Fetched {record_count} records', record_count=len(data))\n\n# FastAPI integration\nfrom fastapi import FastAPI\napp = FastAPI()\nlogfire.instrument_fastapi(app)  # auto-traces all routes","lang":"python","description":"Always call logfire.configure() first. LOGFIRE_TOKEN from env. Free tier: 1 seat, 3 projects."},"warnings":[{"fix":"Call logfire.configure() at application startup, before importing or initializing any instrumented libraries. For FastAPI: call it before app = FastAPI().","message":"logfire.configure() must be called before any spans, logs, or instrument_*() calls. Omitting it causes all telemetry to be silently dropped — no error is raised.","severity":"breaking","affected_versions":"all"},{"fix":"Replace: logfire.instrument_httpx(capture_request_json_body=True) with logfire.instrument_httpx(capture_request_body=True, capture_response_body=True)","message":"instrument_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.","severity":"breaking","affected_versions":"breaking in 0.x series"},{"fix":"Always specify modules: logfire.install_auto_tracing(modules=['myapp', 'myapp.services'])","message":"install_auto_tracing() requires explicit modules parameter — there is no default. Calling it without modules raises TypeError.","severity":"breaking","affected_versions":"all"},{"fix":"pip install logfire. Remove pydantic-logfire from requirements. import logfire not from pydantic_logfire import ...","message":"pydantic-logfire on PyPI is a deprecated stub package that just depends on logfire. Use pip install logfire directly.","severity":"gotcha","affected_versions":"all"},{"fix":"Check current plan at logfire.pydantic.dev. Team plan ($49/mo) for 5 seats/5 projects. Growth plan ($249/mo) for unlimited.","message":"Logfire 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.","severity":"gotcha","affected_versions":"cloud service"},{"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.","message":"logfire.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.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"search_vec":"'2026':50 '4.30.0':17 'backend':33 'built':11 'call':19 'chang':48 'cloud':32 'current':14 'deprec':42 'direct':46 'env':29 'instrument':23 'januari':49 'llm':57 'log':7,52 'logfir':1,27,38,45 'logfire.configure':20 'metric':10 'monitor':55 'must':18 'observ':2,51 'old':35 'opentelemetri':13,54 'packag':39 'platform':3 'price':47 'pydant':5,37,56 'pydantic-logfir':36 'requir':26 'span':25 'structur':6 'stub':43 'token':28 'trace':8,53 'use':44 'var':30 'version':15","created_at":"2026-03-25T16:39:45.785748+00:00","updated_at":"2026-04-16T16:21:11.336714+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"4.35.0","cli_name":"logfire","cli_version":"Running Logfire 4.33.0 with CPython 3.11.15 on Linux.","type":"library","homepage":"https://pydantic.dev/logfire","github":"https://github.com/pydantic/logfire","docs":"https://pydantic.dev/docs/logfire/","changelog":"https://github.com/pydantic/logfire/blob/main/CHANGELOG.md","pypi":"https://pypi.org/project/logfire/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":"verified"}}