[BUG] Remote Dependency requests don't "always" have the correct ai.operation.id tag (page view race condition) #1862
Labels
investigating
Investigating the issue
p2
production
released - NPM
SPA support
Required to support SPA style apps
Milestone
When an ajax (XHR/fetch) request occurs it is provided with the "requestId" and "traceparent" headers for distributed tracing downstream based on the current "traceId" of the page (which is the correct behavior) and when the response for the request is received the SDK will cause an event to be sent via the
trackInternalDependency
function.However, this call will only occur after BOTH of the following
enableAjaxperfTracking
is enabled after the runtime populates the performance event for the request OR the SDK times out waiting for the value (defaults to 3 attempts every 25ms (75ms total)).Additionally, during the construction of the
event
(that is passed to the track call) and it getting stored in the internal buffer (waiting to be sent) the event will be populated with a bunch of standard values including thetag
ai.operation.id
which is the current value at the point of thetrackXXXX()
call.Normally, this is not an issue
-- unless a page navigation occurs OR you set / change the
traceID
for the page (between) the time the ajax was "sent" to the time that it'strackXXX()
call is made. In this case theai.operation.id
tag value sent for the request will be that of the "current page" and not the page that triggered the event.To address this issue fix required (further analysis / investigation required), looks like it would be to
ext.trace
values on the event before callingtraceInternalDependency
getSetValue()
instead ofsetValue()
(which always set the value) or add aisNullOrUndefined
value check argument to to thesetVeluer
helper. Otherwise, this code will ALWAYS overwrite any value on the event.The text was updated successfully, but these errors were encountered: