diff --git a/src/fr/devinsy/statoolinfos/metrics/libreqr/LibreQRHttpLogAnalyzer.java b/src/fr/devinsy/statoolinfos/metrics/libreqr/LibreQRHttpLogAnalyzer.java index 67b0d67..6273ab4 100644 --- a/src/fr/devinsy/statoolinfos/metrics/libreqr/LibreQRHttpLogAnalyzer.java +++ b/src/fr/devinsy/statoolinfos/metrics/libreqr/LibreQRHttpLogAnalyzer.java @@ -39,6 +39,7 @@ public class LibreQRHttpLogAnalyzer private static Logger logger = LoggerFactory.getLogger(LibreQRHttpLogAnalyzer.class); public static final Pattern USE_PATTERN = Pattern.compile("GET /temp/\\w+\\.png.*"); + public static final Pattern CREATE_PATTERN = Pattern.compile("POST / .*"); private PathCounters counters; private UserCounters users; @@ -95,7 +96,6 @@ public class LibreQRHttpLogAnalyzer // metrics.service.users // metrics.service.users.ipv4 // metrics.service.users.ipv6 - // metrics.barcodes.count if ((!log.isBot()) && (USE_PATTERN.matcher(log.getRequest()).matches())) { String key = String.format("%s---%s", log.getIp(), log.getUserAgent()); @@ -111,6 +111,12 @@ public class LibreQRHttpLogAnalyzer this.ipv6Users.put(key, year, yearMonth, yearWeek, date); } } + + // metrics.barcodes.count + if ((log.getStatus().getCode() == 200) && (CREATE_PATTERN.matcher(log.getRequest()).matches())) + { + this.counters.inc("metrics.barcodes.count", year, yearMonth, yearWeek, date); + } } }