Skip to content

Commit

Permalink
[#nossiue] Add Agent Count to AgentMapByHost
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Aug 9, 2024
1 parent f3fc9b0 commit 3215895
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,13 @@ public AgentsMapByHost getAgentsListByApplicationName(AgentStatusFilter agentSta
agentInfoAndStatuses
);

int total = agentsMapByHost.getAgentsListsList()
.stream()
.mapToInt(list -> list.getInstancesList().size())
.sum();
logger.debug("getAgentsMapByHostname={} {}", agentsMapByHost, total);
final int totalAgentCount = agentsMapByHost.size();
if (logger.isInfoEnabled()) {
logger.info("getAgentsMapByHostname size:{}", totalAgentCount);
}
if (logger.isDebugEnabled()) {
logger.debug("getAgentsMapByHostname size:{} data:{}", totalAgentCount, agentsMapByHost);
}
return agentsMapByHost;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ private static AgentStatusAndLink newAgentStatusAndLink(AgentAndStatus agentAndS
return new AgentStatusAndLink(agentInfo, status, hyperLinks);
}

public int size() {
return instancesListMap.size();
}

@Override
public String toString() {
return "AgentsMapByHost{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ public List<InstancesList<T>> getListMap() {
return listMap;
}

public int size() {
return listMap.stream()
.map(InstancesList::getInstancesList)
.mapToInt(List::size)
.sum();
}

@Override
public String toString() {
return "InstancesListMap{" +
"listMap=" + listMap +
'}';
}

}

0 comments on commit 3215895

Please sign in to comment.