From 3e0fc97506e0f075fea4e418cb0ee05e80d72a01 Mon Sep 17 00:00:00 2001 From: Steven Landers Date: Fri, 11 Feb 2022 07:46:23 -0500 Subject: [PATCH 1/2] remove log and condense metric --- services/scanner/agentpool/agent_pool.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/scanner/agentpool/agent_pool.go b/services/scanner/agentpool/agent_pool.go index f5e79fe9..e34c4e70 100644 --- a/services/scanner/agentpool/agent_pool.go +++ b/services/scanner/agentpool/agent_pool.go @@ -123,6 +123,7 @@ func (ap *AgentPool) SendEvaluateTxRequest(req *protocol.EvaluateTxRequest) { agents := ap.agents ap.mu.RUnlock() + drops := make(map[string]*protocol.AgentMetric) var metricsList []*protocol.AgentMetric for _, agent := range agents { if !agent.IsReady() || !agent.ShouldProcessBlock(req.Event.Block.BlockNumber) { @@ -139,8 +140,12 @@ func (ap *AgentPool) SendEvaluateTxRequest(req *protocol.EvaluateTxRequest) { ap.discardAgent(agent) case agent.TxRequestCh() <- req: default: // do not try to send if the buffer is full - lg.WithField("agent", agent.Config().ID).Warn("agent tx request buffer is full - skipping") - metricsList = append(metricsList, metrics.CreateAgentMetric(agent.Config().ID, metrics.MetricTxDrop, 1)) + if _, ok := drops[agent.Config().ID]; !ok { + drops[agent.Config().ID] = metrics.CreateAgentMetric(agent.Config().ID, metrics.MetricTxDrop, 0) + metricsList = append(metricsList, drops[agent.Config().ID]) + } + // increment metric + drops[agent.Config().ID].Value++ } lg.WithFields(log.Fields{ "agent": agent.Config().ID, From c1990b4c2975d6f06c622dd0a275363134ec8455 Mon Sep 17 00:00:00 2001 From: Steven Landers Date: Fri, 11 Feb 2022 07:47:59 -0500 Subject: [PATCH 2/2] remove drop metric --- services/scanner/agentpool/agent_pool.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/services/scanner/agentpool/agent_pool.go b/services/scanner/agentpool/agent_pool.go index e34c4e70..93ce6c89 100644 --- a/services/scanner/agentpool/agent_pool.go +++ b/services/scanner/agentpool/agent_pool.go @@ -123,8 +123,6 @@ func (ap *AgentPool) SendEvaluateTxRequest(req *protocol.EvaluateTxRequest) { agents := ap.agents ap.mu.RUnlock() - drops := make(map[string]*protocol.AgentMetric) - var metricsList []*protocol.AgentMetric for _, agent := range agents { if !agent.IsReady() || !agent.ShouldProcessBlock(req.Event.Block.BlockNumber) { continue @@ -140,19 +138,13 @@ func (ap *AgentPool) SendEvaluateTxRequest(req *protocol.EvaluateTxRequest) { ap.discardAgent(agent) case agent.TxRequestCh() <- req: default: // do not try to send if the buffer is full - if _, ok := drops[agent.Config().ID]; !ok { - drops[agent.Config().ID] = metrics.CreateAgentMetric(agent.Config().ID, metrics.MetricTxDrop, 0) - metricsList = append(metricsList, drops[agent.Config().ID]) - } - // increment metric - drops[agent.Config().ID].Value++ + lg.WithField("agent", agent.Config().ID).Debug("agent tx request buffer is full - skipping") } lg.WithFields(log.Fields{ "agent": agent.Config().ID, "duration": time.Since(startTime), }).Debug("sent tx request to evalTxCh") } - metrics.SendAgentMetrics(ap.msgClient, metricsList) lg.WithFields(log.Fields{ "duration": time.Since(startTime), }).Debug("Finished SendEvaluateTxRequest")