Commit 9936ae26 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Measure Gitaly migration sites against original

We were missing data for Gitaly migration call sites against the
original implementation. This commit adds a histogram with a flag
telling us if gitaly received the call or the original implementation
did.
parent 01340794
...@@ -34,10 +34,11 @@ module Gitlab ...@@ -34,10 +34,11 @@ module Gitlab
private_constant :MUTEX private_constant :MUTEX
class << self class << self
attr_accessor :query_time attr_accessor :query_time, :migrate_histogram
end end
self.query_time = 0 self.query_time = 0
self.migrate_histogram = Gitlab::Metrics.histogram(:gitaly_migrate_call_duration, "Gitaly migration call execution timings")
def self.stub(name, storage) def self.stub(name, storage)
MUTEX.synchronize do MUTEX.synchronize do
...@@ -171,8 +172,11 @@ module Gitlab ...@@ -171,8 +172,11 @@ module Gitlab
feature_stack = Thread.current[:gitaly_feature_stack] ||= [] feature_stack = Thread.current[:gitaly_feature_stack] ||= []
feature_stack.unshift(feature) feature_stack.unshift(feature)
begin begin
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield is_enabled yield is_enabled
ensure ensure
total_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
migrate_histogram.observe({ gitaly_enabled: is_enabled, feature: feature }, total_time)
feature_stack.shift feature_stack.shift
Thread.current[:gitaly_feature_stack] = nil if feature_stack.empty? Thread.current[:gitaly_feature_stack] = nil if feature_stack.empty?
end end
......
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