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
138a5577
Commit
138a5577
authored
May 19, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove prometheus sampler
parent
0f405043
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
51 deletions
+0
-51
lib/gitlab/metrics/prometheus_sampler.rb
lib/gitlab/metrics/prometheus_sampler.rb
+0
-51
No files found.
lib/gitlab/metrics/prometheus_sampler.rb
deleted
100644 → 0
View file @
0f405043
module
Gitlab
module
Metrics
# Class that sends certain metrics to InfluxDB at a specific interval.
#
# This class is used to gather statistics that can't be directly associated
# with a transaction such as system memory usage, garbage collection
# statistics, etc.
class
PrometheusSamples
# interval - The sampling interval in seconds.
def
initialize
(
interval
=
Metrics
.
settings
[
:sample_interval
])
interval_half
=
interval
.
to_f
/
2
@interval
=
interval
@interval_steps
=
(
-
interval_half
..
interval_half
).
step
(
0.1
).
to_a
end
def
start
Thread
.
new
do
Thread
.
current
.
abort_on_exception
=
true
loop
do
sleep
(
sleep_interval
)
sample
end
end
end
def
sidekiq?
Sidekiq
.
server?
end
# Returns the sleep interval with a random adjustment.
#
# The random adjustment is put in place to ensure we:
#
# 1. Don't generate samples at the exact same interval every time (thus
# potentially missing anything that happens in between samples).
# 2. Don't sample data at the same interval two times in a row.
def
sleep_interval
while
step
=
@interval_steps
.
sample
if
step
!=
@last_step
@last_step
=
step
return
@interval
+
@last_step
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