Added account metric for Minetest.
This commit is contained in:
parent
87a6a15f10
commit
f7efce5c4f
3 changed files with 42 additions and 33 deletions
|
@ -88,6 +88,7 @@ public class GiteaProber
|
|||
SQLDatabase database = new SQLDatabase(databaseConfig.getUrl(), databaseConfig.getUser(), databaseConfig.getPassword());
|
||||
database.open();
|
||||
result.putAll(DatabaseProber.probe(database));
|
||||
database.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -73,7 +73,10 @@ public class MinetestProber
|
|||
result = MinetestLogAnalyzer.probe(logs);
|
||||
|
||||
// metrics.service.database.bytes
|
||||
// metrics.service.accounts
|
||||
{
|
||||
long databaseSize = 0;
|
||||
StringList timemarks = result.getNowTimeMarks();
|
||||
try
|
||||
{
|
||||
System.out.println("Probing database [" + playerDatabaseConfig.getUrl() + "]");
|
||||
|
@ -82,6 +85,13 @@ public class MinetestProber
|
|||
SQLDatabase database = new SQLDatabase(playerDatabaseConfig.getUrl(), playerDatabaseConfig.getUser(), playerDatabaseConfig.getPassword());
|
||||
database.open();
|
||||
databaseSize += database.getDatabaseSize();
|
||||
|
||||
// metrics.service.accounts
|
||||
long accountCount = database.queryNumber("select count(*) from player;");
|
||||
result.set(accountCount, "metrics.service.accounts", timemarks);
|
||||
|
||||
//
|
||||
database.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -103,6 +113,7 @@ public class MinetestProber
|
|||
SQLDatabase database = new SQLDatabase(worldDatabaseConfig.getUrl(), worldDatabaseConfig.getUser(), worldDatabaseConfig.getPassword());
|
||||
database.open();
|
||||
databaseSize += database.getDatabaseSize();
|
||||
database.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -115,12 +126,9 @@ public class MinetestProber
|
|||
}
|
||||
}
|
||||
|
||||
StringList timemarks = result.getNowTimeMarks();
|
||||
result.set(databaseSize, "metrics.service.database.bytes", timemarks);
|
||||
|
||||
// result.putAll(MumbleDatabaseAnalyzer.probe());
|
||||
// metrics.service.accounts
|
||||
// metrics.service.database.bytes
|
||||
result.set(databaseSize, "metrics.service.database.bytes", timemarks);
|
||||
}
|
||||
|
||||
// metrics.service.files.bytes
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ public class SQLDatabase
|
|||
|
||||
this.connection = DriverManager.getConnection(this.url, this.login, this.password);
|
||||
this.status = Status.OPENED;
|
||||
logger.info("Single connection opened with [{}].", this.url);
|
||||
logger.info("Single connection opened with [{}].", this.url);
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException exception)
|
||||
|
|
Loading…
Reference in a new issue