1.websocket接受消息,每15秒监控最大耗时消息类型,某消息处理超过300ms会有监控日志

2.GoQueue处理队列监控,每1分钟汇报积压处理的最大量。并监控死循环
This commit is contained in:
duanhf2012
2020-02-25 16:36:43 +08:00
parent 5680712396
commit 4c6d72fd65
8 changed files with 143 additions and 36 deletions

View File

@@ -2,11 +2,11 @@ package service
import (
"fmt"
"github.com/duanhf2012/origin/util"
"github.com/duanhf2012/origin/util/uuid"
"runtime/debug"
"sync"
"sync/atomic"
"github.com/duanhf2012/origin/util"
)
const (
@@ -328,6 +328,9 @@ func (slf *BaseModule) RunModule(module IModule) {
timer.SetupTimer(1000)
slf.WaitGroup.Add(1)
defer slf.WaitGroup.Done()
uuidkey := uuid.Rand().HexEx()
moduleTypeName := fmt.Sprintf("%T",module)
for {
if atomic.LoadInt32(&slf.corouterstatus) != 0 {
module.OnEndRun()
@@ -346,11 +349,14 @@ func (slf *BaseModule) RunModule(module IModule) {
}
}
MonitorEnter(uuidkey,moduleTypeName)
if module.OnRun() == false {
module.OnEndRun()
MonitorLeave(uuidkey)
GetLogger().Printf(LEVER_INFO, "OnEndRun module %T...", module)
return
}
}
MonitorLeave(uuidkey)
}
}