summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2015-10-13 17:21:15 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2015-10-15 12:05:01 +0200
commit7971ed5daca4bfb1310d6458f323377391a99429 (patch)
treee72e7fe0560228839cde90638a8208f3931ee237
parentfa3d7db39077611703edf7d328e33f0049f5d341 (diff)
downloadgitlab-ce-7971ed5daca4bfb1310d6458f323377391a99429.tar.gz
Added active_record_query_trace
This can be used to track down where queries originate from, regardless of whether they're caused by N+1 problems or not. This can be enabled by setting the environment variable ENABLE_QUERY_TRACE to a non-empty value (e.g. "true").
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock2
-rw-r--r--config/initializers/active_record_query_trace.rb5
3 files changed, 8 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index d3c1fd50e3a..0524803f319 100644
--- a/Gemfile
+++ b/Gemfile
@@ -225,6 +225,7 @@ group :development do
gem 'rack-mini-profiler', '~> 0.9.0', require: false
gem 'rerun', '~> 0.10.0'
gem 'bullet', require: false
+ gem 'active_record_query_trace', require: false
# Better errors handler
gem 'better_errors', '~> 1.0.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 48804dba8ec..ed7ea5bb78b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -17,6 +17,7 @@ GEM
activesupport (= 4.1.12)
builder (~> 3.1)
erubis (~> 2.7.0)
+ active_record_query_trace (1.5)
activemodel (4.1.12)
activesupport (= 4.1.12)
builder (~> 3.1)
@@ -788,6 +789,7 @@ PLATFORMS
DEPENDENCIES
RedCloth (~> 4.2.9)
ace-rails-ap (~> 2.0.1)
+ active_record_query_trace
activerecord-deprecated_finders (~> 1.0.3)
activerecord-session_store (~> 0.1.0)
acts-as-taggable-on (~> 3.4)
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