Commit 77ccdceb authored by Bob Van Landuyt's avatar Bob Van Landuyt

Remove transaction memory metrics

This removes the `gitlab_transaction_allocated_memory_bytes`
histogram.

This was measuring the memory before and after a transaction. Which
made sense in a single threaded environment, but it doesn't in a
multithreaded one.

It also had high cardinality.
parent bd874572
...@@ -52,7 +52,6 @@ The following metrics are available: ...@@ -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_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_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_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>_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_<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) | | | `gitlab_transaction_cache_count_total` | Counter | 10.2 | Counter for total Rails cache calls (aggregate) | |
......
...@@ -14,7 +14,6 @@ module Gitlab ...@@ -14,7 +14,6 @@ module Gitlab
THREAD_KEY = :_gitlab_metrics_transaction THREAD_KEY = :_gitlab_metrics_transaction
SMALL_BUCKETS = [0.1, 0.25, 0.5, 1.0, 2.5, 5.0].freeze 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. # The series to store events (e.g. Git pushes) in.
EVENT_SERIES = 'events' EVENT_SERIES = 'events'
...@@ -43,9 +42,6 @@ module Gitlab ...@@ -43,9 +42,6 @@ module Gitlab
@started_at = nil @started_at = nil
@finished_at = nil @finished_at = nil
@memory_before = 0
@memory_after = 0
end end
def duration def duration
...@@ -56,20 +52,14 @@ module Gitlab ...@@ -56,20 +52,14 @@ module Gitlab
System.thread_cpu_duration(@thread_cputime_start) System.thread_cpu_duration(@thread_cputime_start)
end end
def allocated_memory
@memory_after - @memory_before
end
def run def run
Thread.current[THREAD_KEY] = self Thread.current[THREAD_KEY] = self
@memory_before = System.memory_usage_rss
@started_at = System.monotonic_time @started_at = System.monotonic_time
@thread_cputime_start = System.thread_cpu_time @thread_cputime_start = System.thread_cpu_time
yield yield
ensure ensure
@memory_after = System.memory_usage_rss
@finished_at = System.monotonic_time @finished_at = System.monotonic_time
observe(:gitlab_transaction_cputime_seconds, thread_cpu_duration) do observe(:gitlab_transaction_cputime_seconds, thread_cpu_duration) do
...@@ -78,9 +68,6 @@ module Gitlab ...@@ -78,9 +68,6 @@ module Gitlab
observe(:gitlab_transaction_duration_seconds, duration) do observe(:gitlab_transaction_duration_seconds, duration) do
buckets SMALL_BUCKETS buckets SMALL_BUCKETS
end end
observe(:gitlab_transaction_allocated_memory_bytes, allocated_memory * 1024.0) do
buckets BIG_BUCKETS
end
Thread.current[THREAD_KEY] = nil Thread.current[THREAD_KEY] = nil
end end
......
...@@ -28,14 +28,6 @@ RSpec.describe Gitlab::Metrics::Transaction do ...@@ -28,14 +28,6 @@ RSpec.describe Gitlab::Metrics::Transaction do
end end
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 describe '#run' do
it 'yields the supplied block' do it 'yields the supplied block' do
expect { |b| transaction.run(&b) }.to yield_control expect { |b| transaction.run(&b) }.to yield_control
......
...@@ -48,16 +48,6 @@ RSpec.describe Gitlab::Metrics::WebTransaction do ...@@ -48,16 +48,6 @@ RSpec.describe Gitlab::Metrics::WebTransaction do
end end
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 describe '#run' do
include_context 'transaction observe metrics' 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