summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/health_controller.rb2
-rw-r--r--app/controllers/metrics_controller.rb4
-rw-r--r--app/controllers/sessions_controller.rb4
-rw-r--r--db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb1
4 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb
index b646216caa2..abc832e6ddc 100644
--- a/app/controllers/health_controller.rb
+++ b/app/controllers/health_controller.rb
@@ -1,5 +1,3 @@
-require 'prometheus/client/formats/text'
-
class HealthController < ActionController::Base
protect_from_forgery with: :exception
include RequiresHealthToken
diff --git a/app/controllers/metrics_controller.rb b/app/controllers/metrics_controller.rb
index 7191a66fe46..9bcd6f96b34 100644
--- a/app/controllers/metrics_controller.rb
+++ b/app/controllers/metrics_controller.rb
@@ -1,7 +1,9 @@
class MetricsController < ActionController::Base
+ include RequiresHealthToken
+
protect_from_forgery with: :exception
+
before_action :validate_prometheus_metrics
- include RequiresHealthToken
def metrics
response = "#{metrics_service.health_metrics_text}\n#{metrics_service.prometheus_metrics_text}"
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index eaed878283e..fc9de30f256 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -47,7 +47,7 @@ class SessionsController < Devise::SessionsController
private
- def self.login_counter
+ def login_counter
@login_counter ||= Gitlab::Metrics.counter(:user_session_logins, 'User logins count')
end
@@ -129,7 +129,7 @@ class SessionsController < Devise::SessionsController
end
def log_user_activity(user)
- SessionsController.login_counter.increment
+ login_counter.increment
Users::ActivityService.new(user, 'login').execute
end
diff --git a/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb b/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
index 4e2c94be943..6ec2ed712b9 100644
--- a/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
+++ b/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
@@ -1,5 +1,6 @@
class AddPrometheusSettingsToMetricsSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
+
disable_ddl_transaction!
DOWNTIME = false