feat: propagate alert forwarding trace ids

This commit is contained in:
zxr
2026-07-21 17:19:39 +08:00
parent c263825cbc
commit 567dda70c0
3 changed files with 26 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ const (
)
func enqueueAlertWithDB(db *gorm.DB, logEventID uint, body AlertReceiveBody) (uint, error) {
body.TraceID = ensureAlertTraceID(body.TraceID, body.SourceEventKey)
payload, err := json.Marshal(body)
if err != nil {
return 0, err
@@ -193,11 +194,12 @@ func forwardRawEvent(body RawEventIngestBody) error {
if len(body.RawPayload) == 0 {
return fmt.Errorf("raw_payload 不能为空")
}
body.TraceID = ensureAlertTraceID(body.TraceID, body.SourceEventKey)
raw, err := json.Marshal(body)
if err != nil {
return err
}
result, err := postAlertPayload(cfg, "/Alert/v1/raw-events/ingest", raw)
result, err := postAlertPayload(cfg, "/Alert/v1/raw-events/ingest", raw, body.TraceID)
if err != nil {
return err
}