Improved Gitea user metric computation.

This commit is contained in:
Christian P. MOMON 2022-02-27 11:57:56 +01:00
parent f750d648fb
commit 37853c40d9

View file

@ -32,6 +32,7 @@ import fr.devinsy.statoolinfos.metrics.PathCounters;
import fr.devinsy.statoolinfos.metrics.UserCounters; import fr.devinsy.statoolinfos.metrics.UserCounters;
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLog; import fr.devinsy.statoolinfos.metrics.http.HttpAccessLog;
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLogs; import fr.devinsy.statoolinfos.metrics.http.HttpAccessLogs;
import fr.devinsy.statoolinfos.metrics.http.HttpStatusCategory;
import fr.devinsy.statoolinfos.metrics.util.DatabaseProber; import fr.devinsy.statoolinfos.metrics.util.DatabaseProber;
import fr.devinsy.statoolinfos.metrics.util.DatafilesProber; import fr.devinsy.statoolinfos.metrics.util.DatafilesProber;
import fr.devinsy.statoolinfos.util.Files; import fr.devinsy.statoolinfos.util.Files;
@ -186,9 +187,14 @@ public class GiteaProber
GET /cpm GET /cpm
GET /devinsy GET /devinsy
*/ */
// regexList.add("GET /\\w+ .*");
/* /*
GET /devinsy/bacasable GET /devinsy/bacasable
*/
// regexList.add("GET /\\w+/\\w+ .*");
/*
GET /devinsy/bacasable/activity GET /devinsy/bacasable/activity
GET /devinsy/bacasable/commits/branch/master GET /devinsy/bacasable/commits/branch/master
GET /devinsy/bacasable/compare/master...master GET /devinsy/bacasable/compare/master...master
@ -279,7 +285,7 @@ public class GiteaProber
// metrics.service.users // metrics.service.users
// metrics.service.users.ipv4 // metrics.service.users.ipv4
// metrics.service.users.ipv6 // metrics.service.users.ipv6
if ((!log.isBot()) && (USE_PATTERN.matcher(log.getRequest()).matches())) if ((log.getStatus().getCategory() == HttpStatusCategory.SUCCESS) && (!log.isBot()) && (USE_PATTERN.matcher(log.getRequest()).matches()))
{ {
String key = String.format("%s---%s", log.getIp(), log.getUserAgent()); String key = String.format("%s---%s", log.getIp(), log.getUserAgent());