-
-
Notifications
You must be signed in to change notification settings - Fork 513
Set user to the current scope via sidekiq middleware #1469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1469 +/- ##
==========================================
+ Coverage 98.24% 98.74% +0.49%
==========================================
Files 214 120 -94
Lines 10156 6350 -3806
==========================================
- Hits 9978 6270 -3708
+ Misses 178 80 -98
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@st0012 Could you help to finish this PR?
sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb
Outdated
Show resolved
Hide resolved
sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb
Outdated
Show resolved
Hide resolved
56e42c9
to
22366eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@st0012 Hi, I rewrote the test in an E2E way. Could you take a look?
sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb
Outdated
Show resolved
Hide resolved
22366eb
to
e12dcc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's almost done but there's one outstanding issue. The notable changes made from the last review are
- Use
traces_sample_rate = 1.0
"hack". - Use HappyWroker/SadWoker from spec helper.
e12dcc6
to
c903d43
Compare
|
||
queue = random_empty_queue | ||
options = { fetch: Sidekiq::BasicFetch.new(queues: [queue.name]) } | ||
processor = Sidekiq::Processor.new(nil, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way you initialize sidekiq processor is not compatible with sidekiq v5.2 (which runs in Ruby 2.4 test suite).
instead of initializing the processor directly, can we initialize a manager and get the processor from it? like
sentry-ruby/sentry-sidekiq/spec/sentry/sidekiq_spec.rb
Lines 15 to 19 in 6d2fc60
let(:processor) do | |
opts = { :queues => ['default'] } | |
manager = Sidekiq::Manager.new(opts) | |
manager.workers.first | |
end |
I will merge this PR once the test is fixed 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually it still fails with Sidekiq 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran tests with sidekiq 5 and confirmed it works.
c903d43
to
70bf1b6
Compare
70bf1b6
to
f674c58
Compare
|
||
client.push('queue' => queue.name, 'class' => SadWorker, 'args' => []) | ||
|
||
# XXX: In ruby 2.4, two events are pushed. In other versions, only one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@st0012 this behavior is strange...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check this in a follow up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the contribution 👍
I'll add another PR to refactor the test cases and add changelog entry for this.
Thanks a lot for the help 👍 |
Close #1468.