Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b69e3a04
Commit
b69e3a04
authored
Jul 30, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename some variables
- Prevent extra SQL query - Fix spelling error
parent
6b5c7c91
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
app/services/alert_management/process_prometheus_alert_service.rb
...ices/alert_management/process_prometheus_alert_service.rb
+7
-7
spec/factories/alert_management/alerts.rb
spec/factories/alert_management/alerts.rb
+1
-1
spec/services/alert_management/process_prometheus_alert_service_spec.rb
...alert_management/process_prometheus_alert_service_spec.rb
+1
-1
No files found.
app/services/alert_management/process_prometheus_alert_service.rb
View file @
b69e3a04
...
...
@@ -35,7 +35,7 @@ module AlertManagement
create_alert_management_alert
end
create_inciden
t
process_incident_aler
t
end
def
reset_alert_management_alert_status
...
...
@@ -49,16 +49,17 @@ module AlertManagement
end
def
create_alert_management_alert
am_alert
=
AlertManagement
::
Alert
.
new
(
am_alert_params
.
merge
(
ended_at:
nil
))
if
am_alert
.
save
am_alert
.
execute_services
new_alert
=
AlertManagement
::
Alert
.
new
(
am_alert_params
.
merge
(
ended_at:
nil
))
if
new_alert
.
save
new_alert
.
execute_services
@am_alert
=
new_alert
return
end
logger
.
warn
(
message:
'Unable to create AlertManagement::Alert'
,
project_id:
project
.
id
,
alert_errors:
am
_alert
.
errors
.
messages
alert_errors:
new
_alert
.
errors
.
messages
)
end
...
...
@@ -91,8 +92,7 @@ module AlertManagement
SystemNoteService
.
auto_resolve_prometheus_alert
(
issue
,
project
,
User
.
alert_bot
)
if
issue
.
reset
.
closed?
end
def
create_incident
clear_memoization
(
:am_alert
)
if
am_alert
.
blank?
def
process_incident_alert
return
unless
am_alert
return
if
am_alert
.
issue
...
...
spec/factories/alert_management/alerts.rb
View file @
b69e3a04
...
...
@@ -105,7 +105,7 @@ FactoryBot.define do
{
annotations:
{
title:
'This is a prometheus error'
,
summary:
'Summary of the er
or
r'
,
summary:
'Summary of the er
ro
r'
,
description:
'Description of the error'
},
startsAt:
started_at
...
...
spec/services/alert_management/process_prometheus_alert_service_spec.rb
View file @
b69e3a04
...
...
@@ -84,7 +84,7 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
context
'when alert can be created'
do
it_behaves_like
'creates an alert management alert'
it
'
creates an incident issue
'
do
it
'
processes the incident alert
'
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
to
receive
(
:perform_async
)
.
with
(
nil
,
nil
,
kind_of
(
Integer
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment