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
ab2403e3
Commit
ab2403e3
authored
Dec 23, 2019
by
Ash McKenzie
Committed by
Douglas Barbosa Alexandre
Jan 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for #extra_log_data()
extra_log_data() will be merged into base_log_data().
parent
496ffa03
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
57 deletions
+56
-57
ee/app/services/geo/base_file_service.rb
ee/app/services/geo/base_file_service.rb
+6
-5
ee/app/services/geo/cache_invalidation_event_store.rb
ee/app/services/geo/cache_invalidation_event_store.rb
+4
-6
ee/app/services/geo/container_repository_updated_event_store.rb
.../services/geo/container_repository_updated_event_store.rb
+4
-6
ee/app/services/geo/files_expire_service.rb
ee/app/services/geo/files_expire_service.rb
+3
-5
ee/app/services/geo/job_artifact_deleted_event_store.rb
ee/app/services/geo/job_artifact_deleted_event_store.rb
+9
-7
ee/app/services/geo/lfs_object_deleted_event_store.rb
ee/app/services/geo/lfs_object_deleted_event_store.rb
+5
-7
ee/app/services/geo/upload_deleted_event_store.rb
ee/app/services/geo/upload_deleted_event_store.rb
+5
-7
ee/lib/gitlab/geo/container_repository_log_helpers.rb
ee/lib/gitlab/geo/container_repository_log_helpers.rb
+5
-5
ee/lib/gitlab/geo/log_helpers.rb
ee/lib/gitlab/geo/log_helpers.rb
+6
-1
ee/lib/gitlab/geo/project_log_helpers.rb
ee/lib/gitlab/geo/project_log_helpers.rb
+5
-8
ee/spec/services/geo/job_artifact_deleted_event_store_spec.rb
...pec/services/geo/job_artifact_deleted_event_store_spec.rb
+4
-0
No files found.
ee/app/services/geo/base_file_service.rb
View file @
ab2403e3
...
@@ -44,13 +44,14 @@ module Geo
...
@@ -44,13 +44,14 @@ module Geo
object_type
==
:lfs
object_type
==
:lfs
end
end
def
base_log_data
(
message
)
# This is called by LogHelpers to build json log with context info
#
# @see ::Gitlab::Geo::LogHelpers
def
extra_log_data
{
{
class:
self
.
class
.
name
,
object_type:
object_type
,
object_type:
object_type
,
object_db_id:
object_db_id
,
object_db_id:
object_db_id
message:
message
}.
compact
}
end
end
end
end
end
end
ee/app/services/geo/cache_invalidation_event_store.rb
View file @
ab2403e3
...
@@ -16,15 +16,13 @@ module Geo
...
@@ -16,15 +16,13 @@ module Geo
Geo
::
CacheInvalidationEvent
.
new
(
key:
key
)
Geo
::
CacheInvalidationEvent
.
new
(
key:
key
)
end
end
# This is called by
Project
LogHelpers to build json log with context info
# This is called by LogHelpers to build json log with context info
#
#
# @see ::Gitlab::Geo::
Project
LogHelpers
# @see ::Gitlab::Geo::LogHelpers
def
base_log_data
(
message
)
def
extra_log_data
{
{
class:
self
.
class
.
name
,
cache_key:
key
.
to_s
,
cache_key:
key
.
to_s
,
job_id:
get_sidekiq_job_id
,
job_id:
get_sidekiq_job_id
message:
message
}.
compact
}.
compact
end
end
end
end
...
...
ee/app/services/geo/container_repository_updated_event_store.rb
View file @
ab2403e3
...
@@ -18,14 +18,12 @@ module Geo
...
@@ -18,14 +18,12 @@ module Geo
)
)
end
end
# This is called by
Project
LogHelpers to build json log with context info
# This is called by LogHelpers to build json log with context info
#
#
# @see ::Gitlab::Geo::
Project
LogHelpers
# @see ::Gitlab::Geo::LogHelpers
def
base_log_data
(
message
)
def
extra_log_data
{
{
class:
self
.
class
.
name
,
container_repository_id:
repository
.
try
(
:id
)
container_repository_id:
repository
.
try
(
:id
),
message:
message
}.
compact
}.
compact
end
end
end
end
...
...
ee/app/services/geo/files_expire_service.rb
View file @
ab2403e3
...
@@ -66,14 +66,12 @@ module Geo
...
@@ -66,14 +66,12 @@ module Geo
# This is called by LogHelpers to build json log with context info
# This is called by LogHelpers to build json log with context info
#
#
# @see ::Gitlab::Geo::LogHelpers
# @see ::Gitlab::Geo::LogHelpers
def
base_log_data
(
message
)
def
extra_log_data
{
{
class:
self
.
class
.
name
,
project_id:
project
.
id
,
project_id:
project
.
id
,
project_path:
project
.
full_path
,
project_path:
project
.
full_path
,
project_old_path:
old_full_path
,
project_old_path:
old_full_path
message:
message
}.
compact
}
end
end
end
end
end
end
ee/app/services/geo/job_artifact_deleted_event_store.rb
View file @
ab2403e3
...
@@ -25,16 +25,18 @@ module Geo
...
@@ -25,16 +25,18 @@ module Geo
job_artifact
.
file
.
relative_path
if
job_artifact
.
file
.
present?
job_artifact
.
file
.
relative_path
if
job_artifact
.
file
.
present?
end
end
# This is called by ProjectLogHelpers to build json log with context info
def
project
job_artifact
.
project
end
# This is called by LogHelpers to build json log with context info
#
#
# @see ::Gitlab::Geo::
Project
LogHelpers
# @see ::Gitlab::Geo::LogHelpers
def
base_log_data
(
message
)
def
extra_log_data
{
{
class:
self
.
class
.
name
,
job_artifact_id:
job_artifact
.
id
,
job_artifact_id:
job_artifact
.
id
,
file_path:
job_artifact
.
file
.
path
,
file_path:
job_artifact
.
file
.
path
message:
message
}.
compact
}
end
end
end
end
end
end
ee/app/services/geo/lfs_object_deleted_event_store.rb
View file @
ab2403e3
...
@@ -26,16 +26,14 @@ module Geo
...
@@ -26,16 +26,14 @@ module Geo
lfs_object
.
file
.
relative_path
if
lfs_object
.
file
.
present?
lfs_object
.
file
.
relative_path
if
lfs_object
.
file
.
present?
end
end
# This is called by
Project
LogHelpers to build json log with context info
# This is called by LogHelpers to build json log with context info
#
#
# @see ::Gitlab::Geo::
Project
LogHelpers
# @see ::Gitlab::Geo::LogHelpers
def
base_log_data
(
message
)
def
extra_log_data
{
{
class:
self
.
class
.
name
,
lfs_object_id:
lfs_object
.
id
,
lfs_object_id:
lfs_object
.
id
,
file_path:
lfs_object
.
file
.
path
,
file_path:
lfs_object
.
file
.
path
message:
message
}.
compact
}
end
end
end
end
end
end
ee/app/services/geo/upload_deleted_event_store.rb
View file @
ab2403e3
...
@@ -24,19 +24,17 @@ module Geo
...
@@ -24,19 +24,17 @@ module Geo
)
)
end
end
# This is called by
Project
LogHelpers to build json log with context info
# This is called by LogHelpers to build json log with context info
#
#
# @see ::Gitlab::Geo::
Project
LogHelpers
# @see ::Gitlab::Geo::LogHelpers
def
base_log_data
(
message
)
def
extra_log_data
{
{
class:
self
.
class
.
name
,
upload_id:
upload
.
id
,
upload_id:
upload
.
id
,
file_path:
upload
.
path
,
file_path:
upload
.
path
,
model_id:
upload
.
model_id
,
model_id:
upload
.
model_id
,
model_type:
upload
.
model_type
,
model_type:
upload
.
model_type
,
uploader:
upload
.
uploader
,
uploader:
upload
.
uploader
message:
message
}.
compact
}
end
end
end
end
end
end
ee/lib/gitlab/geo/container_repository_log_helpers.rb
View file @
ab2403e3
...
@@ -5,14 +5,14 @@ module Gitlab
...
@@ -5,14 +5,14 @@ module Gitlab
module
ContainerRepositoryLogHelpers
module
ContainerRepositoryLogHelpers
include
LogHelpers
include
LogHelpers
def
base_log_data
(
message
)
# This is called by LogHelpers to build json log with context info
#
# @see ::Gitlab::Geo::LogHelpers
def
extra_log_data
{
{
class:
self
.
class
.
name
,
project_id:
container_repository
.
project
.
id
,
project_id:
container_repository
.
project
.
id
,
project_path:
container_repository
.
project
.
full_path
,
project_path:
container_repository
.
project
.
full_path
,
container_repository_name:
container_repository
.
name
,
container_repository_name:
container_repository
.
name
message:
message
,
job_id:
get_sidekiq_job_id
}.
compact
}.
compact
end
end
end
end
...
...
ee/lib/gitlab/geo/log_helpers.rb
View file @
ab2403e3
...
@@ -25,7 +25,12 @@ module Gitlab
...
@@ -25,7 +25,12 @@ module Gitlab
class:
self
.
class
.
name
,
class:
self
.
class
.
name
,
message:
message
,
message:
message
,
job_id:
get_sidekiq_job_id
job_id:
get_sidekiq_job_id
}.
compact
}.
merge
(
extra_log_data
).
compact
end
# Intended to be overidden elsewhere
def
extra_log_data
{}
end
end
def
geo_logger
def
geo_logger
...
...
ee/lib/gitlab/geo/project_log_helpers.rb
View file @
ab2403e3
...
@@ -6,14 +6,11 @@ module Gitlab
...
@@ -6,14 +6,11 @@ module Gitlab
include
LogHelpers
include
LogHelpers
def
base_log_data
(
message
)
def
base_log_data
(
message
)
{
super
.
merge
({
class:
self
.
class
.
name
,
project_id:
project
.
try
(
:id
),
project_id:
project
.
id
,
project_path:
project
.
try
(
:full_path
),
project_path:
project
.
full_path
,
storage_version:
project
.
try
(
:storage_version
)
storage_version:
project
.
storage_version
,
}).
compact
message:
message
,
job_id:
get_sidekiq_job_id
}.
compact
end
end
end
end
end
end
...
...
ee/spec/services/geo/job_artifact_deleted_event_store_spec.rb
View file @
ab2403e3
...
@@ -32,12 +32,16 @@ describe Geo::JobArtifactDeletedEventStore do
...
@@ -32,12 +32,16 @@ describe Geo::JobArtifactDeletedEventStore do
it
'logs an error message when event creation fail'
do
it
'logs an error message when event creation fail'
do
invalid_job_artifact
=
create
(
:ci_job_artifact
)
invalid_job_artifact
=
create
(
:ci_job_artifact
)
project
=
invalid_job_artifact
.
project
subject
=
described_class
.
new
(
invalid_job_artifact
)
subject
=
described_class
.
new
(
invalid_job_artifact
)
expected_message
=
{
expected_message
=
{
class:
"Geo::JobArtifactDeletedEventStore"
,
class:
"Geo::JobArtifactDeletedEventStore"
,
job_artifact_id:
invalid_job_artifact
.
id
,
job_artifact_id:
invalid_job_artifact
.
id
,
file_path:
nil
,
file_path:
nil
,
project_id:
project
.
id
,
project_path:
project
.
full_path
,
storage_version:
project
.
storage_version
,
message:
"Job artifact deleted event could not be created"
,
message:
"Job artifact deleted event could not be created"
,
error:
"Validation failed: File path can't be blank"
error:
"Validation failed: File path can't be blank"
}
}
...
...
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