diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-23 18:09:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-23 18:09:28 +0300 |
commit | c46b011d3f578d2455443dfabf24226c738c8903 (patch) | |
tree | 89107fa4ccf5340dc14a7d0d2f74a0372e56985f /lib/gitlab/performance_bar | |
parent | b38fc20ae0e90d5b1c538a139aa0a7da1b7b5726 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/performance_bar')
-rw-r--r-- | lib/gitlab/performance_bar/stats.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/performance_bar/stats.rb b/lib/gitlab/performance_bar/stats.rb index 380340b80be..4551b206e98 100644 --- a/lib/gitlab/performance_bar/stats.rb +++ b/lib/gitlab/performance_bar/stats.rb @@ -5,6 +5,11 @@ 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 + ].freeze + def initialize(redis) @redis = redis end @@ -53,7 +58,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 +71,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 |