diff --git a/go/server/api.go b/go/server/api.go index cd6a49780..9d6a43762 100644 --- a/go/server/api.go +++ b/go/server/api.go @@ -395,7 +395,6 @@ func (s *Server) requestRun(c *gin.Context) { } currVersion := git.Version{Major: version} - configs := s.getConfigFiles() cfg, ok := configs[strings.ToLower(benchmarkType)] if !ok { @@ -451,3 +450,21 @@ func (s *Server) deleteRun(c *gin.Context) { c.JSON(http.StatusOK, "deleted") } +func (s *Server) compareBenchmarkFKs(c *gin.Context) { + sha := c.Query("sha") + + var mtypes []string + for _, benchmarkType := range s.benchmarkTypes { + if strings.Contains(benchmarkType, "TPCC") { + mtypes = append(mtypes, benchmarkType) + } + } + + allBenchmarkResults, err := macrobench.GetDetailsFromAllTypes(sha, macrobench.Gen4Planner, s.dbClient, mtypes) + if err != nil { + c.JSON(http.StatusInternalServerError, &ErrorAPI{Error: err.Error()}) + slog.Error(err) + return + } + c.JSON(http.StatusOK, allBenchmarkResults) +} diff --git a/go/server/server.go b/go/server/server.go index a586e1af1..41b3f8a6d 100644 --- a/go/server/server.go +++ b/go/server/server.go @@ -206,12 +206,12 @@ func (s *Server) Run() error { return errors.New(ErrorIncorrectConfiguration) } - err := s.createCrons() - if err != nil { - return err - } + // err := s.createCrons() + // if err != nil { + // return err + // } - err = s.ghApp.Init() + err := s.ghApp.Init() if err != nil { return err } @@ -232,6 +232,7 @@ func (s *Server) Run() error { s.router.GET("/api/recent", s.getRecentExecutions) s.router.GET("/api/queue", s.getExecutionsQueue) s.router.GET("/api/vitess/refs", s.getLatestVitessGitRef) + s.router.GET("/api/fk/compare", s.compareBenchmarkFKs) s.router.GET("/api/macrobench/compare", s.compareMacrobenchmarks) s.router.GET("/api/microbench/compare", s.compareMicrobenchmarks) s.router.GET("/api/search", s.searchBenchmarck) diff --git a/go/tools/macrobench/results.go b/go/tools/macrobench/results.go index a4b47666b..2af9f0cc0 100644 --- a/go/tools/macrobench/results.go +++ b/go/tools/macrobench/results.go @@ -271,6 +271,22 @@ func (qps QPS) OtherStr() string { return humanize.FormatFloat("#,###.#", qps.Other) } +func GetDetailsFromAllTypes(sha string, planner PlannerVersion, dbclient storage.SQLClient, types []string) (map[string]Details, error) { + details, err := GetDetailsArraysFromAllTypes(sha, planner, dbclient, types) + if err != nil { + return nil, err + } + result := make(map[string]Details, len(details)) + for s, array := range details { + var d Details + if len(array) == 1 { + d = array[0] + } + result[s] = d + } + return result, nil +} + // GetDetailsArraysFromAllTypes returns a slice of Details based on the given git ref and Types. func GetDetailsArraysFromAllTypes(sha string, planner PlannerVersion, dbclient storage.SQLClient, types []string) (map[string]DetailsArray, error) { macros := map[string]DetailsArray{}