Skip to content

Commit d89e033

Browse files
committed
fix: update to return schema.Alert and adjust related logic
1 parent 5a4b09e commit d89e033

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

soc-ai/elastic/alerts.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type AlertCorrelation struct {
7373
Classifications []string
7474
}
7575

76-
func GetRelatedAlerts() ([]schema.GPTAlertResponse, error) {
76+
func GetRelatedAlerts() ([]schema.Alert, error) {
7777
// Debug log
7878
utils.Logger.Info("Getting historical alerts from Elasticsearch")
7979

@@ -82,7 +82,7 @@ func GetRelatedAlerts() ([]schema.GPTAlertResponse, error) {
8282
return nil, fmt.Errorf("error getting historical alerts: %v", err)
8383
}
8484

85-
var alerts []schema.GPTAlertResponse
85+
var alerts []schema.Alert
8686
err = json.Unmarshal(result, &alerts)
8787
if err != nil {
8888
return nil, fmt.Errorf("error unmarshalling alerts: %v", err)
@@ -110,7 +110,7 @@ func FindRelatedAlerts(currentAlert schema.Alert) (*AlertCorrelation, error) {
110110

111111
var alertIDs []string
112112
for _, resp := range historicalResponses {
113-
alertIDs = append(alertIDs, resp.ActivityID)
113+
alertIDs = append(alertIDs, resp.ID)
114114
}
115115

116116
for _, id := range alertIDs {
@@ -123,8 +123,8 @@ func FindRelatedAlerts(currentAlert schema.Alert) (*AlertCorrelation, error) {
123123
correlation.RelatedAlerts = append(correlation.RelatedAlerts, alert)
124124

125125
for _, resp := range historicalResponses {
126-
if resp.ActivityID == alert.ID {
127-
correlation.Classifications = append(correlation.Classifications, resp.Classification)
126+
if resp.ID == alert.ID {
127+
correlation.Classifications = append(correlation.Classifications, resp.Tags...)
128128
break
129129
}
130130
}

0 commit comments

Comments
 (0)