| OLD | NEW |
| 1 package alerting | 1 package alerting |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "database/sql" | 4 "database/sql" |
| 5 "encoding/json" | 5 "encoding/json" |
| 6 "fmt" | 6 "fmt" |
| 7 "math" | 7 "math" |
| 8 "time" | 8 "time" |
| 9 | 9 |
| 10 "github.com/skia-dev/glog" | 10 "github.com/skia-dev/glog" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 count++ | 325 count++ |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 glog.Infof("Updated new cluster count: %d", count) | 328 glog.Infof("Updated new cluster count: %d", count) |
| 329 newClustersGauge.Update(int64(count)) | 329 newClustersGauge.Update(int64(count)) |
| 330 } | 330 } |
| 331 | 331 |
| 332 // Start kicks off a go routine the periodically refreshes the current alerting
clusters. | 332 // Start kicks off a go routine the periodically refreshes the current alerting
clusters. |
| 333 func Start(tb tracedb.MasterTileBuilder) { | 333 func Start(tb tracedb.MasterTileBuilder) { |
| 334 newClustersGauge = metrics2.GetInt64Metric("perf.clustering.untriaged",
nil) | 334 newClustersGauge = metrics2.GetInt64Metric("perf.clustering.untriaged",
nil) |
| 335 » runsCounter = metrics2.NewCounter("perf.clustering.runs", nil) | 335 » runsCounter = metrics2.GetCounter("perf.clustering.runs", nil) |
| 336 clusteringLatency = metrics2.NewTimer("perf.clustering.latency", nil) | 336 clusteringLatency = metrics2.NewTimer("perf.clustering.latency", nil) |
| 337 tileBuilder = tb | 337 tileBuilder = tb |
| 338 client, err := auth.NewDefaultJWTServiceAccountClient("https://www.googl
eapis.com/auth/userinfo.email") | 338 client, err := auth.NewDefaultJWTServiceAccountClient("https://www.googl
eapis.com/auth/userinfo.email") |
| 339 if err != nil { | 339 if err != nil { |
| 340 glog.Errorf("Not updating bugs, not able to construct an authent
icated client: %s", err) | 340 glog.Errorf("Not updating bugs, not able to construct an authent
icated client: %s", err) |
| 341 } | 341 } |
| 342 var issueTracker issues.IssueTracker = nil | 342 var issueTracker issues.IssueTracker = nil |
| 343 if client != nil { | 343 if client != nil { |
| 344 issueTracker = issues.NewMonorailIssueTracker(client) | 344 issueTracker = issues.NewMonorailIssueTracker(client) |
| 345 } | 345 } |
| 346 | 346 |
| 347 go func() { | 347 go func() { |
| 348 for _ = range time.Tick(config.RECLUSTER_DURATION) { | 348 for _ = range time.Tick(config.RECLUSTER_DURATION) { |
| 349 singleStep(issueTracker) | 349 singleStep(issueTracker) |
| 350 } | 350 } |
| 351 }() | 351 }() |
| 352 } | 352 } |
| OLD | NEW |