Add method label for prometheus middleware metrics (#3226)

Co-authored-by: 蓝益尤 <lan.yiyou@intellif.com>
This commit is contained in:
SleeplessBot
2023-05-08 20:59:20 +08:00
committed by GitHub
parent 9f42eda9ff
commit a93c24ce84
3 changed files with 8 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ import (
)
func TestPromMetricHandler_Disabled(t *testing.T) {
promMetricHandler := PrometheusHandler("/user/login")
promMetricHandler := PrometheusHandler("/user/login", http.MethodGet)
handler := promMetricHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))
@@ -26,7 +26,7 @@ func TestPromMetricHandler_Enabled(t *testing.T) {
Host: "localhost",
Path: "/",
})
promMetricHandler := PrometheusHandler("/user/login")
promMetricHandler := PrometheusHandler("/user/login", http.MethodGet)
handler := promMetricHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))