diff --git a/cmd/builder/server/server.go b/cmd/builder/server/server.go index 6f61333ff..ac6268a86 100644 --- a/cmd/builder/server/server.go +++ b/cmd/builder/server/server.go @@ -1,19 +1,18 @@ - // RAINBOND, Application Management Platform // Copyright (C) 2014-2017 Goodrain Co., Ltd. - + // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. For any non-GPL usage of Rainbond, // one or multiple Commercial Licenses authorized by Goodrain Co., Ltd. // must be obtained first. - + // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. - + // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -36,18 +35,21 @@ limitations under the License. */ import ( + _ "net/http/pprof" + "os" + "os/signal" + "syscall" + "github.com/goodrain/rainbond/cmd/builder/option" "github.com/goodrain/rainbond/pkg/builder/discover" "github.com/goodrain/rainbond/pkg/builder/exector" "github.com/goodrain/rainbond/pkg/db" "github.com/goodrain/rainbond/pkg/db/config" "github.com/goodrain/rainbond/pkg/event" - "os" - "os/signal" - "syscall" + + "net/http" "github.com/Sirupsen/logrus" - "net/http" "github.com/goodrain/rainbond/pkg/builder/api" ) @@ -82,10 +84,10 @@ func Run(s *option.Builder) error { } defer dis.Stop() - r:=api.APIServer() + r := api.APIServer() + logrus.Info("builder api listen port 3228") go http.ListenAndServe(":3228", r) - logrus.Info("builder begin running...") //step finally: listen Signal term := make(chan os.Signal) diff --git a/cmd/worker/server/server.go b/cmd/worker/server/server.go index 0b0b28330..e8bc392b9 100644 --- a/cmd/worker/server/server.go +++ b/cmd/worker/server/server.go @@ -33,6 +33,9 @@ import ( "github.com/goodrain/rainbond/pkg/worker/executor" "github.com/goodrain/rainbond/pkg/worker/monitor" + "net/http" + _ "net/http/pprof" + "github.com/Sirupsen/logrus" ) @@ -94,6 +97,10 @@ func Run(s *option.Worker) error { } defer exporterManager.Stop() + //step 6 :enable pprof api + logrus.Info("pprof api listen port 3229") + go http.ListenAndServe(":3229", nil) + logrus.Info("worker begin running...") //step finally: listen Signal term := make(chan os.Signal)