Skip to content

Commit

Permalink
Revert "Allow disabling of web-ping request logging via config (#66)" (
Browse files Browse the repository at this point in the history
…#68)

This reverts commit 2bc78a7.
  • Loading branch information
jonog authored Feb 17, 2018
1 parent 2bc78a7 commit 1721618
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ TODO: document Postgres configuration option
"name": "Demo Response Check",
"type": "web-ping",
"config": {
"address": "http://httpstat.us/400",
"logrequests": false
"address": "http://httpstat.us/400"
},
"send_alerts": [
"stderr",
Expand Down
13 changes: 4 additions & 9 deletions checks/web_ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ var WebPingerMetrics = map[string]MetricInfo{
}

type WebPingerConfig struct {
Address string `json:"address"`
Headers map[string]string `json:"headers"`
LogRequests bool `json:"logrequests"`
Address string `json:"address"`
Headers map[string]string `json:"headers"`
}

var NewWebPinger = func(config Config, logger *log.Logger) (Checker, error) {
Expand Down Expand Up @@ -80,9 +79,7 @@ func (wp *WebPinger) ping() (data.Metrics, []byte, int, error) {
}()

startTime := time.Now()
if wp.LogRequests {
wp.log.Println("GET", wp.Address)
}
wp.log.Println("GET", wp.Address)

req, err := http.NewRequest("GET", wp.Address, nil)
if err != nil {
Expand All @@ -106,9 +103,7 @@ func (wp *WebPinger) ping() (data.Metrics, []byte, int, error) {
latencyCalc := endTime.Sub(startTime)
latency = float64(latencyCalc.Seconds() * 1e3)

if wp.LogRequests {
wp.log.Println("Latency", utils.White, latency, utils.Reset)
}
wp.log.Println("Latency", utils.White, latency, utils.Reset)

if err != nil {
return metrics, b, resp.StatusCode, errors.New("web-ping: failed reading body " + err.Error())
Expand Down

0 comments on commit 1721618

Please sign in to comment.