-
Notifications
You must be signed in to change notification settings - Fork 823
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(http): do not set outgoing http span as active in the context #1479 #1546
fix(http): do not set outgoing http span as active in the context #1479 #1546
Conversation
daa6cf2
to
a88ceff
Compare
Codecov Report
@@ Coverage Diff @@
## master #1546 +/- ##
==========================================
- Coverage 91.50% 91.48% -0.02%
==========================================
Files 165 165
Lines 5036 5036
Branches 1025 1025
==========================================
- Hits 4608 4607 -1
- Misses 428 429 +1
|
a88ceff
to
cca6601
Compare
packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
Outdated
Show resolved
Hide resolved
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.
Agree with @blumamir's suggested test, but this seems like a good idea to me.
@vmarchaud this PR duplicates similar stuff I fixed here -> #1541 |
@obecny This PR only removes the |
maybe I'm missing something but trying to analyze possible merge between 2 prs and wondering if it won't be either duplicated or the outcome will be different for both cases. |
|
make sense, thx :) |
cca6601
to
e9e1cbe
Compare
I've rebased the PR, i believe this is a simpler fix than #1541 that does involves injecting anything in the context. |
cc @open-telemetry/javascript-approvers Would like more review to ship it in the next release please ! |
Motivating example for those not sure. Scenario: You want to make 2 requests. The second request should not be made until after the first request completes. With fix: const parent = tracer.startSpan("parent");
tracer.withSpan(parent, () => {
console.log(tracer.getActiveSpan().name); // parent
http.get(url, (res) => { // new span is created by the http plugin
res.resume() // discard response data
res.on('end', () => {
// inside this callback, the http.GET span should NOT be active
console.log(tracer.getActiveSpan().name); // parent - Success!
// the span for this request is a sibling of the first request as expected
http.get(url, (res) => {/* elided */})
})
});
}); without fix const parent = tracer.startSpan("parent");
tracer.withSpan(parent, () => {
console.log(tracer.getActiveSpan().name); // parent
http.get(url, (res) => { // new span is created by the http plugin
res.resume() // discard response data
res.on('end', () => {
// inside this callback, the http.GET span should NOT be active
console.log(tracer.getActiveSpan().name); // GET - Oh no! D: <-------- bug here
// the span for this request is a child of the first request
// even though it is not _caused_by_ the first request.
http.get(url, (res) => {/* elided */})
})
});
}); |
@mwear Would be really nice to review this one so we can ship it with 0.12 ? Thanks |
Sorry I missed the boat on this @vmarchaud. |
See #1479 for motivation