Commit 45ba9d18 authored by syasonik's avatar syasonik

Include alert source in system note if available

parent b19da3b1
......@@ -66,7 +66,10 @@ module Projects
return unless alert.save
alert.execute_services
SystemNoteService.create_new_alert(alert, 'Generic Alert Endpoint')
SystemNoteService.create_new_alert(
alert,
alert.monitoring_tool || 'Generic Alert Endpoint'
)
end
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
it 'creates a system note corresponding to alert creation' do
expect { subject }.to change(Note, :count).by(1)
expect(Note.last.note).to include(payload_raw.fetch(:monitoring_tool))
end
context 'existing alert with same fingerprint' do
......@@ -193,6 +194,11 @@ RSpec.describe Projects::Alerting::NotifyService do
environment_id: nil
)
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
......
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