question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Populate "endpoint" key in ASGI scope

See original GitHub issue

This 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:open
  • Created 4 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
simonwcommented, Jul 19, 2019
0reactions
SteadBytescommented, Jul 22, 2019

@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 an X-Endpoint header instead? 😄

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found