Simplify live dashboard and warn on memory target [skip ci]
myfileagent-python-ci/pipeline/head This commit looks good

This commit is contained in:
Codex Agent
2026-11-28 20:58:48 +00:00
parent 1bb4e0a9dd
commit d118a677e0
11 changed files with 524 additions and 231 deletions
+8 -1
View File
@@ -320,10 +320,17 @@ def metrics(review, output, completed_at):
rows += [f'review_duration_seconds{{mode="live"}} {elapsed}']
resource = data.get('resource_measurement', {})
for field, metric in [('memory_peak_bytes', 'review_job_memory_peak_bytes'),
('memory_limit_bytes', 'review_job_memory_limit_bytes')]:
('memory_limit_bytes', 'review_job_memory_limit_bytes'),
('memory_target_bytes', 'review_job_memory_target_bytes')]:
value = resource.get(field)
if type(value) is int and value > 0:
rows += [f'{metric}{{mode="live"}} {value}']
exceeded = resource.get('memory_target_exceeded')
if type(exceeded) is bool:
peak, target = resource.get('memory_peak_bytes'), resource.get('memory_target_bytes')
if type(peak) is not int or type(target) is not int or exceeded != (peak > target):
raise ValueError('Memory target warning disagrees with measured peak')
rows += [f'review_job_memory_target_exceeded{{mode="live"}} {int(exceeded)}']
if not re.fullmatch('[0-9]+', str(completed_at)):
raise ValueError('Completion timestamp must be measured epoch seconds')
rows += [f'review_completed_timestamp_seconds{{mode="live"}} {completed_at}']