-
Notifications
You must be signed in to change notification settings - Fork 435
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
contrib/gorilla/mux: allow custom resource naming #617
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your first contribution. Would you mind please following our contribution guidelines and opening an issue to discuss the change you want to make before committing to it? It will allow us to more intimately discuss the motivations and find the best possible solution.
Please make sure you explain why you want the change and how it would benefit you.
Hi - sorry, I missed that part of the guidelines. I've opened an issue now (#618) and linked to it from the PR comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial thoughts.
Adds a new `WithResourceNamer` option for the Gorilla Mux router that allows customizing how resources are named based on information from the router itself and the HTTP request being named.
I've done some tweaks in regards to the changes you requested - let me know if you have more input and I'll happily adjust. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! Thanks for your patience! 👏
Thanks - happy to help! |
Adds a new `WithResourceNamer` that allows customizing how resources are named based on information from the router and the request.
Allows customizing the resource names reported to DataDog by specifying a
WithResourceNamer
option on the Mux router. The namer function takes in the*mux.Router
itself and the*http.Request
being handled and should provide enough context to produce a resource name for most use cases.The default namer is still the one that uses the path template on the matched route.
Closes #618