Improved code.

This commit is contained in:
Christian P. MOMON 2022-01-11 16:02:57 +01:00
parent f02a3b7dd4
commit 3feafb815c
4 changed files with 28 additions and 24 deletions

View file

@ -237,7 +237,7 @@ public class HttpAccessLogAnalyzer
}
// metrics.http.pages.* =
if ((isPage(log.getRequest())) && (log.getStatus().getCategory() == HttpStatusCategory.SUCCESS))
if ((log.getStatus().getCategory() == HttpStatusCategory.SUCCESS) && (isPage(log.getRequest())))
{
this.counters.inc("metrics.http.pages", year, yearMonth, yearWeek, date);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -83,6 +83,7 @@ public class MinetestLogAnalyzer
result.putAll(this.counters);
result.putAll(this.activePlayers.getCounters("metrics.service.users"));
result.putAll(this.activePlayers.getCounters("metrics.service.accounts.active"));
result.putAll(this.ips.getCounters("metrics.service.ip"));
result.putAll(this.ipv4.getCounters("metrics.service.ip.ipv4"));
result.putAll(this.ipv6.getCounters("metrics.service.ip.ipv6"));
@ -161,6 +162,7 @@ public class MinetestLogAnalyzer
// metrics.metaverse.logs.warning
// metrics.metaverse.logs.error
// metrics.metaverse.logs.none
// metrics.metaverse.logs.unknown
if (log.getLevel() == MinetestLogLevel.ACTION)
{
this.counters.inc("metrics.metaverse.logs.action", year, yearMonth, yearWeek, date);
@ -182,14 +184,13 @@ public class MinetestLogAnalyzer
this.counters.inc("metrics.metaverse.logs.unknown", year, yearMonth, yearWeek, date);
}
// metrics.metaverse.players.active
// metrics.service.users
// metrics.service.users (= metrics.metaverse.players.active)
this.activePlayers.put(log.getNickname(), year, yearMonth, yearWeek, date);
// metrics.metaverse.players.max
// TODO
// metrics.metaverse.joiners --
// metrics.metaverse.joiners
if (log.getMessage().contains(" joins game."))
{
this.counters.inc("metrics.metaverse.joiners", year, yearMonth, yearWeek, date);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -55,12 +55,24 @@ public class MinetestProber
{
PathCounters result;
// metrics.service.users, metrics.service.accounts.active
// metrics.metaverse.joiners
// metrics.service.ip
// metrics.service.ip.ipv4
// metrics.service.ip.ipv6
// metrics.metaverse.logs
// metrics.metaverse.logs.action
// metrics.metaverse.logs.warning
// metrics.metaverse.logs.error
// metrics.metaverse.logs.none
// metrics.metaverse.logs.unknown
result = MinetestLogAnalyzer.probe(logs);
// metrics.metaverse.players
// accounts
// database size
// file size
// result.putAll(MumbleDatabaseAnalyzer.probe());
// metrics.service.accounts
// metrics.service.database.bytes
// metrics.service.files.bytes
//
return result;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -258,22 +258,13 @@ public class PathPropertyList extends ArrayList<PathProperty> implements PathPro
pattern = prefix + ".";
}
boolean ended = false;
Iterator<PathProperty> iterator = iterator();
while (!ended)
for (PathProperty current : this)
{
if (iterator.hasNext())
if (StringUtils.startsWith(current.getPath(), pattern))
{
PathProperty current = iterator.next();
if (StringUtils.startsWith(current.getPath(), pattern))
{
result.add(current);
}
}
else
{
ended = true;
result.add(current);
}
}
}