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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
bfa061f3
Commit
bfa061f3
authored
Feb 29, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
1ab1a6ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
23 deletions
+2
-23
lib/gitlab/sidekiq_logging/structured_logger.rb
lib/gitlab/sidekiq_logging/structured_logger.rb
+1
-5
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
+1
-18
No files found.
lib/gitlab/sidekiq_logging/structured_logger.rb
View file @
bfa061f3
...
...
@@ -85,11 +85,7 @@ module Gitlab
job
[
'pid'
]
=
::
Process
.
pid
job
.
delete
(
'args'
)
unless
ENV
[
'SIDEKIQ_LOG_ARGUMENTS'
]
if
job
[
'args'
]
job
[
'args'
].
map!
(
&
:to_s
)
job
[
'args'
]
=
Gitlab
::
Utils
::
LogLimitedArray
.
log_limited_array
(
job
[
'args'
])
end
job
[
'args'
]
=
Gitlab
::
Utils
::
LogLimitedArray
.
log_limited_array
(
job
[
'args'
])
if
job
[
'args'
]
job
end
...
...
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
View file @
bfa061f3
...
...
@@ -30,7 +30,6 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
let
(
:clock_thread_cputime_end
)
{
1.333333799
}
let
(
:start_payload
)
do
job
.
except
(
'error_backtrace'
,
'error_class'
,
'error_message'
).
merge
(
'args'
=>
job
[
'args'
].
map
(
&
:to_s
),
'message'
=>
'TestWorker JID-da883554ee4fe414012f5f42: start'
,
'job_status'
=>
'start'
,
'pid'
=>
Process
.
pid
,
...
...
@@ -100,29 +99,13 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
end
end
context
'when the job args contain non-string objects'
do
it
'converts them to strings'
do
Timecop
.
freeze
(
timestamp
)
do
job
[
'args'
]
=
[
2
,
true
,
'foo'
,
{
"foo"
=>
"bar"
}]
expected_args
=
[
'2'
,
'true'
,
'foo'
,
'{"foo"=>"bar"}'
]
expect
(
logger
).
to
receive
(
:info
).
with
(
start_payload
.
merge
(
'args'
=>
expected_args
)).
ordered
expect
(
logger
).
to
receive
(
:info
).
with
(
end_payload
.
merge
(
'args'
=>
expected_args
)).
ordered
expect
(
subject
).
to
receive
(
:log_job_start
).
and_call_original
expect
(
subject
).
to
receive
(
:log_job_done
).
and_call_original
subject
.
call
(
job
,
'test_queue'
)
{
}
end
end
end
context
'when the job args are bigger than the maximum allowed'
do
it
'keeps args from the front until they exceed the limit'
do
Timecop
.
freeze
(
timestamp
)
do
half_limit
=
Gitlab
::
Utils
::
LogLimitedArray
::
MAXIMUM_ARRAY_LENGTH
/
2
job
[
'args'
]
=
[
1
,
2
,
'a'
*
half_limit
,
'b'
*
half_limit
,
3
]
expected_args
=
job
[
'args'
].
map
(
&
:to_s
).
take
(
3
)
+
[
'...'
]
expected_args
=
job
[
'args'
].
take
(
3
)
+
[
'...'
]
expect
(
logger
).
to
receive
(
:info
).
with
(
start_payload
.
merge
(
'args'
=>
expected_args
)).
ordered
expect
(
logger
).
to
receive
(
:info
).
with
(
end_payload
.
merge
(
'args'
=>
expected_args
)).
ordered
...
...
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