Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: monitoring/go/prober/main.go

Issue 777413002: Add new tests to presubmit, fix errors (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « monitoring/go/datahopper/main.go ('k') | perf/go/activitylog/activitylog.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Prober is an HTTP prober that periodically sends out HTTP requests to specifi ed 1 // Prober is an HTTP prober that periodically sends out HTTP requests to specifi ed
2 // endpoints and reports if the returned results match the expectations. The res ults 2 // endpoints and reports if the returned results match the expectations. The res ults
3 // of the probe, including latency, are recored in InfluxDB using the Carbon pro tocol. 3 // of the probe, including latency, are recored in InfluxDB using the Carbon pro tocol.
4 // See probers.json as an example of the config file format. 4 // See probers.json as an example of the config file format.
5 package main 5 package main
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 for _ = range time.Tick(*runEvery) { 261 for _ = range time.Tick(*runEvery) {
262 for name, probe := range cfg { 262 for name, probe := range cfg {
263 glog.Infof("Probe: %s Starting fail value: %d", name, pr obe.failure.Value()) 263 glog.Infof("Probe: %s Starting fail value: %d", name, pr obe.failure.Value())
264 begin = time.Now() 264 begin = time.Now()
265 if probe.Method == "GET" { 265 if probe.Method == "GET" {
266 resp, err = c.Get(probe.URL) 266 resp, err = c.Get(probe.URL)
267 } else if probe.Method == "POST" { 267 } else if probe.Method == "POST" {
268 resp, err = c.Post(probe.URL, probe.MimeType, st rings.NewReader(probe.Body)) 268 resp, err = c.Post(probe.URL, probe.MimeType, st rings.NewReader(probe.Body))
269 } else { 269 } else {
270 » » » » glog.Errorf("Error: unknown method: ", probe.Met hod) 270 » » » » glog.Errorf("Error: unknown method: %s", probe.M ethod)
271 continue 271 continue
272 } 272 }
273 if err != nil { 273 if err != nil {
274 glog.Errorf("Failed to make request: Name: %s UR L: %s Error: %s", name, probe.URL, err) 274 glog.Errorf("Failed to make request: Name: %s UR L: %s Error: %s", name, probe.URL, err)
275 probe.failure.Update(1) 275 probe.failure.Update(1)
276 continue 276 continue
277 } 277 }
278 bodyTestResults := true 278 bodyTestResults := true
279 if probe.bodyTest != nil && resp.Body != nil { 279 if probe.bodyTest != nil && resp.Body != nil {
280 bodyTestResults = probe.bodyTest(resp.Body) 280 bodyTestResults = probe.bodyTest(resp.Body)
(...skipping 13 matching lines...) Expand all
294 glog.Errorf("Body test failed. %#v", probe) 294 glog.Errorf("Body test failed. %#v", probe)
295 probe.failure.Update(1) 295 probe.failure.Update(1)
296 continue 296 continue
297 } 297 }
298 298
299 probe.failure.Update(0) 299 probe.failure.Update(0)
300 probe.latency.Update(d) 300 probe.latency.Update(d)
301 } 301 }
302 } 302 }
303 } 303 }
OLDNEW
« no previous file with comments | « monitoring/go/datahopper/main.go ('k') | perf/go/activitylog/activitylog.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698