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
0b77441a
Commit
0b77441a
authored
Oct 09, 2019
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Humanize Generic Alert params in AlertPresenter
parent
97e49725
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
ee/app/presenters/projects/prometheus/alert_presenter.rb
ee/app/presenters/projects/prometheus/alert_presenter.rb
+9
-13
ee/spec/presenters/projects/prometheus/alert_presenter_spec.rb
...ec/presenters/projects/prometheus/alert_presenter_spec.rb
+1
-1
No files found.
ee/app/presenters/projects/prometheus/alert_presenter.rb
View file @
0b77441a
...
...
@@ -61,9 +61,9 @@ module Projects
metadata
<<
list_item
(
'Start time'
,
starts_at
)
if
starts_at
metadata
<<
list_item
(
'full_query'
,
backtick
(
full_query
))
if
full_query
metadata
<<
list_item
(
'Service'
,
servic
e
)
if
service
metadata
<<
list_item
(
'Monitoring Tool'
,
monitoring_tool
)
if
monitoring_tool
metadata
<<
list_item
(
'Hosts'
,
host
s
.
join
(
' '
))
if
hosts
metadata
<<
list_item
(
service
.
label
.
humanize
,
service
.
valu
e
)
if
service
metadata
<<
list_item
(
monitoring_tool
.
label
.
humanize
,
monitoring_tool
.
value
)
if
monitoring_tool
metadata
<<
list_item
(
hosts
.
label
.
humanize
,
host_link
s
.
join
(
' '
))
if
hosts
metadata
.
join
(
MARKDOWN_LINE_BREAK
)
end
...
...
@@ -100,18 +100,14 @@ module Projects
"[
#{
title
}
](
#{
url
}
)"
end
def
service
annotations
.
find
{
|
a
|
a
.
label
==
'service'
}.
try
(
:value
)
end
def
monitoring_tool
annotations
.
find
{
|
a
|
a
.
label
==
'monitoring_tool'
}.
try
(
:value
)
GENERIC_ALERT_SUMMARY_ANNOTATIONS
.
each
do
|
annotation_name
|
define_method
(
annotation_name
)
do
annotations
.
find
{
|
a
|
a
.
label
==
annotation_name
}
end
end
def
hosts
if
value
=
annotations
.
find
{
|
a
|
a
.
label
==
'hosts'
}.
try
(
:value
)
Array
(
value
).
map
{
|
host
|
markdown_link
(
host
,
host
)
}
end
def
host_links
Array
(
hosts
.
value
).
map
{
|
host
|
markdown_link
(
host
,
host
)
}
end
end
end
...
...
ee/spec/presenters/projects/prometheus/alert_presenter_spec.rb
View file @
0b77441a
...
...
@@ -115,7 +115,7 @@ describe Projects::Prometheus::AlertPresenter do
**Start time:**
#{
presenter
.
starts_at
}#{
markdown_line_break
}
**Service:** service_name
#{
markdown_line_break
}
**Monitoring
T
ool:** monitoring_tool_name
#{
markdown_line_break
}
**Monitoring
t
ool:** monitoring_tool_name
#{
markdown_line_break
}
**Hosts:** [http://localhost:3000](http://localhost:3000) [http://localhost:3001](http://localhost:3001)
#### Alert Details
...
...
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