BigW Consortium Gitlab

Commit 770f07cd by Pawel Chojnacki

Make login_counter instance variable instead of class one.

+ remove unecessarey require + fix small formatiing issues
parent 394e962e
require 'prometheus/client/formats/text'
class HealthController < ActionController::Base
protect_from_forgery with: :exception
include RequiresHealthToken
......
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}"
......
......@@ -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
......
class AddPrometheusSettingsToMetricsSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
DOWNTIME = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment