Populate "endpoint" key in ASGI scope
See original GitHub issueThis is a trick used by Starlette so that other layers of ASGI middleware can see which route was selected.
They added it here: https://github.com/encode/starlette/commit/34d0097feb6f057bd050d5057df5a2f96b97384e
If Datasette supports it as well we can benefit from it if we integrate this sentry_asgi middleware (probably as a datasette-sentry
plugin): https://github.com/encode/sentry-asgi/blob/c6a42d44d31f85885b79e4ee898683ecf8104971/sentry_asgi/middleware.py#L34-L35
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
sentry-asgi/middleware.py at master - GitHub
Return a transaction string to identify the routed endpoint. """ endpoint = scope["endpoint"].
Read more >How to unit test a pure ASGI middleware in python
One way would be to create a TestClient , apply the middleware, send some requests through and assert that "some_field" is set in...
Read more >Consumers — Channels 4.0.0 documentation
In general, the scope is the place to get connection information and where middleware will put attributes it wants to let you access...
Read more >sentry-asgi - PyPI
It is recommended that frameworks populate an "endpoint" key in the ASGI scope, to indicate which view function or class should be logged...
Read more >Middleware - Starlette
The Starlette application class allows you to include the ASGI middleware in a way ... For example raising HTTPException(status_code=404) within an endpoint ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Asked about this on Twitter: https://twitter.com/simonw/status/1152238730259791877
@simonw do you think it is still worth populating the
endpoint
key in the scope as originally intended by this issue, or should we hold off until a decision about possibly using anX-Endpoint
header instead? 😄