Added some more metric to probe.
This commit is contained in:
parent
5ece10ea2a
commit
fb4ff4483f
1 changed files with 49 additions and 2 deletions
|
@ -47,9 +47,13 @@ public class HttpAccessLogAnalyzer
|
||||||
private int errorCount;
|
private int errorCount;
|
||||||
private PathCounters counters;
|
private PathCounters counters;
|
||||||
private VisitCounters visits;
|
private VisitCounters visits;
|
||||||
|
private VisitCounters botVisits;
|
||||||
|
private VisitCounters visitorVisits;
|
||||||
private IpCounters ips;
|
private IpCounters ips;
|
||||||
private IpCounters ipv4;
|
private IpCounters ipv4;
|
||||||
private IpCounters ipv6;
|
private IpCounters ipv6;
|
||||||
|
private IpCounters botIps;
|
||||||
|
private IpCounters visitorIps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new http access log prober.
|
* Instantiates a new http access log prober.
|
||||||
|
@ -58,9 +62,13 @@ public class HttpAccessLogAnalyzer
|
||||||
{
|
{
|
||||||
this.counters = new PathCounters();
|
this.counters = new PathCounters();
|
||||||
this.visits = new VisitCounters();
|
this.visits = new VisitCounters();
|
||||||
|
this.botVisits = new VisitCounters();
|
||||||
|
this.visitorVisits = new VisitCounters();
|
||||||
this.ips = new IpCounters();
|
this.ips = new IpCounters();
|
||||||
this.ipv4 = new IpCounters();
|
this.ipv4 = new IpCounters();
|
||||||
this.ipv6 = new IpCounters();
|
this.ipv6 = new IpCounters();
|
||||||
|
this.botIps = new IpCounters();
|
||||||
|
this.visitorIps = new IpCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,6 +86,7 @@ public class HttpAccessLogAnalyzer
|
||||||
result.putAll(this.ips.getCounters("metrics.http.ip"));
|
result.putAll(this.ips.getCounters("metrics.http.ip"));
|
||||||
result.putAll(this.ipv4.getCounters("metrics.http.ip.ipv4"));
|
result.putAll(this.ipv4.getCounters("metrics.http.ip.ipv4"));
|
||||||
result.putAll(this.ipv6.getCounters("metrics.http.ip.ipv6"));
|
result.putAll(this.ipv6.getCounters("metrics.http.ip.ipv6"));
|
||||||
|
result.putAll(this.botIps.getCounters("metrics.http.ip.ipv6"));
|
||||||
|
|
||||||
result.putAll(this.visits.getCounters("metrics.http.visits"));
|
result.putAll(this.visits.getCounters("metrics.http.visits"));
|
||||||
|
|
||||||
|
@ -156,7 +165,7 @@ public class HttpAccessLogAnalyzer
|
||||||
// metrics.http.files
|
// metrics.http.files
|
||||||
if (log.getBodyBytesSent() != 0)
|
if (log.getBodyBytesSent() != 0)
|
||||||
{
|
{
|
||||||
this.counters.inc("metrics.http.file", year, yearMonth, yearWeek, date);
|
this.counters.inc("metrics.http.files", year, yearMonth, yearWeek, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
// metrics.http.bytes
|
// metrics.http.bytes
|
||||||
|
@ -167,6 +176,22 @@ public class HttpAccessLogAnalyzer
|
||||||
{
|
{
|
||||||
this.counters.inc("metrics.http.hits.bots", year, yearMonth, yearWeek, date);
|
this.counters.inc("metrics.http.hits.bots", year, yearMonth, yearWeek, date);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// metrics.http.hits.visitors.*
|
||||||
|
this.counters.inc("metrics.http.hits.visitors", year, yearMonth, yearWeek, date);
|
||||||
|
|
||||||
|
if (log.isIPv4())
|
||||||
|
{
|
||||||
|
// metrics.http.hits.visitors.ipv4.*
|
||||||
|
this.counters.inc("metrics.http.hits.visitors.ipv4", year, yearMonth, yearWeek, date);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// metrics.http.hits.visitors.ipv6.*
|
||||||
|
this.counters.inc("metrics.http.hits.visitors.ipv6", year, yearMonth, yearWeek, date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// metrics.http.pages.* =
|
// metrics.http.pages.* =
|
||||||
if ((isPage(log.getRequest())) && (log.getStatus().getCategory() == HttpStatusCategory.SUCCESS))
|
if ((isPage(log.getRequest())) && (log.getStatus().getCategory() == HttpStatusCategory.SUCCESS))
|
||||||
|
@ -191,9 +216,10 @@ public class HttpAccessLogAnalyzer
|
||||||
this.counters.inc("metrics.http.devices." + device.toString().toLowerCase(), year, yearMonth, yearWeek, date);
|
this.counters.inc("metrics.http.devices." + device.toString().toLowerCase(), year, yearMonth, yearWeek, date);
|
||||||
|
|
||||||
// metrics.http.ip.* =
|
// metrics.http.ip.* =
|
||||||
|
this.ips.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
||||||
|
|
||||||
// metrics.http.ip.ipv4.* =
|
// metrics.http.ip.ipv4.* =
|
||||||
// metrics.http.ip.ipv6.* =
|
// metrics.http.ip.ipv6.* =
|
||||||
this.ips.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
|
||||||
if (log.isIPv4())
|
if (log.isIPv4())
|
||||||
{
|
{
|
||||||
this.ipv4.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
this.ipv4.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
||||||
|
@ -203,8 +229,29 @@ public class HttpAccessLogAnalyzer
|
||||||
this.ipv6.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
this.ipv6.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// metrics.http.ip.bots.*
|
||||||
|
// metrics.http.ip.visitors.*
|
||||||
|
if (log.isBot())
|
||||||
|
{
|
||||||
|
this.botIps.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.visitorIps.put(log.getRemoteAddress(), year, yearMonth, yearWeek, date);
|
||||||
|
}
|
||||||
|
|
||||||
// metrics.http.visits.* =
|
// metrics.http.visits.* =
|
||||||
this.visits.putVisit(log);
|
this.visits.putVisit(log);
|
||||||
|
|
||||||
|
if (log.isBot())
|
||||||
|
{
|
||||||
|
this.botVisits.putVisit(log);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.visitorVisits.putVisit(log);
|
||||||
|
}
|
||||||
|
|
||||||
this.visits.storeTimeMarks(year, yearMonth, yearWeek, date);
|
this.visits.storeTimeMarks(year, yearMonth, yearWeek, date);
|
||||||
|
|
||||||
// metrics.http.countries.XX =
|
// metrics.http.countries.XX =
|
||||||
|
|
Loading…
Reference in a new issue