update
1. change pprof module 2. remove memory log 3. remove line hook log 4. send line log to es
This commit is contained in:
+9
-2
@@ -5,9 +5,10 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
||||
"git.trj.tw/golang/mtfosbot/module/es"
|
||||
|
||||
"git.trj.tw/golang/mtfosbot/module/config"
|
||||
"git.trj.tw/golang/mtfosbot/module/context"
|
||||
"git.trj.tw/golang/mtfosbot/module/line-message"
|
||||
@@ -72,7 +73,13 @@ func GetLineMessage(c *context.Context) {
|
||||
c.DataFormat("body type error")
|
||||
}
|
||||
|
||||
fmt.Println("Line Hook ::: ", string(raw))
|
||||
jsonMap := make(map[string]interface{})
|
||||
if err := json.Unmarshal(raw, &jsonMap); err == nil {
|
||||
es.PutLog("line", jsonMap)
|
||||
}
|
||||
defer func() {
|
||||
jsonMap = nil
|
||||
}()
|
||||
|
||||
events := struct {
|
||||
Events []*lineobj.EventObject `json:"events"`
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"git.trj.tw/golang/mtfosbot/router/private"
|
||||
"git.trj.tw/golang/mtfosbot/router/rimg"
|
||||
"git.trj.tw/golang/mtfosbot/router/twitch"
|
||||
"github.com/DeanThompson/ginpprof"
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-contrib/pprof"
|
||||
"github.com/gin-gonic/contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -105,5 +105,5 @@ func SetRoutes(r *gin.Engine) {
|
||||
}
|
||||
|
||||
// set pprof router
|
||||
pprof.Register(r, nil)
|
||||
ginpprof.Wrap(r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user