From 0e47ac2daedc993566bd6ae10618b73a1bc58cd8 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 20 Jan 2022 19:25:02 +0100 Subject: [PATCH] Added visits.ipv4 and visits.ipv6 management. --- .../htmlize/FederationMetricWebPage.java | 7 ++++- .../htmlize/OrganizationMetricWebPage.java | 7 ++++- .../htmlize/ServiceMetricWebPage.java | 7 ++++- .../htmlize/serviceMetricWebView.xhtml | 15 +++++++---- .../metrics/http/HttpAccessLogAnalyzer.java | 27 +++++++++++++++++++ 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java index dd9d251..6a1af52 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java @@ -110,13 +110,18 @@ public class FederationMetricWebPage 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-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-ipv4ipv6", federation, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW, + "metrics.http.visits.ipv6", ChartColor.GREEN); + FederationMetricHtmlizer.htmlize(data, "http.visits.ipv4", federation, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW); + FederationMetricHtmlizer.htmlize(data, "http.visits.ipv6", federation, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN); + // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java index 7ed44ff..fedac7c 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricWebPage.java @@ -119,13 +119,18 @@ public class OrganizationMetricWebPage 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-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-ipv4ipv6", organization, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW, + "metrics.http.visits.ipv6", ChartColor.GREEN); + OrganizationMetricHtmlizer.htmlize(data, "http.visits.ipv4", organization, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW); + OrganizationMetricHtmlizer.htmlize(data, "http.visits.ipv6", organization, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN); + // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java index 0f5d415..d169d05 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricWebPage.java @@ -118,13 +118,18 @@ public class ServiceMetricWebPage 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-ipv4ipv6", service, view, period, "http.visits (ipv4 + ipv6)", "metrics.http.visits.ipv4", ChartColor.YELLOW, + "metrics.http.visits.ipv6", ChartColor.GREEN); + ServiceMetricHtmlizer.htmlize(data, "http.visits.ipv4", service, view, period, "metrics.http.visits.ipv4", ChartColor.YELLOW); + ServiceMetricHtmlizer.htmlize(data, "http.visits.ipv6", service, view, period, "metrics.http.visits.ipv6", ChartColor.GREEN); + // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml index 66c0825..5d2215c 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml @@ -61,15 +61,20 @@
-

Visites

-
-
-
+

Visiteurs

+
+
-
+

Visites

+
+ +
+
+
+
diff --git a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java index 8331cbc..9beeef5 100644 --- a/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java +++ b/src/fr/devinsy/statoolinfos/metrics/http/HttpAccessLogAnalyzer.java @@ -62,6 +62,8 @@ public class HttpAccessLogAnalyzer private VisitorCounters botRequesters; private VisitorCounters humanRequesters; private VisitCounters visits; + private VisitCounters ipv4Visits; + private VisitCounters ipv6Visits; private VisitorCounters visitors; private VisitorCounters ipv4Visitors; private VisitorCounters ipv6Visitors; @@ -85,6 +87,9 @@ public class HttpAccessLogAnalyzer this.botRequesters = new VisitorCounters(); this.visits = new VisitCounters(); + this.ipv4Visits = new VisitCounters(); + this.ipv6Visits = new VisitCounters(); + this.visitors = new VisitorCounters(); this.ipv4Visitors = new VisitorCounters(); this.ipv6Visitors = new VisitorCounters(); @@ -115,6 +120,9 @@ public class HttpAccessLogAnalyzer result.putAll(this.humanRequesters.getCounters("metrics.http.requesters.humans")); result.putAll(this.visits.getCounters("metrics.http.visits")); + result.putAll(this.ipv4Visits.getCounters("metrics.http.visits.ipv4")); + result.putAll(this.ipv6Visits.getCounters("metrics.http.visits.ipv6")); + 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")); @@ -297,14 +305,33 @@ public class HttpAccessLogAnalyzer } // metrics.http.visits.* = + // metrics.http.visits.ipv4.* = + // metrics.http.visits.ipv6.* = // metrics.http.visitors.* = // metrics.http.visitors.ipv4.* = // metrics.http.visitors.ipv6.* = if (log.isVisit()) { + // metrics.http.visits.* = + // metrics.http.visits.ipv4.* = + // metrics.http.visits.ipv6.* = this.visits.putVisit(log); this.visits.storeTimeMarks(year, yearMonth, yearWeek, date); + if (log.isIPv4()) + { + this.ipv4Visits.putVisit(log); + this.ipv4Visits.storeTimeMarks(year, yearMonth, yearWeek, date); + } + else + { + this.ipv6Visits.putVisit(log); + this.ipv6Visits.storeTimeMarks(year, yearMonth, yearWeek, date); + } + + // metrics.http.visitors.* = + // metrics.http.visitors.ipv4.* = + // metrics.http.visitors.ipv6.* = this.visitors.put(log.getIp(), log.getUserAgent(), year, yearMonth, yearWeek, date); if (log.isIPv4())