122 lines
4.0 KiB
Go
122 lines
4.0 KiB
Go
package main
|
|
|
|
import (
|
|
"mongo.games.com/goserver/core/module"
|
|
)
|
|
|
|
//var MonitorMgrSington = &MonitorMgr{}
|
|
|
|
type MonitorMgr struct {
|
|
}
|
|
|
|
func (this *MonitorMgr) ModuleName() string {
|
|
return "MonitorMgr"
|
|
}
|
|
|
|
func (this *MonitorMgr) Init() {
|
|
|
|
}
|
|
|
|
func (this *MonitorMgr) Update() {
|
|
//logic stats
|
|
//logicStats := profile.GetStats()
|
|
//if len(logicStats) > 0 {
|
|
// logLogic := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), "", logicStats)
|
|
// if logLogic != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.UpsertMonitorData("logic", logLogic)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
// }
|
|
//}
|
|
//
|
|
////net session stats
|
|
//netStats := netlib.Stats()
|
|
//if len(netStats) > 0 {
|
|
// logNet := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), "", netStats)
|
|
// if logNet != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.UpsertMonitorData("net", logNet)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
// }
|
|
//}
|
|
//
|
|
////schedule stats
|
|
//jobStats := schedule.Stats()
|
|
//if len(jobStats) > 0 {
|
|
// logJob := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), "", jobStats)
|
|
// if logJob != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.UpsertMonitorData("job", logJob)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
// }
|
|
//}
|
|
//
|
|
////trans stats
|
|
//transStats := transact.Stats()
|
|
//if len(transStats) > 0 {
|
|
// logTrans := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), "", transStats)
|
|
// if logTrans != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.UpsertMonitorData("transact", logTrans)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
// }
|
|
//}
|
|
//
|
|
////panic stats
|
|
//panicStats := utils.GetPanicStats()
|
|
//if len(panicStats) > 0 {
|
|
// for key, stats := range panicStats {
|
|
// logPanic := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), key, stats)
|
|
// if logPanic != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.UpsertMonitorData("panic", logPanic)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
// }
|
|
// }
|
|
//}
|
|
//
|
|
////object command quene stats
|
|
//objStats := core.AppCtx.GetStats()
|
|
//if len(objStats) > 0 {
|
|
// logCmd := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), "obj", objStats)
|
|
// if logCmd != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.UpsertMonitorData("cmdque", logCmd)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
// }
|
|
//}
|
|
//
|
|
////gorouting count, eg. system info
|
|
//runtimeStats := utils.StatsRuntime()
|
|
//logRuntime := model.NewMonitorData(int32(common.GetSelfSrvId()), int32(common.GetSelfSrvType()), "", runtimeStats)
|
|
//if logRuntime != nil {
|
|
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
// return model.InsertMonitorData("runtime", logRuntime)
|
|
// }), nil, "InsertMonitorData").StartByFixExecutor("monitor")
|
|
//}
|
|
}
|
|
|
|
func (this *MonitorMgr) Shutdown() {
|
|
module.UnregisteModule(this)
|
|
}
|
|
|
|
func init() {
|
|
//gob registe
|
|
//gob.Register(profile.TimeElement{})
|
|
//gob.Register(map[string]profile.TimeElement{})
|
|
//gob.Register(netlib.ServiceStats{})
|
|
//gob.Register(map[int]netlib.ServiceStats{})
|
|
//gob.Register(schedule.TaskStats{})
|
|
//gob.Register(map[string]schedule.TaskStats{})
|
|
//gob.Register(transact.TransStats{})
|
|
//gob.Register(map[int]transact.TransStats{})
|
|
//gob.Register(utils.PanicStackInfo{})
|
|
//gob.Register(map[string]utils.PanicStackInfo{})
|
|
//gob.Register(basic.CmdStats{})
|
|
//gob.Register(map[string]basic.CmdStats{})
|
|
//gob.Register(utils.RuntimeStats{})
|
|
//gob registe
|
|
|
|
//module.RegisteModule(MonitorMgrSington, time.Minute*5, 0)
|
|
}
|