Tune bucket sizes an action labels
This commit is contained in:
parent
aa25586afe
commit
29a1ad1646
4 changed files with 19 additions and 19 deletions
|
@ -9,7 +9,7 @@ module Gitlab
|
|||
:gitlab_method_call_real_duration_seconds,
|
||||
'Method calls real duration',
|
||||
{ action: nil, call_name: nil },
|
||||
[1000, 2000, 5000, 10000, 20000, 50000, 100000, 1000000]
|
||||
[0.1, 0.2, 0.5, 1, 2, 5, 10]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ module Gitlab
|
|||
:gitlab_method_call_cpu_duration_seconds,
|
||||
'Method calls cpu duration',
|
||||
{ action: nil, call_name: nil },
|
||||
[1000, 2000, 5000, 10000, 20000, 50000, 100000, 1000000]
|
||||
[0.1, 0.2, 0.5, 1, 2, 5, 10]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -44,8 +44,8 @@ module Gitlab
|
|||
@call_count += 1
|
||||
|
||||
if above_threshold?
|
||||
self.class.call_real_duration_histogram.observe({ call_name: @name, action: @action }, @real_time)
|
||||
self.class.call_cpu_duration_histogram.observe({ call_name: @name, action: @action }, @cpu_time)
|
||||
self.class.call_real_duration_histogram.observe({ call_name: @name, action: @action }, @real_time / 1000.0)
|
||||
self.class.call_cpu_duration_histogram.observe({ call_name: @name, action: @action }, @cpu_time / 1000.0)
|
||||
end
|
||||
|
||||
retval
|
||||
|
|
|
@ -35,12 +35,6 @@ module Gitlab
|
|||
# Even in the event of an error we want to submit any metrics we
|
||||
# might've gathered up to this point.
|
||||
ensure
|
||||
if env[CONTROLLER_KEY]
|
||||
tag_controller(trans, env)
|
||||
elsif env[ENDPOINT_KEY]
|
||||
tag_endpoint(trans, env)
|
||||
end
|
||||
|
||||
trans.finish
|
||||
end
|
||||
|
||||
|
@ -50,8 +44,14 @@ module Gitlab
|
|||
def transaction_from_env(env)
|
||||
trans = Transaction.new
|
||||
|
||||
trans.set(:request_uri, filtered_path(env))
|
||||
trans.set(:request_method, env['REQUEST_METHOD'])
|
||||
trans.set(:request_uri, filtered_path(env), false)
|
||||
trans.set(:request_method, env['REQUEST_METHOD'], false)
|
||||
|
||||
if env[CONTROLLER_KEY]
|
||||
tag_controller(trans, env)
|
||||
elsif env[ENDPOINT_KEY]
|
||||
tag_endpoint(trans, env)
|
||||
end
|
||||
|
||||
trans
|
||||
end
|
||||
|
|
|
@ -67,7 +67,7 @@ module Gitlab
|
|||
def observe(key, duration)
|
||||
return unless current_transaction
|
||||
|
||||
metric_cache_duration_seconds.observe({ operation: key, action: action }, duration / 1000.1)
|
||||
self.class.metric_cache_duration_seconds.observe({ operation: key, action: action }, duration / 1000.0)
|
||||
current_transaction.increment(:cache_duration, duration, false)
|
||||
current_transaction.increment(:cache_count, 1, false)
|
||||
current_transaction.increment("#{key}_duration".to_sym, duration, false)
|
||||
|
|
|
@ -54,7 +54,7 @@ module Gitlab
|
|||
:gitlab_transaction_allocated_memory_bytes,
|
||||
'Transaction allocated memory bytes',
|
||||
{ action: nil },
|
||||
[500000, 1000000, 2000000, 5000000, 10000000, 20000000, 100000000]
|
||||
[1000, 10000, 20000, 500000, 1000000, 2000000, 5000000, 10000000, 20000000, 100000000]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -70,7 +70,7 @@ module Gitlab
|
|||
@finished_at = System.monotonic_time
|
||||
|
||||
Transaction.metric_transaction_duration_seconds.observe({ action: action }, duration * 1000)
|
||||
Transaction.metric_transaction_allocated_memory_bytes.observe({ action: action }, allocated_memory / 2 ^ 20)
|
||||
Transaction.metric_transaction_allocated_memory_bytes.observe({ action: action }, allocated_memory * 1024.0)
|
||||
|
||||
Thread.current[THREAD_KEY] = nil
|
||||
end
|
||||
|
@ -100,13 +100,13 @@ module Gitlab
|
|||
method
|
||||
end
|
||||
|
||||
def increment(name, value, compat = true)
|
||||
self.class.metric_transaction_counter(name).increment({ action: action }, value) if compat
|
||||
def increment(name, value, use_prometheus = true)
|
||||
self.class.metric_transaction_counter(name).increment({ action: action }, value) if use_prometheus
|
||||
@values[name] += value
|
||||
end
|
||||
|
||||
def set(name, value, compat = true)
|
||||
self.class.metric_transaction_gauge(name).set({ action: action }, value) if compat
|
||||
def set(name, value, use_prometheus = true)
|
||||
self.class.metric_transaction_gauge(name).set({ action: action }, value) if use_prometheus
|
||||
@values[name] = value
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue