From b0fd69332e4ab2730652e43b611dc01fcce6dade Mon Sep 17 00:00:00 2001 From: Andrei Mihu Date: Wed, 5 Jul 2023 09:53:44 +0100 Subject: [PATCH] Better formatting for graphed values in devconsole status view. --- CHANGELOG.md | 3 +++ server/status_handler.go | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c24baa8..99cebf469 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project are documented below. The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org). ## [Unreleased] +### Changed +- Better formatting for graphed values in devconsole status view. + ### Fixed - Correct cursor usage in group listings using only open/closed group state filter. - Remap original Google IDs to "next generation player IDs". diff --git a/server/status_handler.go b/server/status_handler.go index c3d756025..20116f0c0 100644 --- a/server/status_handler.go +++ b/server/status_handler.go @@ -16,6 +16,7 @@ package server import ( "context" + "math" "runtime" "github.com/heroiclabs/nakama/v3/console" @@ -55,10 +56,10 @@ func (s *LocalStatusHandler) GetStatus(ctx context.Context) ([]*console.StatusLi PresenceCount: int32(s.tracker.Count()), MatchCount: int32(s.matchRegistry.Count()), GoroutineCount: int32(runtime.NumGoroutine()), - AvgLatencyMs: s.metrics.SnapshotLatencyMs(), - AvgRateSec: s.metrics.SnapshotRateSec(), - AvgInputKbs: s.metrics.SnapshotRecvKbSec(), - AvgOutputKbs: s.metrics.SnapshotSentKbSec(), + AvgLatencyMs: math.Floor(s.metrics.SnapshotLatencyMs()*100) / 100, + AvgRateSec: math.Floor(s.metrics.SnapshotRateSec()*100) / 100, + AvgInputKbs: math.Floor(s.metrics.SnapshotRecvKbSec()*100) / 100, + AvgOutputKbs: math.Floor(s.metrics.SnapshotSentKbSec()*100) / 100, }, }, nil } -- GitLab