BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
770f07cd
Commit
770f07cd
authored
May 23, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make login_counter instance variable instead of class one.
+ remove unecessarey require + fix small formatiing issues
parent
394e962e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
5 deletions
+6
-5
health_controller.rb
app/controllers/health_controller.rb
+0
-2
metrics_controller.rb
app/controllers/metrics_controller.rb
+3
-1
sessions_controller.rb
app/controllers/sessions_controller.rb
+2
-2
20170519102115_add_prometheus_settings_to_metrics_settings.rb
...0519102115_add_prometheus_settings_to_metrics_settings.rb
+1
-0
No files found.
app/controllers/health_controller.rb
View file @
770f07cd
require
'prometheus/client/formats/text'
class
HealthController
<
ActionController
::
Base
protect_from_forgery
with: :exception
include
RequiresHealthToken
...
...
app/controllers/metrics_controller.rb
View file @
770f07cd
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
}
"
...
...
app/controllers/sessions_controller.rb
View file @
770f07cd
...
...
@@ -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
...
...
db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
View file @
770f07cd
class
AddPrometheusSettingsToMetricsSettings
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment