Skip to content

Commit

Permalink
add --serve flag to all benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed May 19, 2021
1 parent 10770ee commit 49d6829
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ func (s *Server) handleDownloadJSON(w http.ResponseWriter, req *http.Request) {
enc.Encode(ops)
}

// handleRootAPI handles requests to `/v1`.
func (s *Server) handleRootAPI(w http.ResponseWriter, req *http.Request) {
// handleStop handles requests to `/v1/stop`, stops the service.
func (s *Server) handleStop(w http.ResponseWriter, req *http.Request) {
if req.Method == http.MethodDelete {
w.WriteHeader(200)
w.Write([]byte(`bye...`))
Expand All @@ -273,8 +273,8 @@ func NewBenchmarkMonitor(listenAddr string) *Server {

s.ctx, s.cancel = context.WithCancel(context.Background())
mux := http.NewServeMux()
mux.HandleFunc("/v1/stop", s.handleStop)
mux.HandleFunc("/v1/status", s.handleStatus)
mux.HandleFunc("/v1", s.handleRootAPI)
mux.HandleFunc("/v1/aggregated", s.handleAggregated)
mux.HandleFunc("/v1/operations/json", s.handleDownloadJSON)
mux.HandleFunc("/v1/operations", s.handleDownloadZst)
Expand Down
6 changes: 0 additions & 6 deletions cli/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ var analyzeFlags = []cli.Flag{
Name: "analyze.v",
Usage: "Display additional analysis data.",
},
cli.StringFlag{
Name: serverFlagName,
Usage: "When running benchmarks open a webserver on this ip:port and keep it running afterwards.",
Value: "",
Hidden: true,
},
}

var analyzeCmd = cli.Command{
Expand Down
4 changes: 4 additions & 0 deletions cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ var globalFlags = []cli.Flag{
Name: "autocompletion",
Usage: "install auto-completion for your shell",
},
cli.StringFlag{
Name: serverFlagName,
Usage: "When running benchmarks open a webserver to fetch results remotely, eg: localhost:7762",
},
}

var profileFlags = []cli.Flag{
Expand Down

0 comments on commit 49d6829

Please sign in to comment.