diff options
Diffstat (limited to 'lib/gitlab/performance_bar/stats.rb')
-rw-r--r-- | lib/gitlab/performance_bar/stats.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/gitlab/performance_bar/stats.rb b/lib/gitlab/performance_bar/stats.rb index 380340b80be..c2a4602fd16 100644 --- a/lib/gitlab/performance_bar/stats.rb +++ b/lib/gitlab/performance_bar/stats.rb @@ -5,6 +5,12 @@ module Gitlab # This class fetches Peek stats stored in redis and logs them in a # structured log (so these can be then analyzed in Kibana) class Stats + IGNORED_BACKTRACE_LOCATIONS = %w[ + ee/lib/ee/peek + lib/peek + lib/gitlab/database + ].freeze + def initialize(redis) @redis = redis end @@ -53,7 +59,8 @@ module Gitlab end def parse_backtrace(backtrace) - return unless match = /(?<filename>.*):(?<filenum>\d+):in `(?<method>.*)'/.match(backtrace.first) + return unless backtrace_row = find_caller(backtrace) + return unless match = /(?<filename>.*):(?<filenum>\d+):in `(?<method>.*)'/.match(backtrace_row) { filename: match[:filename], @@ -65,6 +72,12 @@ module Gitlab } end + def find_caller(backtrace) + backtrace.find do |line| + !line.start_with?(*IGNORED_BACKTRACE_LOCATIONS) + end + end + def logger @logger ||= Gitlab::PerformanceBar::Logger.build end |