Commit e1294e95 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'bvl-remove-transaction-memory-metrics' into 'master'

Remove transaction memory metrics

See merge request gitlab-org/gitlab!38358
parents 609d185d 77ccdceb
......@@ -52,7 +52,6 @@ The following metrics are available:
| `gitlab_sql_duration_seconds` | Histogram | 10.2 | SQL execution time, excluding `SCHEMA` operations and `BEGIN` / `COMMIT` | |
| `gitlab_ruby_threads_max_expected_threads` | Gauge | 13.3 | Maximum number of threads expected to be running and performing application work |
| `gitlab_ruby_threads_running_threads` | Gauge | 13.3 | Number of running Ruby threads by name |
| `gitlab_transaction_allocated_memory_bytes` | Histogram | 10.2 | Allocated memory for all transactions (`gitlab_transaction_*` metrics) | |
| `gitlab_transaction_cache_<key>_count_total` | Counter | 10.2 | Counter for total Rails cache calls (per key) | |
| `gitlab_transaction_cache_<key>_duration_total` | Counter | 10.2 | Counter for total time (seconds) spent in Rails cache calls (per key) | |
| `gitlab_transaction_cache_count_total` | Counter | 10.2 | Counter for total Rails cache calls (aggregate) | |
......
......@@ -14,7 +14,6 @@ module Gitlab
THREAD_KEY = :_gitlab_metrics_transaction
SMALL_BUCKETS = [0.1, 0.25, 0.5, 1.0, 2.5, 5.0].freeze
BIG_BUCKETS = [100, 1000, 10000, 100000, 1000000, 10000000].freeze
# The series to store events (e.g. Git pushes) in.
EVENT_SERIES = 'events'
......@@ -43,9 +42,6 @@ module Gitlab
@started_at = nil
@finished_at = nil
@memory_before = 0
@memory_after = 0
end
def duration
......@@ -56,20 +52,14 @@ module Gitlab
System.thread_cpu_duration(@thread_cputime_start)
end
def allocated_memory
@memory_after - @memory_before
end
def run
Thread.current[THREAD_KEY] = self
@memory_before = System.memory_usage_rss
@started_at = System.monotonic_time
@thread_cputime_start = System.thread_cpu_time
yield
ensure
@memory_after = System.memory_usage_rss
@finished_at = System.monotonic_time
observe(:gitlab_transaction_cputime_seconds, thread_cpu_duration) do
......@@ -78,9 +68,6 @@ module Gitlab
observe(:gitlab_transaction_duration_seconds, duration) do
buckets SMALL_BUCKETS
end
observe(:gitlab_transaction_allocated_memory_bytes, allocated_memory * 1024.0) do
buckets BIG_BUCKETS
end
Thread.current[THREAD_KEY] = nil
end
......
......@@ -28,14 +28,6 @@ RSpec.describe Gitlab::Metrics::Transaction do
end
end
describe '#allocated_memory' do
it 'returns the allocated memory in bytes' do
transaction.run { 'a' * 32 }
expect(transaction.allocated_memory).to be_a_kind_of(Numeric)
end
end
describe '#run' do
it 'yields the supplied block' do
expect { |b| transaction.run(&b) }.to yield_control
......
......@@ -48,16 +48,6 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
end
end
describe '#allocated_memory' do
include_context 'transaction observe metrics'
it 'returns the allocated memory in bytes' do
transaction.run { 'a' * 32 }
expect(transaction.allocated_memory).to be_a_kind_of(Numeric)
end
end
describe '#run' do
include_context 'transaction observe metrics'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment