File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
29
29
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
30
30
31
31
// _ "k8s.io/client-go/plugin/pkg/client/auth/openstack"
32
+ "github.com/intelops/kubviz/agent/server"
32
33
"k8s.io/client-go/tools/cache"
33
34
"k8s.io/client-go/tools/clientcmd"
34
35
)
@@ -104,7 +105,7 @@ func main() {
104
105
clientset = getK8sClient (config )
105
106
}
106
107
go publishMetrics (clientset , js , clusterMetricsChan )
107
-
108
+ go server . StartServer ()
108
109
collectAndPublishMetrics := func () {
109
110
err := outDatedImages (config , js )
110
111
LogErr (err )
Original file line number Diff line number Diff line change
1
+ package server
2
+
3
+ import (
4
+ "log"
5
+ "net/http"
6
+ _ "net/http/pprof"
7
+
8
+ "github.com/gin-gonic/gin"
9
+ )
10
+
11
+ func EnableProfile (r * gin.Engine ) {
12
+ pprofGroup := r .Group ("/debug/pprof" )
13
+ {
14
+ pprofGroup .GET ("/" , gin .WrapH (http .DefaultServeMux ))
15
+ pprofGroup .GET ("/cmdline" , gin .WrapH (http .DefaultServeMux ))
16
+ pprofGroup .GET ("/profile" , gin .WrapH (http .DefaultServeMux ))
17
+ pprofGroup .POST ("/symbol" , gin .WrapH (http .DefaultServeMux ))
18
+ pprofGroup .GET ("/symbol" , gin .WrapH (http .DefaultServeMux ))
19
+ pprofGroup .GET ("/trace" , gin .WrapH (http .DefaultServeMux ))
20
+ pprofGroup .GET ("/allocs" , gin .WrapH (http .DefaultServeMux ))
21
+ pprofGroup .GET ("/block" , gin .WrapH (http .DefaultServeMux ))
22
+ pprofGroup .GET ("/goroutine" , gin .WrapH (http .DefaultServeMux ))
23
+ pprofGroup .GET ("/heap" , gin .WrapH (http .DefaultServeMux ))
24
+ pprofGroup .GET ("/mutex" , gin .WrapH (http .DefaultServeMux ))
25
+ pprofGroup .GET ("/threadcreate" , gin .WrapH (http .DefaultServeMux ))
26
+ }
27
+
28
+ r .GET ("/liveness" , func (c * gin.Context ) {
29
+ c .String (http .StatusOK , "Alive" )
30
+ })
31
+ }
32
+
33
+ func StartServer () {
34
+ r := gin .Default ()
35
+ EnableProfile (r )
36
+ log .Fatal (r .Run (":8080" ))
37
+ }
You can’t perform that action at this time.
0 commit comments