summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /config/initializers
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
downloadgitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/00_active_record_gitlab_schema.rb10
-rw-r--r--config/initializers/0_marginalia.rb5
-rw-r--r--config/initializers/0_postgresql_types.rb17
-rw-r--r--config/initializers/1_acts_as_taggable.rb (renamed from config/initializers/0_acts_as_taggable.rb)12
-rw-r--r--config/initializers/1_postgresql_only.rb2
-rw-r--r--config/initializers/1_settings.rb11
-rw-r--r--config/initializers/7_prometheus_metrics.rb2
-rw-r--r--config/initializers/action_cable.rb3
-rw-r--r--config/initializers/action_view.rb7
-rw-r--r--config/initializers/active_record_lifecycle.rb2
-rw-r--r--config/initializers/console_message.rb4
-rw-r--r--config/initializers/cookies_serializer.rb1
-rw-r--r--config/initializers/database_config.rb2
-rw-r--r--config/initializers/database_query_analyzers.rb15
-rw-r--r--config/initializers/direct_upload_support.rb10
-rw-r--r--config/initializers/elastic_client_setup.rb17
-rw-r--r--config/initializers/forbid_sidekiq_in_transactions.rb2
-rw-r--r--config/initializers/load_balancing.rb2
-rw-r--r--config/initializers/new_framework_defaults.rb24
-rw-r--r--config/initializers/postgres_partitioning.rb27
-rw-r--r--config/initializers/session_store.rb38
-rw-r--r--config/initializers/sidekiq.rb3
-rw-r--r--config/initializers/zz_metrics.rb2
23 files changed, 133 insertions, 85 deletions
diff --git a/config/initializers/00_active_record_gitlab_schema.rb b/config/initializers/00_active_record_gitlab_schema.rb
deleted file mode 100644
index f1ddd4d4eb1..00000000000
--- a/config/initializers/00_active_record_gitlab_schema.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-# This parameter describes a virtual context to indicate
-# table affinity to other tables.
-#
-# Table affinity limits cross-joins, cross-modifications,
-# foreign keys and validates relationship between tables
-#
-# By default it is undefined
-ActiveRecord::Base.class_attribute :gitlab_schema, default: nil
diff --git a/config/initializers/0_marginalia.rb b/config/initializers/0_marginalia.rb
index f7a1f5f0469..805a9e33347 100644
--- a/config/initializers/0_marginalia.rb
+++ b/config/initializers/0_marginalia.rb
@@ -19,7 +19,10 @@ Marginalia::Comment.components = [:application, :correlation_id, :jid, :endpoint
# adding :line has some overhead because a regexp on the backtrace has
# to be run on every SQL query. Only enable this in development because
# we've seen it slow things down.
-Marginalia::Comment.components << :line if Rails.env.development?
+if Rails.env.development?
+ Marginalia::Comment.components << :line
+ Marginalia::Comment.lines_to_ignore = Regexp.union(Gitlab::BacktraceCleaner::IGNORE_BACKTRACES + %w(lib/ruby/gems/ lib/gem_extensions/ lib/ruby/))
+end
Gitlab::Marginalia.set_application_name
diff --git a/config/initializers/0_postgresql_types.rb b/config/initializers/0_postgresql_types.rb
new file mode 100644
index 00000000000..79e7510ee55
--- /dev/null
+++ b/config/initializers/0_postgresql_types.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+# As discussed in https://github.com/rails/rails/issues/40687, this
+# patch registers a few types to silence warnings when Rails comes
+# across some PostgreSQL types it does not recognize.
+module PostgreSQLAdapterCustomTypes
+ def initialize_type_map(m = type_map) # rubocop:disable Naming/MethodParameterName
+ m.register_type('xid', ActiveRecord::Type::Integer.new(limit: 8))
+ m.register_type('pg_node_tree', ActiveRecord::Type::String.new)
+ m.register_type('_aclitem', ActiveRecord::Type::String.new)
+ m.register_type('pg_lsn', ActiveRecord::Type::String.new)
+
+ super
+ end
+end
+
+ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterCustomTypes)
diff --git a/config/initializers/0_acts_as_taggable.rb b/config/initializers/1_acts_as_taggable.rb
index 8dee3c52a53..59412aef755 100644
--- a/config/initializers/0_acts_as_taggable.rb
+++ b/config/initializers/1_acts_as_taggable.rb
@@ -10,10 +10,8 @@ ActsAsTaggableOn.tags_counter = false
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.5', remove_after: '2021-10-22'
-ActsAsTaggableOn::Tagging.ignore_column :taggable_id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
-
-# The tags and taggings are supposed to be part of `gitlab_ci`
-ActsAsTaggableOn::Tag.gitlab_schema = :gitlab_ci
-ActsAsTaggableOn::Tagging.gitlab_schema = :gitlab_ci
+# Redirects retrieve_connection to use Ci::ApplicationRecord's connection
+[::ActsAsTaggableOn::Tag, ::ActsAsTaggableOn::Tagging].each do |model|
+ model.connection_specification_name = Ci::ApplicationRecord.connection_specification_name
+ model.singleton_class.delegate :connection, :sticking, to: '::Ci::ApplicationRecord'
+end
diff --git a/config/initializers/1_postgresql_only.rb b/config/initializers/1_postgresql_only.rb
index 7bb851daa08..3be55255ddd 100644
--- a/config/initializers/1_postgresql_only.rb
+++ b/config/initializers/1_postgresql_only.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
raise "PostgreSQL is the only supported database from GitLab 12.1" unless
- Gitlab::Database.main.postgresql?
+ ApplicationRecord.database.postgresql?
Gitlab::Database.check_postgres_version_and_print_warning
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index d6957491b16..8fb2161b14e 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -571,7 +571,7 @@ Settings.cron_jobs['user_status_cleanup_batch_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['user_status_cleanup_batch_worker']['cron'] ||= '* * * * *'
Settings.cron_jobs['user_status_cleanup_batch_worker']['job_class'] = 'UserStatusCleanup::BatchWorker'
Settings.cron_jobs['ssh_keys_expired_notification_worker'] ||= Settingslogic.new({})
-Settings.cron_jobs['ssh_keys_expired_notification_worker']['cron'] ||= '0 2 * * *'
+Settings.cron_jobs['ssh_keys_expired_notification_worker']['cron'] ||= '0 2,14 * * *'
Settings.cron_jobs['ssh_keys_expired_notification_worker']['job_class'] = 'SshKeys::ExpiredNotificationWorker'
Settings.cron_jobs['namespaces_in_product_marketing_emails_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['namespaces_in_product_marketing_emails_worker']['cron'] ||= '0 16 * * *'
@@ -588,6 +588,12 @@ Settings.cron_jobs['ci_delete_unit_tests_worker']['job_class'] = 'Ci::DeleteUnit
Settings.cron_jobs['batched_background_migrations_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['batched_background_migrations_worker']['cron'] ||= '* * * * *'
Settings.cron_jobs['batched_background_migrations_worker']['job_class'] = 'Database::BatchedBackgroundMigrationWorker'
+Settings.cron_jobs['issues_reschedule_stuck_issue_rebalances'] ||= Settingslogic.new({})
+Settings.cron_jobs['issues_reschedule_stuck_issue_rebalances']['cron'] ||= '*/15 * * * *'
+Settings.cron_jobs['issues_reschedule_stuck_issue_rebalances']['job_class'] = 'Issues::RescheduleStuckIssueRebalancesWorker'
+Settings.cron_jobs['clusters_integrations_check_prometheus_health_worker'] ||= Settingslogic.new({})
+Settings.cron_jobs['clusters_integrations_check_prometheus_health_worker']['cron'] ||= '0 * * * *'
+Settings.cron_jobs['clusters_integrations_check_prometheus_health_worker']['job_class'] = 'Clusters::Integrations::CheckPrometheusHealthWorker'
Gitlab.ee do
Settings.cron_jobs['analytics_devops_adoption_create_all_snapshots_worker'] ||= Settingslogic.new({})
@@ -713,6 +719,9 @@ Gitlab.ee do
Settings.cron_jobs['app_sec_dast_profile_schedule_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['app_sec_dast_profile_schedule_worker']['cron'] ||= '7-59/15 * * * *'
Settings.cron_jobs['app_sec_dast_profile_schedule_worker']['job_class'] = 'AppSec::Dast::ProfileScheduleWorker'
+ Settings.cron_jobs['loose_foreign_keys_cleanup_worker'] ||= Settingslogic.new({})
+ Settings.cron_jobs['loose_foreign_keys_cleanup_worker']['cron'] ||= '*/5 * * * *'
+ Settings.cron_jobs['loose_foreign_keys_cleanup_worker']['job_class'] = 'LooseForeignKeys::CleanupWorker'
end
#
diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb
index 587d393fd77..28f3da9b3df 100644
--- a/config/initializers/7_prometheus_metrics.rb
+++ b/config/initializers/7_prometheus_metrics.rb
@@ -65,7 +65,7 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled?
Gitlab::Metrics::Samplers::DatabaseSampler.initialize_instance.start
Gitlab::Metrics::Samplers::ThreadsSampler.initialize_instance.start
- if Gitlab::Runtime.action_cable?
+ if Gitlab::Runtime.web_server?
Gitlab::Metrics::Samplers::ActionCableSampler.instance.start
end
diff --git a/config/initializers/action_cable.rb b/config/initializers/action_cable.rb
index a7ef5cc332c..fc40d0b69c5 100644
--- a/config/initializers/action_cable.rb
+++ b/config/initializers/action_cable.rb
@@ -3,8 +3,7 @@
require 'action_cable/subscription_adapter/redis'
Rails.application.configure do
- # Mount the ActionCable engine when in-app mode is enabled
- config.action_cable.mount_path = Gitlab::ActionCable::Config.in_app? ? '/-/cable' : nil
+ config.action_cable.mount_path = '/-/cable'
config.action_cable.url = Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/cable')
config.action_cable.worker_pool_size = Gitlab::ActionCable::Config.worker_pool_size
diff --git a/config/initializers/action_view.rb b/config/initializers/action_view.rb
deleted file mode 100644
index 76171733483..00000000000
--- a/config/initializers/action_view.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# 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_lifecycle.rb b/config/initializers/active_record_lifecycle.rb
index 75991c9da35..8d4b6d61abe 100644
--- a/config/initializers/active_record_lifecycle.rb
+++ b/config/initializers/active_record_lifecycle.rb
@@ -14,7 +14,7 @@ end
if defined?(ActiveRecord::Base)
Gitlab::Cluster::LifecycleEvents.on_before_fork do
- raise 'ActiveRecord connection not established. Unable to start.' unless Gitlab::Database.main.exists?
+ raise 'ActiveRecord connection not established. Unable to start.' unless ApplicationRecord.database.exists?
# the following is highly recommended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection
diff --git a/config/initializers/console_message.rb b/config/initializers/console_message.rb
index 5e9e7a7a9af..3f98568c500 100644
--- a/config/initializers/console_message.rb
+++ b/config/initializers/console_message.rb
@@ -10,8 +10,8 @@ if Gitlab::Runtime.console?
puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision}) #{Gitlab.ee? ? 'EE' : 'FOSS'}"
puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.version)}"
- if Gitlab::Database.main.exists?
- puts " #{Gitlab::Database.main.human_adapter_name}:".ljust(justify) + Gitlab::Database.main.version
+ if ApplicationRecord.database.exists?
+ puts " #{ApplicationRecord.database.human_adapter_name}:".ljust(justify) + ApplicationRecord.database.version
Gitlab.ee do
if Gitlab::Geo.connected? && Gitlab::Geo.enabled?
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index 375a23fdfd6..27451001679 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -2,6 +2,5 @@
# Be sure to restart your server when you modify this file.
-Rails.application.config.action_dispatch.use_cookies_with_metadata = true
Rails.application.config.action_dispatch.cookies_serializer =
Gitlab::Utils.to_boolean(ENV['USE_UNSAFE_HYBRID_COOKIES']) ? :hybrid : :json
diff --git a/config/initializers/database_config.rb b/config/initializers/database_config.rb
index 7aedf9013ae..1eb9d12812a 100644
--- a/config/initializers/database_config.rb
+++ b/config/initializers/database_config.rb
@@ -10,8 +10,6 @@ Gitlab.ee do
end
end
-ActiveRecord::Base.establish_connection(Gitlab::Database.main.db_config_with_default_pool_size)
-
Gitlab.ee do
if Gitlab::Runtime.sidekiq? && Gitlab::Geo.geo_database_configured?
Rails.configuration.geo_database['pool'] = Gitlab::Database.default_pool_size
diff --git a/config/initializers/database_query_analyzers.rb b/config/initializers/database_query_analyzers.rb
new file mode 100644
index 00000000000..8a2fe1d8388
--- /dev/null
+++ b/config/initializers/database_query_analyzers.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+# Currently we register validator only for `dev` or `test` environment
+if Gitlab.dev_or_test_env? || Gitlab::Utils.to_boolean(ENV['GITLAB_ENABLE_QUERY_ANALYZERS'], default: false)
+ Gitlab::Database::QueryAnalyzer.instance.hook!
+ Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics)
+
+ if Rails.env.test? || Gitlab::Utils.to_boolean(ENV['ENABLE_CROSS_DATABASE_MODIFICATION_DETECTION'], default: false)
+ Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification)
+ end
+
+ Gitlab::Application.configure do |config|
+ config.middleware.use(Gitlab::Middleware::QueryAnalyzer)
+ end
+end
diff --git a/config/initializers/direct_upload_support.rb b/config/initializers/direct_upload_support.rb
index 880aea7d114..f57f0d7980d 100644
--- a/config/initializers/direct_upload_support.rb
+++ b/config/initializers/direct_upload_support.rb
@@ -17,7 +17,7 @@ class DirectUploadsValidator
raise ValidationError, "No provider configured for '#{uploader_type}'. #{supported_provider_text}" if provider.blank?
- return if provider_loaded?(provider)
+ return if provider_supported?(provider)
raise ValidationError, "Object storage provider '#{provider}' is not supported " \
"when 'direct_upload' is used for '#{uploader_type}'. #{supported_provider_text}"
@@ -25,12 +25,8 @@ class DirectUploadsValidator
private
- def provider_loaded?(provider)
- return false unless SUPPORTED_DIRECT_UPLOAD_PROVIDERS.include?(provider)
-
- require 'fog/azurerm' if provider == ObjectStorage::Config::AZURE_PROVIDER
-
- true
+ def provider_supported?(provider)
+ SUPPORTED_DIRECT_UPLOAD_PROVIDERS.include?(provider)
end
def supported_provider_text
diff --git a/config/initializers/elastic_client_setup.rb b/config/initializers/elastic_client_setup.rb
index 5b8d81265ad..67b5032a2ee 100644
--- a/config/initializers/elastic_client_setup.rb
+++ b/config/initializers/elastic_client_setup.rb
@@ -45,6 +45,23 @@ Gitlab.ee do
end
end
+ ### Modified from elasticsearch-model/lib/elasticsearch/model/searching.rb
+
+ module Elasticsearch
+ module Model
+ module Searching
+ class SearchRequest
+ def execute!
+ response = klass.client.search(@definition)
+ raise Elastic::TimeoutError if response['timed_out']
+
+ response
+ end
+ end
+ end
+ end
+ end
+
### Modified from elasticsearch-model/lib/elasticsearch/model.rb
[
diff --git a/config/initializers/forbid_sidekiq_in_transactions.rb b/config/initializers/forbid_sidekiq_in_transactions.rb
index ba5c1340b10..e5e17672c4e 100644
--- a/config/initializers/forbid_sidekiq_in_transactions.rb
+++ b/config/initializers/forbid_sidekiq_in_transactions.rb
@@ -20,7 +20,7 @@ module Sidekiq
module NoEnqueueingFromTransactions
%i(perform_async perform_at perform_in).each do |name|
define_method(name) do |*args|
- if !Sidekiq::Worker.skip_transaction_check && Gitlab::Database.main.inside_transaction?
+ if !Sidekiq::Worker.skip_transaction_check && ApplicationRecord.inside_transaction?
begin
raise Sidekiq::Worker::EnqueueFromTransactionError, <<~MSG
`#{self}.#{name}` cannot be called inside a transaction as this can lead to
diff --git a/config/initializers/load_balancing.rb b/config/initializers/load_balancing.rb
index a31b11bb2be..df75178740b 100644
--- a/config/initializers/load_balancing.rb
+++ b/config/initializers/load_balancing.rb
@@ -20,7 +20,7 @@ Gitlab::Database::LoadBalancing.base_models.each do |model|
Gitlab::Cluster::LifecycleEvents.on_before_fork do
# When forking, we don't want to wait until the connections aren't in use
# any more, as this could delay the boot cycle.
- model.connection.load_balancer.disconnect!(timeout: 0)
+ model.load_balancer.disconnect!(timeout: 0)
end
# Service discovery only needs to run in the worker processes, as the main one
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
deleted file mode 100644
index 3d3ee5299e2..00000000000
--- a/config/initializers/new_framework_defaults.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-# Remove this `if` condition when upgraded to rails 5.0.
-# The body must be kept.
-# Be sure to restart your server when you modify this file.
-#
-# This file contains migration options to ease your Rails 5.0 upgrade.
-#
-# Once upgraded flip defaults one by one to migrate to the new default.
-#
-# Read the Guide for Upgrading Ruby on Rails for more info on each option.
-
-# Enable per-form CSRF tokens. Previous versions had false.
-Rails.application.config.action_controller.per_form_csrf_tokens = false
-
-# Enable origin-checking CSRF mitigation. Previous versions had false.
-Rails.application.config.action_controller.forgery_protection_origin_check = false
-
-# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
-# Previous versions had false.
-ActiveSupport.to_time_preserves_timezone = false
-
-# Require `belongs_to` associations by default. Previous versions had false.
-Rails.application.config.active_record.belongs_to_required_by_default = false
diff --git a/config/initializers/postgres_partitioning.rb b/config/initializers/postgres_partitioning.rb
index 49f382547d6..5af8cf52656 100644
--- a/config/initializers/postgres_partitioning.rb
+++ b/config/initializers/postgres_partitioning.rb
@@ -10,10 +10,29 @@ if Gitlab.ee?
IncidentManagement::PendingEscalations::Alert,
IncidentManagement::PendingEscalations::Issue
])
+else
+ Gitlab::Database::Partitioning.register_tables([
+ {
+ table_name: 'incident_management_pending_alert_escalations',
+ partitioned_column: :process_at, strategy: :monthly
+ },
+ {
+ table_name: 'incident_management_pending_issue_escalations',
+ partitioned_column: :process_at, strategy: :monthly
+ }
+ ])
end
-begin
- Gitlab::Database::Partitioning.sync_partitions unless ENV['DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP']
-rescue ActiveRecord::ActiveRecordError, PG::Error
- # ignore - happens when Rake tasks yet have to create a database, e.g. for testing
+# The following tables are already defined as models
+unless Gitlab.jh?
+ Gitlab::Database::Partitioning.register_tables([
+ # This should be synchronized with the following model:
+ # https://gitlab.com/gitlab-jh/gitlab/-/blob/main-jh/jh/app/models/phone/verification_code.rb
+ {
+ table_name: 'verification_codes',
+ partitioned_column: :created_at, strategy: :monthly
+ }
+ ])
end
+
+Gitlab::Database::Partitioning.sync_partitions_ignore_db_error
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 02fc4912f94..75328dcd891 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -19,15 +19,31 @@ cookie_key = if Rails.env.development?
"_gitlab_session"
end
-sessions_config = Gitlab::Redis::SharedState.params
-sessions_config[:namespace] = Gitlab::Redis::SharedState::SESSION_NAMESPACE
+if Gitlab::Utils.to_boolean(ENV['GITLAB_REDIS_STORE_WITH_SESSION_STORE'], default: true)
+ store = Gitlab::Redis::SharedState.store(
+ namespace: Gitlab::Redis::SharedState::SESSION_NAMESPACE
+ )
-Gitlab::Application.config.session_store(
- :redis_store, # Using the cookie_store would enable session replay attacks.
- servers: sessions_config,
- key: cookie_key,
- secure: Gitlab.config.gitlab.https,
- httponly: true,
- expires_in: Settings.gitlab['session_expire_delay'] * 60,
- path: Rails.application.config.relative_url_root.presence || '/'
-)
+ Gitlab::Application.config.session_store(
+ :redis_store, # Using the cookie_store would enable session replay attacks.
+ redis_store: store,
+ key: cookie_key,
+ secure: Gitlab.config.gitlab.https,
+ httponly: true,
+ expires_in: Settings.gitlab['session_expire_delay'] * 60,
+ path: Rails.application.config.relative_url_root.presence || '/'
+ )
+else
+ sessions_config = Gitlab::Redis::SharedState.params
+ sessions_config[:namespace] = Gitlab::Redis::SharedState::SESSION_NAMESPACE
+
+ Gitlab::Application.config.session_store(
+ :redis_store, # Using the cookie_store would enable session replay attacks.
+ servers: sessions_config,
+ key: cookie_key,
+ secure: Gitlab.config.gitlab.https,
+ httponly: true,
+ expires_in: Settings.gitlab['session_expire_delay'] * 60,
+ path: Rails.application.config.relative_url_root.presence || '/'
+ )
+end
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index d33550b82d1..23052e7ac57 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -114,3 +114,6 @@ Sidekiq.configure_client do |config|
config.client_middleware(&Gitlab::SidekiqMiddleware.client_configurator)
end
+
+Sidekiq::Client.prepend Gitlab::Patch::SidekiqClient
+Sidekiq::Cron::Poller.prepend Gitlab::Patch::SidekiqCronPoller
diff --git a/config/initializers/zz_metrics.rb b/config/initializers/zz_metrics.rb
index 8e69e1634f1..7fa71225aae 100644
--- a/config/initializers/zz_metrics.rb
+++ b/config/initializers/zz_metrics.rb
@@ -42,7 +42,7 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
def connect(*args)
val = super
- if current_transaction = ::Gitlab::Metrics::Transaction.current
+ if current_transaction = (::Gitlab::Metrics::WebTransaction.current || ::Gitlab::Metrics::BackgroundTransaction.current)
current_transaction.increment(:gitlab_transaction_new_redis_connections_total, 1)
end