Skip to content

Commit

Permalink
Add alert_id field to CreatedAlertPayload and update notification han…
Browse files Browse the repository at this point in the history
…dling (#383)
  • Loading branch information
taylorwalton authored Dec 19, 2024
1 parent e40f447 commit c6e8afd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/app/incidents/schema/incident_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class CreatedAlertPayload(BaseModel):
source: str
index_name: Optional[str] = None
index_id: Optional[str] = None
alert_id: Optional[int] = None


class CreatedCaseNotificationPayload(BaseModel):
Expand Down
2 changes: 2 additions & 0 deletions backend/app/incidents/services/incident_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ async def handle_customer_notifications(
"customer_code": customer_code,
"alert_context_payload": alert_payload.alert_context_payload,
"alert_title": alert_payload.alert_title_payload,
"alert_id": alert_payload.alert_id,
},
start="",
),
Expand Down Expand Up @@ -534,6 +535,7 @@ async def create_alert_full(alert_payload: CreatedAlertPayload, customer_code: s
f"Creating alert for customer code {customer_code} with alert context ID {alert_context_id} and asset ID {asset_id} and ioc ID {ioc_id}",
)
logger.info(f"Creating alert for customer code {customer_code} with alert context ID {alert_context_id} and asset ID {asset_id}")
alert_payload.alert_id = alert_id
await handle_customer_notifications(customer_code=customer_code, alert_payload=alert_payload, session=session)

await add_alert_to_document(CreateAlertRequest(index_name=alert_payload.index_name, alert_id=alert_payload.index_id), alert_id)
Expand Down

0 comments on commit c6e8afd

Please sign in to comment.