Improved federation stats.
This commit is contained in:
parent
920be72700
commit
bfc3dbb942
4 changed files with 75 additions and 40 deletions
|
@ -22,7 +22,6 @@ 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;
|
||||
|
||||
|
@ -672,41 +671,6 @@ 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.
|
||||
*
|
||||
|
|
|
@ -354,9 +354,9 @@ public class Htmlizer
|
|||
OrganizationTurnoutStats stats = StatAgent.statsOrganizationTurnout(organizations);
|
||||
|
||||
PieChart pie = new PieChart("Participation");
|
||||
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("1 fichier", stats.getWithSelfFileCount(), ChartColor.ORANGE);
|
||||
pie.add("n fichiers", stats.getWithServiceFileCount(), ChartColor.YELLOW);
|
||||
pie.add("Métriques", stats.getWithServiceMetricCount(), ChartColor.GREEN);
|
||||
pie.add("Passive", stats.getPassiveCount(), ChartColor.BLUE);
|
||||
pie.setLegendPosition(Position.RIGHT);
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -160,6 +162,37 @@ public class PathPropertyList extends ArrayList<PathProperty> implements PathPro
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by pattern.
|
||||
*
|
||||
* @param regex
|
||||
* the regex
|
||||
* @return the by pattern
|
||||
*/
|
||||
public PathPropertyList getByPattern(final String regex)
|
||||
{
|
||||
PathPropertyList result;
|
||||
|
||||
result = new PathPropertyList();
|
||||
|
||||
if (StringUtils.isNotBlank(regex))
|
||||
{
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
|
||||
for (PathProperty property : this)
|
||||
{
|
||||
Matcher matcher = pattern.matcher(property.getPath());
|
||||
if (matcher.matches())
|
||||
{
|
||||
result.add(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by prefix.
|
||||
*
|
||||
|
@ -404,6 +437,41 @@ public class PathPropertyList extends ArrayList<PathProperty> implements PathPro
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for filled metrics.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean hasFilledValue()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(final String key, final long value)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ import fr.devinsy.statoolinfos.core.Services;
|
|||
import fr.devinsy.statoolinfos.core.Software;
|
||||
import fr.devinsy.statoolinfos.core.Softwares;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.stats.categories.CategoryStat;
|
||||
import fr.devinsy.statoolinfos.stats.categories.CategoryStats;
|
||||
import fr.devinsy.statoolinfos.stats.organizations.OrganizationTurnoutStats;
|
||||
|
@ -381,7 +382,9 @@ public class StatAgent
|
|||
{
|
||||
Service service = iterator.next();
|
||||
|
||||
if (service.hasFilledMetrics())
|
||||
PathPropertyList lines = service.getByPattern("metrics\\..*\\.\\d{4}\\.(months|weeks|days)");
|
||||
|
||||
if (lines.hasFilledValue())
|
||||
{
|
||||
ended = true;
|
||||
result.incWithServiceMetricCount();
|
||||
|
|
Loading…
Reference in a new issue