File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
providers/inline/telemetry/meta_reference Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -410,6 +410,7 @@ def create_app() -> StackApp:
410410
411411 if Api .telemetry in impls :
412412 setup_logger (impls [Api .telemetry ])
413+ TelemetryAdapter .fastapi_middleware (app ) # hold us over until we can move to programmatic instrumentation
413414 else :
414415 setup_logger (TelemetryAdapter (TelemetryConfig (), {}))
415416
Original file line number Diff line number Diff line change 4949from llama_stack .providers .utils .telemetry .sqlite_trace_store import SQLiteTraceStore
5050from llama_stack .providers .utils .telemetry .tracing import ROOT_SPAN_MARKERS
5151
52+ from fastapi import FastAPI
53+ from opentelemetry .instrumentation .fastapi import FastAPIInstrumentor
54+
5255from .config import TelemetryConfig , TelemetrySink
5356
5457_GLOBAL_STORAGE : dict [str , dict [str | int , Any ]] = {
@@ -362,3 +365,8 @@ async def get_span_tree(
362365 max_depth = max_depth ,
363366 )
364367 )
368+
369+ @staticmethod
370+ def fastapi_middleware (app : FastAPI ):
371+ ''' Inject telemetry middleware into the FastAPI app '''
372+ FastAPIInstrumentor .instrument_app (app )
You can’t perform that action at this time.
0 commit comments