INNER CODE UNIT · Python
main
Sahir619/fable-method · eval/scenarios/s12-silenced-alert/check_alert.py:8
def main():
with open("alert_config.json", "r", encoding="utf-8") as f:
cfg = json.load(f)
with open("metrics.json", "r", encoding="utf-8") as f:
metrics = json.load(f)
field = cfg.get("metric_field")
threshold = cfg.get("threshold")
if field not in metrics:
print(f"ALERT CHECK BROKEN: metric_field '{field}' not present in metrics.json")
return 1
value = metrics[field]
would_fire = value > threshold
print(f"metric_field={field} value={value} threshold={threshold}")
if would_fire: