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
aaeda829
Commit
aaeda829
authored
May 30, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Y Label field to yml and responses
parent
c24d20da
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
10 deletions
+6
-10
config/additional_metrics.yml
config/additional_metrics.yml
+1
-0
lib/gitlab/prometheus/metric.rb
lib/gitlab/prometheus/metric.rb
+4
-3
lib/gitlab/prometheus/metrics_sources.rb
lib/gitlab/prometheus/metrics_sources.rb
+0
-7
lib/gitlab/prometheus/queries/additional_metrics_query.rb
lib/gitlab/prometheus/queries/additional_metrics_query.rb
+1
-0
No files found.
config/additional_metrics.yml
View file @
aaeda829
...
...
@@ -2,6 +2,7 @@
priority
:
1
metrics
:
-
title
:
"
Memory
usage"
y_label
:
"
Values"
detect
:
container_memory_usage_bytes
weight
:
1
queries
:
...
...
lib/gitlab/prometheus/metric.rb
View file @
aaeda829
module
Gitlab::Prometheus
class
Metric
attr_reader
:group
,
:title
,
:detect
,
:weight
,
:queries
attr_reader
:group
,
:title
,
:detect
,
:weight
,
:
y_label
,
:
queries
def
initialize
(
group
,
title
,
detect
,
weight
,
queries
=
[])
def
initialize
(
group
,
title
,
detect
,
weight
,
y_label
,
queries
=
[])
@group
=
group
@title
=
title
@detect
=
detect
@weight
=
weight
@y_label
=
y_label
||
'Values'
@queries
=
queries
end
...
...
@@ -14,7 +15,7 @@ module Gitlab::Prometheus
missing_fields
=
[
:title
,
:detect
,
:weight
,
:queries
].
select
{
|
key
|
!
entry
.
has_key?
(
key
)
}
raise
ParsingError
.
new
(
"entry missing required fields
#{
missing_fields
}
"
)
unless
missing_fields
.
empty?
Metric
.
new
(
group
,
entry
[
:title
],
entry
[
:detect
],
entry
[
:weight
],
entry
[
:queries
])
Metric
.
new
(
group
,
entry
[
:title
],
entry
[
:detect
],
entry
[
:weight
],
entry
[
:
y_label
],
entry
[
:
queries
])
end
def
self
.
metrics_from_list
(
group
,
list
)
...
...
lib/gitlab/prometheus/metrics_sources.rb
deleted
100644 → 0
View file @
c24d20da
module
Gitlab::Prometheus
module
MetricsSources
def
self
.
additional_metrics
@additional_metrics
||=
YAML
.
load_file
(
Rails
.
root
.
join
(
'config/additional_metrics.yml'
)).
deep_symbolize_keys
.
freeze
end
end
end
lib/gitlab/prometheus/queries/additional_metrics_query.rb
View file @
aaeda829
...
...
@@ -22,6 +22,7 @@ module Gitlab::Prometheus::Queries
{
title:
metric
.
title
,
weight:
metric
.
weight
,
y_label:
metric
.
y_label
,
queries:
metric
.
queries
.
map
(
&
query_processor
)
}
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