Skip to content

Cannot startup fastapi with apm  #1184

@alexcc4

Description

@alexcc4

With start apm in docker, I just set up agent in fastapi. Then I run app with uvicorn, it hangs.
To Reproduce

  1. Start Service with docker compose Reference

image

  • Test apm status
    image
  1. Run the following simple FastAPI app:
from fastapi import FastAPI from elasticapm.contrib.starlette import make_apm_client, ElasticAPM import uvicorn apm = make_apm_client({'SERVICE_NAME': 'test', 'SERVER_URL': 'http://0.0.0.0:8200'}) app = FastAPI() app.add_middleware(ElasticAPM, client=apm) @app.get("/") def read_root(): return {"Hello": "World"} if __name__ == '__main__': uvicorn.run(app, host='0.0.0.0', port=8000) 
  • Result
    image

Environment

  • OS: Mac
  • Python version: 3.7.10
  • Framework and version: fastapi==0.66.0
  • APM Server version: image: docker.elastic.co/apm/apm-server:7.13.2
  • Agent version: elastic-apm==6.3.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions