Step in metrics charts feature.
This commit is contained in:
parent
152af0d74a
commit
e8b479f386
6 changed files with 80 additions and 6 deletions
|
@ -393,6 +393,12 @@ public class Factory
|
||||||
CrawlJournal journal = cache.restoreJournal();
|
CrawlJournal journal = cache.restoreJournal();
|
||||||
result.getCrawlJournal().add(journal.getByUrl(inputURL));
|
result.getCrawlJournal().add(journal.getByUrl(inputURL));
|
||||||
result.getCrawlJournal().addAll(journal.searchByParent(result.getInputURL()));
|
result.getCrawlJournal().addAll(journal.searchByParent(result.getInputURL()));
|
||||||
|
|
||||||
|
//
|
||||||
|
for (Metrics metrics : result.getMetrics())
|
||||||
|
{
|
||||||
|
result.addAll(metrics.getByPrefix("metrics."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -39,6 +39,7 @@ import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||||
import fr.devinsy.statoolinfos.properties.PathProperty;
|
import fr.devinsy.statoolinfos.properties.PathProperty;
|
||||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||||
import fr.devinsy.strings.StringList;
|
import fr.devinsy.strings.StringList;
|
||||||
|
import fr.devinsy.strings.StringSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class Service.
|
* The Class Service.
|
||||||
|
@ -506,7 +507,7 @@ public class Service extends PathPropertyList
|
||||||
{
|
{
|
||||||
StringList result;
|
StringList result;
|
||||||
|
|
||||||
result = new StringList();
|
StringSet years = new StringSet();
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile("^" + path + "\\.(?<year>\\d{4}).*$");
|
Pattern pattern = Pattern.compile("^" + path + "\\.(?<year>\\d{4}).*$");
|
||||||
|
|
||||||
|
@ -518,11 +519,13 @@ public class Service extends PathPropertyList
|
||||||
{
|
{
|
||||||
if (matcher.start("year") != -1)
|
if (matcher.start("year") != -1)
|
||||||
{
|
{
|
||||||
result.add(matcher.group("year"));
|
years.add(matcher.group("year"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = new StringList(years);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class PropertyFileCheckPage
|
||||||
|
|
||||||
for (Service service : organization.getServices())
|
for (Service service : organization.getServices())
|
||||||
{
|
{
|
||||||
checks = service.getInputChecksAll();
|
checks = service.getInputChecks();
|
||||||
page = htmlize("Service", checks);
|
page = htmlize("Service", checks);
|
||||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
|
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class ServicePage
|
||||||
// data.setContent("fooChart", graphicIndex++,
|
// data.setContent("fooChart", graphicIndex++,
|
||||||
// LineMonthsChartView.build());
|
// LineMonthsChartView.build());
|
||||||
|
|
||||||
service.getPrefixes();
|
// service.getPrefixes();
|
||||||
|
|
||||||
Metric metric = service.getMetric("metrics.http.hits");
|
Metric metric = service.getMetric("metrics.http.hits");
|
||||||
if ((metric != null) && (!metric.isEmpty()))
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
@ -267,6 +267,72 @@ public class ServicePage
|
||||||
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.RED));
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.errors.php");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.hits.ipv4");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.hits.ipv6");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.hits.bots");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.files");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.pages");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.bytes");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.ip");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.ip.ipv4");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.BLUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.ip.ipv6");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
metric = service.getMetric("metrics.http.visits");
|
||||||
|
if ((metric != null) && (!metric.isEmpty()))
|
||||||
|
{
|
||||||
|
data.setContent("fooChart", graphicIndex++, BarMonthsChartView.build(metric, ChartColor.RED));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class BarMonthsChartView
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
LocalDate start = LocalDate.parse(metric.getStartYear() + "-01-01");
|
LocalDate start = LocalDate.parse(metric.getStartYear() + "-01-01");
|
||||||
LocalDate end = start.plusMonths(metric.getMonthValues().size());
|
LocalDate end = start.plusMonths(metric.getMonthValues().size() - 1);
|
||||||
StringList labels = ChabuUtils.buildYearMonthAlphaLabels(start, end);
|
StringList labels = ChabuUtils.buildYearMonthAlphaLabels(start, end);
|
||||||
|
|
||||||
result = build(metric.getName(), metric.getDescription(), labels, metric.getMonthValues(), color);
|
result = build(metric.getName(), metric.getDescription(), labels, metric.getMonthValues(), color);
|
||||||
|
|
|
@ -83,5 +83,4 @@ public class HttpStatus
|
||||||
{
|
{
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue