in usage-statistics-impl/src/jetbrains/buildServer/usageStatistics/impl/providers/ClusterStatisticsProvider.java [42:61]
private void publishClusterInfo(@NotNull final UsageStatisticsPublisher publisher, @NotNull final UsageStatisticsPresentationManager presentationManager) {
int activityThresholdSeconds = TeamCityProperties.getInteger("teamcity.usageStatistics.nodeInactivityTime.seconds", 120);
final List<TeamCityNode> onlineNodes = myTeamCityNodes.getOnlineNodes(activityThresholdSeconds);
final Long secondaryNodesCount = onlineNodes.stream()
.filter(TeamCityNode::isSecondaryNode)
.count();
final String id = makeId("secondaryNodes");
presentationManager.applyPresentation(id, "Number of secondary nodes", myGroupName, null, null);
publisher.publishStatistic(id, secondaryNodesCount);
final Map<NodeResponsibility, Long> stats = onlineNodes.stream()
.filter(TeamCityNode::isSecondaryNode)
.map(TeamCityNode::getEnabledResponsibilities)
.flatMap(it -> it.stream())
.collect(Collectors.groupingBy(identity(), Collectors.counting()));
stats.forEach((nodeResponsibility, count) -> {
final String rId = makeId("nodeResponsibility." + nodeResponsibility.name().toLowerCase());
presentationManager.applyPresentation(rId, nodeResponsibility.getDisplayName(), myGroupName, null, null);
publisher.publishStatistic(rId, count);
});
}