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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
fab7dacc
Commit
fab7dacc
authored
Jul 25, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates CE backport
parent
f7abde93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
lib/gitlab/prometheus/metric.rb
lib/gitlab/prometheus/metric.rb
+1
-1
lib/gitlab/prometheus/queries/query_additional_metrics.rb
lib/gitlab/prometheus/queries/query_additional_metrics.rb
+5
-1
spec/models/clusters/applications/prometheus_spec.rb
spec/models/clusters/applications/prometheus_spec.rb
+6
-6
No files found.
lib/gitlab/prometheus/metric.rb
View file @
fab7dacc
...
@@ -3,7 +3,7 @@ module Gitlab
...
@@ -3,7 +3,7 @@ module Gitlab
class
Metric
class
Metric
include
ActiveModel
::
Model
include
ActiveModel
::
Model
attr_accessor
:title
,
:required_metrics
,
:weight
,
:y_label
,
:queries
attr_accessor
:
id
,
:
title
,
:required_metrics
,
:weight
,
:y_label
,
:queries
validates
:title
,
:required_metrics
,
:weight
,
:y_label
,
:queries
,
presence:
true
validates
:title
,
:required_metrics
,
:weight
,
:y_label
,
:queries
,
presence:
true
...
...
lib/gitlab/prometheus/queries/query_additional_metrics.rb
View file @
fab7dacc
...
@@ -14,12 +14,16 @@ module Gitlab
...
@@ -14,12 +14,16 @@ module Gitlab
lambda
do
|
group
|
lambda
do
|
group
|
metrics
=
group
.
metrics
.
map
do
|
metric
|
metrics
=
group
.
metrics
.
map
do
|
metric
|
{
metric_hsh
=
{
title:
metric
.
title
,
title:
metric
.
title
,
weight:
metric
.
weight
,
weight:
metric
.
weight
,
y_label:
metric
.
y_label
,
y_label:
metric
.
y_label
,
queries:
metric
.
queries
.
map
(
&
query_processor
).
select
(
&
method
(
:query_with_result
))
queries:
metric
.
queries
.
map
(
&
query_processor
).
select
(
&
method
(
:query_with_result
))
}
}
metric_hsh
[
:id
]
=
metric
.
id
if
metric
.
id
metric_hsh
end
end
{
{
...
...
spec/models/clusters/applications/prometheus_spec.rb
View file @
fab7dacc
...
@@ -41,37 +41,37 @@ describe Clusters::Applications::Prometheus do
...
@@ -41,37 +41,37 @@ describe Clusters::Applications::Prometheus do
it
'returns true when installed'
do
it
'returns true when installed'
do
application
=
build
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
application
=
build
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
expect
(
application
.
ready?
).
to
be
true
expect
(
application
).
to
be_ready
end
end
it
'returns false when not_installable'
do
it
'returns false when not_installable'
do
application
=
build
(
:clusters_applications_prometheus
,
:not_installable
,
cluster:
cluster
)
application
=
build
(
:clusters_applications_prometheus
,
:not_installable
,
cluster:
cluster
)
expect
(
application
.
ready?
).
to
be
false
expect
(
application
).
not_to
be_ready
end
end
it
'returns false when installable'
do
it
'returns false when installable'
do
application
=
build
(
:clusters_applications_prometheus
,
:installable
,
cluster:
cluster
)
application
=
build
(
:clusters_applications_prometheus
,
:installable
,
cluster:
cluster
)
expect
(
application
.
ready?
).
to
be
false
expect
(
application
).
not_to
be_ready
end
end
it
'returns false when scheduled'
do
it
'returns false when scheduled'
do
application
=
build
(
:clusters_applications_prometheus
,
:scheduled
,
cluster:
cluster
)
application
=
build
(
:clusters_applications_prometheus
,
:scheduled
,
cluster:
cluster
)
expect
(
application
.
ready?
).
to
be
false
expect
(
application
).
not_to
be_ready
end
end
it
'returns false when installing'
do
it
'returns false when installing'
do
application
=
build
(
:clusters_applications_prometheus
,
:installing
,
cluster:
cluster
)
application
=
build
(
:clusters_applications_prometheus
,
:installing
,
cluster:
cluster
)
expect
(
application
.
ready?
).
to
be
false
expect
(
application
).
not_to
be_ready
end
end
it
'returns false when errored'
do
it
'returns false when errored'
do
application
=
build
(
:clusters_applications_prometheus
,
:errored
,
cluster:
cluster
)
application
=
build
(
:clusters_applications_prometheus
,
:errored
,
cluster:
cluster
)
expect
(
application
.
ready?
).
to
be
false
expect
(
application
).
not_to
be_ready
end
end
end
end
...
...
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