Skip to content

Commit

Permalink
Merge pull request #1100 from microsoft/trask/fix-async-thread-tracking
Browse files Browse the repository at this point in the history
Fix async thread tracking
  • Loading branch information
trask authored Oct 16, 2019
2 parents 9e20a2f + 77d91cc commit 2882bc8
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ public Span startAndMarkAsyncTransactionComplete() {
private Span start(boolean completeAsyncTransaction) {
ThreadContextThreadLocal.Holder threadContextHolder = Global.getThreadContextHolder();
ThreadContextPlus threadContext = threadContextHolder.get();
if (threadContext != null) {
// TODO once local spans are supported, only return NOP if parent spans are the same
// Checking if in same request is needed in case the existing thread context is from a prior request
// (e.g. this can happen if the thread activity was captured via Thread constructor, but the thread was
// really then used in a thread pool)
if (threadContext != null && threadContext.getServletRequestInfo() == servletRequestInfo) {
if (completeAsyncTransaction) {
threadContext.setTransactionAsyncComplete();
}
Expand Down

0 comments on commit 2882bc8

Please sign in to comment.