Status: Remove influx.

BUG=skia:

Change-Id: Ifd7e992e8afcd0e16cfb0d0dca4dbbc554a30c8a
Reviewed-on: https://skia-review.googlesource.com/8962
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
diff --git a/status/go/status/main.go b/status/go/status/main.go
index 1a0ad39..2ae4adc 100644
--- a/status/go/status/main.go
+++ b/status/go/status/main.go
@@ -26,10 +26,7 @@
 	"go.skia.org/infra/go/common"
 	"go.skia.org/infra/go/git/repograph"
 	"go.skia.org/infra/go/httputils"
-	"go.skia.org/infra/go/influxdb"
-	"go.skia.org/infra/go/influxdb_init"
 	"go.skia.org/infra/go/login"
-	"go.skia.org/infra/go/polling_status"
 	"go.skia.org/infra/go/skiaversion"
 	"go.skia.org/infra/go/sklog"
 	"go.skia.org/infra/go/timer"
@@ -45,24 +42,18 @@
 	DEFAULT_COMMITS_TO_LOAD = 50
 	SKIA_REPO               = "skia"
 	INFRA_REPO              = "infra"
-	// The from clause needs to be in double quotes and the where clauses need to be
-	// in single quotes because InfluxDB is quite particular about these things.
-	GOLD_STATUS_QUERY_TMPL = `select value from "gold.status.by-corpus" WHERE time > now() - 1h and host='skia-gold-prod' AND app='skiacorrectness' AND type='untriaged' AND corpus='%s' ORDER BY time DESC LIMIT 1`
-	PERF_STATUS_QUERY      = `select value from "perf.clustering.untriaged" where time > now() - 1h and app='skiaperf' and host='skia-perf' order by time desc limit 1`
 
 	// OAUTH2_CALLBACK_PATH is callback endpoint used for the Oauth2 flow.
 	OAUTH2_CALLBACK_PATH = "/oauth2callback/"
 )
 
 var (
-	buildCache       *franken.BTCache              = nil
-	buildDb          buildbot.DB                   = nil
-	capacityClient   *capacity.CapacityClient      = nil
-	capacityTemplate *template.Template            = nil
-	commitsTemplate  *template.Template            = nil
-	dbClient         *influxdb.Client              = nil
-	perfStatus       *polling_status.PollingStatus = nil
-	tasksPerCommit   *tasksPerCommitCache          = nil
+	buildCache       *franken.BTCache         = nil
+	buildDb          buildbot.DB              = nil
+	capacityClient   *capacity.CapacityClient = nil
+	capacityTemplate *template.Template       = nil
+	commitsTemplate  *template.Template       = nil
+	tasksPerCommit   *tasksPerCommitCache     = nil
 )
 
 // flags
@@ -80,11 +71,6 @@
 	useMetadata                 = flag.Bool("use_metadata", true, "Load sensitive values from metadata not from flags.")
 	workdir                     = flag.String("workdir", ".", "Directory to use for scratch work.")
 
-	influxHost     = flag.String("influxdb_host", influxdb.DEFAULT_HOST, "The InfluxDB hostname.")
-	influxUser     = flag.String("influxdb_name", influxdb.DEFAULT_USER, "The InfluxDB username.")
-	influxPassword = flag.String("influxdb_password", influxdb.DEFAULT_PASSWORD, "The InfluxDB password.")
-	influxDatabase = flag.String("influxdb_database", influxdb.DEFAULT_DATABASE, "The InfluxDB database.")
-
 	repos repograph.Map
 )
 
@@ -475,14 +461,6 @@
 	}
 }
 
-func perfJsonHandler(w http.ResponseWriter, r *http.Request) {
-	w.Header().Set("Content-Type", "application/json")
-	if err := json.NewEncoder(w).Encode(map[string]interface{}{"alerts": perfStatus}); err != nil {
-		httputils.ReportError(w, r, err, fmt.Sprintf("Failed to report Perf status: %v", err))
-		return
-	}
-}
-
 // buildProgressHandler returns the number of finished builds at the given
 // commit, compared to that of an older commit.
 func buildProgressHandler(w http.ResponseWriter, r *http.Request) {
@@ -548,7 +526,6 @@
 	r.HandleFunc("/repo/{repo}", statusHandler)
 	r.HandleFunc("/capacity", capacityHandler)
 	r.HandleFunc("/capacity/json", capacityStatsHandler)
-	r.HandleFunc("/json/perfAlerts", perfJsonHandler)
 	r.HandleFunc("/json/version", skiaversion.JsonHandler)
 	r.HandleFunc("/json/{repo}/buildProgress", buildProgressHandler)
 	r.HandleFunc("/logout/", login.LogoutHandler)
@@ -576,7 +553,6 @@
 
 	common.InitWithMust(
 		"status",
-		common.InfluxOpt(influxHost, influxUser, influxPassword, influxDatabase, testing),
 		common.PrometheusOpt(promPort),
 		common.CloudLoggingOpt(),
 	)
@@ -611,12 +587,6 @@
 		}
 	}
 
-	// Setup InfluxDB client.
-	dbClient, err = influxdb_init.NewClientFromParamsAndMetadata(*influxHost, *influxUser, *influxPassword, *influxDatabase, *testing)
-	if err != nil {
-		sklog.Fatal(err)
-	}
-
 	login.SimpleInitMust(*port, *testing)
 
 	// Check out source code.
@@ -649,9 +619,6 @@
 	capacityClient = capacity.New(tasksPerCommit.tcc, bc.GetTaskCache(), repos)
 	capacityClient.StartLoading(*capacityRecalculateInterval)
 
-	// Load Perf and Gold data in a loop.
-	perfStatus = dbClient.Int64PollingStatus("skmetrics", PERF_STATUS_QUERY, time.Minute)
-
 	// Run the server.
 	runServer(serverURL)
 }
diff --git a/status/sys/status-internal.service b/status/sys/status-internal.service
index e9c3831..5458540 100644
--- a/status/sys/status-internal.service
+++ b/status/sys/status-internal.service
@@ -10,8 +10,6 @@
     --workdir=/mnt/pd0/status_workdir \
     --use_metadata=true \
     --host=status-internal.skia.org \
-    --influxdb_host=skia-monitoring:10117 \
-    --influxdb_database=skmetrics \
     --resources_dir=/usr/local/share/status \
     --capacity_recalculate_interval=30m \
     --repo=https://skia.googlesource.com/internal_test.git \
diff --git a/status/sys/statusd.service b/status/sys/statusd.service
index fbd9eb3..e89042f 100644
--- a/status/sys/statusd.service
+++ b/status/sys/statusd.service
@@ -10,8 +10,6 @@
     --workdir=/mnt/pd0/status_workdir \
     --use_metadata=true \
     --host=status.skia.org \
-    --influxdb_host=skia-monitoring:10117 \
-    --influxdb_database=skmetrics \
     --resources_dir=/usr/local/share/status \
     --capacity_recalculate_interval=30m \
     --task_db_url=http://skia-task-scheduler:8008/db/