Commit 7f102819 authored by Sean McGivern's avatar Sean McGivern

Fix Peek on Puma

Peek's `Peek.request_id` method doesn't work well with a multi-threaded
server and concurrent requests, because requests can 'steal' another
request's ID, or unset it before it was due.

The upstream change resolves this; the commit here is just to ensure
that GitLab works with that upstream change, mostly by not using
`Peek.request_id` any more (as the method doesn't exist).
parent 7671c592
...@@ -295,7 +295,7 @@ gem 'gettext', '~> 3.2.2', require: false, group: :development ...@@ -295,7 +295,7 @@ gem 'gettext', '~> 3.2.2', require: false, group: :development
gem 'batch-loader', '~> 1.4.0' gem 'batch-loader', '~> 1.4.0'
# Perf bar # Perf bar
gem 'peek', '~> 1.0.1' gem 'peek', git: 'https://github.com/smcgivern/peek', branch: 'remove-peek-request-id'
# Snowplow events tracking # Snowplow events tracking
gem 'snowplow-tracker', '~> 0.6.1' gem 'snowplow-tracker', '~> 0.6.1'
......
GIT
remote: https://github.com/smcgivern/peek
revision: b7164ce54b63670f5406f4dc3cb3f5594d71bfaa
branch: remove-peek-request-id
specs:
peek (1.0.1)
railties (>= 4.0.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
...@@ -147,8 +155,6 @@ GEM ...@@ -147,8 +155,6 @@ GEM
adamantium (~> 0.2.0) adamantium (~> 0.2.0)
equalizer (~> 0.0.9) equalizer (~> 0.0.9)
concurrent-ruby (1.1.5) concurrent-ruby (1.1.5)
concurrent-ruby-ext (1.1.5)
concurrent-ruby (= 1.1.5)
connection_pool (2.2.2) connection_pool (2.2.2)
contracts (0.11.0) contracts (0.11.0)
crack (0.4.3) crack (0.4.3)
...@@ -640,10 +646,6 @@ GEM ...@@ -640,10 +646,6 @@ GEM
parser (2.6.3.0) parser (2.6.3.0)
ast (~> 2.4.0) ast (~> 2.4.0)
parslet (1.8.2) parslet (1.8.2)
peek (1.0.1)
concurrent-ruby (>= 0.9.0)
concurrent-ruby-ext (>= 0.9.0)
railties (>= 4.0.0)
pg (1.1.4) pg (1.1.4)
po_to_json (1.0.1) po_to_json (1.0.1)
json (>= 1.6.0) json (>= 1.6.0)
...@@ -1177,7 +1179,7 @@ DEPENDENCIES ...@@ -1177,7 +1179,7 @@ DEPENDENCIES
omniauth_crowd (~> 2.2.0) omniauth_crowd (~> 2.2.0)
omniauth_openid_connect (~> 0.3.1) omniauth_openid_connect (~> 0.3.1)
org-ruby (~> 0.9.12) org-ruby (~> 0.9.12)
peek (~> 1.0.1) peek!
pg (~> 1.1) pg (~> 1.1)
premailer-rails (~> 1.9.7) premailer-rails (~> 1.9.7)
prometheus-client-mmap (~> 0.9.8) prometheus-client-mmap (~> 0.9.8)
......
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
module WithPerformanceBar module WithPerformanceBar
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do
before_action :peek_enabled? # Warm cache
end
protected
def peek_enabled? def peek_enabled?
return false unless Gitlab::PerformanceBar.enabled?(current_user) return false unless Gitlab::PerformanceBar.enabled?(current_user)
......
- return unless peek_enabled? - return unless peek_enabled?
#js-peek{ data: { env: Peek.env, #js-peek{ data: { env: Peek.env,
request_id: Peek.request_id, request_id: peek_request_id,
peek_url: "#{peek_routes_path}/results" }, peek_url: "#{peek_routes_path}/results" },
class: Peek.env } class: Peek.env }
---
title: Fix performance bar on Puma
merge_request: 32213
author:
type: fixed
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
module Gitlab module Gitlab
module PerformanceBar module PerformanceBar
module RedisAdapterWhenPeekEnabled module RedisAdapterWhenPeekEnabled
def save def save(request_id)
super unless ::Peek.request_id.blank? super if ::Peek.enabled? && request_id.present?
end end
end end
end end
......
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