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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b6d75b29
Commit
b6d75b29
authored
Sep 04, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove common Base Sampler code
parent
f464adaa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
55 deletions
+18
-55
doc/user/project/integrations/prometheus.md
doc/user/project/integrations/prometheus.md
+0
-2
lib/gitlab/metrics/samplers/base_sampler.rb
lib/gitlab/metrics/samplers/base_sampler.rb
+18
-53
No files found.
doc/user/project/integrations/prometheus.md
View file @
b6d75b29
...
@@ -14,8 +14,6 @@ the settings page with a default template. To configure the template, see the
...
@@ -14,8 +14,6 @@ the settings page with a default template. To configure the template, see the
## Requirements
## Requirements
[
supported performance metrics
](
https://docs.gitlab.com/ee/user/project/integrations/prometheus_library/metrics.html
)
Integration with Prometheus requires the following:
Integration with Prometheus requires the following:
1.
GitLab 9.0 or higher
1.
GitLab 9.0 or higher
...
...
lib/gitlab/metrics/samplers/base_sampler.rb
View file @
b6d75b29
...
@@ -2,20 +2,7 @@ require 'logger'
...
@@ -2,20 +2,7 @@ require 'logger'
module
Gitlab
module
Gitlab
module
Metrics
module
Metrics
module
Samplers
module
Samplers
class
BaseSampler
class
BaseSampler
<
Daemon
def
self
.
initialize_instance
(
*
args
)
raise
"
#{
name
}
singleton instance already initialized"
if
@instance
@instance
=
new
(
*
args
)
at_exit
(
&
@instance
.
method
(
:stop
))
@instance
end
def
self
.
instance
@instance
end
attr_reader
:running
# interval - The sampling interval in seconds.
# interval - The sampling interval in seconds.
def
initialize
(
interval
)
def
initialize
(
interval
)
interval_half
=
interval
.
to_f
/
2
interval_half
=
interval
.
to_f
/
2
...
@@ -23,44 +10,7 @@ module Gitlab
...
@@ -23,44 +10,7 @@ module Gitlab
@interval
=
interval
@interval
=
interval
@interval_steps
=
(
-
interval_half
..
interval_half
).
step
(
0.1
).
to_a
@interval_steps
=
(
-
interval_half
..
interval_half
).
step
(
0.1
).
to_a
@mutex
=
Mutex
.
new
super
()
end
def
enabled?
true
end
def
start
return
unless
enabled?
@mutex
.
synchronize
do
return
if
running
@running
=
true
@thread
=
Thread
.
new
do
sleep
(
sleep_interval
)
while
running
safe_sample
sleep
(
sleep_interval
)
end
end
end
end
def
stop
@mutex
.
synchronize
do
return
unless
running
@running
=
false
if
@thread
@thread
.
wakeup
if
@thread
.
alive?
@thread
.
join
@thread
=
nil
end
end
end
end
def
safe_sample
def
safe_sample
...
@@ -90,7 +40,22 @@ module Gitlab
...
@@ -90,7 +40,22 @@ module Gitlab
end
end
end
end
end
end
private
def
start_working
@running
=
true
sleep
(
sleep_interval
)
while
running
safe_sample
end
end
def
stop_working
@running
=
false
end
end
end
end
end
end
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