| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Dispatcher usage: | 5 // Dispatcher usage: |
| 6 // go run infra/monitoring/dispatcher | 6 // go run infra/monitoring/dispatcher |
| 7 // Expects gatekeeper.json to be in the current directory. | 7 // Expects gatekeeper.json to be in the current directory. |
| 8 | 8 |
| 9 package main | 9 package main |
| 10 | 10 |
| 11 import ( | 11 import ( |
| 12 "encoding/json" | 12 "encoding/json" |
| 13 "flag" | 13 "flag" |
| 14 "fmt" | 14 "fmt" |
| 15 "io/ioutil" | 15 "io/ioutil" |
| 16 "os" | 16 "os" |
| 17 "strings" | 17 "strings" |
| 18 "time" | 18 "time" |
| 19 | 19 |
| 20 "github.com/luci/luci-go/common/clock" |
| 20 "github.com/luci/luci-go/common/logging/gologger" | 21 "github.com/luci/luci-go/common/logging/gologger" |
| 21 | 22 |
| 22 "infra/libs/clock" | |
| 23 "infra/monitoring/analyzer" | 23 "infra/monitoring/analyzer" |
| 24 "infra/monitoring/client" | 24 "infra/monitoring/client" |
| 25 "infra/monitoring/messages" | 25 "infra/monitoring/messages" |
| 26 ) | 26 ) |
| 27 | 27 |
| 28 var ( | 28 var ( |
| 29 dataURL = flag.String("data_url", "", "Url where alerts are
stored") | 29 dataURL = flag.String("data_url", "", "Url where alerts are
stored") |
| 30 masterFilter = flag.String("master-filter", "", "Filter out maste
rs that contain this string") | 30 masterFilter = flag.String("master-filter", "", "Filter out maste
rs that contain this string") |
| 31 masterOnly = flag.String("master", "", "Only check this master"
) | 31 masterOnly = flag.String("master", "", "Only check this master"
) |
| 32 mastersOnly = flag.Bool("masters-only", false, "Just check for m
aster alerts, not builders") | 32 mastersOnly = flag.Bool("masters-only", false, "Just check for m
aster alerts, not builders") |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 return nil | 299 return nil |
| 300 } | 300 } |
| 301 | 301 |
| 302 loopResults := loop(f, cycle, duration, *maxErrs, clock.GetSystemClock()
) | 302 loopResults := loop(f, cycle, duration, *maxErrs, clock.GetSystemClock()
) |
| 303 | 303 |
| 304 if !loopResults.success { | 304 if !loopResults.success { |
| 305 log.Errorf("Failed to run loop, %v errors", loopResults.errs) | 305 log.Errorf("Failed to run loop, %v errors", loopResults.errs) |
| 306 os.Exit(1) | 306 os.Exit(1) |
| 307 } | 307 } |
| 308 } | 308 } |
| OLD | NEW |