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
Léo-Paul Géneau
gitlab-ce
Commits
8270be8a
Commit
8270be8a
authored
Oct 26, 2018
by
Peter Leitzen
Committed by
Mike Greiling
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "No longer require a deploy to start Prometheus monitoring"
parent
91765b80
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
40 deletions
+32
-40
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+6
-2
app/models/environment.rb
app/models/environment.rb
+1
-1
changelogs/unreleased/45068-no-longer-require-a-deploy-to-start-prometheus-monitoring.yml
...onger-require-a-deploy-to-start-prometheus-monitoring.yml
+5
-0
spec/javascripts/monitoring/dashboard_spec.js
spec/javascripts/monitoring/dashboard_spec.js
+16
-0
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+4
-37
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
8270be8a
...
...
@@ -149,7 +149,7 @@ export default {
.
catch
(()
=>
Flash
(
s__
(
'
Metrics|There was an error getting deployment information.
'
))),
this
.
service
.
getEnvironmentsData
()
.
then
(
(
data
)
=>
this
.
store
.
storeEnvironmentsData
(
data
))
.
then
(
data
=>
this
.
store
.
storeEnvironmentsData
(
data
))
.
catch
(()
=>
Flash
(
s__
(
'
Metrics|There was an error getting environments information.
'
))),
])
.
then
(()
=>
{
...
...
@@ -157,6 +157,7 @@ export default {
this
.
state
=
'
noData
'
;
return
;
}
this
.
showEmptyState
=
false
;
})
.
then
(
this
.
resize
)
...
...
@@ -195,7 +196,10 @@ export default {
name=
"chevron-down"
/>
</button>
<div
class=
"dropdown-menu dropdown-menu-selectable dropdown-menu-drop-up"
>
<div
v-if=
"store.environmentsData.length > 0"
class=
"dropdown-menu dropdown-menu-selectable dropdown-menu-drop-up"
>
<ul>
<li
v-for=
"environment in store.environmentsData"
...
...
app/models/environment.rb
View file @
8270be8a
...
...
@@ -149,7 +149,7 @@ class Environment < ActiveRecord::Base
end
def
has_metrics?
prometheus_adapter
&
.
can_query?
&&
available?
&&
last_deployment
.
present?
prometheus_adapter
&
.
can_query?
&&
available?
end
def
metrics
...
...
changelogs/unreleased/45068-no-longer-require-a-deploy-to-start-prometheus-monitoring.yml
0 → 100644
View file @
8270be8a
---
title
:
No longer require a deploy to start Prometheus monitoring
merge_request
:
22401
author
:
type
:
changed
spec/javascripts/monitoring/dashboard_spec.js
View file @
8270be8a
...
...
@@ -113,6 +113,22 @@ describe('Dashboard', () => {
});
});
it
(
'
hides the dropdown list when there is no environments
'
,
done
=>
{
const
component
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
.prometheus-graphs
'
),
propsData
:
{
...
propsData
,
hasMetrics
:
true
,
showPanels
:
false
},
});
component
.
store
.
storeEnvironmentsData
([]);
setTimeout
(()
=>
{
const
dropdownMenuEnvironments
=
component
.
$el
.
querySelectorAll
(
'
.dropdown-menu ul
'
);
expect
(
dropdownMenuEnvironments
.
length
).
toEqual
(
0
);
done
();
});
});
it
(
'
renders the dropdown with a single is-active element
'
,
done
=>
{
const
component
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
.prometheus-graphs
'
),
...
...
spec/models/environment_spec.rb
View file @
8270be8a
...
...
@@ -334,7 +334,7 @@ describe Environment do
describe
'#has_terminals?'
do
subject
{
environment
.
has_terminals?
}
context
'when the enviroment is available'
do
context
'when the enviro
n
ment is available'
do
context
'with a deployment service'
do
shared_examples
'same behavior between KubernetesService and Platform::Kubernetes'
do
context
'and a deployment'
do
...
...
@@ -447,7 +447,7 @@ describe Environment do
describe
'#has_metrics?'
do
subject
{
environment
.
has_metrics?
}
context
'when the enviroment is available'
do
context
'when the enviro
n
ment is available'
do
context
'with a deployment service'
do
let
(
:project
)
{
create
(
:prometheus_project
)
}
...
...
@@ -456,8 +456,8 @@ describe Environment do
it
{
is_expected
.
to
be_truthy
}
end
context
'
but
no deployments'
do
it
{
is_expected
.
to
be_
fals
y
}
context
'
and
no deployments'
do
it
{
is_expected
.
to
be_
truth
y
}
end
end
...
...
@@ -504,39 +504,6 @@ describe Environment do
end
end
describe
'#has_metrics?'
do
subject
{
environment
.
has_metrics?
}
context
'when the enviroment is available'
do
context
'with a deployment service'
do
let
(
:project
)
{
create
(
:prometheus_project
)
}
context
'and a deployment'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
it
{
is_expected
.
to
be_truthy
}
end
context
'but no deployments'
do
it
{
is_expected
.
to
be_falsy
}
end
end
context
'without a monitoring service'
do
it
{
is_expected
.
to
be_falsy
}
end
end
context
'when the environment is unavailable'
do
let
(
:project
)
{
create
(
:prometheus_project
)
}
before
do
environment
.
stop
end
it
{
is_expected
.
to
be_falsy
}
end
end
describe
'#additional_metrics'
do
let
(
:project
)
{
create
(
:prometheus_project
)
}
subject
{
environment
.
additional_metrics
}
...
...
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