Get match path in Phoenix



Is there some way in Phoenix to see what path was used to match a route?
This would be very useful for metrics and logging (and probably other things). We would like to have the match path as a label in prometheus and as a log field so we can aggregate on that in kibana.

In Plug this was added a while ago in this PR

I’ve check that there are no equivalent field in conn.private from Phoenix, but is it accessible in some other way?


What version of plug are you using according to mix.exs and mix.lock?


In general that field should only get accessed through Plug.Router.match_path, which is available since 1.5 as far as I can tell.


Plug is version 1.7.1, but I don’t think the Phoenix.Router uses the Plug.Router to match under the hood.
It works fine in a regular Plug.Router outside of Phoenix.


I always thought Phoenix.Router where just wrapping Plug.Router.