Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve handler RouteInfo #649

Closed
itsjamie opened this issue Jun 22, 2016 · 3 comments
Closed

Retrieve handler RouteInfo #649

itsjamie opened this issue Jun 22, 2016 · 3 comments

Comments

@itsjamie
Copy link
Contributor

When a request hits Gin, it would be great for instrumentation to have access to the original route string that was passed to register the handler that has been selected to handle the request.

@itsjamie
Copy link
Contributor Author

itsjamie commented Jun 22, 2016

#584 was originally opened to support this. It appears that the original issue creator would like something similar to what I would like, and I'd be willing to take a crack at a PR, but figured I'd open an issue first to see if thoughts on whether it would be appreciated since the original issue was closed.

It would be great to see the selected Route available for introspection on the Context object. Right now, when one of our global middleware throws an exception, we can't track what the end path was going to be by handler.

@clutchski
Copy link

I would like to see this as well. It's very good for instrumentation where you'd like to aggregate statistics by route (e.g. /user/:id) and not by path. Is this on anybody's radar?

@itsjamie itsjamie changed the title Retrieve original request path Retrieve handler RouteInfo Feb 23, 2017
@jonaz
Copy link

jonaz commented Jun 27, 2017

We would also need this. I did an ugly workarround in a middleware the mean time:

		routes := p.parent.Routes()
		url := ""
		for _, r := range routes {
			if r.Handler == c.HandlerName() {
				url = r.Path
				break
			}


		}

I guess its also affecting performance since every call is looping over all routes. But until this issue is resolved i think its the only way.

@isgj isgj mentioned this issue Aug 8, 2018
@itsjamie itsjamie closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
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

No branches or pull requests

3 participants