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
8bc7ea0d
Commit
8bc7ea0d
authored
Feb 01, 2021
by
Quang-Minh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unwrap ActiveJob wrapper in Sidekiq logs
Issue
https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/435
parent
df83223b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
lib/gitlab/sidekiq_logging/logs_jobs.rb
lib/gitlab/sidekiq_logging/logs_jobs.rb
+3
-0
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
+15
-0
No files found.
lib/gitlab/sidekiq_logging/logs_jobs.rb
View file @
8bc7ea0d
...
...
@@ -9,6 +9,9 @@ module Gitlab
# NOTE: Arguments are truncated/stringified in sidekiq_logging/json_formatter.rb
def
parse_job
(
job
)
if
job
[
'wrapped'
].
present?
job
[
'class'
]
=
job
.
delete
(
'wrapped'
)
end
# Error information from the previous try is in the payload for
# displaying in the Sidekiq UI, but is very confusing in logs!
job
=
job
.
except
(
'error_backtrace'
,
'error_class'
,
'error_message'
)
...
...
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
View file @
8bc7ea0d
...
...
@@ -89,6 +89,21 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
end
end
it
'logs real job wrapped by active job worker'
do
wrapped_job
=
job
.
merge
(
"class"
=>
"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
,
"wrapped"
=>
"TestWorker"
)
Timecop
.
freeze
(
timestamp
)
do
expect
(
logger
).
to
receive
(
:info
).
with
(
start_payload
).
ordered
expect
(
logger
).
to
receive
(
:info
).
with
(
end_payload
).
ordered
expect
(
subject
).
to
receive
(
:log_job_start
).
and_call_original
expect
(
subject
).
to
receive
(
:log_job_done
).
and_call_original
subject
.
call
(
wrapped_job
,
'test_queue'
)
{}
end
end
it
'logs an exception in job'
do
Timecop
.
freeze
(
timestamp
)
do
expect
(
logger
).
to
receive
(
:info
).
with
(
start_payload
)
...
...
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