Skip to content

Commit 7572303

Browse files
author
Douwe Maan
committed
Merge branch 'zj-circuit-breaker-removal' into 'master'
Remove Git circuit breaker Closes #45405 See merge request gitlab-org/gitlab-ce!22212
2 parents 8921840 + 30b4ce9 commit 7572303

File tree

61 files changed

+65
-2058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+65
-2058
lines changed

app/controllers/admin/health_check_controller.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,5 @@
33
class Admin::HealthCheckController < Admin::ApplicationController
44
def show
55
@errors = HealthCheck::Utils.process_checks(['standard'])
6-
@failing_storage_statuses = Gitlab::Git::Storage::Health.for_failing_storages
7-
end
8-
9-
def reset_storage_health
10-
Gitlab::Git::Storage::FailureInfo.reset_all!
11-
redirect_to admin_health_check_path,
12-
notice: _('Git storage health information has been reset')
136
end
147
end

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ApplicationController < ActionController::Base
6666
head :forbidden, retry_after: Gitlab::Auth::UniqueIpsLimiter.config.unique_ips_limit_time_window
6767
end
6868

69-
rescue_from Gitlab::Git::Storage::Inaccessible, GRPC::Unavailable, Gitlab::Git::CommandError do |exception|
69+
rescue_from GRPC::Unavailable, Gitlab::Git::CommandError do |exception|
7070
log_exception(exception)
7171

7272
headers['Retry-After'] = exception.retry_after if exception.respond_to?(:retry_after)

app/controllers/health_controller.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
class HealthController < ActionController::Base
4-
protect_from_forgery with: :exception, except: :storage_check, prepend: true
4+
protect_from_forgery with: :exception, prepend: true
55
include RequiresWhitelistedMonitoringClient
66

77
CHECKS = [
@@ -25,15 +25,6 @@ def liveness
2525
render_check_results(results)
2626
end
2727

28-
def storage_check
29-
results = Gitlab::Git::Storage::Checker.check_all
30-
31-
render json: {
32-
check_interval: Gitlab::CurrentSettings.current_application_settings.circuitbreaker_check_interval,
33-
results: results
34-
}
35-
end
36-
3728
private
3829

3930
def render_check_results(results)

app/helpers/application_settings_helper.rb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -108,37 +108,6 @@ def repository_storages_options_for_select(selected)
108108
options_for_select(options, selected)
109109
end
110110

111-
def circuitbreaker_failure_count_help_text
112-
health_link = link_to(s_('AdminHealthPageLink|health page'), admin_health_check_path)
113-
api_link = link_to(s_('CircuitBreakerApiLink|circuitbreaker api'), help_page_path("api/repository_storage_health"))
114-
message = _("The number of failures of after which GitLab will completely "\
115-
"prevent access to the storage. The number of failures can be "\
116-
"reset in the admin interface: %{link_to_health_page} or using "\
117-
"the %{api_documentation_link}.")
118-
message = message % { link_to_health_page: health_link, api_documentation_link: api_link }
119-
120-
message.html_safe
121-
end
122-
123-
def circuitbreaker_access_retries_help_text
124-
_('The number of attempts GitLab will make to access a storage.')
125-
end
126-
127-
def circuitbreaker_failure_reset_time_help_text
128-
_("The time in seconds GitLab will keep failure information. When no "\
129-
"failures occur during this time, information about the mount is reset.")
130-
end
131-
132-
def circuitbreaker_storage_timeout_help_text
133-
_("The time in seconds GitLab will try to access storage. After this time a "\
134-
"timeout error will be raised.")
135-
end
136-
137-
def circuitbreaker_check_interval_help_text
138-
_("The time in seconds between storage checks. When a previous check did "\
139-
"complete yet, GitLab will skip a check.")
140-
end
141-
142111
def visible_attributes
143112
[
144113
:admin_notification_email,
@@ -150,11 +119,6 @@ def visible_attributes
150119
:authorized_keys_enabled,
151120
:auto_devops_enabled,
152121
:auto_devops_domain,
153-
:circuitbreaker_access_retries,
154-
:circuitbreaker_check_interval,
155-
:circuitbreaker_failure_count_threshold,
156-
:circuitbreaker_failure_reset_time,
157-
:circuitbreaker_storage_timeout,
158122
:clientside_sentry_dsn,
159123
:clientside_sentry_enabled,
160124
:container_registry_token_expire_delay,

app/helpers/storage_health_helper.rb

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/models/application_setting.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class ApplicationSetting < ActiveRecord::Base
44
include CacheableAttributes
55
include CacheMarkdownField
66
include TokenAuthenticatable
7+
include IgnorableColumn
78

89
add_authentication_token_field :runners_registration_token
910
add_authentication_token_field :health_check_access_token
@@ -27,6 +28,12 @@ class ApplicationSetting < ActiveRecord::Base
2728
serialize :domain_blacklist, Array # rubocop:disable Cop/ActiveRecordSerialize
2829
serialize :repository_storages # rubocop:disable Cop/ActiveRecordSerialize
2930

31+
ignore_column :circuitbreaker_failure_count_threshold
32+
ignore_column :circuitbreaker_failure_reset_time
33+
ignore_column :circuitbreaker_storage_timeout
34+
ignore_column :circuitbreaker_access_retries
35+
ignore_column :circuitbreaker_check_interval
36+
3037
cache_markdown_field :sign_in_text
3138
cache_markdown_field :help_page_text
3239
cache_markdown_field :shared_runners_text, pipeline: :plain_markdown
@@ -150,17 +157,6 @@ class ApplicationSetting < ActiveRecord::Base
150157
presence: true,
151158
numericality: { greater_than_or_equal_to: 0 }
152159

153-
validates :circuitbreaker_failure_count_threshold,
154-
:circuitbreaker_failure_reset_time,
155-
:circuitbreaker_storage_timeout,
156-
:circuitbreaker_check_interval,
157-
presence: true,
158-
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
159-
160-
validates :circuitbreaker_access_retries,
161-
presence: true,
162-
numericality: { only_integer: true, greater_than_or_equal_to: 1 }
163-
164160
validates :gitaly_timeout_default,
165161
presence: true,
166162
numericality: { only_integer: true, greater_than_or_equal_to: 0 }

app/views/admin/application_settings/_repository_storage.html.haml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,5 @@
2020
Manage repository storage paths. Learn more in the
2121
= succeed "." do
2222
= link_to "repository storages documentation", help_page_path("administration/repository_storage_paths")
23-
.sub-section
24-
%h4 Circuit breaker
25-
.form-group
26-
= f.label :circuitbreaker_check_interval, _('Check interval'), class: 'label-bold'
27-
= f.number_field :circuitbreaker_check_interval, class: 'form-control'
28-
.form-text.text-muted
29-
= circuitbreaker_check_interval_help_text
30-
.form-group
31-
= f.label :circuitbreaker_access_retries, _('Number of access attempts'), class: 'label-bold'
32-
= f.number_field :circuitbreaker_access_retries, class: 'form-control'
33-
.form-text.text-muted
34-
= circuitbreaker_access_retries_help_text
35-
.form-group
36-
= f.label :circuitbreaker_storage_timeout, _('Seconds to wait for a storage access attempt'), class: 'label-bold'
37-
= f.number_field :circuitbreaker_storage_timeout, class: 'form-control'
38-
.form-text.text-muted
39-
= circuitbreaker_storage_timeout_help_text
40-
.form-group
41-
= f.label :circuitbreaker_failure_count_threshold, _('Maximum git storage failures'), class: 'label-bold'
42-
= f.number_field :circuitbreaker_failure_count_threshold, class: 'form-control'
43-
.form-text.text-muted
44-
= circuitbreaker_failure_count_help_text
45-
.form-group
46-
= f.label :circuitbreaker_failure_reset_time, _('Seconds before reseting failure information'), class: 'label-bold'
47-
= f.number_field :circuitbreaker_failure_reset_time, class: 'form-control'
48-
.form-text.text-muted
49-
= circuitbreaker_failure_reset_time_help_text
5023

5124
= f.submit 'Save changes', class: "btn btn-success qa-save-changes-button"

app/views/admin/application_settings/repository.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
2121
= expanded_by_default? ? _('Collapse') : _('Expand')
2222
%p
23-
= _('Configure storage path and circuit breaker settings.')
23+
= _('Configure storage path settings.')
2424
.settings-content
2525
= render 'repository_storage'
2626

app/views/admin/health_check/_failing_storages.html.haml

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/views/admin/health_check/show.html.haml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- @no_container = true
22
- page_title _('Health Check')
3-
- no_errors = @errors.blank? && @failing_storage_statuses.blank?
3+
- no_errors = @errors.blank?
44

55
%div{ class: container_class }
66
%h3.page-title= page_title
@@ -39,4 +39,3 @@
3939
#{ s_('HealthCheck|No Health Problems Detected') }
4040
- else
4141
= @errors
42-
= render partial: 'failing_storages', object: @failing_storage_statuses

bin/storage_check

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Remove Git circuit breaker
3+
merge_request: 22212
4+
author:
5+
type: removed

config/routes.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
# '/-/health' implemented by BasicHealthMiddleware
5757
get 'liveness' => 'health#liveness'
5858
get 'readiness' => 'health#readiness'
59-
post 'storage_check' => 'health#storage_check'
6059
resources :metrics, only: [:index]
6160
mount Peek::Railtie => '/peek', as: 'peek_routes'
6261

config/routes/admin.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@
6969
end
7070

7171
resource :logs, only: [:show]
72-
resource :health_check, controller: 'health_check', only: [:show] do
73-
post :reset_storage_health
74-
end
72+
resource :health_check, controller: 'health_check', only: [:show]
7573
resource :background_jobs, controller: 'background_jobs', only: [:show]
7674
resource :system_info, controller: 'system_info', only: [:show]
7775
resources :requests_profiles, only: [:index, :show], param: :name, constraints: { name: /.+\.html/ }
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
class RemoveCircuitBreaker < ActiveRecord::Migration
4+
include Gitlab::Database::MigrationHelpers
5+
6+
# Set this constant to true if this migration requires downtime.
7+
DOWNTIME = false
8+
9+
disable_ddl_transaction!
10+
11+
CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT = {
12+
circuitbreaker_failure_count_threshold: 3,
13+
circuitbreaker_failure_reset_time: 1800,
14+
circuitbreaker_storage_timeout: 15,
15+
circuitbreaker_access_retries: 3,
16+
circuitbreaker_check_interval: 1
17+
}.freeze
18+
19+
def up
20+
CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT.keys.each do |column|
21+
remove_column(:application_settings, column) if column_exists?(:application_settings, column)
22+
end
23+
end
24+
25+
def down
26+
CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT.each do |column, default|
27+
add_column_with_default(:application_settings, column, :integer, default: default) unless column_exists?(:application_settings, column)
28+
end
29+
end
30+
end

db/schema.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20181008145359) do
14+
ActiveRecord::Schema.define(version: 20181008200441) do
1515

1616
# These are extensions that must be enabled in order to support this database
1717
enable_extension "plpgsql"
@@ -139,10 +139,6 @@
139139
t.boolean "hashed_storage_enabled", default: false, null: false
140140
t.boolean "project_export_enabled", default: true, null: false
141141
t.boolean "auto_devops_enabled", default: true, null: false
142-
t.integer "circuitbreaker_failure_count_threshold", default: 3
143-
t.integer "circuitbreaker_failure_reset_time", default: 1800
144-
t.integer "circuitbreaker_storage_timeout", default: 15
145-
t.integer "circuitbreaker_access_retries", default: 3
146142
t.boolean "throttle_unauthenticated_enabled", default: false, null: false
147143
t.integer "throttle_unauthenticated_requests_per_period", default: 3600, null: false
148144
t.integer "throttle_unauthenticated_period_in_seconds", default: 3600, null: false
@@ -152,7 +148,6 @@
152148
t.boolean "throttle_authenticated_web_enabled", default: false, null: false
153149
t.integer "throttle_authenticated_web_requests_per_period", default: 7200, null: false
154150
t.integer "throttle_authenticated_web_period_in_seconds", default: 3600, null: false
155-
t.integer "circuitbreaker_check_interval", default: 1, null: false
156151
t.boolean "password_authentication_enabled_for_web"
157152
t.boolean "password_authentication_enabled_for_git", default: true
158153
t.integer "gitaly_timeout_default", default: 55, null: false
-28.4 KB
Binary file not shown.
-15.9 KB
Binary file not shown.

doc/administration/monitoring/prometheus/gitlab_metrics.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ The following metrics are available:
4545
| redis_ping_success | Gauge | 9.4 | Whether or not the last redis ping succeeded |
4646
| redis_ping_latency_seconds | Gauge | 9.4 | Round trip time of the redis ping |
4747
| user_session_logins_total | Counter | 9.4 | Counter of how many users have logged in |
48-
| filesystem_circuitbreaker_latency_seconds | Gauge | 9.5 | Time spent validating if a storage is accessible |
49-
| filesystem_circuitbreaker | Gauge | 9.5 | Whether or not the circuit for a certain shard is broken or not |
50-
| circuitbreaker_storage_check_duration_seconds | Histogram | 10.3 | Time a single storage probe took |
5148
| failed_login_captcha_total | Gauge | 11.0 | Counter of failed CAPTCHA attempts during login |
5249
| successful_login_captcha_total | Gauge | 11.0 | Counter of successful CAPTCHA attempts during login |
5350

0 commit comments

Comments
 (0)