diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /config/initializers/0_marginalia.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-7f049e661d257321a8fa9ac9d5f98ed7494ef266.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'config/initializers/0_marginalia.rb')
-rw-r--r-- | config/initializers/0_marginalia.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/config/initializers/0_marginalia.rb b/config/initializers/0_marginalia.rb index 952dd75886d..ab21f936cd8 100644 --- a/config/initializers/0_marginalia.rb +++ b/config/initializers/0_marginalia.rb @@ -4,17 +4,16 @@ require 'marginalia' ::Marginalia::Comment.extend(::Gitlab::Marginalia::Comment) -# Patch to modify 'Marginalia::ActiveRecordInstrumentation.annotate_sql' method with feature check. -# Orignal Marginalia::ActiveRecordInstrumentation is included to ActiveRecord::ConnectionAdapters::PostgreSQLAdapter in the Marginalia Railtie. -# Refer: https://github.com/basecamp/marginalia/blob/v1.8.0/lib/marginalia/railtie.rb#L67 -ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(Gitlab::Marginalia::ActiveRecordInstrumentation) - # By default, PostgreSQL only tracks the first 1024 bytes of a SQL # query. Prepending the comment allows us to trace the source of the # query without having to increase the `track_activity_query_size` # parameter. -Marginalia::Comment.prepend_comment = true unless Rails.env.test? # Some tests do string matching against raw SQL -Marginalia::Comment.components = [:application, :controller, :action, :correlation_id, :jid, :job_class] +# +# We only enable this in production because a number of tests do string +# matching against the raw SQL, and prepending the comment prevents color +# coding from working in the development log. +Marginalia::Comment.prepend_comment = true if Rails.env.production? +Marginalia::Comment.components = [:application, :controller, :action, :correlation_id, :jid, :job_class, :endpoint_id] # As mentioned in https://github.com/basecamp/marginalia/pull/93/files, # adding :line has some overhead because a regexp on the backtrace has @@ -25,5 +24,3 @@ Marginalia::Comment.components << :line if Rails.env.development? Gitlab::Marginalia.set_application_name Gitlab::Marginalia.enable_sidekiq_instrumentation - -Gitlab::Marginalia.set_enabled_from_feature_flag |