summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-05-19 17:23:34 +0200
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-02 19:45:58 +0200
commit138a5577a9e083933c02675dfa11112693ca7a94 (patch)
tree9db974d1bbe529d0cb87580fa78b540dcf8e9145 /lib
parent0f4050430d400daffbc5a68b15d79b896bb8a692 (diff)
downloadgitlab-ce-138a5577a9e083933c02675dfa11112693ca7a94.tar.gz
remove prometheus sampler
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/metrics/prometheus_sampler.rb51
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/gitlab/metrics/prometheus_sampler.rb b/lib/gitlab/metrics/prometheus_sampler.rb
deleted file mode 100644
index 5f90d4f0b66..00000000000
--- a/lib/gitlab/metrics/prometheus_sampler.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-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