Files
agent_delta/backend/app/core/logfire_setup.py
T
2026-06-15 14:22:07 +08:00

33 lines
740 B
Python

"""Logfire observability configuration."""
from typing import Any
import logfire
from app.core.config import settings
def setup_logfire() -> None:
"""Configure Logfire instrumentation."""
logfire.configure(
token=settings.LOGFIRE_TOKEN,
service_name=settings.LOGFIRE_SERVICE_NAME,
environment=settings.LOGFIRE_ENVIRONMENT,
send_to_logfire="if-token-present",
)
def instrument_app(app: Any) -> None:
"""Instrument FastAPI app with Logfire."""
logfire.instrument_fastapi(app)
def instrument_asyncpg() -> None:
"""Instrument asyncpg for PostgreSQL."""
logfire.instrument_asyncpg()
def instrument_redis() -> None:
"""Instrument Redis."""
logfire.instrument_redis()