debian-mirror-gitlab/config/initializers/0_marginalia.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
1.3 KiB
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
require 'marginalia'
::Marginalia::Comment.extend(::Gitlab::Marginalia::Comment)
2021-03-11 19:13:27 +05:30
# 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.
2021-04-17 20:07:23 +05:30
#
# 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?
2021-11-11 11:23:49 +05:30
Marginalia::Comment.components = [:application, :correlation_id, :jid, :endpoint_id, :db_config_name]
2020-03-13 15:44:24 +05:30
# As mentioned in https://github.com/basecamp/marginalia/pull/93/files,
# adding :line has some overhead because a regexp on the backtrace has
2022-07-16 23:28:13 +05:30
# to be run on every SQL query. Only enable this in development and test because
2020-03-13 15:44:24 +05:30
# we've seen it slow things down.
2022-07-16 23:28:13 +05:30
if Gitlab.dev_or_test_env?
2021-12-11 22:18:48 +05:30
Marginalia::Comment.components << :line
2022-07-16 23:28:13 +05:30
Marginalia::Comment.lines_to_ignore = Regexp.union(
Gitlab::BacktraceCleaner::IGNORE_BACKTRACES + %w[
lib/ruby/gems/ lib/gem_extensions/ lib/ruby/ lib/gitlab/marginalia/ gems/
])
2021-12-11 22:18:48 +05:30
end
2020-01-01 13:55:28 +05:30
Gitlab::Marginalia.set_application_name
Gitlab::Marginalia.enable_sidekiq_instrumentation