Only save Peek session in Redis when Peek is enabled

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2019-07-03 16:02:03 +02:00
parent 96efba34d3
commit eaf58debac
No known key found for this signature in database
GPG key ID: 98DFFD1C0C62B70B
2 changed files with 15 additions and 0 deletions

View file

@ -42,3 +42,6 @@ class PEEK_DB_CLIENT
end
PEEK_DB_VIEW.prepend ::Gitlab::PerformanceBar::PeekQueryTracker
require 'peek/adapters/redis'
Peek::Adapters::Redis.prepend ::Gitlab::PerformanceBar::RedisAdapterWhenPeekEnabled

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
# Adapted from https://github.com/peek/peek/blob/master/lib/peek/adapters/redis.rb
module Gitlab
module PerformanceBar
module RedisAdapterWhenPeekEnabled
def save
super unless ::Peek.request_id.blank?
end
end
end
end