diff --git a/scanner/internal/event/agent_cache_gc.go b/scanner/internal/event/agent_cache_gc.go index 22e5521..f37bff8 100644 --- a/scanner/internal/event/agent_cache_gc.go +++ b/scanner/internal/event/agent_cache_gc.go @@ -40,8 +40,11 @@ func (t *AgentCacheGC) TryMerge(other Event) bool { func (t *AgentCacheGC) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentCacheGC]("Event") + startTime := time.Now() log.Debugf("begin with %v", logger.FormatStruct(t.AgentCacheGC)) - defer log.Debugf("end") + defer func() { + log.Debugf("end, time: %v", time.Since(startTime)) + }() // TODO unavailable的节点需不需要发送任务? diff --git a/scanner/internal/event/agent_check_cache.go b/scanner/internal/event/agent_check_cache.go index 7f4cd45..17bc18f 100644 --- a/scanner/internal/event/agent_check_cache.go +++ b/scanner/internal/event/agent_check_cache.go @@ -40,9 +40,11 @@ func (t *AgentCheckCache) TryMerge(other Event) bool { func (t *AgentCheckCache) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentCheckCache]("Event") + startTime := time.Now() log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckCache)) - defer log.Debugf("end") - + defer func() { + log.Debugf("end, time: %v", time.Since(startTime)) + }() // TODO unavailable的节点需不需要发送任务? agtCli, err := stgglb.AgentMQPool.Acquire(t.NodeID) diff --git a/scanner/internal/event/agent_storage_gc.go b/scanner/internal/event/agent_storage_gc.go index c89e9b8..c3c22ad 100644 --- a/scanner/internal/event/agent_storage_gc.go +++ b/scanner/internal/event/agent_storage_gc.go @@ -37,8 +37,11 @@ func (t *AgentStorageGC) TryMerge(other Event) bool { func (t *AgentStorageGC) Execute(execCtx ExecuteContext) { log := logger.WithType[AgentStorageGC]("Event") + startTime := time.Now() log.Debugf("begin with %v", logger.FormatStruct(t.AgentStorageGC)) - defer log.Debugf("end") + defer func() { + log.Debugf("end, time: %v", time.Since(startTime)) + }() // TODO unavailable的节点需不需要发送任务? diff --git a/scanner/internal/event/check_package_redundancy.go b/scanner/internal/event/check_package_redundancy.go index 9d82041..0a6eee0 100644 --- a/scanner/internal/event/check_package_redundancy.go +++ b/scanner/internal/event/check_package_redundancy.go @@ -51,8 +51,11 @@ func (t *CheckPackageRedundancy) TryMerge(other Event) bool { func (t *CheckPackageRedundancy) Execute(execCtx ExecuteContext) { log := logger.WithType[CheckPackageRedundancy]("Event") + startTime := time.Now() log.Debugf("begin with %v", logger.FormatStruct(t.CheckPackageRedundancy)) - defer log.Debugf("end") + defer func() { + log.Debugf("end, time: %v", time.Since(startTime)) + }() coorCli, err := stgglb.CoordinatorMQPool.Acquire() if err != nil { diff --git a/scanner/internal/event/clean_pinned.go b/scanner/internal/event/clean_pinned.go index 4957770..67e4599 100644 --- a/scanner/internal/event/clean_pinned.go +++ b/scanner/internal/event/clean_pinned.go @@ -5,6 +5,7 @@ import ( "math" "math/rand" "sync" + "time" "github.com/samber/lo" "gitlink.org.cn/cloudream/common/pkgs/bitmap" @@ -44,8 +45,11 @@ func (t *CleanPinned) TryMerge(other Event) bool { func (t *CleanPinned) Execute(execCtx ExecuteContext) { log := logger.WithType[CleanPinned]("Event") + startTime := time.Now() log.Debugf("begin with %v", logger.FormatStruct(t.CleanPinned)) - defer log.Debugf("end") + defer func() { + log.Debugf("end, time: %v", time.Since(startTime)) + }() coorCli, err := stgglb.CoordinatorMQPool.Acquire() if err != nil {