diff --git a/main.go b/main.go index 2df9de9..5492707 100644 --- a/main.go +++ b/main.go @@ -5269,6 +5269,13 @@ func buildSQLMatchCondition(r DynamicRule) (string, []any) { } func (s *server) runDetectionsOnce() { + ctx, cancel := context.WithTimeout(context.Background(), s.cfg.DetectionInterval) + defer cancel() + + if err := s.detector.updateAgentMetrics(ctx); err != nil { + s.logger.Printf("update agent metrics: %v", err) + } + type ruleSpec struct { name string timeout time.Duration