How to add custom attributes to the trace dynamically with xhr request instrumentation #2677
Unanswered
SunilManthenaG01
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@SunilManthenaG01 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using XMLHttpRequestInstrumentation for tracing. I was able to see the traces but I am looking to add some custom header which the xhr request has into the trace. I am trying something like below but i was unable to access the request object from here.
new XMLHttpRequestInstrumentation({
clearTimingResources: true,
ignoreUrls: config.ignoredUrls,
propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
applyCustomAttributesOnSpan: (span: Span, xhr: XMLHttpRequest) => {
// how to get the request header objects from here.
// span.setAttribute('app-user-id', xhr.getResponseHeader('app-user-id'));
}
}),
Beta Was this translation helpful? Give feedback.
All reactions