MCPcopy Create free account
hub / github.com/TalkingData/owl / startHttpServer

Method startHttpServer

controller/health.go:13–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11)
12
13func (c *Controller) startHttpServer() {
14 defer func() {
15 if r := recover(); r != nil {
16 fmt.Errorf("%v", r)
17 debug.PrintStack()
18 }
19 }()
20
21 Engine := gin.Default()
22 Engine.GET("/debug/pprof/", gin.WrapF(http.HandlerFunc(pprof.Index)))
23 Engine.GET("/debug/pprof/cmdline", gin.WrapF(http.HandlerFunc(pprof.Cmdline)))
24 Engine.GET("/debug/pprof/profile", gin.WrapF(http.HandlerFunc(pprof.Profile)))
25 Engine.GET("/debug/pprof/symbol", gin.WrapF(http.HandlerFunc(pprof.Symbol)))
26 Engine.GET("/debug/pprof/trace", gin.WrapF(http.HandlerFunc(pprof.Trace)))
27 nodes := Engine.Group("/nodes")
28 {
29 nodes.GET("/status", nodesStatus)
30 }
31 queues := Engine.Group("/queues")
32 {
33 queues.GET("/status", queueStatus)
34 queues.POST("/:id/clean", queueClean)
35 queues.POST("/:id/mute", queueMute)
36 queues.POST("/:id/unmute", queueUnMute)
37 }
38
39 Engine.Run(GlobalConfig.HTTP_SERVER)
40}
41
42func nodesStatus(c *gin.Context) {
43 c.JSON(http.StatusOK, gin.H{"nodes": controller.nodePool.Nodes})

Callers 1

InitControllerFunction · 0.80

Calls 1

RunMethod · 0.80

Tested by

no test coverage detected