mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
feat: add optional logfire instrumentation for cloud mode distributed tracing
This commit is contained in:
@@ -31,6 +31,17 @@ async def lifespan(app: FastAPI): # pragma: no cover
|
||||
app_config = ConfigManager().config
|
||||
logger.info("Starting Basic Memory API")
|
||||
|
||||
# Instrument httpx client for distributed tracing when in cloud mode
|
||||
if app_config.cloud_mode_enabled:
|
||||
try:
|
||||
import logfire
|
||||
from basic_memory.mcp.async_client import client as httpx_client
|
||||
|
||||
logger.info("Cloud mode enabled - instrumenting httpx client for distributed tracing")
|
||||
logfire.instrument_httpx(client=httpx_client)
|
||||
except ImportError:
|
||||
logger.warning("logfire not available - skipping httpx instrumentation")
|
||||
|
||||
await initialize_app(app_config)
|
||||
|
||||
# Cache database connections in app state for performance
|
||||
|
||||
Reference in New Issue
Block a user