diff --git a/src/model/node.go b/src/model/node.go index e07e3f68..b79a71e2 100644 --- a/src/model/node.go +++ b/src/model/node.go @@ -79,7 +79,7 @@ func NodeQueryPath(query string, limit int) (nodes []Node, err error) { func TreeSearchByPath(query string) (nodes []Node, err error) { session := DB["mon"].NewSession() - defer session.Clone() + defer session.Close() if strings.Contains(query, " ") { arr := strings.Fields(query) diff --git a/src/model/team.go b/src/model/team.go index 4fe4217e..a03bf81a 100644 --- a/src/model/team.go +++ b/src/model/team.go @@ -20,7 +20,7 @@ type Team struct { func (t *Team) Del() error { session := DB["uic"].NewSession() - defer session.Clone() + defer session.Close() if err := session.Begin(); err != nil { return err diff --git a/src/modules/collector/log/strategy/strategy.go b/src/modules/collector/log/strategy/strategy.go index 7b1b453b..8bf54cd9 100644 --- a/src/modules/collector/log/strategy/strategy.go +++ b/src/modules/collector/log/strategy/strategy.go @@ -18,9 +18,9 @@ func init() { } func Update() error { - strategys := stra.GetLogCollects() + strategies := stra.GetLogCollects() - err := UpdateGlobalStrategy(strategys) + err := UpdateGlobalStrategy(strategies) if err != nil { logger.Errorf("Update Strategy cache error ! [msg:%v]", err) return err diff --git a/src/modules/collector/stra/log.go b/src/modules/collector/stra/log.go index d5b3789d..ae0fc8b7 100644 --- a/src/modules/collector/stra/log.go +++ b/src/modules/collector/stra/log.go @@ -146,8 +146,8 @@ func DeepCopyStringMap(p map[string]string) map[string]string { const PATTERN_EXCLUDE_PARTITION = "```EXCLUDE```" -func parsePattern(strategys []*Strategy) { - for _, st := range strategys { +func parsePattern(strategies []*Strategy) { + for _, st := range strategies { patList := strings.Split(st.Pattern, PATTERN_EXCLUDE_PARTITION) if len(patList) == 1 { @@ -163,8 +163,8 @@ func parsePattern(strategys []*Strategy) { } } -func updateRegs(strategys []*Strategy) { - for _, st := range strategys { +func updateRegs(strategies []*Strategy) { + for _, st := range strategies { st.TagRegs = make(map[string]*regexp.Regexp, 0) st.ParseSucc = false diff --git a/src/modules/collector/sys/procs/cron.go b/src/modules/collector/sys/procs/cron.go index 49894844..3533ad5b 100644 --- a/src/modules/collector/sys/procs/cron.go +++ b/src/modules/collector/sys/procs/cron.go @@ -20,6 +20,6 @@ func loopDetect() { func detect() { ps := stra.GetProcCollects() - DelNoPorcCollect(ps) - AddNewPorcCollect(ps) + DelNoProcCollect(ps) + AddNewProcCollect(ps) } diff --git a/src/modules/collector/sys/procs/proc.go b/src/modules/collector/sys/procs/proc.go index e7e093b2..15b8c751 100644 --- a/src/modules/collector/sys/procs/proc.go +++ b/src/modules/collector/sys/procs/proc.go @@ -9,7 +9,7 @@ var ( ProcsWithScheduler = make(map[string]*ProcScheduler) ) -func DelNoPorcCollect(newCollect map[string]*model.ProcCollect) { +func DelNoProcCollect(newCollect map[string]*model.ProcCollect) { for currKey, currProc := range Procs { newProc, ok := newCollect[currKey] if !ok || currProc.LastUpdated != newProc.LastUpdated { @@ -18,7 +18,7 @@ func DelNoPorcCollect(newCollect map[string]*model.ProcCollect) { } } -func AddNewPorcCollect(newCollect map[string]*model.ProcCollect) { +func AddNewProcCollect(newCollect map[string]*model.ProcCollect) { for target, newProc := range newCollect { if _, ok := Procs[target]; ok && newProc.LastUpdated == Procs[target].LastUpdated { continue