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
66c2a3a8
Commit
66c2a3a8
authored
Jan 16, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix helper methods and document metric builder options
parent
5328584b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
lib/gitlab/metrics/concern.rb
lib/gitlab/metrics/concern.rb
+4
-4
lib/gitlab/metrics/concern/metric_options.rb
lib/gitlab/metrics/concern/metric_options.rb
+9
-0
No files found.
lib/gitlab/metrics/concern.rb
View file @
66c2a3a8
...
...
@@ -65,28 +65,28 @@ module Gitlab
# @param [Symbol] name
# @param [Hash] opts
def
fetch_counter
(
name
,
opts
=
{},
&
block
)
define
_metric
(
:counter
,
name
,
opts
,
&
block
)
fetch
_metric
(
:counter
,
name
,
opts
,
&
block
)
end
# DFetch and/or initialize gauge metric
# @param [Symbol] name
# @param [Hash] opts
def
fetch_gauge
(
name
,
opts
=
{},
&
block
)
define
_metric
(
:counter
,
name
,
opts
,
&
block
)
fetch
_metric
(
:counter
,
name
,
opts
,
&
block
)
end
# Fetch and/or initialize histogram metric
# @param [Symbol] name
# @param [Hash] opts
def
fetch_histogram
(
name
,
opts
=
{},
&
block
)
define
_metric
(
:histogram
,
name
,
opts
,
&
block
)
fetch
_metric
(
:histogram
,
name
,
opts
,
&
block
)
end
# Fetch and/or initialize summary metric
# @param [Symbol] name
# @param [Hash] opts
def
fetch_summary
(
name
,
opts
=
{},
&
block
)
define
_metric
(
:summary
,
name
,
opts
,
&
block
)
fetch
_metric
(
:summary
,
name
,
opts
,
&
block
)
end
# Define metric accessor method for a Counter
...
...
lib/gitlab/metrics/concern/metric_options.rb
View file @
66c2a3a8
...
...
@@ -10,30 +10,39 @@ module Gitlab
@with_feature
=
options
[
:with_feature
]
end
# Documentation describing metric in metrics endpoint '/-/metrics'
def
docstring
(
docstring
=
nil
)
@docstring
=
docstring
unless
docstring
.
nil?
@docstring
end
# Gauge aggregation mode for multiprocess metrics
# - :all (default) returns each gauge for every process
# - :livesum all process'es gauges summed up
# - :max maximum value of per process gauges
# - :min minimum value of per process gauges
def
multiprocess_mode
(
mode
=
nil
)
@multiprocess_mode
=
mode
unless
mode
.
nil?
@multiprocess_mode
end
# Measurement buckets for histograms
def
buckets
(
buckets
=
nil
)
@buckets
=
buckets
unless
buckets
.
nil?
@buckets
end
# Base labels are merged with per metric labels
def
base_labels
(
base_labels
=
nil
)
@base_labels
=
base_labels
unless
base_labels
.
nil?
@base_labels
end
# Use feature toggle to control whether certain metric is enabled/disabled
def
with_feature
(
name
=
nil
)
@feature_name
=
name
unless
name
.
nil?
...
...
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