From a484ba76eb9c4777bbb1fe59dcf11f7dcac8be50 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Tue, 28 Jun 2022 08:53:34 -0400 Subject: [PATCH] address irfan nits and lint errors --- pkg/cmd/roachprod/flags.go | 4 +++- pkg/cmd/roachprod/main.go | 11 +++++------ pkg/cmd/roachtest/tests/canary.go | 11 ----------- pkg/roachprod/install/cluster_synced.go | 2 +- pkg/roachprod/prometheus/prometheus.go | 2 +- pkg/roachprod/roachprod.go | 1 + 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/pkg/cmd/roachprod/flags.go b/pkg/cmd/roachprod/flags.go index 239c889d47a2..be099fc368f8 100644 --- a/pkg/cmd/roachprod/flags.go +++ b/pkg/cmd/roachprod/flags.go @@ -244,7 +244,9 @@ func initFlags() { "open", false, "open the grafana dashboard url on the browser") grafanaStopCmd.Flags().StringVar(&grafanaDumpDir, "dump-dir", "", - "the absolute path to dump prometheus data to. If empty, no data will get dumped") + "the absolute path on the machine running roachprod to dump prometheus data to.\n"+ + "In the dump-dir, the 'prometheus-docker-run.sh' bash script allows the user to interact\n"+ + "with the dumped data. If empty, no data will get dumped.") for _, cmd := range []*cobra.Command{createCmd, destroyCmd, extendCmd, logsCmd} { cmd.Flags().StringVarP(&username, "username", "u", os.Getenv("ROACHPROD_USER"), diff --git a/pkg/cmd/roachprod/main.go b/pkg/cmd/roachprod/main.go index 988b45a87319..bfa17c6744a9 100644 --- a/pkg/cmd/roachprod/main.go +++ b/pkg/cmd/roachprod/main.go @@ -886,8 +886,8 @@ var getProvidersCmd = &cobra.Command{ } var grafanaStartCmd = &cobra.Command{ - Use: `grafana-start []`, - Short: `spins up a prometheus and grafana instances on the last node provided`, + Use: `grafana-start `, + Short: `spins up a prometheus and grafana instances on the last node in the cluster`, Long: `spins up a prometheus and grafana instances on the highest numbered node in the cluster and will scrape from all nodes in the cluster`, Args: cobra.ExactArgs(1), @@ -900,11 +900,10 @@ and will scrape from all nodes in the cluster`, var grafanaStopCmd = &cobra.Command{ Use: `grafana-stop `, Short: `spins down prometheus and grafana instances on the last node in the cluster`, - Long: `spins down the prometheus and grafana instances on provided roachprod node and -dumps the prometheus data at the root of the last node in the cluster`, - Args: cobra.ExactArgs(1), + Long: `spins down the prometheus and grafana instances on the last node in the cluster`, + Args: cobra.ExactArgs(1), Run: wrap(func(cmd *cobra.Command, args []string) error { - return roachprod.StopGrafana(context.Background(), roachprodLibraryLogger, args[0], "") + return roachprod.StopGrafana(context.Background(), roachprodLibraryLogger, args[0], grafanaDumpDir) }), } diff --git a/pkg/cmd/roachtest/tests/canary.go b/pkg/cmd/roachtest/tests/canary.go index 488ab408ab41..79ffc2709e43 100644 --- a/pkg/cmd/roachtest/tests/canary.go +++ b/pkg/cmd/roachtest/tests/canary.go @@ -109,17 +109,6 @@ var canaryRetryOptions = retry.Options{ MaxRetries: 10, } -type repeatRunner struct { - T test.Test - C cluster.Cluster -} - -func (rr repeatRunner) repeatRunE( - ctx context.Context, node option.NodeListOption, operation string, args ...string, -) error { - return repeatRunE(ctx, rr.T, rr.C, node, operation, args...) -} - // repeatRunE is the same function as c.RunE but with an automatic retry loop. func repeatRunE( ctx context.Context, diff --git a/pkg/roachprod/install/cluster_synced.go b/pkg/roachprod/install/cluster_synced.go index 07ec814ce7b3..ae75398735ab 100644 --- a/pkg/roachprod/install/cluster_synced.go +++ b/pkg/roachprod/install/cluster_synced.go @@ -772,7 +772,7 @@ var roachprodRetryOptions = retry.Options{ MaxRetries: 10, } -// repeatRun is the same function as c.Run but with an automatic retry loop. +// RepeatRun is the same function as c.Run, but with an automatic retry loop. func (c *SyncedCluster) RepeatRun( ctx context.Context, l *logger.Logger, stdout, stderr io.Writer, nodes Nodes, title, cmd string, diff --git a/pkg/roachprod/prometheus/prometheus.go b/pkg/roachprod/prometheus/prometheus.go index 421ffe72e23d..a6b46c79db8c 100644 --- a/pkg/roachprod/prometheus/prometheus.go +++ b/pkg/roachprod/prometheus/prometheus.go @@ -436,7 +436,7 @@ func Shutdown( "stop prometheus", "sudo systemctl stop prometheus || echo 'Stopped prometheus'", ); err != nil { - l.Printf("Failed to stop prometheus server") + l.Printf("Failed to stop prometheus server: %v", err) } return nil } diff --git a/pkg/roachprod/roachprod.go b/pkg/roachprod/roachprod.go index 8cdef188068d..4dcfca40c4be 100644 --- a/pkg/roachprod/roachprod.go +++ b/pkg/roachprod/roachprod.go @@ -1430,6 +1430,7 @@ func StopGrafana(ctx context.Context, l *logger.Logger, clusterName string, dump return nil } +// GrafanaURL returns a url to the grafana dashboard func GrafanaURL( ctx context.Context, l *logger.Logger, clusterName string, openInBrowser bool, ) ([]string, error) {