From df7b3a164e357e5c7bfec3745120ce2691d9d9ab Mon Sep 17 00:00:00 2001
From: Sean McGivern <sean@gitlab.com>
Date: Thu, 28 Nov 2019 11:51:13 +0000
Subject: [PATCH] Use upstream Peek again

Peek 1.1.0 contains the change that we had in our gitlab-peek gem, as
well as only saving when the request ID is present.
---
 Gemfile                                                     | 3 +--
 Gemfile.lock                                                | 6 +++---
 .../performance_bar/redis_adapter_when_peek_enabled.rb      | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/Gemfile b/Gemfile
index be3de8c08e7af..de344aaa6620b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -312,8 +312,7 @@ gem 'gettext', '~> 3.2.2', require: false, group: :development
 gem 'batch-loader', '~> 1.4.0'
 
 # Perf bar
-# https://gitlab.com/gitlab-org/gitlab/issues/13996
-gem 'gitlab-peek', '~> 0.0.1', require: 'peek'
+gem 'peek', '~> 1.1'
 
 # Snowplow events tracking
 gem 'snowplow-tracker', '~> 0.6.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index fda4028adec0a..2610ac83b1da0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -373,8 +373,6 @@ GEM
     gitlab-license (1.0.0)
     gitlab-markup (1.7.0)
     gitlab-net-dns (0.9.1)
-    gitlab-peek (0.0.1)
-      railties (>= 4.0.0)
     gitlab-sidekiq-fetcher (0.5.2)
       sidekiq (~> 5)
     gitlab-styles (2.8.0)
@@ -724,6 +722,8 @@ GEM
     parser (2.6.3.0)
       ast (~> 2.4.0)
     parslet (1.8.2)
+    peek (1.1.0)
+      railties (>= 4.0.0)
     pg (1.1.4)
     po_to_json (1.0.1)
       json (>= 1.6.0)
@@ -1201,7 +1201,6 @@ DEPENDENCIES
   gitlab-license (~> 1.0)
   gitlab-markup (~> 1.7.0)
   gitlab-net-dns (~> 0.9.1)
-  gitlab-peek (~> 0.0.1)
   gitlab-sidekiq-fetcher (= 0.5.2)
   gitlab-styles (~> 2.7)
   gitlab_chronic_duration (~> 0.10.6.2)
@@ -1276,6 +1275,7 @@ DEPENDENCIES
   omniauth_crowd (~> 2.2.0)
   omniauth_openid_connect (~> 0.3.3)
   org-ruby (~> 0.9.12)
+  peek (~> 1.1)
   pg (~> 1.1)
   premailer-rails (~> 1.10.3)
   prometheus-client-mmap (~> 0.9.10)
diff --git a/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb b/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
index cddd4f18cc3d8..805283b0f93b5 100644
--- a/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
+++ b/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
@@ -5,7 +5,7 @@ module Gitlab
   module PerformanceBar
     module RedisAdapterWhenPeekEnabled
       def save(request_id)
-        super if ::Gitlab::PerformanceBar.enabled_for_request? && request_id.present?
+        super if ::Gitlab::PerformanceBar.enabled_for_request?
       end
     end
   end
-- 
GitLab