{"html_url": "https://github.com/simonw/datasette/issues/537#issuecomment-512126748", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/537", "id": 512126748, "node_id": "MDEyOklzc3VlQ29tbWVudDUxMjEyNjc0OA==", "user": {"value": 14834132, "label": "SteadBytes"}, "created_at": "2019-07-17T06:48:35Z", "updated_at": "2019-07-17T06:48:35Z", "author_association": "NONE", "body": "It looks as if the `datasette.utils.AsgiRouter.__call__` is the place to add this https://github.com/simonw/datasette/blob/90d4f497f9b3f6a5882937c91fddb496ac3e7368/datasette/utils/asgi.py#L101 .\r\n\r\nThe sentry_asgi middleware uses the `__qualname__` or `__name__` attributes of the `endpoint` https://github.com/encode/sentry-asgi/blob/c6a42d44d31f85885b79e4ee898683ecf8104971/sentry_asgi/middleware.py#L84\r\n\r\nLooking at the Starlette implementation `endpoint` is a `Callable` https://github.com/encode/starlette/commit/34d0097feb6f057bd050d5057df5a2f96b97384e#diff-34fba745b50527bfb4245d02afd59246R100 which as far as I can tell is analogous to the `view` function which is matched here https://github.com/simonw/datasette/blob/90d4f497f9b3f6a5882937c91fddb496ac3e7368/datasette/utils/asgi.py#L96 .\r\n\r\nA slight issue is that `__qualname__` is matched *first* in the sentry_asgi middleware, and `__name__` is used if that doesn't exist. I think (please correct me if I am wrong) that for datasette, the `__name__` is what should be used. For example, when using the development fixtures and hitting `http://127.0.0.1:8001/fixtures/compound_three_primary_keys` the `view` function that is matched gives:\r\n\r\n```python\r\n>>> view.__qualname__\r\n'AsgiView.as_asgi..view'\r\n>>> view.__name__\r\n'TableView'\r\n```\r\n\r\nWould `TableView` be the desired value here? Or am I looking in entirely the wrong place? :smile: \r\n\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 463544206, "label": "Populate \"endpoint\" key in ASGI scope"}, "performed_via_github_app": null}