File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ dependencies = [
3737 " aiofiles>=24.1.0" , # Async file I/O
3838]
3939
40+ [project .optional-dependencies ]
41+ cloud = [
42+ " logfire>=4.10.0" , # Distributed tracing for cloud mode
43+ ]
4044
4145[project .urls ]
4246Homepage = " https://github.com/basicmachines-co/basic-memory"
Original file line number Diff line number Diff line change @@ -31,6 +31,17 @@ async def lifespan(app: FastAPI): # pragma: no cover
3131 app_config = ConfigManager ().config
3232 logger .info ("Starting Basic Memory API" )
3333
34+ # Instrument httpx client for distributed tracing when in cloud mode
35+ if app_config .cloud_mode_enabled :
36+ try :
37+ import logfire
38+ from basic_memory .mcp .async_client import client as httpx_client
39+
40+ logger .info ("Cloud mode enabled - instrumenting httpx client for distributed tracing" )
41+ logfire .instrument_httpx (client = httpx_client )
42+ except ImportError :
43+ logger .warning ("logfire not available - skipping httpx instrumentation" )
44+
3445 await initialize_app (app_config )
3546
3647 # Cache database connections in app state for performance
You can’t perform that action at this time.
0 commit comments