diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /config/initializers | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'config/initializers')
23 files changed, 142 insertions, 222 deletions
diff --git a/config/initializers/0_acts_as_taggable.rb b/config/initializers/0_acts_as_taggable.rb index 9a92b8f2d18..9f66d970ffd 100644 --- a/config/initializers/0_acts_as_taggable.rb +++ b/config/initializers/0_acts_as_taggable.rb @@ -9,3 +9,7 @@ ActsAsTaggableOn.tags_counter = false # validate that counter cache is disabled raise "Counter cache is not disabled" if ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache] + +ActsAsTaggableOn::Tagging.include IgnorableColumns +ActsAsTaggableOn::Tagging.ignore_column :id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22' +ActsAsTaggableOn::Tagging.ignore_column :taggable_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22' diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 8d5e19afc20..8f4c6492cad 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -216,6 +216,8 @@ Settings.gitlab['impersonation_enabled'] ||= true if Settings.gitlab['impersonat Settings.gitlab['usage_ping_enabled'] = true if Settings.gitlab['usage_ping_enabled'].nil? Settings.gitlab['max_request_duration_seconds'] ||= 57 +Settings.gitlab['display_initial_root_password'] = true if Settings.gitlab['display_initial_root_password'].nil? + Gitlab.ee do Settings.gitlab['mirror_max_delay'] ||= 300 Settings.gitlab['mirror_max_capacity'] ||= 30 @@ -584,7 +586,7 @@ end Gitlab.ee do Settings.cron_jobs['analytics_devops_adoption_create_all_snapshots_worker'] ||= Settingslogic.new({}) - Settings.cron_jobs['analytics_devops_adoption_create_all_snapshots_worker']['cron'] ||= '0 4 * * 0' + Settings.cron_jobs['analytics_devops_adoption_create_all_snapshots_worker']['cron'] ||= '0 0 1 * *' Settings.cron_jobs['analytics_devops_adoption_create_all_snapshots_worker']['job_class'] = 'Analytics::DevopsAdoption::CreateAllSnapshotsWorker' Settings.cron_jobs['active_user_count_threshold_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['active_user_count_threshold_worker']['cron'] ||= '0 12 * * *' @@ -676,9 +678,6 @@ Gitlab.ee do Settings.cron_jobs['sync_seat_link_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['sync_seat_link_worker']['cron'] ||= "#{rand(60)} 3 * * * UTC" Settings.cron_jobs['sync_seat_link_worker']['job_class'] = 'SyncSeatLinkWorker' - Settings.cron_jobs['web_application_firewall_metrics_worker'] ||= Settingslogic.new({}) - Settings.cron_jobs['web_application_firewall_metrics_worker']['cron'] ||= '0 1 * * 0' - Settings.cron_jobs['web_application_firewall_metrics_worker']['job_class'] = 'IngressModsecurityCounterMetricsWorker' Settings.cron_jobs['users_create_statistics_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['users_create_statistics_worker']['cron'] ||= '2 15 * * *' Settings.cron_jobs['users_create_statistics_worker']['job_class'] = 'Users::CreateStatisticsWorker' @@ -688,6 +687,9 @@ Gitlab.ee do Settings.cron_jobs['iterations_update_status_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['iterations_update_status_worker']['cron'] ||= '5 0 * * *' Settings.cron_jobs['iterations_update_status_worker']['job_class'] = 'IterationsUpdateStatusWorker' + Settings.cron_jobs['iterations_generator_worker'] ||= Settingslogic.new({}) + Settings.cron_jobs['iterations_generator_worker']['cron'] ||= '5 0 * * *' + Settings.cron_jobs['iterations_generator_worker']['job_class'] = 'Iterations::Cadences::ScheduleCreateIterationsWorker' Settings.cron_jobs['vulnerability_statistics_schedule_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['vulnerability_statistics_schedule_worker']['cron'] ||= '15 1 * * *' Settings.cron_jobs['vulnerability_statistics_schedule_worker']['job_class'] = 'Vulnerabilities::Statistics::ScheduleWorker' @@ -902,7 +904,6 @@ Settings.webpack.dev_server['https'] ||= false # Settings['monitoring'] ||= Settingslogic.new({}) Settings.monitoring['ip_whitelist'] ||= ['127.0.0.1/8'] -Settings.monitoring['unicorn_sampler_interval'] ||= 10 Settings.monitoring['sidekiq_exporter'] ||= Settingslogic.new({}) Settings.monitoring.sidekiq_exporter['enabled'] ||= false Settings.monitoring.sidekiq_exporter['log_enabled'] ||= false diff --git a/config/initializers/6_labkit_middleware.rb b/config/initializers/6_labkit_middleware.rb new file mode 100644 index 00000000000..9aad1e3f92b --- /dev/null +++ b/config/initializers/6_labkit_middleware.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# partial backport of https://github.com/rails/rails/pull/38169 +# this is in order to be able to re-order rack middlewares. + +unless Rails::Configuration::MiddlewareStackProxy.method_defined?(:move) + module Rails + module Configuration + class MiddlewareStackProxy + def move(*args, &block) + @operations << ->(middleware) { middleware.send(__method__, *args, &block) } + end + ruby2_keywords(:move) if respond_to?(:ruby2_keywords, true) + end + end + end +end + +Rails.application.config.middleware.move(1, ActionDispatch::RequestId) +Rails.application.config.middleware.insert(1, Labkit::Middleware::Rack) diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index a304f861db8..8dee21016f9 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -8,8 +8,6 @@ def prometheus_default_multiproc_dir if Gitlab::Runtime.sidekiq? Rails.root.join('tmp/prometheus_multiproc_dir/sidekiq') - elsif Gitlab::Runtime.unicorn? - Rails.root.join('tmp/prometheus_multiproc_dir/unicorn') elsif Gitlab::Runtime.puma? Rails.root.join('tmp/prometheus_multiproc_dir/puma') else @@ -29,7 +27,7 @@ end Gitlab::Application.configure do |config| # 0 should be Sentry to catch errors in this middleware - config.middleware.insert(1, Gitlab::Metrics::RequestsRackMiddleware) + config.middleware.insert_after(Labkit::Middleware::Rack, Gitlab::Metrics::RequestsRackMiddleware) end Sidekiq.configure_server do |config| @@ -49,9 +47,7 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? ::Prometheus::Client.reinitialize_on_pid_change(force: true) - if Gitlab::Runtime.unicorn? - Gitlab::Metrics::Samplers::UnicornSampler.instance(Settings.monitoring.unicorn_sampler_interval).start - elsif Gitlab::Runtime.puma? + if Gitlab::Runtime.puma? Gitlab::Metrics::Samplers::PumaSampler.instance.start end diff --git a/config/initializers/7_redis.rb b/config/initializers/7_redis.rb index a6025a6dbf0..fe37dfd7579 100644 --- a/config/initializers/7_redis.rb +++ b/config/initializers/7_redis.rb @@ -8,3 +8,4 @@ Gitlab::Redis::Cache.with { nil } Gitlab::Redis::Queues.with { nil } Gitlab::Redis::SharedState.with { nil } +Gitlab::Redis::TraceChunks.with { nil } diff --git a/config/initializers/action_dispatch_journey_formatter.rb b/config/initializers/action_dispatch_journey_formatter.rb deleted file mode 100644 index 108fb2e5012..00000000000 --- a/config/initializers/action_dispatch_journey_formatter.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -# TODO: Eliminate this file when https://github.com/rails/rails/pull/38184 is released. -# Cleanup issue: https://gitlab.com/gitlab-org/gitlab/issues/195841 -ActionDispatch::Journey::Formatter.prepend(Gitlab::Patch::ActionDispatchJourneyFormatter) - -module ActionDispatch - module Journey - module Path - class Pattern - def requirements_for_missing_keys_check - @requirements_for_missing_keys_check ||= requirements.transform_values do |regex| - /\A#{regex}\Z/ - end - end - end - end - end -end diff --git a/config/initializers/action_view.rb b/config/initializers/action_view.rb new file mode 100644 index 00000000000..76171733483 --- /dev/null +++ b/config/initializers/action_view.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file was introduced during upgrading Rails from 5.2 to 6.0. +# This file can be removed when `config.load_defaults 6.0` is introduced. + +# Don't force requests from old versions of IE to be UTF-8 encoded. +Rails.application.config.action_view.default_enforce_utf8 = false diff --git a/config/initializers/active_record_keyset_pagination.rb b/config/initializers/active_record_keyset_pagination.rb new file mode 100644 index 00000000000..f8c2ada5255 --- /dev/null +++ b/config/initializers/active_record_keyset_pagination.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module PaginatorExtension + # This method loads the records for the requested page and returns a keyset paginator object. + def keyset_paginate(cursor: nil, per_page: 20) + Gitlab::Pagination::Keyset::Paginator.new(scope: self.dup, cursor: cursor, per_page: per_page) + end +end + +ActiveSupport.on_load(:active_record) do + ActiveRecord::Relation.include(PaginatorExtension) +end diff --git a/config/initializers/active_record_ping.rb b/config/initializers/active_record_postgresql_adapter.rb index 7088c690a51..14bc7153f44 100644 --- a/config/initializers/active_record_ping.rb +++ b/config/initializers/active_record_postgresql_adapter.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true -# # frozen_string_literal: true - if Gitlab::Utils.to_boolean(ENV['ENABLE_ACTIVERECORD_EMPTY_PING'], default: true) ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(Gitlab::Database::PostgresqlAdapter::EmptyQueryPing) end + +if Gitlab::Utils.to_boolean(ENV['ENABLE_ACTIVERECORD_TYPEMAP_CACHE'], default: true) + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(Gitlab::Database::PostgresqlAdapter::TypeMapCache) +end diff --git a/config/initializers/cluster_events_before_phased_restart.rb b/config/initializers/cluster_events_before_phased_restart.rb index d029adbe363..f84682c1436 100644 --- a/config/initializers/cluster_events_before_phased_restart.rb +++ b/config/initializers/cluster_events_before_phased_restart.rb @@ -7,8 +7,6 @@ # # Follow-up the issue: https://gitlab.com/gitlab-org/gitlab/issues/34107 -if Gitlab::Runtime.puma? - Puma::Cluster.prepend(::Gitlab::Cluster::Mixins::PumaCluster) -elsif Gitlab::Runtime.unicorn? - Unicorn::HttpServer.prepend(::Gitlab::Cluster::Mixins::UnicornHttpServer) -end +return unless Gitlab::Runtime.puma? + +Puma::Cluster.prepend(::Gitlab::Cluster::Mixins::PumaCluster) diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb new file mode 100644 index 00000000000..be4f01f537d --- /dev/null +++ b/config/initializers/flipper.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +Rails.application.configure do + config.flipper.preload = false + config.flipper.memoizer = false +end diff --git a/config/initializers/gitlab_experiment.rb b/config/initializers/gitlab_experiment.rb index a312755f300..055979bb66b 100644 --- a/config/initializers/gitlab_experiment.rb +++ b/config/initializers/gitlab_experiment.rb @@ -5,4 +5,13 @@ Gitlab::Experiment.configure do |config| config.cache = Gitlab::Experiment::Cache::RedisHashStore.new( pool: ->(&block) { Gitlab::Redis::SharedState.with { |redis| block.call(redis) } } ) + + # TODO: This will be deprecated as of v0.6.0, but needs to stay intact for + # actively running experiments until a versioning concept is put in place to + # enable migrating into the new SHA2 strategy. + config.context_hash_strategy = lambda do |source, seed| + source = source.keys + source.values if source.is_a?(Hash) + data = Array(source).map { |v| (v.respond_to?(:to_global_id) ? v.to_global_id : v).to_s } + Digest::MD5.hexdigest(data.unshift(seed).join('|')) + end end diff --git a/config/initializers/global_id.rb b/config/initializers/global_id.rb new file mode 100644 index 00000000000..8f1b8f2aeeb --- /dev/null +++ b/config/initializers/global_id.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +GlobalID.prepend(Gitlab::Patch::GlobalID) diff --git a/config/initializers/hangouts_chat_http_override.rb b/config/initializers/hangouts_chat_http_override.rb index edb31ed53f1..42ffb6f78e1 100644 --- a/config/initializers/hangouts_chat_http_override.rb +++ b/config/initializers/hangouts_chat_http_override.rb @@ -1,28 +1,3 @@ # frozen_string_literal: true -module HangoutsChat - class Sender - class HTTP - module GitlabHTTPOverride - extend ::Gitlab::Utils::Override - - attr_reader :uri - - # see https://github.com/enzinia/hangouts-chat/blob/6a509f61a56e757f8f417578b393b94423831ff7/lib/hangouts_chat/http.rb - override :post - def post(payload) - httparty_response = Gitlab::HTTP.post( - uri, - body: payload.to_json, - headers: { 'Content-Type' => 'application/json' }, - parse: nil # disables automatic response parsing - ) - httparty_response.response - # The rest of the integration expects a Net::HTTP response - end - end - - prepend GitlabHTTPOverride - end - end -end +HangoutsChat::Sender::HTTP.prepend(Gitlab::Patch::HangoutsChatHTTPOverride) diff --git a/config/initializers/labkit_middleware.rb b/config/initializers/labkit_middleware.rb deleted file mode 100644 index 748666b6cd7..00000000000 --- a/config/initializers/labkit_middleware.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -# partial backport of https://github.com/rails/rails/pull/38169 -# this is in order to be able to re-order rack middlewares. - -if ActionDispatch::MiddlewareStack.method_defined?(:move) - warn "`move` is now defined in in ActionDispatch itself: https://github.com/rails/rails/pull/38169, please remove this patch from #{__FILE__}" -else - module ActionDispatch - class MiddlewareStack - def move(target, source) - source_index = assert_index(source, :before) - source_middleware = middlewares.delete_at(source_index) - - target_index = assert_index(target, :before) - middlewares.insert(target_index, source_middleware) - end - end - end -end - -unless Rails::Configuration::MiddlewareStackProxy.method_defined?(:move) - module Rails - module Configuration - class MiddlewareStackProxy - def move(*args, &block) - @operations << ->(middleware) { middleware.send(__method__, *args, &block) } - end - ruby2_keywords(:move) if respond_to?(:ruby2_keywords, true) - end - end - end -end - -Rails.application.config.middleware.move(1, ActionDispatch::RequestId) -Rails.application.config.middleware.insert_after(ActionDispatch::RequestId, Labkit::Middleware::Rack) diff --git a/config/initializers/load_balancing.rb b/config/initializers/load_balancing.rb index 7502a6299ae..f3c977893ba 100644 --- a/config/initializers/load_balancing.rb +++ b/config/initializers/load_balancing.rb @@ -1,25 +1,21 @@ # frozen_string_literal: true -# We need to run this initializer after migrations are done so it doesn't fail on CI +if Gitlab::Database::LoadBalancing.enable? + Gitlab::Database.disable_prepared_statements -Gitlab.ee do - if Gitlab::Database.cached_table_exists?('licenses') - if Gitlab::Database::LoadBalancing.enable? - Gitlab::Database.disable_prepared_statements - - Gitlab::Application.configure do |config| - config.middleware.use(Gitlab::Database::LoadBalancing::RackMiddleware) - end + Gitlab::Application.configure do |config| + config.middleware.use(Gitlab::Database::LoadBalancing::RackMiddleware) + end - Gitlab::Database::LoadBalancing.configure_proxy + Gitlab::Database::LoadBalancing.configure_proxy - # This needs to be executed after fork of clustered processes - Gitlab::Cluster::LifecycleEvents.on_worker_start do - # Service discovery must be started after configuring the proxy, as service - # discovery depends on this. - Gitlab::Database::LoadBalancing.start_service_discovery - end + # This needs to be executed after fork of clustered processes + Gitlab::Cluster::LifecycleEvents.on_worker_start do + # For Host-based LB, we need to re-connect as Rails discards connections on fork + Gitlab::Database::LoadBalancing.configure_proxy - end + # Service discovery must be started after configuring the proxy, as service + # discovery depends on this. + Gitlab::Database::LoadBalancing.start_service_discovery end end diff --git a/config/initializers/macos.rb b/config/initializers/macos.rb index f410af6ed47..1edd6c0a730 100644 --- a/config/initializers/macos.rb +++ b/config/initializers/macos.rb @@ -5,7 +5,7 @@ if /darwin/ =~ RUBY_PLATFORM require 'fiddle' # Dynamically load Foundation.framework, ~implicitly~ initialising - # the Objective-C runtime before any forking happens in Unicorn + # the Objective-C runtime before any forking happens in webserver # # From https://bugs.ruby-lang.org/issues/14009 Fiddle.dlopen '/System/Library/Frameworks/Foundation.framework/Foundation' diff --git a/config/initializers/mailer_retries.rb b/config/initializers/mailer_retries.rb new file mode 100644 index 00000000000..64fb0ffaa55 --- /dev/null +++ b/config/initializers/mailer_retries.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +class ActiveJob::QueueAdapters::SidekiqAdapter + # With Sidekiq 6, we can do something like: + # class ActionMailer::MailDeliveryJob + # sidekiq_options retry: 3 + # end + # + # See https://gitlab.com/gitlab-org/gitlab/-/issues/329430 + raise "Update this monkey patch: #{__FILE__}" unless Sidekiq::VERSION == '5.2.9' + + def enqueue(job) #:nodoc: + # Sidekiq::Client does not support symbols as keys + job.provider_job_id = Sidekiq::Client.push \ + "class" => JobWrapper, + "wrapped" => job.class.to_s, + "queue" => job.queue_name, + "args" => [job.serialize], + "retry" => retry_for(job) + end + + def enqueue_at(job, timestamp) #:nodoc: + job.provider_job_id = Sidekiq::Client.push \ + "class" => JobWrapper, + "wrapped" => job.class.to_s, + "queue" => job.queue_name, + "args" => [job.serialize], + "at" => timestamp, + "retry" => retry_for(job) + end + + private + + def retry_for(job) + if job.queue_name == 'mailers' + 3 + else + true + end + end +end diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index 85bfc4f0214..6fd92865731 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -15,9 +15,15 @@ Peek.into Peek::Views::Elasticsearch Peek.into Peek::Views::Rugged Peek.into Peek::Views::ExternalHttp Peek.into Peek::Views::BulletDetailed if defined?(Bullet) +Peek.into Peek::Views::Memory Peek.into Peek::Views::Tracing if Labkit::Tracing.tracing_url_enabled? +# Trigger view creation here, since views might be subscribing to Rails notifications +# via setup_subscribers, which is called in the initializer. +# See https://github.com/peek/peek/blob/master/lib/peek/views/view.rb +Peek.views + ActiveSupport::Notifications.subscribe('endpoint_run.grape') do |_name, _start, _finish, _id, payload| if request_id = payload[:env]['action_dispatch.request_id'] Peek.adapter.save(request_id) diff --git a/config/initializers/puma_client_tempfile_patch.rb b/config/initializers/puma_client_tempfile_patch.rb deleted file mode 100644 index 972eeaf0c83..00000000000 --- a/config/initializers/puma_client_tempfile_patch.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: true - -if Gitlab::Runtime.puma? - # This patch represents https://github.com/puma/puma/pull/2613. If - # this PR is accepted in the next Puma release, we can remove this - # entire file. - # - # The patch itself is quite large because the tempfile creation in - # Puma is inside these fairly long methods. The actual changes are - # just two lines, commented with 'GitLab' to make them easier to find. - raise "Remove this monkey patch: #{__FILE__}" unless Puma::Const::VERSION == '5.1.1' - - module Puma - class Client - private - - def setup_body - @body_read_start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond) - - if @env[HTTP_EXPECT] == CONTINUE - # TODO allow a hook here to check the headers before - # going forward - @io << HTTP_11_100 - @io.flush - end - - @read_header = false - - body = @parser.body - - te = @env[TRANSFER_ENCODING2] - - if te - if te.include?(",") - te.split(",").each do |part| - if CHUNKED.casecmp(part.strip) == 0 # rubocop:disable Metrics/BlockNesting - return setup_chunked_body(body) - end - end - elsif CHUNKED.casecmp(te) == 0 - return setup_chunked_body(body) - end - end - - @chunked_body = false - - cl = @env[CONTENT_LENGTH] - - unless cl - @buffer = body.empty? ? nil : body - @body = EmptyBody - set_ready - return true - end - - remain = cl.to_i - body.bytesize - - if remain <= 0 - @body = StringIO.new(body) - @buffer = nil - set_ready - return true - end - - if remain > MAX_BODY - @body = Tempfile.new(Const::PUMA_TMP_BASE) - @body.binmode - @body.unlink # GitLab: this is the changed part - @tempfile = @body - else - # The body[0,0] trick is to get an empty string in the same - # encoding as body. - @body = StringIO.new body[0,0] # rubocop:disable Layout/SpaceAfterComma - end - - @body.write body - - @body_remain = remain - - return false # rubocop:disable Style/RedundantReturn - end - - def setup_chunked_body(body) - @chunked_body = true - @partial_part_left = 0 - @prev_chunk = "" - - @body = Tempfile.new(Const::PUMA_TMP_BASE) - @body.binmode - @body.unlink # GitLab: this is the changed part - @tempfile = @body - @chunked_content_length = 0 - - if decode_chunk(body) - @env[CONTENT_LENGTH] = @chunked_content_length - return true # rubocop:disable Style/RedundantReturn - end - end - end - end -end diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rb index e217398ee7d..d5027cae08d 100644 --- a/config/initializers/rack_timeout.rb +++ b/config/initializers/rack_timeout.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -# Unicorn terminates any request which runs longer than 60 seconds. # Puma doesn't have any timeout mechanism for terminating long-running # requests, to make sure that server is not paralyzed by long-running # or stuck queries, we add a request timeout which terminates the diff --git a/config/initializers/rbtrace.rb b/config/initializers/rbtrace.rb index 6a1b71bf4bd..2359fc9f6b5 100644 --- a/config/initializers/rbtrace.rb +++ b/config/initializers/rbtrace.rb @@ -2,8 +2,8 @@ if ENV['ENABLE_RBTRACE'] Gitlab::Cluster::LifecycleEvents.on_worker_start do - # Unicorn clears out signals before it forks, so rbtrace won't work - # unless it is enabled after the fork. + # We need to require `rbtrace` in a context of a worker process. + # See https://github.com/tmm1/rbtrace/issues/56#issuecomment-648683596. require 'rbtrace' end end diff --git a/config/initializers/tracing.rb b/config/initializers/tracing.rb index 3f066953c23..10b59a9e3d8 100644 --- a/config/initializers/tracing.rb +++ b/config/initializers/tracing.rb @@ -15,7 +15,7 @@ if Labkit::Tracing.enabled? Labkit::Tracing::Rails::ActionViewSubscriber.instrument Labkit::Tracing::Rails::ActiveSupportSubscriber.instrument - # In multi-processed clustered architectures (puma, unicorn) don't + # In multi-processed clustered architectures (e.g. Puma cluster) don't # start tracing until the worker processes are spawned. This works # around issues when the opentracing implementation spawns threads Gitlab::Cluster::LifecycleEvents.on_worker_start do |