Spaces:
Sleeping
Sleeping
File size: 405 Bytes
287a0bc |
1 2 3 4 5 6 7 8 9 10 11 |
from typing import List, Optional
from fastapi import FastAPI
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
def instrument_fastapi(app: FastAPI, excluded_urls: Optional[List[str]] = None) -> None:
"""Instrument FastAPI to emit OpenTelemetry spans."""
FastAPIInstrumentor.instrument_app(
app, excluded_urls=",".join(excluded_urls) if excluded_urls else None
)
|