summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-11-23 15:28:37 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2017-11-23 23:33:01 +0100
commit0051b5fbcc3154dacf20b1e89387b9ea55827266 (patch)
tree7f27a93b1aeb9783b34ff53d00942bf08da35aca /lib
parentefe4cab92b1c93b2beb75fc6b4c0dbe0787d301e (diff)
downloadgitlab-ce-0051b5fbcc3154dacf20b1e89387b9ea55827266.tar.gz
Use only real duration to measure method call performance via Prometheus
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/metrics/method_call.rb27
1 files changed, 6 insertions, 21 deletions
diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb
index 03bdb5885a8..518aefa19ee 100644
--- a/lib/gitlab/metrics/method_call.rb
+++ b/lib/gitlab/metrics/method_call.rb
@@ -6,29 +6,15 @@ module Gitlab
BASE_LABELS = { module: nil, method: nil }.freeze
attr_reader :real_time, :cpu_time, :call_count, :labels
- def self.call_real_duration_histogram
- return @call_real_duration_histogram if @call_real_duration_histogram
-
- MUTEX.synchronize do
- @call_real_duration_histogram ||= Gitlab::Metrics.histogram(
- :gitlab_method_call_real_duration_seconds,
- 'Method calls real duration',
- Transaction::BASE_LABELS.merge(BASE_LABELS),
- [0.1, 0.2, 0.5, 1, 2, 5, 10]
- )
- end
- end
-
- def self.call_cpu_duration_histogram
- return @call_cpu_duration_histogram if @call_cpu_duration_histogram
+ def self.call_duration_histogram
+ return @call_duration_histogram if @call_duration_histogram
MUTEX.synchronize do
@call_duration_histogram ||= Gitlab::Metrics.histogram(
- :gitlab_method_call_cpu_duration_seconds,
- 'Method calls cpu duration',
+ :gitlab_method_call_duration_seconds,
+ 'Method calls real duration',
Transaction::BASE_LABELS.merge(BASE_LABELS),
- [0.1, 0.2, 0.5, 1, 2, 5, 10]
- )
+ [0.01, 0.05, 0.1, 0.5, 1])
end
end
@@ -60,8 +46,7 @@ module Gitlab
@call_count += 1
if prometheus_enabled? && above_threshold?
- self.class.call_real_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)
- self.class.call_cpu_duration_histogram.observe(@transaction.labels.merge(labels), cpu_time / 1000.0)
+ self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)
end
retval