From 77d0fe784fa3fbb2bc7577faabbcdcd022c1d55e Mon Sep 17 00:00:00 2001 From: OG T Date: Tue, 31 Mar 2026 11:14:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20AnomalyFrequency.model=5Fdump()=20?= =?UTF-8?q?=E2=86=92=20to=5Fdict()=20(dataclass=20=E9=9D=9E=20Pydantic)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2026-03-31 ogt: AnomalyFrequency 是 @dataclass,沒有 model_dump() 方法 Co-Authored-By: Claude Opus 4.5 --- apps/api/src/api/v1/signoz_webhook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/api/v1/signoz_webhook.py b/apps/api/src/api/v1/signoz_webhook.py index 289dcaf6..f9d136fe 100644 --- a/apps/api/src/api/v1/signoz_webhook.py +++ b/apps/api/src/api/v1/signoz_webhook.py @@ -151,7 +151,8 @@ async def process_signoz_alert( "error_type": labels.get("error_type", severity), } frequency = await anomaly_counter.record_anomaly(anomaly_signature) - anomaly_frequency = frequency.model_dump() if frequency else None + # 2026-03-31 ogt: AnomalyFrequency 是 dataclass,使用 to_dict() 而非 model_dump() + anomaly_frequency = frequency.to_dict() if frequency else None logger.info( "signoz_anomaly_recorded",