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
f085ec5f
Commit
f085ec5f
authored
Jul 26, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create issue automatically from Prometheus alert
parent
1b7292d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
app/services/alert_management/process_prometheus_alert_service.rb
...ices/alert_management/process_prometheus_alert_service.rb
+10
-0
app/workers/incident_management/process_alert_worker.rb
app/workers/incident_management/process_alert_worker.rb
+5
-1
No files found.
app/services/alert_management/process_prometheus_alert_service.rb
View file @
f085ec5f
...
@@ -34,6 +34,8 @@ module AlertManagement
...
@@ -34,6 +34,8 @@ module AlertManagement
else
else
create_alert_management_alert
create_alert_management_alert
end
end
create_incident
end
end
def
reset_alert_management_alert_status
def
reset_alert_management_alert_status
...
@@ -89,6 +91,14 @@ module AlertManagement
...
@@ -89,6 +91,14 @@ module AlertManagement
SystemNoteService
.
auto_resolve_prometheus_alert
(
issue
,
project
,
User
.
alert_bot
)
if
issue
.
reset
.
closed?
SystemNoteService
.
auto_resolve_prometheus_alert
(
issue
,
project
,
User
.
alert_bot
)
if
issue
.
reset
.
closed?
end
end
def
create_incident
clear_memoization
(
:am_alert
)
if
am_alert
.
blank?
return
unless
am_alert
return
if
am_alert
.
issue
IncidentManagement
::
ProcessAlertWorker
.
new
.
perform
(
nil
,
nil
,
am_alert
.
id
)
end
def
logger
def
logger
@logger
||=
Gitlab
::
AppLogger
@logger
||=
Gitlab
::
AppLogger
end
end
...
...
app/workers/incident_management/process_alert_worker.rb
View file @
f085ec5f
...
@@ -30,7 +30,11 @@ module IncidentManagement
...
@@ -30,7 +30,11 @@ module IncidentManagement
end
end
def
parsed_payload
(
alert
)
def
parsed_payload
(
alert
)
Gitlab
::
Alerting
::
NotificationPayloadParser
.
call
(
alert
.
payload
.
to_h
,
alert
.
project
)
if
alert
.
prometheus?
alert
.
payload
else
Gitlab
::
Alerting
::
NotificationPayloadParser
.
call
(
alert
.
payload
.
to_h
,
alert
.
project
)
end
end
end
def
create_issue_for
(
alert
)
def
create_issue_for
(
alert
)
...
...
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