-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new RequestPathFunc feature to customize request path (#41)
* feat: new RequestPathFunc to retrieve request path and corresponding option on *Prometheus Recording metrics for routes not registered on the instrumented root *gin.Router currently requires defining a side-middleware mimicking the *Prometheus internals, that is, declaring counters, histograms and summaries for the metrics one wants to record, and "manually" handling them inside the middleware. With RequestPathFunc, one can monitor calls to unregistered routes by setting RequestPathFunc to some function that returns a default value if the request path is undefined. Even finer-grained monitoring is made possible by this commit, e.g. recording a metric with the (*http.Request).RequestURI rather than the (*gin.Context).Fullpath() return value. * feat: add test for new feature RequestPathFunc
- Loading branch information
Showing
2 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters