From 22def0b5cb3c7e8227b675df19e532d572620238 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 2 Oct 2026 09:54:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=90=86=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E7=BB=9F=E8=AE=A1=E7=B4=AF=E5=8A=A0=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=97=B6=E6=9C=AA=E5=8C=BA=E5=88=86=20appId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AccumulateChildNodes 把子代理数据累加到上级代理时,匹配条件只比了 SumDate, 没有比 AppId。上级节点的 Stats 在同一 SumDate 下每个 app 各有一条,子代理 某个 app 的数据会被累加进上级的全部 app 条目,且命中后不 break,会继续累加 进后续所有匹配项。 触发条件: GetAllAgentStatDict 对 appId 是可选过滤,而 AgentChannelStatSearch 的 AppId 为 *int32 且无 binding:required。请求不传 appId 时 statDict 跨 全部 app,此时必然多加。影响 /api/stat/agent/channel/stat,是代理商侧看到的 数据。 同函数下方的 lostStat 分支本就带 AppId: childStat.AppId,说明 appId 本是 预期维度,匹配处属遗漏。 本次只加 appId 比较,未加 break。 Co-Authored-By: Claude Opus 5 (1M context) --- service/agentSer/node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/agentSer/node.go b/service/agentSer/node.go index 5dfefe4..4fbd61f 100644 --- a/service/agentSer/node.go +++ b/service/agentSer/node.go @@ -111,7 +111,7 @@ func (s *AgentNode) AccumulateChildNodes(ruleMap RuleMap) error { for _, childStat := range childAgent.Stats { hit := false for _, parentStat := range found.Stats { - if parentStat.SumDate.Equal(childStat.SumDate) { + if parentStat.AppId == childStat.AppId && parentStat.SumDate.Equal(childStat.SumDate) { hit = true AccumulateChildAgentChannelStatToParent(parentStat, childStat) }