]> git.pld-linux.org Git - packages/gitlab-ce.git/blob - revert-5281.patch
up to 8.11.2
[packages/gitlab-ce.git] / revert-5281.patch
1 revert https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5281
2 hack due https://github.com/ruby-prof/ruby-prof/pull/191
3
4 --- b/Gemfile
5 +++ a/Gemfile
6 @@ -334,8 +334,6 @@
7  
8  gem 'email_reply_parser', '~> 0.5.8'
9  
10 -gem 'ruby-prof', '~> 0.15.9'
11 -
12  ## CI
13  gem 'activerecord-session_store', '~> 1.0.0'
14  gem 'nested_form', '~> 0.3.2'
15 --- b/Gemfile.lock
16 +++ a/Gemfile.lock
17 @@ -620,7 +620,6 @@
18        rubocop (>= 0.40.0)
19      ruby-fogbugz (0.2.1)
20        crack (~> 0.4)
21 -    ruby-prof (0.15.9)
22      ruby-progressbar (1.8.1)
23      ruby-saml (1.3.0)
24        nokogiri (>= 1.5.10)
25 @@ -949,7 +948,6 @@
26    rubocop (~> 0.41.2)
27    rubocop-rspec (~> 1.5.0)
28    ruby-fogbugz (~> 0.2.1)
29 -  ruby-prof (~> 0.15.9)
30    sanitize (~> 2.0)
31    sass-rails (~> 5.0.0)
32    scss_lint (~> 0.47.0)
33 --- b/app/controllers/admin/requests_profiles_controller.rb
34 +++ /dev/null
35 @@ -1,17 +0,0 @@
36 -class Admin::RequestsProfilesController < Admin::ApplicationController
37 -  def index
38 -    @profile_token = Gitlab::RequestProfiler.profile_token
39 -    @profiles      = Gitlab::RequestProfiler::Profile.all.group_by(&:request_path)
40 -  end
41 -
42 -  def show
43 -    clean_name = Rack::Utils.clean_path_info(params[:name])
44 -    profile    = Gitlab::RequestProfiler::Profile.find(clean_name)
45 -
46 -    if profile
47 -      render text: profile.content
48 -    else
49 -      redirect_to admin_requests_profiles_path, alert: 'Profile not found'
50 -    end
51 -  end
52 -end
53 --- b/app/views/admin/background_jobs/_head.html.haml
54 +++ a/app/views/admin/background_jobs/_head.html.haml
55 @@ -16,7 +16,3 @@
56        = link_to admin_health_check_path, title: 'Health Check' do
57          %span
58            Health Check
59 -    = nav_link(controller: :requests_profiles) do
60 -      = link_to admin_requests_profiles_path, title: 'Requests Profiles' do
61 -        %span
62 -          Requests Profiles
63 --- b/app/views/admin/requests_profiles/index.html.haml
64 +++ /dev/null
65 @@ -1,26 +0,0 @@
66 -- @no_container = true
67 -- page_title 'Requests Profiles'
68 -= render 'admin/background_jobs/head'
69 -
70 -%div{ class: container_class }
71 -  %h3.page-title
72 -    = page_title
73 -
74 -  .bs-callout.clearfix
75 -    Pass the header
76 -    %code X-Profile-Token: #{@profile_token}
77 -    to profile the request
78 -
79 -  - if @profiles.present?
80 -    .prepend-top-default
81 -      - @profiles.each do |path, profiles|
82 -        .panel.panel-default.panel-small
83 -          .panel-heading
84 -            %code= path
85 -          %ul.content-list
86 -            - profiles.each do |profile|
87 -              %li
88 -                = link_to profile.time.to_s(:long), admin_requests_profile_path(profile), data: {no_turbolink: true}
89 -  - else
90 -    %p
91 -      No profiles found
92 --- b/app/views/layouts/nav/_admin.html.haml
93 +++ a/app/views/layouts/nav/_admin.html.haml
94 @@ -9,7 +9,7 @@
95        = link_to admin_root_path, title: 'Overview', class: 'shortcuts-tree' do
96          %span
97            Overview
98 +    = nav_link(controller: %w(system_info background_jobs logs health_check)) do
99 -    = nav_link(controller: %w(system_info background_jobs logs health_check requests_profiles)) do
100        = link_to admin_system_info_path, title: 'Monitoring' do
101          %span
102            Monitoring
103 --- b/app/workers/requests_profiles_worker.rb
104 +++ /dev/null
105 @@ -1,9 +0,0 @@
106 -class RequestsProfilesWorker
107 -  include Sidekiq::Worker
108 -
109 -  sidekiq_options queue: :default
110 -
111 -  def perform
112 -    Gitlab::RequestProfiler.remove_all_profiles
113 -  end
114 -end
115 --- gitlabhq-8.11.0/config/initializers/request_profiler.rb     2016-08-22 15:27:22.000000000 +0300
116 +++ /dev/null   2007-02-13 18:29:53.000000000 +0200
117 @@ -1,5 +0,0 @@
118 -require 'gitlab/request_profiler/middleware'
119 -
120 -Rails.application.configure do |config|
121 -  config.middleware.use(Gitlab::RequestProfiler::Middleware)
122 -end
123 --- b/lib/gitlab/request_profiler.rb
124 +++ /dev/null
125 @@ -1,19 +0,0 @@
126 -require 'fileutils'
127 -
128 -module Gitlab
129 -  module RequestProfiler
130 -    PROFILES_DIR = "#{Gitlab.config.shared.path}/tmp/requests_profiles"
131 -
132 -    def profile_token
133 -      Rails.cache.fetch('profile-token') do
134 -        Devise.friendly_token
135 -      end
136 -    end
137 -    module_function :profile_token
138 -
139 -    def remove_all_profiles
140 -      FileUtils.rm_rf(PROFILES_DIR)
141 -    end
142 -    module_function :remove_all_profiles
143 -  end
144 -end
145 --- gitlabhq-8.11.0/lib/gitlab/request_profiler/middleware.rb   2016-08-22 15:27:22.000000000 +0300
146 +++ /dev/null   2007-02-13 18:29:53.000000000 +0200
147 @@ -1,54 +0,0 @@
148 -require 'ruby-prof'
149 -require_dependency 'gitlab/request_profiler'
150 -
151 -module Gitlab
152 -  module RequestProfiler
153 -    class Middleware
154 -      def initialize(app)
155 -        @app = app
156 -      end
157 -
158 -      def call(env)
159 -        if profile?(env)
160 -          call_with_profiling(env)
161 -        else
162 -          @app.call(env)
163 -        end
164 -      end
165 -
166 -      def profile?(env)
167 -        header_token = env['HTTP_X_PROFILE_TOKEN']
168 -        return unless header_token.present?
169 -
170 -        profile_token = RequestProfiler.profile_token
171 -        return unless profile_token.present?
172 -
173 -        header_token == profile_token
174 -      end
175 -
176 -      def call_with_profiling(env)
177 -        ret = nil
178 -        result = RubyProf::Profile.profile do
179 -          ret = catch(:warden) do
180 -            @app.call(env)
181 -          end
182 -        end
183 -
184 -        printer   = RubyProf::CallStackPrinter.new(result)
185 -        file_name = "#{env['PATH_INFO'].tr('/', '|')}_#{Time.current.to_i}.html"
186 -        file_path = "#{PROFILES_DIR}/#{file_name}"
187 -
188 -        FileUtils.mkdir_p(PROFILES_DIR)
189 -        File.open(file_path, 'wb') do |file|
190 -          printer.print(file)
191 -        end
192 -
193 -        if ret.is_a?(Array)
194 -          ret
195 -        else
196 -          throw(:warden, ret)
197 -        end
198 -      end
199 -    end
200 -  end
201 -end
202 --- b/lib/gitlab/request_profiler/profile.rb
203 +++ /dev/null
204 @@ -1,43 +0,0 @@
205 -module Gitlab
206 -  module RequestProfiler
207 -    class Profile
208 -      attr_reader :name, :time, :request_path
209 -
210 -      alias_method :to_param, :name
211 -
212 -      def self.all
213 -        Dir["#{PROFILES_DIR}/*.html"].map do |path|
214 -          new(File.basename(path))
215 -        end
216 -      end
217 -
218 -      def self.find(name)
219 -        name_dup = name.dup
220 -        name_dup << '.html' unless name.end_with?('.html')
221 -
222 -        file_path = "#{PROFILES_DIR}/#{name_dup}"
223 -        return unless File.exist?(file_path)
224 -
225 -        new(name_dup)
226 -      end
227 -
228 -      def initialize(name)
229 -        @name = name
230 -
231 -        set_attributes
232 -      end
233 -
234 -      def content
235 -        File.read("#{PROFILES_DIR}/#{name}")
236 -      end
237 -
238 -      private
239 -
240 -      def set_attributes
241 -        _, path, timestamp = name.split(/(.*)_(\d+)\.html$/)
242 -        @request_path      = path.tr('|', '/')
243 -        @time              = Time.at(timestamp.to_i).utc
244 -      end
245 -    end
246 -  end
247 -end
This page took 0.145325 seconds and 3 git commands to generate.