From 6c68f412d2eba9d78b8b17537158bfa0a60482bf Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sat, 4 Apr 2026 19:08:19 +0200 Subject: [PATCH] don't log move_direction_counts into metric because looking almost the same --- server/metrics/ServerMetricsCollector.py | 54 ++++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/server/metrics/ServerMetricsCollector.py b/server/metrics/ServerMetricsCollector.py index 1587507..695ec27 100644 --- a/server/metrics/ServerMetricsCollector.py +++ b/server/metrics/ServerMetricsCollector.py @@ -26,13 +26,13 @@ class ServerMetricsCollector: # 'move': 0, # 'end': 0, # }, - 'move_direction_counts': { - 'up': 0, - 'down': 0, - 'left': 0, - 'right': 0, - 'unknown': 0, - }, + # 'move_direction_counts': { + # 'up': 0, + # 'down': 0, + # 'left': 0, + # 'right': 0, + # 'unknown': 0, + # }, 'move_response_time_ms_total': 0.0, 'move_response_time_ms_max': 0.0, 'last_game_start_unix': 0, @@ -76,12 +76,12 @@ class ServerMetricsCollector: self._metrics['move_response_time_ms_max'], elapsed_ms, ) - move_counts = self._metrics['move_direction_counts'] - if direction in move_counts: - move_counts[direction] += 1 - else: - move_counts['unknown'] += 1 - self._metrics['last_move_unix'] = int(time.time()) + # move_counts = self._metrics['move_direction_counts'] + # if direction in move_counts: + # move_counts[direction] += 1 + # else: + # move_counts['unknown'] += 1 + # self._metrics['last_move_unix'] = int(time.time()) await self._auto_publish() async def record_game_end(self, game_state:dict) -> None: @@ -156,8 +156,8 @@ class ServerMetricsCollector: 'avg_turns_per_game': round(avg_turns, 2), 'win_rate': round(win_rate, 4), 'avg_move_response_ms': round(avg_move_ms, 2), - 'http_requests_by_endpoint': dict(self._metrics['http_requests_by_endpoint']), - 'move_direction_counts': dict(self._metrics['move_direction_counts']), + # 'http_requests_by_endpoint': dict(self._metrics['http_requests_by_endpoint']), + # 'move_direction_counts': dict(self._metrics['move_direction_counts']), 'oldest_active_game_age_sec': oldest_active_age, 'stale_game_timeout_sec': self._stale_game_timeout_sec, 'active_games_stale': report_stale_candidates, @@ -243,19 +243,19 @@ class ServerMetricsCollector: f'snake_active_games_stale {snapshot["active_games_stale"]}', ] - lines.extend([ - '# HELP snake_http_requests_by_endpoint_total Requests served grouped by endpoint.', - '# TYPE snake_http_requests_by_endpoint_total counter', - ]) - for endpoint, count in snapshot['http_requests_by_endpoint'].items(): - lines.append(f'snake_http_requests_by_endpoint_total{{endpoint="{endpoint}"}} {count}') + # lines.extend([ + # '# HELP snake_http_requests_by_endpoint_total Requests served grouped by endpoint.', + # '# TYPE snake_http_requests_by_endpoint_total counter', + # ]) + # for endpoint, count in snapshot['http_requests_by_endpoint'].items(): + # lines.append(f'snake_http_requests_by_endpoint_total{{endpoint="{endpoint}"}} {count}') - lines.extend([ - '# HELP snake_moves_by_direction_total Move responses grouped by direction.', - '# TYPE snake_moves_by_direction_total counter', - ]) - for direction, count in snapshot['move_direction_counts'].items(): - lines.append(f'snake_moves_by_direction_total{{direction="{direction}"}} {count}') + # lines.extend([ + # '# HELP snake_moves_by_direction_total Move responses grouped by direction.', + # '# TYPE snake_moves_by_direction_total counter', + # ]) + # for direction, count in snapshot['move_direction_counts'].items(): + # lines.append(f'snake_moves_by_direction_total{{direction="{direction}"}} {count}') return '\n'.join(lines) + '\n'