Starlette middleware feature requests

Open
#637 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
observability

Research direction

Start by reviewing the existing Starlette middleware entry point and how it currently handles asyncio and route names. Compare the requested route allowlist and request-sampling behavior with the modified middleware described in the issue; done means both options are defined, documented, and covered by tests.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
77
Forks
19
Avg merge
1d 9h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from scoutapp/scout_apm_python

All issues in scoutapp/scout_apm_python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.