Set XMLHttpRequest Instrumentation to use traceparent meta tag on initial page load #3419
Unanswered
paychex-ssmithrand
asked this question in
Q&A
Replies: 1 comment
-
Did you ever find how to make XMLHttpRequest use the same traceparent? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have dynamically generated HTML being served from an instrumented Ruby On Rails controller. That controller initiates the root span and sets the
meta
tag on the generated HTML appropriately. On the client side, I have both DocumentLoadInstrumentation and XMLHttpRequest Instrumentation enabled.Since DocumentLoadInstrumentation has built-in code to continue using the passed trace context via the traceparent meta tag, it correctly correlates its generated Spans. However, calls to APIs are being made as part of page initialization and XMLHttpRequest Instrumentation is not using the traceparent context, causing each call to have its own trace id. This behavior makes sense when API calls are being made after page load and the user is interacting with the app, but is it possible to flag that instrumentation to use the traceparent context on page load only?
Currently, our Collector is not exposed publicly, so just using DocumentLoadInstrumentation and exporting those Spans is not an option (for now). The API endpoints that get called are right back to other Ruby controllers, which means they will be collected and can be correlated on the backend.
Thoughts here?
Beta Was this translation helpful? Give feedback.
All reactions