diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-04 18:12:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-04 18:12:14 +0300 |
commit | e9ab4187093f05b873b32045295eeb580c97cdce (patch) | |
tree | 74f41f843e6addc0e17d4da877366f90e7f2fc68 /lib/gitlab/stack_prof.rb | |
parent | 0327ce54a7e315b3aa6f80cc4e540fbb6792f2e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
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 |