Skip to content

Comments

Add 'route' reference to Mount child scope#3152

Open
y2kbugger wants to merge 1 commit intoKludex:mainfrom
y2kbugger:mount_route_reference
Open

Add 'route' reference to Mount child scope#3152
y2kbugger wants to merge 1 commit intoKludex:mainfrom
y2kbugger:mount_route_reference

Conversation

@y2kbugger
Copy link

@y2kbugger y2kbugger commented Feb 17, 2026

Summary

When matching a mount point, record the Mount as scope["route"]

The purpose: when enriching logs with metadata, I would like to include the name of routes without having to re-traverse routes or rematch. Specifically, I'm focused on FastAPI endpoints and StaticFiles right now.

For fastapi endpoints, this is already easy:
image

"route_definition": "internalapp.endpoints.devtools.devtools:log_alternate_name"
"route_name": "my_custom_name"

But for handling StaticFiles mounts, this was the least intrusive way I could think to do it.
I'm open to other thoughts, especially if Mount is used more widely internally in a way that would make this a bad idea.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant