summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRyan Cobb <rcobb@gitlab.com>2019-04-24 17:05:09 -0600
committerRyan Cobb <rcobb@gitlab.com>2019-04-24 17:05:09 -0600
commitbb27bf4a1c7153f2f5074eb058d8659dd9f198ad (patch)
treea97200488452580d04f50ad16d5ab0d7a26fb95f /spec
parent174a03dfc284781d811df1874ce3cf11d451a8f5 (diff)
downloadgitlab-ce-bb27bf4a1c7153f2f5074eb058d8659dd9f198ad.tar.gz
Update docs and calculate process start time via proc table
This updates monitor docs to reflect the new ruby and unicorn metrics as well as making it so we fetch process start time via the proc table instead of via CLOCK_BOOTTIME
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb6
-rw-r--r--spec/lib/gitlab/metrics/system_spec.rb18
2 files changed, 15 insertions, 9 deletions
diff --git a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
index 0fafcb8e380..aaf8c9fa2a0 100644
--- a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+++ b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
@@ -20,10 +20,10 @@ describe Gitlab::Metrics::Samplers::RubySampler do
sampler.sample
end
- it 'adds a metric containing the memory usage' do
+ it 'adds a metric containing the process resident memory bytes' do
expect(Gitlab::Metrics::System).to receive(:memory_usage).and_return(9000)
- expect(sampler.metrics[:memory_usage]).to receive(:set).with({}, 9000)
+ expect(sampler.metrics[:process_resident_memory_bytes]).to receive(:set).with({}, 9000)
sampler.sample
end
@@ -37,7 +37,7 @@ describe Gitlab::Metrics::Samplers::RubySampler do
sampler.sample
end
- it 'adds a metric containing the processes total cpu time' do
+ it 'adds a metric containing the process total cpu time' do
expect(Gitlab::Metrics::System).to receive(:cpu_time).and_return(0.51)
expect(sampler.metrics[:process_cpu_seconds_total]).to receive(:set).with({}, 0.51)
diff --git a/spec/lib/gitlab/metrics/system_spec.rb b/spec/lib/gitlab/metrics/system_spec.rb
index 2de6821bb79..b0603d96eb2 100644
--- a/spec/lib/gitlab/metrics/system_spec.rb
+++ b/spec/lib/gitlab/metrics/system_spec.rb
@@ -19,6 +19,12 @@ describe Gitlab::Metrics::System do
expect(described_class.max_open_file_descriptors).to be > 0
end
end
+
+ describe '.process_start_time' do
+ it 'returns the process start time' do
+ expect(described_class.process_start_time).to be > 0
+ end
+ end
else
describe '.memory_usage' do
it 'returns 0.0' do
@@ -37,6 +43,12 @@ describe Gitlab::Metrics::System do
expect(described_class.max_open_file_descriptors).to eq(0)
end
end
+
+ describe 'process_start_time' do
+ it 'returns 0' do
+ expect(described_class.process_start_time).to eq(0)
+ end
+ end
end
describe '.cpu_time' do
@@ -56,10 +68,4 @@ describe Gitlab::Metrics::System do
expect(described_class.monotonic_time).to be_an(Float)
end
end
-
- describe '.process_start_time' do
- it 'returns a Float' do
- expect(described_class.process_start_time).to be_an(Float)
- end
- end
end