diff --git a/utils/stats_utils.py b/utils/stats_utils.py index fd0f3b8..24b6067 100644 --- a/utils/stats_utils.py +++ b/utils/stats_utils.py @@ -51,24 +51,24 @@ def parse_haproxy_stats(stats_data): try: bin_bytes = float(row.get('bin', 0) or 0) - bytes_in_mb = f'{bin_bytes / (1024 * 1024):.2f}' + bytes_in_mb = bin_bytes / (1024 * 1024) # ✅ FLOAT, nie string! except (ValueError, TypeError): - bytes_in_mb = '0.00' + bytes_in_mb = 0.0 try: bout_bytes = float(row.get('bout', 0) or 0) - bytes_out_mb = f'{bout_bytes / (1024 * 1024):.2f}' + bytes_out_mb = bout_bytes / (1024 * 1024) # ✅ FLOAT, nie string! except (ValueError, TypeError): - bytes_out_mb = '0.00' + bytes_out_mb = 0.0 data.append({ 'frontend_name': row.get('pxname', 'Unknown'), 'server_name': row.get('svname', 'Unknown'), '4xx_errors': hrsp_4xx, '5xx_errors': hrsp_5xx, - 'bytes_in_mb': bytes_in_mb, - 'bytes_out_mb': bytes_out_mb, - 'conn_tot': conn_tot, # ✅ Teraz INT + 'bytes_in_mb': bytes_in_mb, # ✅ Float + 'bytes_out_mb': bytes_out_mb, # ✅ Float + 'conn_tot': conn_tot, # ✅ Int }) return data