Description
For requests to endpoints defined in FastAPI sub-applications, the mount path is chosen as the transaction name. I expected the full route of the endpoint.
To Reproduce
- Run the following simple FastAPI app:
import uvicorn
from elasticapm.contrib.starlette import ElasticAPM, make_apm_client
from fastapi import FastAPI
app = FastAPI()
sub = FastAPI()
app.mount("/sub", sub)
apm = make_apm_client(
{
"SERVICE_NAME": "sub-app-test",
}
)
app.add_middleware(ElasticAPM, client=apm)
@sub.get("/hi")
async def hi():
return "hi"
@sub.get("/bye")
async def bye():
return "bye"
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8888)
-
Environment
- OS:
- Client: Windows
- Server: Ubuntu
- Python version: 3.7.3
- Framework and version:
fastapi==0.61.2
- APM Server version: docker image
elasticsearch/elasticsearch:7.10.2
- Agent version:
elastic-apm==6.0.0
Description
For requests to endpoints defined in FastAPI sub-applications, the mount path is chosen as the transaction name. I expected the full route of the endpoint.
To Reproduce
Observed behavior

The transactions of
/sub/hiand/sub/byeare both named/suband grouped.Expected behavior
The transactions of
/sub/hiand/sub/byeare named according to the full route.Environment
fastapi==0.61.2elasticsearch/elasticsearch:7.10.2elastic-apm==6.0.0