Skip to content

Commit 2dcd486

Browse files
committed
Limit the number of recent anomaly explanations in llmalert job to improve performance
1 parent ddf8ca8 commit 2dcd486

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

anomstack/jobs/llmalert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def llmalert(context, df: pd.DataFrame) -> pd.DataFrame:
176176
df_metric["anomaly_timestamp"].notnull()
177177
][["anomaly_timestamp", "anomaly_explanation"]].apply(
178178
lambda x: f"{x[0]}: {x[1]}", axis=1
179-
).sort_values(ascending=False)
179+
).tail(llmalert_recent_n).sort_values(ascending=False)
180180
anomaly_explanations = "\n- ".join(anomaly_explanations)
181181
metric_timestamp_max = df_metric["metric_timestamp"].max()
182182
alert_title = (

0 commit comments

Comments
 (0)