Commit 45ba9d18 authored by syasonik's avatar syasonik

Include alert source in system note if available

parent b19da3b1
...@@ -66,7 +66,10 @@ module Projects ...@@ -66,7 +66,10 @@ module Projects
return unless alert.save return unless alert.save
alert.execute_services alert.execute_services
SystemNoteService.create_new_alert(alert, 'Generic Alert Endpoint') SystemNoteService.create_new_alert(
alert,
alert.monitoring_tool || 'Generic Alert Endpoint'
)
end end
def process_incident_issues def process_incident_issues
......
---
title: Include monitoring tool from payload in system note for alert creation
merge_request: 42631
author:
type: changed
...@@ -89,6 +89,7 @@ RSpec.describe Projects::Alerting::NotifyService do ...@@ -89,6 +89,7 @@ RSpec.describe Projects::Alerting::NotifyService do
it 'creates a system note corresponding to alert creation' do it 'creates a system note corresponding to alert creation' do
expect { subject }.to change(Note, :count).by(1) expect { subject }.to change(Note, :count).by(1)
expect(Note.last.note).to include(payload_raw.fetch(:monitoring_tool))
end end
context 'existing alert with same fingerprint' do context 'existing alert with same fingerprint' do
...@@ -193,6 +194,11 @@ RSpec.describe Projects::Alerting::NotifyService do ...@@ -193,6 +194,11 @@ RSpec.describe Projects::Alerting::NotifyService do
environment_id: nil environment_id: nil
) )
end end
it 'creates a system note corresponding to alert creation' do
expect { subject }.to change(Note, :count).by(1)
expect(Note.last.note).to include('Generic Alert Endpoint')
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment