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
Start using OTEL tracing on the client for network requests #8470
Comments
To integrate W3C-compliant OTEL tracing for network requests on the client side, follow these steps:
Example Code Snippet for XMLHttpRequest: XHR.setRequestHeader = function (this: BrowserXHR, header: string, value: string) {
if (header.toLowerCase() === 'traceparent') {
// Generate or use existing traceId and spanId
const traceValue = `00-${traceId}-${spanId}-01`;
this._requestHeaders['traceparent'] = traceValue;
}
return originalSetRequestHeader.apply(this, arguments);
} This approach ensures that the client-side network requests are traced in a manner that's compatible with the backend's observability tools, adhering to the W3C Trace Context specification. Referenceshighlight/highlight/sdk/client/src/listeners/network-listener/utils/utils.ts |
Ensure we use the W3C spec on the client so we can pick it up on the back end.
The text was updated successfully, but these errors were encountered: