From f1361c9d2544855d351e12df2a9b23f377ca52fd Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 13 Jan 2022 12:55:17 +0100 Subject: [PATCH] Fixed visit and visitor new definition. --- src/fr/devinsy/statoolinfos/core/Service.java | 2 +- .../htmlize/FederationMetricSummaryPage.java | 4 +- .../htmlize/FederationMetricWebPage.java | 26 +++--- .../OrganizationMetricSummaryPage.java | 4 +- .../htmlize/OrganizationMetricWebPage.java | 26 +++--- .../htmlize/ServiceMetricSummaryPage.java | 4 +- .../htmlize/ServiceMetricWebPage.java | 24 ++--- .../htmlize/serviceMetricSummaryView.xhtml | 4 +- .../htmlize/serviceMetricWebView.xhtml | 25 ++--- .../metrics/http/HttpAccessLog.java | 22 +++++ .../metrics/http/HttpAccessLogAnalyzer.java | 92 ++++++++++--------- .../metrics/http/VisitCounters.java | 2 - 12 files changed, 133 insertions(+), 102 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/core/Service.java b/src/fr/devinsy/statoolinfos/core/Service.java index f5d48f4..7c673a6 100644 --- a/src/fr/devinsy/statoolinfos/core/Service.java +++ b/src/fr/devinsy/statoolinfos/core/Service.java @@ -507,7 +507,7 @@ public class Service extends PathPropertyList { long result; - MonthValues values = getMetricMonthValues("metrics.http.visits.humans"); + MonthValues values = getMetricMonthValues("metrics.http.visits"); values = values.extract(YearMonth.now().minusMonths(1), YearMonth.now().minusMonths(1)); diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricSummaryPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricSummaryPage.java index 00272b6..93e83c7 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricSummaryPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricSummaryPage.java @@ -69,8 +69,8 @@ public class FederationMetricSummaryPage data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.SUMMARY, view, period)); FederationMetricHtmlizer.htmlize(data, "http.hits.humans", federation, view, period, "metrics.http.hits.humans", ChartColor.GREEN); - FederationMetricHtmlizer.htmlize(data, "http.visitors.humans", federation, view, period, "metrics.http.visitors.humans", ChartColor.GREEN); - FederationMetricHtmlizer.htmlize(data, "http.visits.humans", federation, view, period, "metrics.http.visits.humans", ChartColor.GREEN); + FederationMetricHtmlizer.htmlize(data, "http.visitors", federation, view, period, "metrics.http.visitors", ChartColor.GREEN); + FederationMetricHtmlizer.htmlize(data, "http.visits", federation, view, period, "metrics.http.visits", ChartColor.GREEN); // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java index 5f15fb7..dd9d251 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java @@ -98,25 +98,25 @@ public class FederationMetricWebPage FederationMetricHtmlizer.htmlize(data, "http.ip.ipv4", federation, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW); FederationMetricHtmlizer.htmlize(data, "http.ip.ipv6", federation, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN); + FederationMetricHtmlizer.htmlize(data, "http.requesters", federation, view, period, "metrics.http.requesters", ChartColor.BLUE); + + FederationMetricHtmlizer.htmlize(data, "http.requesters-humansbots", federation, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN, + "metrics.http.requesters.bots", ChartColor.YELLOW); + FederationMetricHtmlizer.htmlize(data, "http.requesters.humans", federation, view, period, "metrics.http.requesters.humans", ChartColor.GREEN); + FederationMetricHtmlizer.htmlize(data, "http.requesters.bots", federation, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW); + + FederationMetricHtmlizer.htmlize(data, "http.requesters-ipv4ipv6", federation, view, period, "http.requesters (ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW, + "metrics.http.requesters.ipv6", ChartColor.GREEN); + FederationMetricHtmlizer.htmlize(data, "http.requesters.ipv4", federation, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW); + FederationMetricHtmlizer.htmlize(data, "http.requesters.ipv6", federation, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN); + + FederationMetricHtmlizer.htmlize(data, "http.visits", federation, view, period, "metrics.http.visits", ChartColor.BLUE); FederationMetricHtmlizer.htmlize(data, "http.visitors", federation, view, period, "metrics.http.visitors", ChartColor.BLUE); - - FederationMetricHtmlizer.htmlize(data, "http.visitors-humansbots", federation, view, period, "http.visitors (humans + bots)", "metrics.http.visitors.humans", ChartColor.GREEN, - "metrics.http.visitors.bots", ChartColor.YELLOW); - FederationMetricHtmlizer.htmlize(data, "http.visitors.humans", federation, view, period, "metrics.http.visitors.humans", ChartColor.GREEN); - FederationMetricHtmlizer.htmlize(data, "http.visitors.bots", federation, view, period, "metrics.http.visitors.bots", ChartColor.YELLOW); - FederationMetricHtmlizer.htmlize(data, "http.visitors-ipv4ipv6", federation, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW, "metrics.http.visitors.ipv6", ChartColor.GREEN); FederationMetricHtmlizer.htmlize(data, "http.visitors.ipv4", federation, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW); FederationMetricHtmlizer.htmlize(data, "http.visitors.ipv6", federation, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN); - FederationMetricHtmlizer.htmlize(data, "http.visits", federation, view, period, "metrics.http.visits", ChartColor.BLUE); - - FederationMetricHtmlizer.htmlize(data, "http.visits-humansbots", federation, view, period, "http.visits (humans + bots)", "metrics.http.visits.humans", ChartColor.GREEN, - "metrics.http.visits.bots", ChartColor.YELLOW); - FederationMetricHtmlizer.htmlize(data, "http.visits.bots", federation, view, period, "metrics.http.visits.bots", ChartColor.YELLOW); - FederationMetricHtmlizer.htmlize(data, "http.visits.humans", federation, view, period, "metrics.http.visits.humans", ChartColor.GREEN); - // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricSummaryPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricSummaryPage.java index d618dda..a0b35ec 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricSummaryPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricSummaryPage.java @@ -70,8 +70,8 @@ public class OrganizationMetricSummaryPage data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, TypeMenu.SUMMARY, view, period)); OrganizationMetricHtmlizer.htmlize(data, "http.hits.humans", organization, view, period, "metrics.http.hits.humans", ChartColor.GREEN); - OrganizationMetricHtmlizer.htmlize(data, "http.visitors.humans", organization, view, period, "metrics.http.visitors.humans", ChartColor.GREEN); - OrganizationMetricHtmlizer.htmlize(data, "http.visits.humans", organization, view, period, "metrics.http.visits.humans", ChartColor.GREEN); + OrganizationMetricHtmlizer.htmlize(data, "http.visitors", organization, view, period, "metrics.http.visitors", ChartColor.GREEN); + OrganizationMetricHtmlizer.htmlize(data, "http.visits", organization, view, period, "metrics.http.visits", ChartColor.GREEN); // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java index 17e7cd6..7ed44ff 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java @@ -107,25 +107,25 @@ public class OrganizationMetricWebPage OrganizationMetricHtmlizer.htmlize(data, "http.ip.ipv4", organization, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW); OrganizationMetricHtmlizer.htmlize(data, "http.ip.ipv6", organization, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN); + OrganizationMetricHtmlizer.htmlize(data, "http.requesters", organization, view, period, "metrics.http.requesters", ChartColor.BLUE); + + OrganizationMetricHtmlizer.htmlize(data, "http.requesters-humansbots", organization, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN, + "metrics.http.requesters.bots", ChartColor.YELLOW); + OrganizationMetricHtmlizer.htmlize(data, "http.requesters.humans", organization, view, period, "metrics.http.requesters.humans", ChartColor.GREEN); + OrganizationMetricHtmlizer.htmlize(data, "http.requesters.bots", organization, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW); + + OrganizationMetricHtmlizer.htmlize(data, "http.requesters-ipv4ipv6", organization, view, period, "http.requesters(ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW, + "metrics.http.requesters.ipv6", ChartColor.GREEN); + OrganizationMetricHtmlizer.htmlize(data, "http.requesters.ipv4", organization, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW); + OrganizationMetricHtmlizer.htmlize(data, "http.requesters.ipv6", organization, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN); + + OrganizationMetricHtmlizer.htmlize(data, "http.visits", organization, view, period, "metrics.http.visits", ChartColor.BLUE); OrganizationMetricHtmlizer.htmlize(data, "http.visitors", organization, view, period, "metrics.http.visitors", ChartColor.BLUE); - - OrganizationMetricHtmlizer.htmlize(data, "http.visitors-humansbots", organization, view, period, "http.visitors (humans + bots)", "metrics.http.visitors.humans", ChartColor.GREEN, - "metrics.http.visitors.bots", ChartColor.YELLOW); - OrganizationMetricHtmlizer.htmlize(data, "http.visitors.humans", organization, view, period, "metrics.http.visitors.humans", ChartColor.GREEN); - OrganizationMetricHtmlizer.htmlize(data, "http.visitors.bots", organization, view, period, "metrics.http.visitors.bots", ChartColor.YELLOW); - OrganizationMetricHtmlizer.htmlize(data, "http.visitors-ipv4ipv6", organization, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW, "metrics.http.visitors.ipv6", ChartColor.GREEN); OrganizationMetricHtmlizer.htmlize(data, "http.visitors.ipv4", organization, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW); OrganizationMetricHtmlizer.htmlize(data, "http.visitors.ipv6", organization, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN); - OrganizationMetricHtmlizer.htmlize(data, "http.visits", organization, view, period, "metrics.http.visits", ChartColor.BLUE); - - OrganizationMetricHtmlizer.htmlize(data, "http.visits-humansbots", organization, view, period, "http.visits (humans + bots)", "metrics.http.visits.humans", ChartColor.GREEN, - "metrics.http.visits.bots", ChartColor.YELLOW); - OrganizationMetricHtmlizer.htmlize(data, "http.visits.bots", organization, view, period, "metrics.http.visits.bots", ChartColor.YELLOW); - OrganizationMetricHtmlizer.htmlize(data, "http.visits.humans", organization, view, period, "metrics.http.visits.humans", ChartColor.GREEN); - // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricSummaryPage.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricSummaryPage.java index 3cba792..45e05fe 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricSummaryPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricSummaryPage.java @@ -70,8 +70,8 @@ public class ServiceMetricSummaryPage data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, TypeMenu.SUMMARY, view, period)); ServiceMetricHtmlizer.htmlize(data, "http.hits.humans", service, view, period, "metrics.http.hits.humans", ChartColor.GREEN); - ServiceMetricHtmlizer.htmlize(data, "http.visitors.humans", service, view, period, "metrics.http.visitors.humans", ChartColor.GREEN); - ServiceMetricHtmlizer.htmlize(data, "http.visits.humans", service, view, period, "metrics.http.visits.humans", ChartColor.GREEN); + ServiceMetricHtmlizer.htmlize(data, "http.visitors", service, view, period, "metrics.http.visitors", ChartColor.GREEN); + ServiceMetricHtmlizer.htmlize(data, "http.visits", service, view, period, "metrics.http.visits", ChartColor.GREEN); // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java index daa3ba3..0f5d415 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java @@ -106,25 +106,25 @@ public class ServiceMetricWebPage ServiceMetricHtmlizer.htmlize(data, "http.ip.ipv4", service, view, period, "metrics.http.ip.ipv4", ChartColor.YELLOW); ServiceMetricHtmlizer.htmlize(data, "http.ip.ipv6", service, view, period, "metrics.http.ip.ipv6", ChartColor.GREEN); - ServiceMetricHtmlizer.htmlize(data, "http.visitors", service, view, period, "metrics.http.ip", ChartColor.BLUE); + ServiceMetricHtmlizer.htmlize(data, "http.requesters", service, view, period, "metrics.http.requesters", ChartColor.BLUE); - ServiceMetricHtmlizer.htmlize(data, "http.visitors-humansbots", service, view, period, "http.visitors (humans + bots)", "metrics.http.visitors.humans", ChartColor.GREEN, - "metrics.http.visitors.bots", ChartColor.YELLOW); - ServiceMetricHtmlizer.htmlize(data, "http.visitors.humans", service, view, period, "metrics.http.visitors.humans", ChartColor.GREEN); - ServiceMetricHtmlizer.htmlize(data, "http.visitors.bots", service, view, period, "metrics.http.visitors.bots", ChartColor.YELLOW); + ServiceMetricHtmlizer.htmlize(data, "http.requesters-humansbots", service, view, period, "http.requesters (humans + bots)", "metrics.http.requesters.humans", ChartColor.GREEN, + "metrics.http.requesters.bots", ChartColor.YELLOW); + ServiceMetricHtmlizer.htmlize(data, "http.requesters.humans", service, view, period, "metrics.http.requesters.humans", ChartColor.GREEN); + ServiceMetricHtmlizer.htmlize(data, "http.requesters.bots", service, view, period, "metrics.http.requesters.bots", ChartColor.YELLOW); + ServiceMetricHtmlizer.htmlize(data, "http.requesters-ipv4ipv6", service, view, period, "http.requesters (ipv4 + ipv6)", "metrics.http.requesters.ipv4", ChartColor.YELLOW, + "metrics.http.requesters.ipv6", ChartColor.GREEN); + ServiceMetricHtmlizer.htmlize(data, "http.requesters.ipv4", service, view, period, "metrics.http.requesters.ipv4", ChartColor.YELLOW); + ServiceMetricHtmlizer.htmlize(data, "http.requesters.ipv6", service, view, period, "metrics.http.requesters.ipv6", ChartColor.GREEN); + + ServiceMetricHtmlizer.htmlize(data, "http.visits", service, view, period, "metrics.http.visits", ChartColor.BLUE); + ServiceMetricHtmlizer.htmlize(data, "http.visitors", service, view, period, "metrics.http.visitors", ChartColor.BLUE); ServiceMetricHtmlizer.htmlize(data, "http.visitors-ipv4ipv6", service, view, period, "http.visitors (ipv4 + ipv6)", "metrics.http.visitors.ipv4", ChartColor.YELLOW, "metrics.http.visitors.ipv6", ChartColor.GREEN); ServiceMetricHtmlizer.htmlize(data, "http.visitors.ipv4", service, view, period, "metrics.http.visitors.ipv4", ChartColor.YELLOW); ServiceMetricHtmlizer.htmlize(data, "http.visitors.ipv6", service, view, period, "metrics.http.visitors.ipv6", ChartColor.GREEN); - ServiceMetricHtmlizer.htmlize(data, "http.visits", service, view, period, "metrics.http.visits", ChartColor.BLUE); - - ServiceMetricHtmlizer.htmlize(data, "http.visits-humansbots", service, view, period, "http.visits (humans + bots)", "metrics.http.visits.humans", ChartColor.GREEN, - "metrics.http.visits.bots", ChartColor.YELLOW); - ServiceMetricHtmlizer.htmlize(data, "http.visits.bots", service, view, period, "metrics.http.visits.bots", ChartColor.YELLOW); - ServiceMetricHtmlizer.htmlize(data, "http.visits.humans", service, view, period, "metrics.http.visits.humans", ChartColor.GREEN); - // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml index 25b7c5b..461bb19 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml @@ -16,8 +16,8 @@
-
-
+
+
diff --git a/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml index c252430..66c0825 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml @@ -50,23 +50,26 @@
-

http.visitors

-
+

http.requesters

+
+
+
+
+
+
+
+
+ +

Visites

+
+
+

-
-
-
-

http.visits

-
- -
-
-
diff --git a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java index d0d4a60..4f9ee9f 100644 --- a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java +++ b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLog.java @@ -231,6 +231,28 @@ public class HttpAccessLog return result; } + /** + * Checks if is visit. + * + * @return true, if is visit + */ + public boolean isVisit() + { + boolean result; + + if ((this.status.getCategory() == HttpStatusCategory.SUCCESS) && (!isBot()) && (this.request.startsWith("GET "))) + { + result = true; + } + else + { + result = false; + } + + // + return result; + } + public void setBodyBytesSent(final long bodyBytesSent) { this.bodyBytesSent = bodyBytesSent; diff --git a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java index 9e10247..8331cbc 100644 --- a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java +++ b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java @@ -51,19 +51,20 @@ public class HttpAccessLogAnalyzer private int errorCount; private PathCounters counters; - private VisitCounters visits; - private VisitCounters botVisits; - private VisitCounters humanVisits; private IpCounters ips; private IpCounters ipv4; private IpCounters ipv6; private IpCounters botIps; private IpCounters humanIps; + private VisitorCounters requesters; + private VisitorCounters ipv4Requesters; + private VisitorCounters ipv6Requesters; + private VisitorCounters botRequesters; + private VisitorCounters humanRequesters; + private VisitCounters visits; private VisitorCounters visitors; private VisitorCounters ipv4Visitors; private VisitorCounters ipv6Visitors; - private VisitorCounters botVisitors; - private VisitorCounters humanVisitors; /** * Instantiates a new http access log prober. @@ -71,20 +72,22 @@ public class HttpAccessLogAnalyzer public HttpAccessLogAnalyzer() { this.counters = new PathCounters(); - this.visits = new VisitCounters(); - this.botVisits = new VisitCounters(); - this.humanVisits = new VisitCounters(); this.ips = new IpCounters(); this.ipv4 = new IpCounters(); this.ipv6 = new IpCounters(); this.botIps = new IpCounters(); this.humanIps = new IpCounters(); + this.requesters = new VisitorCounters(); + this.ipv4Requesters = new VisitorCounters(); + this.ipv6Requesters = new VisitorCounters(); + this.humanRequesters = new VisitorCounters(); + this.botRequesters = new VisitorCounters(); + + this.visits = new VisitCounters(); this.visitors = new VisitorCounters(); this.ipv4Visitors = new VisitorCounters(); this.ipv6Visitors = new VisitorCounters(); - this.botVisitors = new VisitorCounters(); - this.humanVisitors = new VisitorCounters(); } /** @@ -105,15 +108,16 @@ public class HttpAccessLogAnalyzer result.putAll(this.botIps.getCounters("metrics.http.ip.bots")); result.putAll(this.humanIps.getCounters("metrics.http.ip.humans")); - result.putAll(this.visits.getCounters("metrics.http.visits")); - result.putAll(this.botVisits.getCounters("metrics.http.visits.bots")); - result.putAll(this.humanVisits.getCounters("metrics.http.visits.humans")); + result.putAll(this.requesters.getCounters("metrics.http.requesters")); + result.putAll(this.ipv4Requesters.getCounters("metrics.http.requesters.ipv4")); + result.putAll(this.ipv6Requesters.getCounters("metrics.http.requesters.ipv6")); + result.putAll(this.botRequesters.getCounters("metrics.http.requesters.bots")); + result.putAll(this.humanRequesters.getCounters("metrics.http.requesters.humans")); + result.putAll(this.visits.getCounters("metrics.http.visits")); result.putAll(this.visitors.getCounters("metrics.http.visitors")); result.putAll(this.ipv4Visitors.getCounters("metrics.http.visitors.ipv4")); result.putAll(this.ipv6Visitors.getCounters("metrics.http.visitors.ipv6")); - result.putAll(this.botVisitors.getCounters("metrics.http.visitors.bots")); - result.putAll(this.humanVisitors.getCounters("metrics.http.visitors.humans")); // return result; @@ -267,46 +271,50 @@ public class HttpAccessLogAnalyzer this.humanIps.put(log.getIp(), year, yearMonth, yearWeek, date); } - // metrics.http.visits.* = - this.visits.putVisit(log); - this.visits.storeTimeMarks(year, yearMonth, yearWeek, date); + // metrics.http.requesters.* = + this.requesters.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); - if (log.isBot()) - { - this.botVisits.putVisit(log); - this.botVisits.storeTimeMarks(year, yearMonth, yearWeek, date); - } - else - { - this.humanVisits.putVisit(log); - this.humanVisits.storeTimeMarks(year, yearMonth, yearWeek, date); - } - - // - - // metrics.http.visitors.* = - this.visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); - - // metrics.http.visitors.ipv4.* = - // metrics.http.visitors.ipv6.* = + // metrics.http.requesters.ipv4.* = + // metrics.http.requesters.ipv6.* = if (log.isIPv4()) { - this.ipv4Visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + this.ipv4Requesters.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); } else { - this.ipv6Visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + this.ipv6Requesters.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); } - // metrics.http.visitors.bots.* - // metrics.http.visitors.humans.* + // metrics.http.requesters.bots.* + // metrics.http.requesters.humans.* if (log.isBot()) { - this.botVisitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + this.botRequesters.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); } else { - this.humanVisitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + this.humanRequesters.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + } + + // metrics.http.visits.* = + // metrics.http.visitors.* = + // metrics.http.visitors.ipv4.* = + // metrics.http.visitors.ipv6.* = + if (log.isVisit()) + { + this.visits.putVisit(log); + this.visits.storeTimeMarks(year, yearMonth, yearWeek, date); + + this.visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + + if (log.isIPv4()) + { + this.ipv4Visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + } + else + { + this.ipv6Visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); + } } // metrics.http.status.XXXX diff --git a/src/fr/devinsy/statoolinfos/metrics/http/VisitCounters.java b/src/fr/devinsy/statoolinfos/metrics/http/VisitCounters.java index b25d09d..d9039e2 100644 --- a/src/fr/devinsy/statoolinfos/metrics/http/VisitCounters.java +++ b/src/fr/devinsy/statoolinfos/metrics/http/VisitCounters.java @@ -176,8 +176,6 @@ public class VisitCounters extends HashMap */ public void putVisit(final HttpAccessLog log) { - // if ((log != null) && (log.getStatus().getCategory() == - // HttpStatusCategory.SUCCESS)) if (log != null) { String key = computeKey(log);