diff options
Diffstat (limited to 'lib/gitlab/stack_prof.rb')
-rw-r--r-- | lib/gitlab/stack_prof.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/stack_prof.rb b/lib/gitlab/stack_prof.rb index 97f52491e9e..9fc4798ffdc 100644 --- a/lib/gitlab/stack_prof.rb +++ b/lib/gitlab/stack_prof.rb @@ -75,20 +75,20 @@ module Gitlab current_timeout_s = nil else mode = ENV['STACKPROF_MODE']&.to_sym || DEFAULT_MODE - interval = ENV['STACKPROF_INTERVAL']&.to_i - interval ||= (mode == :object ? DEFAULT_INTERVAL_EVENTS : DEFAULT_INTERVAL_US) + stackprof_interval = ENV['STACKPROF_INTERVAL']&.to_i + stackprof_interval ||= interval(mode) log_event( 'starting profile', profile_mode: mode, - profile_interval: interval, + profile_interval: stackprof_interval, profile_timeout: timeout_s ) ::StackProf.start( mode: mode, raw: Gitlab::Utils.to_boolean(ENV['STACKPROF_RAW'] || 'true'), - interval: interval + interval: stackprof_interval ) current_timeout_s = timeout_s end @@ -131,5 +131,9 @@ module Gitlab pid: Process.pid }.merge(labels.compact)) end + + def self.interval(mode) + mode == :object ? DEFAULT_INTERVAL_EVENTS : DEFAULT_INTERVAL_US + end end end |