Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
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
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
5 deletions
+6
-5
app/controllers/health_controller.rb
app/controllers/health_controller.rb
+0
-2
app/controllers/metrics_controller.rb
app/controllers/metrics_controller.rb
+3
-1
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+2
-2
db/migrate/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