Skip to content

Commit

Permalink
address irfan nits and lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
msbutler committed Jun 28, 2022
1 parent 7156d31 commit a484ba7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
4 changes: 3 additions & 1 deletion pkg/cmd/roachprod/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
11 changes: 5 additions & 6 deletions pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,8 @@ var getProvidersCmd = &cobra.Command{
}

var grafanaStartCmd = &cobra.Command{
Use: `grafana-start <cluster> [<grafanaConfig>]`,
Short: `spins up a prometheus and grafana instances on the last node provided`,
Use: `grafana-start <cluster>`,
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),
Expand All @@ -900,11 +900,10 @@ and will scrape from all nodes in the cluster`,
var grafanaStopCmd = &cobra.Command{
Use: `grafana-stop <cluster>`,
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)
}),
}

Expand Down
11 changes: 0 additions & 11 deletions pkg/cmd/roachtest/tests/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/roachprod/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions pkg/roachprod/roachprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a484ba7

Please sign in to comment.