def configure_telemetry(app: FastAPI):
    """
    Configures telemetry middleware for the app if telemetry is enabled
    """
    if not settings.enable_telemetry:
        return

    @app.middleware("http")
    async def track_api_requests(request: Request, call_next):
        response = await call_next(request)
        try:
            await get_telemetry_client().track_api_request(request, response)
        except Exception as e:
            _LOGGER.warning(f"Error tracking request: {e}")
        finally:
            return response

    Configures telemetry middleware for the app if telemetry is enabled
    
argilla-server/src/argilla_server/_app.py