Added qrcode count metric for LibreQR.
This commit is contained in:
parent
71da08488b
commit
a3e3fce191
1 changed files with 7 additions and 1 deletions
|
@ -39,6 +39,7 @@ public class LibreQRHttpLogAnalyzer
|
||||||
private static Logger logger = LoggerFactory.getLogger(LibreQRHttpLogAnalyzer.class);
|
private static Logger logger = LoggerFactory.getLogger(LibreQRHttpLogAnalyzer.class);
|
||||||
|
|
||||||
public static final Pattern USE_PATTERN = Pattern.compile("GET /temp/\\w+\\.png.*");
|
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 PathCounters counters;
|
||||||
private UserCounters users;
|
private UserCounters users;
|
||||||
|
@ -95,7 +96,6 @@ public class LibreQRHttpLogAnalyzer
|
||||||
// metrics.service.users
|
// metrics.service.users
|
||||||
// metrics.service.users.ipv4
|
// metrics.service.users.ipv4
|
||||||
// metrics.service.users.ipv6
|
// metrics.service.users.ipv6
|
||||||
// metrics.barcodes.count
|
|
||||||
if ((!log.isBot()) && (USE_PATTERN.matcher(log.getRequest()).matches()))
|
if ((!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());
|
||||||
|
@ -111,6 +111,12 @@ public class LibreQRHttpLogAnalyzer
|
||||||
this.ipv6Users.put(key, year, yearMonth, yearWeek, date);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue