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
04ae2ca5
Commit
04ae2ca5
authored
May 18, 2020
by
Aakriti Gupta
Committed by
Douglas Barbosa Alexandre
May 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add trigger info to log for log cursor events
- set trigger type as event - add event id to trace in kibana
parent
7b03016f
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
80 additions
and
45 deletions
+80
-45
ee/lib/gitlab/geo/log_cursor/events/base_event.rb
ee/lib/gitlab/geo/log_cursor/events/base_event.rb
+8
-0
ee/lib/gitlab/geo/log_cursor/events/cache_invalidation_event.rb
.../gitlab/geo/log_cursor/events/cache_invalidation_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/container_repository_updated_event.rb
...o/log_cursor/events/container_repository_updated_event.rb
+3
-3
ee/lib/gitlab/geo/log_cursor/events/design_repository_updated_event.rb
.../geo/log_cursor/events/design_repository_updated_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/hashed_storage_attachments_event.rb
...geo/log_cursor/events/hashed_storage_attachments_event.rb
+2
-4
ee/lib/gitlab/geo/log_cursor/events/hashed_storage_migrated_event.rb
...ab/geo/log_cursor/events/hashed_storage_migrated_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/job_artifact_deleted_event.rb
...itlab/geo/log_cursor/events/job_artifact_deleted_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/lfs_object_deleted_event.rb
.../gitlab/geo/log_cursor/events/lfs_object_deleted_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/repositories_changed_event.rb
...itlab/geo/log_cursor/events/repositories_changed_event.rb
+7
-2
ee/lib/gitlab/geo/log_cursor/events/repository_created_event.rb
.../gitlab/geo/log_cursor/events/repository_created_event.rb
+9
-6
ee/lib/gitlab/geo/log_cursor/events/repository_deleted_event.rb
.../gitlab/geo/log_cursor/events/repository_deleted_event.rb
+2
-4
ee/lib/gitlab/geo/log_cursor/events/repository_renamed_event.rb
.../gitlab/geo/log_cursor/events/repository_renamed_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/repository_updated_event.rb
.../gitlab/geo/log_cursor/events/repository_updated_event.rb
+1
-2
ee/lib/gitlab/geo/log_cursor/events/reset_checksum_event.rb
ee/lib/gitlab/geo/log_cursor/events/reset_checksum_event.rb
+2
-9
ee/lib/gitlab/geo/log_cursor/events/upload_deleted_event.rb
ee/lib/gitlab/geo/log_cursor/events/upload_deleted_event.rb
+1
-2
ee/spec/lib/gitlab/geo/log_cursor/events/cache_invalidation_event_spec.rb
...ab/geo/log_cursor/events/cache_invalidation_event_spec.rb
+1
-1
ee/spec/lib/gitlab/geo/log_cursor/events/container_repository_updated_event_spec.rb
..._cursor/events/container_repository_updated_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/design_repository_updated_event_spec.rb
...log_cursor/events/design_repository_updated_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/hashed_storage_attachments_event_spec.rb
...og_cursor/events/hashed_storage_attachments_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/hashed_storage_migrated_event_spec.rb
...o/log_cursor/events/hashed_storage_migrated_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/job_artifact_deleted_event_spec.rb
.../geo/log_cursor/events/job_artifact_deleted_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/lfs_object_deleted_event_spec.rb
...ab/geo/log_cursor/events/lfs_object_deleted_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/repositories_changed_event_spec.rb
.../geo/log_cursor/events/repositories_changed_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/repository_created_event_spec.rb
...ab/geo/log_cursor/events/repository_created_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/repository_deleted_event_spec.rb
...ab/geo/log_cursor/events/repository_deleted_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/repository_renamed_event_spec.rb
...ab/geo/log_cursor/events/repository_renamed_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb
...ab/geo/log_cursor/events/repository_updated_event_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/log_cursor/events/upload_deleted_event_spec.rb
...gitlab/geo/log_cursor/events/upload_deleted_event_spec.rb
+2
-0
ee/spec/support/shared_examples/lib/gitlab/geo/geo_logs_event_source_info_shared_examples.rb
.../gitlab/geo/geo_logs_event_source_info_shared_examples.rb
+14
-0
No files found.
ee/lib/gitlab/geo/log_cursor/events/base_event.rb
View file @
04ae2ca5
...
...
@@ -36,6 +36,14 @@ module Gitlab
def
enqueue_job_if_shard_healthy
(
event
)
yield
if
healthy_shard_for?
(
event
)
end
def
log_event
(
message
,
params
=
{})
logger
.
event_info
(
created_at
,
message
,
params
.
merge
(
event_id:
event
.
id
)
)
end
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/cache_invalidation_event.rb
View file @
04ae2ca5
...
...
@@ -19,8 +19,7 @@ module Gitlab
end
def
log_cache_invalidation_event
(
expired
)
logger
.
event_info
(
created_at
,
log_event
(
'Cache invalidation'
,
cache_key:
event
.
key
,
cache_expired:
expired
,
...
...
ee/lib/gitlab/geo/log_cursor/events/container_repository_updated_event.rb
View file @
04ae2ca5
...
...
@@ -30,12 +30,12 @@ module Gitlab
# rubocop: enable CodeReuse/ActiveRecord
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Docker Repository update'
,
container_repository_id:
registry
.
container_repository_id
,
skippable:
skippable?
,
project:
registry
.
container_repository
.
project_id
)
project:
registry
.
container_repository
.
project_id
,
job_id:
job_id
)
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/design_repository_updated_event.rb
View file @
04ae2ca5
...
...
@@ -30,8 +30,7 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Design repository update'
,
project_id:
event
.
project_id
,
scheduled_at:
Time
.
now
,
...
...
ee/lib/gitlab/geo/log_cursor/events/hashed_storage_attachments_event.rb
View file @
04ae2ca5
...
...
@@ -24,14 +24,12 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Migrating attachments to hashed storage'
,
project_id:
event
.
project_id
,
old_attachments_path:
event
.
old_attachments_path
,
new_attachments_path:
event
.
new_attachments_path
,
job_id:
job_id
)
job_id:
job_id
)
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/hashed_storage_migrated_event.rb
View file @
04ae2ca5
...
...
@@ -27,8 +27,7 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Migrating project to hashed storage'
,
project_id:
event
.
project_id
,
old_storage_version:
event
.
old_storage_version
,
...
...
ee/lib/gitlab/geo/log_cursor/events/job_artifact_deleted_event.rb
View file @
04ae2ca5
...
...
@@ -20,8 +20,7 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Delete job artifact scheduled'
,
file_id:
event
.
job_artifact_id
,
file_path:
event
.
file_path
,
...
...
ee/lib/gitlab/geo/log_cursor/events/lfs_object_deleted_event.rb
View file @
04ae2ca5
...
...
@@ -20,8 +20,7 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Delete LFS object scheduled'
,
oid:
event
.
oid
,
file_id:
event
.
lfs_object_id
,
...
...
ee/lib/gitlab/geo/log_cursor/events/repositories_changed_event.rb
View file @
04ae2ca5
...
...
@@ -19,9 +19,14 @@ module Gitlab
def
log_event
(
job_id
)
if
job_id
logger
.
info
(
'Scheduled repositories clean up for Geo node'
,
geo_node_id:
event
.
geo_node_id
,
job_id:
job_id
)
super
(
'Scheduled repositories clean up for Geo node'
,
geo_node_id:
event
.
geo_node_id
,
job_id:
job_id
)
else
logger
.
error
(
'Could not schedule repositories clean up for Geo node'
,
geo_node_id:
event
.
geo_node_id
)
logger
.
error
(
'Could not schedule repositories clean up for Geo node'
,
geo_node_id:
event
.
geo_node_id
)
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/repository_created_event.rb
View file @
04ae2ca5
...
...
@@ -8,25 +8,28 @@ module Gitlab
include
BaseEvent
def
process
log_event
registry
.
repository_created!
(
event
)
job_id
=
nil
enqueue_job_if_shard_healthy
(
event
)
do
::
Geo
::
ProjectSyncWorker
.
perform_async
(
event
.
project_id
,
sync_repository:
true
,
sync_wiki:
true
)
job_id
=
::
Geo
::
ProjectSyncWorker
.
perform_async
(
event
.
project_id
,
sync_repository:
true
,
sync_wiki:
true
)
end
log_event
(
job_id
)
end
private
def
log_event
logger
.
event_info
(
created_at
,
def
log_event
(
job_id
)
super
(
'Repository created'
,
project_id:
event
.
project_id
,
repo_path:
event
.
repo_path
,
wiki_path:
event
.
wiki_path
,
resync_repository:
registry
.
resync_repository
,
resync_wiki:
registry
.
resync_wiki
)
resync_wiki:
registry
.
resync_wiki
,
job_id:
job_id
)
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/repository_deleted_event.rb
View file @
04ae2ca5
...
...
@@ -30,15 +30,13 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Deleted project'
,
project_id:
event
.
project_id
,
repository_storage_name:
event
.
repository_storage_name
,
disk_path:
event
.
deleted_path
,
skippable:
skippable?
,
job_id:
job_id
)
job_id:
job_id
)
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/repository_renamed_event.rb
View file @
04ae2ca5
...
...
@@ -26,8 +26,7 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Renaming project'
,
project_id:
event
.
project_id
,
old_path:
event
.
old_path_with_namespace
,
...
...
ee/lib/gitlab/geo/log_cursor/events/repository_updated_event.rb
View file @
04ae2ca5
...
...
@@ -24,8 +24,7 @@ module Gitlab
private
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Repository update'
,
project_id:
event
.
project_id
,
source:
event
.
source
,
...
...
ee/lib/gitlab/geo/log_cursor/events/reset_checksum_event.rb
View file @
04ae2ca5
...
...
@@ -9,18 +9,11 @@ module Gitlab
def
process
registry
.
reset_checksum!
unless
skippable?
log_event
end
private
def
log_event
logger
.
event_info
(
created_at
,
log_event
(
'Reset checksum'
,
project_id:
event
.
project_id
,
skippable:
skippable?
)
skippable:
skippable?
)
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/events/upload_deleted_event.rb
View file @
04ae2ca5
...
...
@@ -13,8 +13,7 @@ module Gitlab
end
def
log_event
(
job_id
)
logger
.
event_info
(
created_at
,
super
(
'Delete upload file scheduled'
,
upload_id:
event
.
upload_id
,
upload_type:
event
.
upload_type
,
...
...
ee/spec/lib/gitlab/geo/log_cursor/events/cache_invalidation_event_spec.rb
View file @
04ae2ca5
...
...
@@ -33,7 +33,7 @@ describe Gitlab::Geo::LogCursor::Events::CacheInvalidationEvent, :clean_gitlab_r
expect
(
::
Gitlab
::
Logger
)
.
to
receive
(
:info
)
.
with
(
hash_including
(
data
))
.
with
(
hash_including
(
:event_id
,
data
))
subject
.
process
end
...
...
ee/spec/lib/gitlab/geo/log_cursor/events/container_repository_updated_event_spec.rb
View file @
04ae2ca5
...
...
@@ -26,5 +26,7 @@ describe Gitlab::Geo::LogCursor::Events::ContainerRepositoryUpdatedEvent, :clean
subject
.
process
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/design_repository_updated_event_spec.rb
View file @
04ae2ca5
...
...
@@ -63,5 +63,7 @@ describe Gitlab::Geo::LogCursor::Events::DesignRepositoryUpdatedEvent, :clean_gi
subject
.
process
end
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/hashed_storage_attachments_event_spec.rb
View file @
04ae2ca5
...
...
@@ -28,5 +28,7 @@ describe Gitlab::Geo::LogCursor::Events::HashedStorageAttachmentsEvent, :clean_g
subject
.
process
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/hashed_storage_migrated_event_spec.rb
View file @
04ae2ca5
...
...
@@ -40,5 +40,7 @@ describe Gitlab::Geo::LogCursor::Events::HashedStorageMigratedEvent, :clean_gitl
subject
.
process
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/job_artifact_deleted_event_spec.rb
View file @
04ae2ca5
...
...
@@ -72,5 +72,7 @@ describe Gitlab::Geo::LogCursor::Events::JobArtifactDeletedEvent, :clean_gitlab_
expect
{
subject
.
process
}.
not_to
change
{
File
.
exist?
(
job_artifact
.
file
.
path
)
}.
from
(
true
)
end
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/lfs_object_deleted_event_spec.rb
View file @
04ae2ca5
...
...
@@ -31,5 +31,7 @@ describe Gitlab::Geo::LogCursor::Events::LfsObjectDeletedEvent, :clean_gitlab_re
subject
.
process
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/repositories_changed_event_spec.rb
View file @
04ae2ca5
...
...
@@ -35,5 +35,7 @@ describe Gitlab::Geo::LogCursor::Events::RepositoriesChangedEvent, :clean_gitlab
subject
.
process
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/repository_created_event_spec.rb
View file @
04ae2ca5
...
...
@@ -52,6 +52,8 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryCreatedEvent, :clean_gitlab_r
subject
.
process
end
it_behaves_like
'logs event source info'
end
context
'when the associated shard is not healthy'
do
...
...
ee/spec/lib/gitlab/geo/log_cursor/events/repository_deleted_event_spec.rb
View file @
04ae2ca5
...
...
@@ -51,5 +51,7 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryDeletedEvent, :clean_gitlab_r
end
end
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/repository_renamed_event_spec.rb
View file @
04ae2ca5
...
...
@@ -39,5 +39,7 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryRenamedEvent, :clean_gitlab_r
subject
.
process
end
it_behaves_like
'logs event source info'
end
end
ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb
View file @
04ae2ca5
...
...
@@ -142,6 +142,8 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :clean_gitlab_r
end
end
end
it_behaves_like
'logs event source info'
end
context
'when associated shard is unhealthy'
do
...
...
ee/spec/lib/gitlab/geo/log_cursor/events/upload_deleted_event_spec.rb
View file @
04ae2ca5
...
...
@@ -31,6 +31,8 @@ describe Gitlab::Geo::LogCursor::Events::UploadDeletedEvent, :clean_gitlab_redis
expect
{
subject
.
process
}.
to
change
(
Geo
::
UploadRegistry
,
:count
).
by
(
-
1
)
end
it_behaves_like
'logs event source info'
end
end
end
ee/spec/support/shared_examples/lib/gitlab/geo/geo_logs_event_source_info_shared_examples.rb
0 → 100644
View file @
04ae2ca5
# frozen_string_literal: true
RSpec
.
shared_examples
'logs event source info'
do
it
'logs `job_id` and `event_id'
do
expect_any_instance_of
(
Gitlab
::
Geo
::
LogCursor
::
Logger
).
to
receive
(
:info
)
.
with
(
anything
,
hash_including
(
:job_id
,
:event_id
))
.
at_least
(
:once
)
.
and_call_original
subject
.
process
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