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

Side by Side Diff: fuzzer/go/fuzzer-fe/main.go

Issue 1682363003: Migrate fuzzer to use shiny new metrics2 package (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 package main 1 package main
2 2
3 /* 3 /*
4 Runs the frontend portion of the fuzzer. This primarily is the webserver (see D ESIGN.md) 4 Runs the frontend portion of the fuzzer. This primarily is the webserver (see D ESIGN.md)
5 */ 5 */
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "encoding/base64" 9 "encoding/base64"
10 "encoding/json" 10 "encoding/json"
(...skipping 13 matching lines...) Expand all
24 "go.skia.org/infra/fuzzer/go/config" 24 "go.skia.org/infra/fuzzer/go/config"
25 "go.skia.org/infra/fuzzer/go/frontend" 25 "go.skia.org/infra/fuzzer/go/frontend"
26 "go.skia.org/infra/fuzzer/go/frontend/data" 26 "go.skia.org/infra/fuzzer/go/frontend/data"
27 "go.skia.org/infra/fuzzer/go/frontend/gsloader" 27 "go.skia.org/infra/fuzzer/go/frontend/gsloader"
28 "go.skia.org/infra/fuzzer/go/frontend/syncer" 28 "go.skia.org/infra/fuzzer/go/frontend/syncer"
29 "go.skia.org/infra/fuzzer/go/fuzzcache" 29 "go.skia.org/infra/fuzzer/go/fuzzcache"
30 "go.skia.org/infra/go/auth" 30 "go.skia.org/infra/go/auth"
31 "go.skia.org/infra/go/common" 31 "go.skia.org/infra/go/common"
32 "go.skia.org/infra/go/fileutil" 32 "go.skia.org/infra/go/fileutil"
33 "go.skia.org/infra/go/gs" 33 "go.skia.org/infra/go/gs"
34 "go.skia.org/infra/go/influxdb"
34 "go.skia.org/infra/go/login" 35 "go.skia.org/infra/go/login"
35 "go.skia.org/infra/go/skiaversion" 36 "go.skia.org/infra/go/skiaversion"
36 "go.skia.org/infra/go/util" 37 "go.skia.org/infra/go/util"
37 "golang.org/x/net/context" 38 "golang.org/x/net/context"
38 "google.golang.org/cloud" 39 "google.golang.org/cloud"
39 "google.golang.org/cloud/storage" 40 "google.golang.org/cloud/storage"
40 ) 41 )
41 42
42 const ( 43 const (
43 // OAUTH2_CALLBACK_PATH is callback endpoint used for the Oauth2 flow. 44 // OAUTH2_CALLBACK_PATH is callback endpoint used for the Oauth2 flow.
44 OAUTH2_CALLBACK_PATH = "/oauth2callback/" 45 OAUTH2_CALLBACK_PATH = "/oauth2callback/"
45 ) 46 )
46 47
47 var ( 48 var (
48 // indexTemplate is the main index.html page we serve. 49 // indexTemplate is the main index.html page we serve.
49 indexTemplate *template.Template = nil 50 indexTemplate *template.Template = nil
50 // detailsTemplate is used for /category, which displays the count of fu zzes in various files 51 // detailsTemplate is used for /category, which displays the count of fu zzes in various files
51 // as well as the stacktraces. 52 // as well as the stacktraces.
52 detailsTemplate *template.Template = nil 53 detailsTemplate *template.Template = nil
53 54
54 storageClient *storage.Client = nil 55 storageClient *storage.Client = nil
55 56
56 versionWatcher *fcommon.VersionWatcher = nil 57 versionWatcher *fcommon.VersionWatcher = nil
57 58
58 fuzzSyncer *syncer.FuzzSyncer = nil 59 fuzzSyncer *syncer.FuzzSyncer = nil
59 ) 60 )
60 61
61 var ( 62 var (
62 // web server params 63 // web server params
63 » graphiteServer = flag.String("graphite_server", "localhost:2003", "Where is Graphite metrics ingestion server running.") 64 » influxHost = flag.String("influxdb_host", influxdb.DEFAULT_HOST, "Th e InfluxDB hostname.")
64 » host = flag.String("host", "localhost", "HTTP service host") 65 » influxUser = flag.String("influxdb_name", influxdb.DEFAULT_USER, "Th e InfluxDB username.")
65 » port = flag.String("port", ":8001", "HTTP service port (e.g., ':8002')") 66 » influxPassword = flag.String("influxdb_password", influxdb.DEFAULT_PASSW ORD, "The InfluxDB password.")
66 » local = flag.Bool("local", false, "Running locally if true. As opposed to in production.") 67 » influxDatabase = flag.String("influxdb_database", influxdb.DEFAULT_DATAB ASE, "The InfluxDB database.")
67 » resourcesDir = flag.String("resources_dir", "", "The directory to find templates, JS, and CSS files. If blank the current directory will be used.") 68
68 » boltDBPath = flag.String("bolt_db_path", "fuzzer-db", "The path to t he bolt db to be used as a local cache.") 69 » host = flag.String("host", "localhost", "HTTP service host")
70 » port = flag.String("port", ":8001", "HTTP service port (e.g., ': 8002')")
71 » local = flag.Bool("local", false, "Running locally if true. As op posed to in production.")
72 » resourcesDir = flag.String("resources_dir", "", "The directory to find t emplates, JS, and CSS files. If blank the current directory will be used.")
73 » boltDBPath = flag.String("bolt_db_path", "fuzzer-db", "The path to the bolt db to be used as a local cache.")
69 74
70 // OAUTH params 75 // OAUTH params
71 authWhiteList = flag.String("auth_whitelist", login.DEFAULT_DOMAIN_WHITE LIST, "White space separated list of domains and email addresses that are allowe d to login.") 76 authWhiteList = flag.String("auth_whitelist", login.DEFAULT_DOMAIN_WHITE LIST, "White space separated list of domains and email addresses that are allowe d to login.")
72 redirectURL = flag.String("redirect_url", "https://fuzzer.skia.org/oau th2callback/", "OAuth2 redirect url. Only used when local=false.") 77 redirectURL = flag.String("redirect_url", "https://fuzzer.skia.org/oau th2callback/", "OAuth2 redirect url. Only used when local=false.")
73 78
74 // Scanning params 79 // Scanning params
75 skiaRoot = flag.String("skia_root", "", "[REQUIRED] The root di rectory of the Skia source code.") 80 skiaRoot = flag.String("skia_root", "", "[REQUIRED] The root di rectory of the Skia source code.")
76 clangPath = flag.String("clang_path", "", "[REQUIRED] The path t o the clang executable.") 81 clangPath = flag.String("clang_path", "", "[REQUIRED] The path t o the clang executable.")
77 clangPlusPlusPath = flag.String("clang_p_p_path", "", "[REQUIRED] The pa th to the clang++ executable.") 82 clangPlusPlusPath = flag.String("clang_p_p_path", "", "[REQUIRED] The pa th to the clang++ executable.")
78 depotToolsPath = flag.String("depot_tools_path", "", "The absolute pa th to depot_tools. Can be empty if they are on your path.") 83 depotToolsPath = flag.String("depot_tools_path", "", "The absolute pa th to depot_tools. Can be empty if they are on your path.")
(...skipping 22 matching lines...) Expand all
101 detailsTemplate.Delims("{%", "%}") 106 detailsTemplate.Delims("{%", "%}")
102 detailsTemplate = template.Must(detailsTemplate.ParseFiles( 107 detailsTemplate = template.Must(detailsTemplate.ParseFiles(
103 filepath.Join(*resourcesDir, "templates/details.html"), 108 filepath.Join(*resourcesDir, "templates/details.html"),
104 filepath.Join(*resourcesDir, "templates/header.html"), 109 filepath.Join(*resourcesDir, "templates/header.html"),
105 )) 110 ))
106 } 111 }
107 112
108 func main() { 113 func main() {
109 defer common.LogPanic() 114 defer common.LogPanic()
110 // Calls flag.Parse() 115 // Calls flag.Parse()
111 » common.InitWithMetrics("fuzzer", graphiteServer) 116 » common.InitWithMetrics2("fuzzer-fe", influxHost, influxUser, influxPassw ord, influxDatabase, local)
112 117
113 if err := writeFlagsToConfig(); err != nil { 118 if err := writeFlagsToConfig(); err != nil {
114 glog.Fatalf("Problem with configuration: %s", err) 119 glog.Fatalf("Problem with configuration: %s", err)
115 } 120 }
116 121
117 Init() 122 Init()
118 123
119 if err := setupOAuth(); err != nil { 124 if err := setupOAuth(); err != nil {
120 glog.Fatal(err) 125 glog.Fatal(err)
121 } 126 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 481 }
477 var t bytes.Buffer 482 var t bytes.Buffer
478 if err := newBugTemplate.Execute(&t, b); err != nil { 483 if err := newBugTemplate.Execute(&t, b); err != nil {
479 util.ReportError(w, r, err, fmt.Sprintf("Could not create templa te with %#v", b)) 484 util.ReportError(w, r, err, fmt.Sprintf("Could not create templa te with %#v", b))
480 return 485 return
481 } 486 }
482 q.Add("comment", t.String()) 487 q.Add("comment", t.String())
483 // 303 means "make a GET request to this url" 488 // 303 means "make a GET request to this url"
484 http.Redirect(w, r, "https://bugs.chromium.org/p/skia/issues/entry?"+q.E ncode(), 303) 489 http.Redirect(w, r, "https://bugs.chromium.org/p/skia/issues/entry?"+q.E ncode(), 303)
485 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698