Tags: depado/ginprom
Tags
feat: add support for custom labels in the counter metric (#62) * feat: add support for custom labels to counter metric * add test * revert module change * apply suggestions from code review Co-authored-by: Depado <Depado@users.noreply.github.com> --------- Co-authored-by: Depado <Depado@users.noreply.github.com>
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
Fix behavior when adding a custom Gauge or Counter with a custom Regi… …stry (#39) * fix: ensure AddCustomGauge and AddCustomCounter register the Gauge and Value in the correct registry Before that, the AddCustomGauge and AddCustomCounter would both register the respective Gauge and Counter in the default prometheus Registry, even if a custom one was set. Also, since this commit introduced a new simple mustRegister method on *Prometheus, it seemed logical to use it in the register function. * feat: add tests to check that custom counters and gauges are registered in the correct registry
PreviousNext