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

Side by Side Diff: go/src/infra/monitoring/analyzer/analyzer.go

Issue 1149313002: go: Replace Logrus with go-logging. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: typo Created 5 years, 7 months 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 | « go/src/infra/libs/logging/logrus_test.go ('k') | go/src/infra/monitoring/client/client.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 // 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 package analyzer 5 package analyzer
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "net/url" 10 "net/url"
11 "path/filepath" 11 "path/filepath"
12 "sort" 12 "sort"
13 "strings" 13 "strings"
14 "sync" 14 "sync"
15 "time" 15 "time"
16 16
17 » "github.com/Sirupsen/logrus" 17 » "infra/libs/logging"
18 18
19 "infra/monitoring/client" 19 "infra/monitoring/client"
20 "infra/monitoring/messages" 20 "infra/monitoring/messages"
21 ) 21 )
22 22
23 const ( 23 const (
24 // StepCompletedRun is a synthetic step name used to indicate the build run is complete. 24 // StepCompletedRun is a synthetic step name used to indicate the build run is complete.
25 StepCompletedRun = "completed run" 25 StepCompletedRun = "completed run"
26 treeCloserPri = 0 26 treeCloserPri = 0
27 staleMasterSev = 0 27 staleMasterSev = 0
28 staleBuilderSev = 0 28 staleBuilderSev = 0
29 hungBuilderSev = 1 29 hungBuilderSev = 1
30 idleBuilderSev = 1 30 idleBuilderSev = 1
31 offlineBuilderSev = 1 31 offlineBuilderSev = 1
32 resOK = float64(1) 32 resOK = float64(1)
33 resInfraFailure = float64(4) 33 resInfraFailure = float64(4)
34 ) 34 )
35 35
36 var ( 36 var (
37 » log = logrus.New() 37 » log = logging.DefaultLogger
38 ) 38 )
39 39
40 var ( 40 var (
41 errNoBuildSteps = errors.New("No build steps") 41 errNoBuildSteps = errors.New("No build steps")
42 errNoRecentBuilds = errors.New("No recent builds") 42 errNoRecentBuilds = errors.New("No recent builds")
43 errNoCompletedBuilds = errors.New("No completed builds") 43 errNoCompletedBuilds = errors.New("No completed builds")
44 ) 44 )
45 45
46 // StepAnalyzer reasons about a stepFailure and produces a set of reasons for th e 46 // StepAnalyzer reasons about a stepFailure and produces a set of reasons for th e
47 // failure. It also indicates whether or not it recognizes the stepFailure. 47 // failure. It also indicates whether or not it recognizes the stepFailure.
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 for _, r := range reasons { 740 for _, r := range reasons {
741 bf.Reasons = append(bf.Reasons, messages.Reason{ 741 bf.Reasons = append(bf.Reasons, messages.Reason{
742 TestName: r, 742 TestName: r,
743 Step: f.step.Name, 743 Step: f.step.Name,
744 URL: f.URL(), 744 URL: f.URL(),
745 }) 745 })
746 } 746 }
747 747
748 alr.Key = alertKey(f.masterName, f.builderName, f.step.N ame) 748 alr.Key = alertKey(f.masterName, f.builderName, f.step.N ame)
749 if len(bf.Reasons) == 0 { 749 if len(bf.Reasons) == 0 {
750 » » » » log.Warnf("No reasons for step failure: %s", alr .Key) 750 » » » » log.Warningf("No reasons for step failure: %s", alr.Key)
751 bf.Reasons = append(bf.Reasons, messages.Reason{ 751 bf.Reasons = append(bf.Reasons, messages.Reason{
752 Step: f.step.Name, 752 Step: f.step.Name,
753 URL: f.URL(), 753 URL: f.URL(),
754 }) 754 })
755 } 755 }
756 756
757 alr.Extension = bf 757 alr.Extension = bf
758 758
759 rs <- res{ 759 rs <- res{
760 f: f, 760 f: f,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // even though they're specified in gatekeeper.json 819 // even though they're specified in gatekeeper.json
820 for _, s := range mc.ExcludedSteps { 820 for _, s := range mc.ExcludedSteps {
821 if step == s { 821 if step == s {
822 return true 822 return true
823 } 823 }
824 } 824 }
825 825
826 bc, ok := mc.Builders[builder] 826 bc, ok := mc.Builders[builder]
827 if !ok { 827 if !ok {
828 if bc, ok = mc.Builders["*"]; !ok { 828 if bc, ok = mc.Builders["*"]; !ok {
829 » » » log.Warnf("Unknown %s builder %s", master, builder) 829 » » » log.Warningf("Unknown %s builder %s", master, builder)
830 return true 830 return true
831 } 831 }
832 } 832 }
833 833
834 for _, esName := range bc.ExcludedSteps { 834 for _, esName := range bc.ExcludedSteps {
835 if esName == step || esName == "*" { 835 if esName == step || esName == "*" {
836 return true 836 return true
837 } 837 }
838 } 838 }
839 839
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 masterName string 903 masterName string
904 builderName string 904 builderName string
905 build messages.Build 905 build messages.Build
906 step messages.Step 906 step messages.Step
907 } 907 }
908 908
909 // URL returns a url to builder step failure page. 909 // URL returns a url to builder step failure page.
910 func (f stepFailure) URL() string { 910 func (f stepFailure) URL() string {
911 return client.StepURL(f.masterName, f.builderName, f.step.Name, f.build. Number) 911 return client.StepURL(f.masterName, f.builderName, f.step.Name, f.build. Number)
912 } 912 }
OLDNEW
« no previous file with comments | « go/src/infra/libs/logging/logrus_test.go ('k') | go/src/infra/monitoring/client/client.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698