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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7d125f1a
Commit
7d125f1a
authored
Nov 02, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitlab::Geo::LogHelpers where possible
parent
9190e081
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
22 deletions
+6
-22
app/services/geo/event_store.rb
app/services/geo/event_store.rb
+2
-15
app/workers/geo/prune_event_log_worker.rb
app/workers/geo/prune_event_log_worker.rb
+1
-5
lib/gitlab/geo/log_helpers.rb
lib/gitlab/geo/log_helpers.rb
+3
-2
No files found.
app/services/geo/event_store.rb
View file @
7d125f1a
...
@@ -17,6 +17,8 @@ module Geo
...
@@ -17,6 +17,8 @@ module Geo
# The `build_event` method is supposed to return an instance of the event
# The `build_event` method is supposed to return an instance of the event
# that will be logged.
# that will be logged.
class
EventStore
class
EventStore
include
::
Gitlab
::
Geo
::
ProjectLogHelpers
class
<<
self
class
<<
self
attr_accessor
:event_type
attr_accessor
:event_type
end
end
...
@@ -43,20 +45,5 @@ module Geo
...
@@ -43,20 +45,5 @@ module Geo
raise
NotImplementedError
,
raise
NotImplementedError
,
"
#{
self
.
class
}
does not implement
#{
__method__
}
"
"
#{
self
.
class
}
does not implement
#{
__method__
}
"
end
end
def
log_error
(
message
,
error
)
Gitlab
::
Geo
::
Logger
.
error
({
class:
self
.
class
.
name
,
message:
message
,
error:
error
}.
merge
(
log_params
))
end
def
log_params
{
project_id:
project
.
id
,
project_path:
project
.
full_path
}
end
end
end
end
end
app/workers/geo/prune_event_log_worker.rb
View file @
7d125f1a
...
@@ -3,6 +3,7 @@ module Geo
...
@@ -3,6 +3,7 @@ module Geo
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
CronjobQueue
include
CronjobQueue
include
ExclusiveLeaseGuard
include
ExclusiveLeaseGuard
include
::
Gitlab
::
Geo
::
LogHelpers
LEASE_TIMEOUT
=
60
.
minutes
LEASE_TIMEOUT
=
60
.
minutes
...
@@ -10,11 +11,6 @@ module Geo
...
@@ -10,11 +11,6 @@ module Geo
LEASE_TIMEOUT
LEASE_TIMEOUT
end
end
def
log_error
(
message
,
extra_args
=
{})
args
=
{
class:
self
.
class
.
name
,
message:
message
}.
merge
(
extra_args
)
Gitlab
::
Geo
::
Logger
.
error
(
args
)
end
def
perform
def
perform
return
unless
Gitlab
::
Geo
.
primary?
return
unless
Gitlab
::
Geo
.
primary?
...
...
lib/gitlab/geo/log_helpers.rb
View file @
7d125f1a
...
@@ -7,9 +7,10 @@ module Gitlab
...
@@ -7,9 +7,10 @@ module Gitlab
Gitlab
::
Geo
::
Logger
.
info
(
data
)
Gitlab
::
Geo
::
Logger
.
info
(
data
)
end
end
def
log_error
(
message
,
error
)
def
log_error
(
message
,
error
=
nil
,
details
=
{}
)
data
=
base_log_data
(
message
)
data
=
base_log_data
(
message
)
data
[
:error
]
=
error
.
to_s
data
[
:error
]
=
error
.
to_s
if
error
data
.
merge!
(
details
)
if
details
Gitlab
::
Geo
::
Logger
.
error
(
data
)
Gitlab
::
Geo
::
Logger
.
error
(
data
)
end
end
...
...
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