rename prommetric to prometheous, add unit tests
This commit is contained in:
@@ -110,7 +110,7 @@ func (s *engine) bindRoute(fr featuredRoutes, router httpx.Router, metrics *stat
|
||||
handler.TimeoutHandler(time.Duration(s.conf.Timeout)*time.Millisecond),
|
||||
handler.RecoverHandler,
|
||||
handler.MetricHandler(metrics),
|
||||
handler.PromMetricHandler(route.Path),
|
||||
handler.PrometheousHandler(route.Path),
|
||||
handler.MaxBytesHandler(s.conf.MaxBytes),
|
||||
handler.GunzipHandler,
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ var (
|
||||
})
|
||||
)
|
||||
|
||||
func PromMetricHandler(path string) func(http.Handler) http.Handler {
|
||||
func PrometheousHandler(path string) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
startTime := timex.Now()
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPromMetricHandler(t *testing.T) {
|
||||
promMetricHandler := PromMetricHandler("/user/login")
|
||||
promMetricHandler := PrometheousHandler("/user/login")
|
||||
handler := promMetricHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
Reference in New Issue
Block a user