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
e00f4870
Commit
e00f4870
authored
Jun 22, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where Service `created_at` time was used instead of deployment time.
parent
97c42df3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
app/models/project_services/prometheus_service.rb
app/models/project_services/prometheus_service.rb
+1
-1
spec/models/project_services/prometheus_service_spec.rb
spec/models/project_services/prometheus_service_spec.rb
+5
-2
No files found.
app/models/project_services/prometheus_service.rb
View file @
e00f4870
...
...
@@ -60,7 +60,7 @@ class PrometheusService < MonitoringService
def
deployment_metrics
(
deployment
)
metrics
=
with_reactive_cache
(
Gitlab
::
Prometheus
::
Queries
::
DeploymentQuery
.
name
,
deployment
.
id
,
&
method
(
:rename_data_to_metrics
))
metrics
&
.
merge
(
deployment_time:
created_at
.
to_i
)
||
{}
metrics
&
.
merge
(
deployment_time:
deployment
.
created_at
.
to_i
)
||
{}
end
def
additional_environment_metrics
(
environment
)
...
...
spec/models/project_services/prometheus_service_spec.rb
View file @
e00f4870
...
...
@@ -71,7 +71,7 @@ describe PrometheusService, models: true, caching: true do
end
describe
'#deployment_metrics'
do
let
(
:deployment
)
{
build_stubbed
(
:deployment
)}
let
(
:deployment
)
{
build_stubbed
(
:deployment
)
}
let
(
:deployment_query
)
{
Gitlab
::
Prometheus
::
Queries
::
DeploymentQuery
}
around
do
|
example
|
...
...
@@ -80,13 +80,16 @@ describe PrometheusService, models: true, caching: true do
context
'with valid data'
do
subject
{
service
.
deployment_metrics
(
deployment
)
}
let
(
:fake_deployment_time
)
{
10
}
before
do
stub_reactive_cache
(
service
,
prometheus_data
,
deployment_query
,
deployment
.
id
)
end
it
'returns reactive data'
do
is_expected
.
to
eq
(
prometheus_metrics_data
.
merge
(
deployment_time:
deployment
.
created_at
.
to_i
))
expect
(
deployment
).
to
receive
(
:created_at
).
and_return
(
fake_deployment_time
)
expect
(
subject
).
to
eq
(
prometheus_metrics_data
.
merge
(
deployment_time:
fake_deployment_time
))
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