Skip to content

Commit d68929d

Browse files
chertsMikhail Grigorev
andauthored
Improved skip scraping logging (#96)
Co-authored-by: Mikhail Grigorev <grigorev_mm@magnit.ru>
1 parent 37e5373 commit d68929d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

internal/pgscv/pgscv.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9+
net_http "net/http"
10+
"strings"
11+
"sync"
12+
"time"
13+
914
"github.com/cherts/pgscv/discovery"
1015
sd "github.com/cherts/pgscv/internal/discovery/service"
1116
"github.com/cherts/pgscv/internal/http"
@@ -14,10 +19,6 @@ import (
1419
"github.com/cherts/pgscv/internal/service"
1520
"github.com/prometheus/client_golang/prometheus"
1621
"github.com/prometheus/client_golang/prometheus/promhttp"
17-
net_http "net/http"
18-
"strings"
19-
"sync"
20-
"time"
2122
)
2223

2324
const pgSCVSubscriber = "pgscv_subscriber"
@@ -173,7 +174,7 @@ func getMetricsHandler(repository *service.Repository, throttlingInterval *int)
173174
if ok {
174175
if time.Now().Sub(t) < time.Duration(*throttlingInterval)*time.Second {
175176
w.WriteHeader(http.StatusOK)
176-
log.Warn("Skip scraping")
177+
log.Warnf("Skip scraping, method: %s, proto: %s, request_uri: %s, user_agent: %s, remote_addr: %s", r.Method, r.Proto, r.RequestURI, r.UserAgent(), r.RemoteAddr)
177178
return
178179
}
179180
}

0 commit comments

Comments
 (0)