Commit 58a79089 authored by James Lopez's avatar James Lopez

Merge branch 'sy-improve-generic-alert-system-note' into 'master'

Include alert source in system note if available

See merge request gitlab-org/gitlab!42631
parents 0cd08998 45ba9d18
......@@ -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