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
b17c388e
Commit
b17c388e
authored
Feb 01, 2021
by
Quang-Minh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not modify job in the structured job
parent
5faa90ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
lib/gitlab/sidekiq_logging/logs_jobs.rb
lib/gitlab/sidekiq_logging/logs_jobs.rb
+1
-3
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
+18
-0
No files found.
lib/gitlab/sidekiq_logging/logs_jobs.rb
View file @
b17c388e
...
...
@@ -9,12 +9,10 @@ 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'
)
job
[
'class'
]
=
job
.
delete
(
'wrapped'
)
if
job
[
'wrapped'
].
present?
# Add process id params
job
[
'pid'
]
=
::
Process
.
pid
...
...
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
View file @
b17c388e
...
...
@@ -188,6 +188,24 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
end
end
end
it
'does not modify the wrapped job'
do
Timecop
.
freeze
(
timestamp
)
do
wrapped_job
=
job
.
merge
(
"class"
=>
"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
,
"wrapped"
=>
"TestWorker"
)
job_copy
=
wrapped_job
.
deep_dup
allow
(
logger
).
to
receive
(
:info
)
allow
(
subject
).
to
receive
(
:log_job_start
).
and_call_original
allow
(
subject
).
to
receive
(
:log_job_done
).
and_call_original
subject
.
call
(
wrapped_job
,
'test_queue'
)
do
expect
(
wrapped_job
).
to
eq
(
job_copy
)
end
end
end
end
context
'with SIDEKIQ_LOG_ARGUMENTS disabled'
do
...
...
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