new_functions_and_fixes #1

Merged
gru merged 33 commits from new_functions_and_fixes into master 2025-11-03 14:35:20 +01:00
Showing only changes of commit acef7eb610 - Show all commits

View File

@@ -51,24 +51,24 @@ def parse_haproxy_stats(stats_data):
try: try:
bin_bytes = float(row.get('bin', 0) or 0) 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): except (ValueError, TypeError):
bytes_in_mb = '0.00' bytes_in_mb = 0.0
try: try:
bout_bytes = float(row.get('bout', 0) or 0) 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): except (ValueError, TypeError):
bytes_out_mb = '0.00' bytes_out_mb = 0.0
data.append({ data.append({
'frontend_name': row.get('pxname', 'Unknown'), 'frontend_name': row.get('pxname', 'Unknown'),
'server_name': row.get('svname', 'Unknown'), 'server_name': row.get('svname', 'Unknown'),
'4xx_errors': hrsp_4xx, '4xx_errors': hrsp_4xx,
'5xx_errors': hrsp_5xx, '5xx_errors': hrsp_5xx,
'bytes_in_mb': bytes_in_mb, 'bytes_in_mb': bytes_in_mb, # ✅ Float
'bytes_out_mb': bytes_out_mb, 'bytes_out_mb': bytes_out_mb, # ✅ Float
'conn_tot': conn_tot, # ✅ Teraz INT 'conn_tot': conn_tot, # ✅ Int
}) })
return data return data