Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-15 15:37:04 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-15 15:37:04 +0300
commitc0a6836be48bdf9a32ac2c9e610f62aef1e2e3f7 (patch)
tree5c4a5a2e8eb5dd612acb575fdc3e5ad68aea19bb /config
parent4b28f2d999eeb936e2e3718e5ea25d3b1020291e (diff)
parent97e02f4bc99d391c5e1dc0ce8e317be105e6d2b0 (diff)
Merge branch 'view-issue-performance'
Diffstat (limited to 'config')
-rw-r--r--config/environments/development.rb2
-rw-r--r--config/initializers/active_record_query_trace.rb5
-rw-r--r--config/initializers/bullet.rb6
-rw-r--r--config/initializers/rack_lineprof.rb31
4 files changed, 43 insertions, 1 deletions
diff --git a/config/environments/development.rb b/config/environments/development.rb
index d7d6aed1602..827a110c249 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -24,7 +24,7 @@ Gitlab::Application.configure do
# Expands the lines which load the assets
# config.assets.debug = true
-
+
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
diff --git a/config/initializers/active_record_query_trace.rb b/config/initializers/active_record_query_trace.rb
new file mode 100644
index 00000000000..4b3c2803b3b
--- /dev/null
+++ b/config/initializers/active_record_query_trace.rb
@@ -0,0 +1,5 @@
+if ENV['ENABLE_QUERY_TRACE']
+ require 'active_record_query_trace'
+
+ ActiveRecordQueryTrace.enabled = 'true'
+end
diff --git a/config/initializers/bullet.rb b/config/initializers/bullet.rb
new file mode 100644
index 00000000000..95e82966c7a
--- /dev/null
+++ b/config/initializers/bullet.rb
@@ -0,0 +1,6 @@
+if ENV['ENABLE_BULLET']
+ require 'bullet'
+
+ Bullet.enable = true
+ Bullet.console = true
+end
diff --git a/config/initializers/rack_lineprof.rb b/config/initializers/rack_lineprof.rb
new file mode 100644
index 00000000000..f0c006d811b
--- /dev/null
+++ b/config/initializers/rack_lineprof.rb
@@ -0,0 +1,31 @@
+# The default colors of rack-lineprof can be very hard to look at in terminals
+# with darker backgrounds. This patch tweaks the colors a bit so the output is
+# actually readable.
+if Rails.env.development? and RUBY_ENGINE == 'ruby' and ENV['ENABLE_LINEPROF']
+ Gitlab::Application.config.middleware.use(Rack::Lineprof)
+
+ module Rack
+ class Lineprof
+ class Sample < Rack::Lineprof::Sample.superclass
+ def format(*)
+ formatted = if level == CONTEXT
+ sprintf " | % 3i %s", line, code
+ else
+ sprintf "% 8.1fms %5i | % 3i %s", ms, calls, line, code
+ end
+
+ case level
+ when CRITICAL
+ color.red formatted
+ when WARNING
+ color.yellow formatted
+ when NOMINAL
+ color.white formatted
+ else # CONTEXT
+ formatted
+ end
+ end
+ end
+ end
+ end
+end