I have connected my Fast api application to elastic APM using APM client and some times it is successfully recording transactions but some times I am getting below error and transactions are not getting recorded. The error I am mentioned in my reply

apm = make_apm_client(
    {
        "SERVICE_NAME": "FaveeoV2Backend",
        "SECRET_TOKEN": config.get("APM_SECRET_TOKEN"),
        "SERVER_URL": config.get("APM_SERVER_URL"),
        "ENVIRONMENT": config.get("STAGE", "local"),
    }
)

app = FastAPI(
    title=config.get("PROJECT_NAME"),
    version=config.get("VERSION"),
    openapi_prefix=config.get("OPENAPI_PREFIX", ""),
)
# Add middlewares
app.add_middleware(ElasticAPM, client=apm)

I am attaching my error here

ERROR:elasticapm.transport:Closing the transport connection timed out.