Improved page metric computation in probing.
This commit is contained in:
parent
a2cbf2d762
commit
152af0d74a
1 changed files with 40 additions and 1 deletions
|
@ -169,7 +169,7 @@ public class HttpAccessLogAnalyzer
|
||||||
}
|
}
|
||||||
|
|
||||||
// metrics.http.pages.* =
|
// metrics.http.pages.* =
|
||||||
if (StringUtils.endsWithAny(log.getRequest(), ".html", ".htm", ".xhtml", ".cgi", "/"))
|
if ((isPage(log.getRequest())) && (log.getStatus().getCategory() == HttpStatusCategory.SUCCESS))
|
||||||
{
|
{
|
||||||
this.counters.inc("metrics.http.pages", year, yearMonth, yearWeek, date);
|
this.counters.inc("metrics.http.pages", year, yearMonth, yearWeek, date);
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,45 @@ public class HttpAccessLogAnalyzer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is page.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* the request
|
||||||
|
* @return true, if is page
|
||||||
|
*/
|
||||||
|
public static boolean isPage(final String request)
|
||||||
|
{
|
||||||
|
boolean result;
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(request))
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pattern PAGE_PATTERN = Pattern.compile("^.* (?<path>/[^ \\?]*)(\\?.*| .*)?$");
|
||||||
|
|
||||||
|
Matcher matcher = PAGE_PATTERN.matcher(request);
|
||||||
|
if (matcher.find())
|
||||||
|
{
|
||||||
|
String path = matcher.group("path").toLowerCase();
|
||||||
|
|
||||||
|
result = path.matches("^.*(/|/[^/]*\\.html|/[^/]*\\.htm|/[^/]*\\.xhtml|/[^/]*\\.cgi|/[^/]*\\.php|/[^/\\.]*[a-z0-9])$");
|
||||||
|
|
||||||
|
// System.out.println(result + " [" + path + "] [" + request +
|
||||||
|
// "]");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the log.
|
* Parses the log.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue