in usage-statistics-impl/src/jetbrains/buildServer/usageStatistics/impl/providers/CloudUsageStatisticsProvider.java [60:101]
private void publishCloudInfo(final UsageStatisticsPublisher publisher,
final UsageStatisticsPresentationManager presentationManager,
final Map<String, String> cloudTypeCodeNames
){
final Map<String, AtomicInteger> imagesByType = new HashMap<String, AtomicInteger>();
final Map<String, AtomicInteger> profileCountByType = new HashMap<String, AtomicInteger>();
for (CloudProfile profile : myCloudManager.listAllProfiles()) {
final CloudClient cli = myCloudManager.getClient(profile.getProjectId(), profile.getProfileId());
final String cloudName = profile.getCloudCode();
if (imagesByType.get(cloudName) == null){
imagesByType.put(cloudName, new AtomicInteger(0));
}
if (profileCountByType.get(cloudName) == null){
profileCountByType.put(cloudName, new AtomicInteger(0));
}
profileCountByType.get(cloudName).incrementAndGet();
imagesByType.get(cloudName).addAndGet(cli.getImages().size());
}
for (String cloudCodeName : cloudTypeCodeNames.keySet()) {
if (!profileCountByType.containsKey(cloudCodeName)){
continue;
}
applyData(publisher, presentationManager,
"profilesCount", "cloud profiles",
cloudCodeName, cloudTypeCodeNames.get(cloudCodeName),
profileCountByType.get(cloudCodeName).get());
applyData(publisher, presentationManager,
"imagesCount", "cloud images",
cloudCodeName, cloudTypeCodeNames.get(cloudCodeName),
imagesByType.get(cloudCodeName).get());
final int maxInstances = myRuntimeStatisticsCollector.getMaxValueAndReset(cloudCodeName);
applyData(publisher, presentationManager,
"agentsCount", "cloud agents",
cloudCodeName, cloudTypeCodeNames.get(cloudCodeName),
maxInstances);
}
}