Adding new gameMetric

This commit is contained in:
Jakub Pomykala 2024-10-07 16:38:02 +01:00
parent 2e6152d6c8
commit 6ef2d2b182
No known key found for this signature in database
GPG Key ID: 443513F7E6795E4B
2 changed files with 11 additions and 14 deletions

View File

@ -92,13 +92,13 @@ public class GameMetrics {
return currentPartiesCounter;
}
// @Timed(unit = MetricUnits.SECONDS,
// name = "timer",
// absolute = true,
// description = "The time an app has been running")
// public Context startTimer() {
// return timerContext;
// }
@Timed(unit = MetricUnits.SECONDS,
name = "timer",
absolute = true,
description = "The time an app has been running")
public Context startTimer() {
return timerContext;
}
public void incTotalPlayerCount() {
System.out.println("Increasing player count");

View File

@ -22,8 +22,8 @@ import jakarta.websocket.server.PathParam;
import jakarta.websocket.server.ServerEndpoint;
import org.eclipse.microprofile.faulttolerance.Retry;
import org.eclipse.microprofile.metrics.annotation.Counted;
//import org.eclipse.microprofile.metrics.Timer.Context;
//import org.eclipse.microprofile.metrics.annotation.Metered;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.libertybikes.game.core.GameRound;
import org.libertybikes.game.core.GameRound.State;
@ -83,12 +83,9 @@ public class GameRoundWebsocket {
}
@OnMessage
/*
* @Metered(name = "rate_of_websocket_calls",
* displayName = "Rate of GameRound Websocket Calls",
* description = "Rate of incoming messages to the game round websocket",
* absolute = true)
*/
@Counted(name = "rate_of_websocket_calls",
description = "Rate of incoming messages to the game round websocket",
absolute = true)
public void onMessage(@PathParam("roundId") final String roundId, String message, Session session) {
try {
final InboundMessage msg = jsonb.fromJson(message, InboundMessage.class);