mirror of
https://github.com/furyhawk/agent_delta.git
synced 2026-07-21 10:15:36 +00:00
33 lines
740 B
Python
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()
|