Improved organization turnout stats.

This commit is contained in:
Christian P. MOMON 2020-11-20 13:22:48 +01:00
parent d6bfc02de2
commit 920be72700
3 changed files with 40 additions and 4 deletions

View file

@ -22,6 +22,7 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -671,6 +672,41 @@ public class Service extends PathPropertyList
return result;
}
/**
* Checks for filled metrics.
*
* @return true, if successful
*/
public boolean hasFilledMetrics()
{
boolean result;
boolean ended = false;
Iterator<PathProperty> iterator = this.iterator();
result = false;
while (!ended)
{
if (iterator.hasNext())
{
PathProperty property = iterator.next();
if (StringUtils.isNotBlank(property.getValue()))
{
ended = true;
result = true;
}
}
else
{
ended = true;
result = false;
}
}
//
return result;
}
/**
* Checks if is registration client.
*

View file

@ -354,9 +354,9 @@ public class Htmlizer
OrganizationTurnoutStats stats = StatAgent.statsOrganizationTurnout(organizations);
PieChart pie = new PieChart("Participation");
pie.add("Active 1", stats.getWithSelfFileCount(), ChartColor.GREEN);
pie.add("Active 2", stats.getWithServiceFileCount(), ChartColor.YELLOW);
pie.add("Active 3", stats.getWithServiceMetricCount(), ChartColor.ORANGE);
pie.add("Active A", stats.getWithSelfFileCount(), ChartColor.ORANGE);
pie.add("Active B", stats.getWithServiceFileCount(), ChartColor.YELLOW);
pie.add("Active C", stats.getWithServiceMetricCount(), ChartColor.GREEN);
pie.add("Passive", stats.getPassiveCount(), ChartColor.BLUE);
pie.setLegendPosition(Position.RIGHT);

View file

@ -381,7 +381,7 @@ public class StatAgent
{
Service service = iterator.next();
if (!service.getByPrefix("metrics.").isEmpty())
if (service.hasFilledMetrics())
{
ended = true;
result.incWithServiceMetricCount();