fix: correlate log alert recovery lifecycle
This commit is contained in:
@@ -38,6 +38,7 @@ type AlertReceiveBody struct {
|
||||
Labels map[string]string `json:"labels"`
|
||||
Agent string `json:"agent"`
|
||||
PolicyID uint `json:"policy_id"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
SourceEventKey string `json:"source_event_key"`
|
||||
TraceID string `json:"trace_id"`
|
||||
@@ -104,6 +105,9 @@ func forwardAlert(body AlertReceiveBody) error {
|
||||
(details.Status != "firing" && details.Status != "resolved") || !validFingerprint(details.Fingerprint) {
|
||||
return fmt.Errorf("Alert 响应缺少完整写入结果,无法确认转发成功;请稍后重试")
|
||||
}
|
||||
if body.Fingerprint != "" && details.Fingerprint != body.Fingerprint {
|
||||
return fmt.Errorf("Alert 返回的告警指纹与请求不一致;请稍后重试")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user