Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Cobb <rcobb@gitlab.com>2019-05-20 22:36:59 +0300
committerRyan Cobb <rcobb@gitlab.com>2019-05-20 22:36:59 +0300
commit9eeedfccbcbaa98265597a964cdf895f27fcf68b (patch)
tree0b9dd1e1ea736c938228de8ef8f8437d0a13ff9d /lib/gitlab/metrics/system.rb
parent4063b7e811050c0870d782072664673e16eafdfe (diff)
Adds ruby and unicorn instrumentation
This adds ruby and unicorn instrumentation. This was originally intended in 11.11 but due to performance concerns it was reverted. This new commit foregoes the sys-proctable gem was causing performance issues previously.
Diffstat (limited to 'lib/gitlab/metrics/system.rb')
-rw-r--r--lib/gitlab/metrics/system.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb
index 426496855e3..d3cbd200584 100644
--- a/lib/gitlab/metrics/system.rb
+++ b/lib/gitlab/metrics/system.rb
@@ -23,6 +23,20 @@ module Gitlab
def self.file_descriptor_count
Dir.glob('/proc/self/fd/*').length
end
+
+ def self.max_open_file_descriptors
+ match = File.read('/proc/self/limits').match(/Max open files\s*(\d+)/)
+
+ return unless match && match[1]
+
+ match[1].to_i
+ end
+
+ def self.process_start_time
+ fields = File.read('/proc/self/stat').split
+
+ ( fields[21].to_i || 0 ) / clk_tck
+ end
else
def self.memory_usage
0.0
@@ -31,6 +45,14 @@ module Gitlab
def self.file_descriptor_count
0
end
+
+ def self.max_open_file_descriptors
+ 0
+ end
+
+ def self.process_start_time
+ 0
+ end
end
# THREAD_CPUTIME is not supported on OS X
@@ -59,6 +81,10 @@ module Gitlab
def self.monotonic_time
Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second)
end
+
+ def self.clk_tck
+ @clk_tck ||= `genconf CLK_TCK`.to_i
+ end
end
end
end