Commit 79d2df0d authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch 'fix_pbar' into 'master'

Ignore peek-related backtrace lines

See merge request gitlab-org/gitlab!57208
parents 57b1b32b 624ba327
......@@ -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
......
......@@ -13,6 +13,8 @@
"duration": 1.096,
"sql": "SELECT COUNT(*) FROM ((SELECT \"badges\".* FROM \"badges\" WHERE \"badges\".\"type\" = 'ProjectBadge' AND \"badges\".\"project_id\" = 8)\nUNION\n(SELECT \"badges\".* FROM \"badges\" WHERE \"badges\".\"type\" = 'GroupBadge' AND \"badges\".\"group_id\" IN (SELECT \"namespaces\".\"id\" FROM \"namespaces\" WHERE \"namespaces\".\"type\" = 'Group' AND \"namespaces\".\"id\" = 28))) badges",
"backtrace": [
"ee/lib/ee/peek/views/active_record.rb:11:in `generate_detail'",
"lib/peek/views/active_record.rb:42:in `block in setup_subscribers'",
"lib/gitlab/pagination/offset_pagination.rb:53:in `add_pagination_headers'",
"lib/gitlab/pagination/offset_pagination.rb:15:in `block in paginate'",
"lib/gitlab/pagination/offset_pagination.rb:14:in `tap'",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment