update metrics websocket json response
This commit is contained in:
parent
0228f7205d
commit
d9ebbfe99e
@ -42,13 +42,11 @@ public class MetricsWebSocketHandler extends TextWebSocketHandler {
|
|||||||
*/
|
*/
|
||||||
private void sendMetrics(WebSocketSession session) {
|
private void sendMetrics(WebSocketSession session) {
|
||||||
try {
|
try {
|
||||||
WebsocketMetrics metrics = new WebsocketMetrics(Map.of(
|
session.sendMessage(new TextMessage(Main.GSON.toJson(Map.of(
|
||||||
"totalRequests", metricService.getMetric(TotalRequestsMetric.class).getValue(),
|
"totalRequests", metricService.getMetric(TotalRequestsMetric.class).getValue(),
|
||||||
"totalServerLookups", metricService.getMetric(TotalServerLookupsMetric.class).getValue(),
|
"totalServerLookups", metricService.getMetric(TotalServerLookupsMetric.class).getValue(),
|
||||||
"totalPlayerLookups", metricService.getMetric(TotalPlayerLookupsMetric.class).getValue()
|
"totalPlayerLookups", metricService.getMetric(TotalPlayerLookupsMetric.class).getValue()
|
||||||
));
|
))));
|
||||||
|
|
||||||
session.sendMessage(new TextMessage(Main.GSON.toJson(metrics)));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("An error occurred while sending metrics to the client", e);
|
log.error("An error occurred while sending metrics to the client", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user