scout_apm_python
scout_apm_python copied to clipboard
Starlette middleware feature requests
We're using a modified version of the Starlette middleware at the moment, primarily to support asyncio better.
Assuming asyncio support is added in future, there are a couple of other features we've added which it would be nice to see too:
- An optional list of routes to monitor which can be passed in.
- Allows us to monitor the specific endpoints we want without health checks / documentation endpoints etc.
- This can be accomplished manually, but I think being able to set it in config / on the middleware would be a nice addition
- This requires getting the templated route name from the FastAPI router in our case, I think the same applies to Starlette.
- Request sampling
- To reduce the number of events we send, I've added the ability to sample requests
- i.e monitor 50% of requests.
If I've missed a better way / place to implement these, then please let me know.
Hi @bitdivision, thank you for the suggestions. Would the ignore setting in the config work for you? Another option would be to define a decorator that calls scout_apm.api.ignore_transaction().
Regarding sampling based on a percentage of requests, you're correct that is currently not implemented.