feat: mysql and redis metric support (#2355)

* feat: mysql and redis metric support

* feat: mysql and redis metric support

* feat: mysql and redis metric support

Co-authored-by: dawn.zhou <dawn.zhou@yijinin.com>
This commit is contained in:
dawn_zhou
2022-09-17 19:35:30 +08:00
committed by GitHub
parent b8664be2bb
commit ae7f1aabdd
15 changed files with 164 additions and 23 deletions

View File

@@ -6,7 +6,6 @@ import (
"time"
"github.com/zeromicro/go-zero/core/metric"
"github.com/zeromicro/go-zero/core/prometheus"
"github.com/zeromicro/go-zero/core/timex"
"github.com/zeromicro/go-zero/rest/internal/response"
)
@@ -35,10 +34,6 @@ var (
// PrometheusHandler returns a middleware that reports stats to prometheus.
func PrometheusHandler(path string) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
if !prometheus.Enabled() {
return next
}
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
startTime := timex.Now()
cw := &response.WithCodeResponseWriter{Writer: w}