-
Notifications
You must be signed in to change notification settings - Fork 487
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
fix(ioredis): Make sure span.end is only called once #2256
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2256 +/- ##
==========================================
- Coverage 90.97% 90.36% -0.62%
==========================================
Files 146 148 +2
Lines 7492 7524 +32
Branches 1502 1576 +74
==========================================
- Hits 6816 6799 -17
- Misses 676 725 +49
|
Once some tests are added, this looks good to me. As for how you might go about doing that - would it be possible to recreate the scenario with the ioredis package that was calling |
I'm struggling figuring out a good way to spy on the returned span here. I have something like so: let endSpanSpy;
const original = instrumentation['tracer'].startSpan;
sinon
.stub(instrumentation['tracer'], 'startSpan')
.callsFake((name, options, context) => {
const span = original(name, options, context);
endSpanSpy = sinon.spy(span, 'end');
return span;
}); but that seems to be causing issues for some reason. |
Alright I have it something like so:
but the |
Which problem is this PR solving?
Fixes #2254
Short description of the changes
I moved the
endSpan
helper inline and made it mutate aspanHasEnded
flag to enforcespan.end
is only called once.Not sure how to best test this change, advice there appreciated!