mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-14 06:37:12 +00:00
tmp: Print mem stats in api-server
This commit is contained in:
parent
82c640267f
commit
c6c77e6f92
@ -9,6 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -17,6 +18,7 @@ import (
|
|||||||
"github.com/gin-contrib/pprof"
|
"github.com/gin-contrib/pprof"
|
||||||
"github.com/gin-contrib/static"
|
"github.com/gin-contrib/static"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/struCoder/pidusage"
|
||||||
"github.com/up9inc/mizu/agent/pkg/dependency"
|
"github.com/up9inc/mizu/agent/pkg/dependency"
|
||||||
"github.com/up9inc/mizu/agent/pkg/entries"
|
"github.com/up9inc/mizu/agent/pkg/entries"
|
||||||
"github.com/up9inc/mizu/agent/pkg/middlewares"
|
"github.com/up9inc/mizu/agent/pkg/middlewares"
|
||||||
@ -76,6 +78,18 @@ func main() {
|
|||||||
|
|
||||||
if *profiler {
|
if *profiler {
|
||||||
pprof.Register(app)
|
pprof.Register(app)
|
||||||
|
go func() {
|
||||||
|
memStats := runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(&memStats)
|
||||||
|
sysInfo, _ := pidusage.GetStat(os.Getpid())
|
||||||
|
logger.Log.Infof(
|
||||||
|
"HeapAlloc: %d, HeapSys: %d, rss: %f",
|
||||||
|
memStats.HeapAlloc,
|
||||||
|
memStats.HeapSys,
|
||||||
|
sysInfo.Memory,
|
||||||
|
)
|
||||||
|
time.Sleep(time.Minute)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.StartServer(app)
|
utils.StartServer(app)
|
||||||
|
Loading…
Reference in New Issue
Block a user