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
ce3d98f7
Commit
ce3d98f7
authored
Sep 04, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static analysis
parent
5646f3f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
db/importers/common_metrics_importer.rb
db/importers/common_metrics_importer.rb
+5
-5
spec/db/importers/common_metrics_importer_spec.rb
spec/db/importers/common_metrics_importer_spec.rb
+1
-1
No files found.
db/importers/common_metrics_importer.rb
View file @
ce3d98f7
...
...
@@ -9,11 +9,11 @@ module Importers
aws_elb:
-
3
,
nginx:
-
4
,
kubernetes:
-
5
,
# custom groups
business:
0
,
response:
1
,
system:
2
,
system:
2
}
scope
:common
,
->
{
where
(
common:
true
)
}
...
...
@@ -38,7 +38,7 @@ module Importers
def
initialize
(
file
=
'config/prometheus/common_metrics.yml'
)
@content
=
YAML
.
load_file
(
file
)
end
def
execute
process_content
do
|
id
,
attributes
|
find_or_build_metric!
(
id
)
...
...
@@ -80,12 +80,12 @@ module Importers
query:
query
[
'query_range'
],
unit:
query
[
'unit'
])
blk
.
call
(
query
[
'id'
],
attributes
)
yield
(
query
[
'id'
],
attributes
)
end
def
find_or_build_metric!
(
id
)
raise
MissingQueryId
unless
id
PrometheusMetric
.
common
.
find_by
(
identifier:
id
)
||
PrometheusMetric
.
new
(
common:
true
,
identifier:
id
)
end
...
...
spec/db/importers/common_metrics_importer_spec.rb
View file @
ce3d98f7
...
...
@@ -118,4 +118,4 @@ describe Importers::CommonMetricsImporter do
end
end
end
end
\ No newline at end of file
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