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
1b6ab2df
Commit
1b6ab2df
authored
Jun 05, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove orig file + rubocop cleanup
parent
ffedc52e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
26 deletions
+13
-26
lib/gitlab/prometheus/queries/additional_metrics_deployment_query.rb
...prometheus/queries/additional_metrics_deployment_query.rb
+0
-2
lib/gitlab/prometheus/queries/additional_metrics_query.rb
lib/gitlab/prometheus/queries/additional_metrics_query.rb
+2
-3
lib/gitlab/prometheus_client.rb
lib/gitlab/prometheus_client.rb
+1
-1
spec/db/production/settings.rb.orig
spec/db/production/settings.rb.orig
+0
-16
spec/lib/gitlab/prometheus/queries/matched_metrics_query_spec.rb
...b/gitlab/prometheus/queries/matched_metrics_query_spec.rb
+7
-2
spec/support/prometheus/additional_metrics_shared_examples.rb
.../support/prometheus/additional_metrics_shared_examples.rb
+3
-2
No files found.
lib/gitlab/prometheus/queries/additional_metrics_deployment_query.rb
View file @
1b6ab2df
module
Gitlab::Prometheus::Queries
module
Gitlab::Prometheus::Queries
class
AdditionalMetricsDeploymentQuery
<
AdditionalMetricsQuery
class
AdditionalMetricsDeploymentQuery
<
AdditionalMetricsQuery
def
query
(
deployment_id
)
def
query
(
deployment_id
)
deployment
=
Deployment
.
find_by
(
id:
deployment_id
)
deployment
=
Deployment
.
find_by
(
id:
deployment_id
)
query_context
=
{
query_context
=
{
...
@@ -14,4 +13,3 @@ module Gitlab::Prometheus::Queries
...
@@ -14,4 +13,3 @@ module Gitlab::Prometheus::Queries
end
end
end
end
end
end
lib/gitlab/prometheus/queries/additional_metrics_query.rb
View file @
1b6ab2df
...
@@ -40,11 +40,11 @@ module Gitlab::Prometheus::Queries
...
@@ -40,11 +40,11 @@ module Gitlab::Prometheus::Queries
private
private
def
metric_with_any_queries
(
metric
)
def
metric_with_any_queries
(
metric
)
metric
[
:queries
]
&
.
count
>
0
metric
[
:queries
]
&
.
count
&
.
>
0
end
end
def
group_with_any_metrics
(
group
)
def
group_with_any_metrics
(
group
)
group
[
:metrics
]
&
.
count
>
0
group
[
:metrics
]
&
.
count
&
.
>
0
end
end
def
query_with_result
(
query
)
def
query_with_result
(
query
)
...
@@ -64,7 +64,6 @@ module Gitlab::Prometheus::Queries
...
@@ -64,7 +64,6 @@ module Gitlab::Prometheus::Queries
query_with_result
query_with_result
end
end
def
available_metrics
def
available_metrics
@available_metrics
||=
client_label_values
||
[]
@available_metrics
||=
client_label_values
||
[]
end
end
...
...
lib/gitlab/prometheus_client.rb
View file @
1b6ab2df
...
@@ -29,7 +29,7 @@ module Gitlab
...
@@ -29,7 +29,7 @@ module Gitlab
end
end
end
end
def
label_values
(
name
=
'__name__'
)
def
label_values
(
name
=
'__name__'
)
json_api_get
(
"label/
#{
name
}
/values"
)
json_api_get
(
"label/
#{
name
}
/values"
)
end
end
...
...
spec/db/production/settings.rb.orig
deleted
100644 → 0
View file @
ffedc52e
require 'spec_helper'
describe 'seed production settings', lib: true do
include StubENV
context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do
before do
stub_env('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN', '013456789')
end
it 'writes the token to the database' do
load(File.join(__dir__, '../../../db/fixtures/production/010_settings.rb'))
expect(ApplicationSetting.current.runners_registration_token).to eq('013456789')
end
end
end
spec/lib/gitlab/prometheus/queries/matched_metrics_query_spec.rb
View file @
1b6ab2df
...
@@ -9,6 +9,7 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
...
@@ -9,6 +9,7 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
def
series_info_with_environment
(
*
more_metrics
)
def
series_info_with_environment
(
*
more_metrics
)
%w{metric_a metric_b}
.
concat
(
more_metrics
).
map
{
|
metric_name
|
{
'__name__'
=>
metric_name
,
'environment'
=>
''
}
}
%w{metric_a metric_b}
.
concat
(
more_metrics
).
map
{
|
metric_name
|
{
'__name__'
=>
metric_name
,
'environment'
=>
''
}
}
end
end
let
(
:metric_names
)
{
%w{metric_a metric_b}
}
let
(
:metric_names
)
{
%w{metric_a metric_b}
}
let
(
:series_info_without_environment
)
do
let
(
:series_info_without_environment
)
do
[{
'__name__'
=>
'metric_a'
},
[{
'__name__'
=>
'metric_a'
},
...
@@ -110,7 +111,9 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
...
@@ -110,7 +111,9 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
it
'responds with one metrics as active and no missing requiremens'
do
it
'responds with one metrics as active and no missing requiremens'
do
expect
(
subject
.
query
).
to
eq
([
expect
(
subject
.
query
).
to
eq
([
{
group:
'name'
,
priority:
1
,
active_metrics:
1
,
metrics_missing_requirements:
0
},
{
group:
'name'
,
priority:
1
,
active_metrics:
1
,
metrics_missing_requirements:
0
},
{
group:
'nameb'
,
priority:
1
,
active_metrics:
2
,
metrics_missing_requirements:
0
}])
{
group:
'nameb'
,
priority:
1
,
active_metrics:
2
,
metrics_missing_requirements:
0
}
]
)
end
end
end
end
...
@@ -122,7 +125,9 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
...
@@ -122,7 +125,9 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
it
'responds with one metrics as active and no missing requiremens'
do
it
'responds with one metrics as active and no missing requiremens'
do
expect
(
subject
.
query
).
to
eq
([
expect
(
subject
.
query
).
to
eq
([
{
group:
'name'
,
priority:
1
,
active_metrics:
0
,
metrics_missing_requirements:
1
},
{
group:
'name'
,
priority:
1
,
active_metrics:
0
,
metrics_missing_requirements:
1
},
{
group:
'nameb'
,
priority:
1
,
active_metrics:
0
,
metrics_missing_requirements:
2
}])
{
group:
'nameb'
,
priority:
1
,
active_metrics:
0
,
metrics_missing_requirements:
2
}
]
)
end
end
end
end
end
end
...
...
spec/support/prometheus/additional_metrics_shared_examples.rb
View file @
1b6ab2df
...
@@ -81,7 +81,8 @@ RSpec.shared_examples 'additional metrics query' do
...
@@ -81,7 +81,8 @@ RSpec.shared_examples 'additional metrics query' do
result:
[
result:
[
{
{
metric:
{},
metric:
{},
values:
[[
1488758662.506
,
'0.00002996364761904785'
],
[
1488758722.506
,
'0.00003090239047619091'
]]
}
values:
[[
1488758662.506
,
'0.00002996364761904785'
],
[
1488758722.506
,
'0.00003090239047619091'
]]
}
]
]
}
}
]
]
...
...
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