faro-web-sdk
faro-web-sdk copied to clipboard
`tracestate` headers are not propagated
Description
Based on issue #131 I have managed to get partially propagate cors trace headers. I expected to also get the tracestate header propagated, but I am only getting the traceparent header propagated.
Steps to reproduce
Initialize faro as per on #131:
import {
initializeFaro as coreInit,
getWebInstrumentations,
ReactIntegration,
ReactRouterVersion,
Faro,
FetchTransport,
ConsoleTransport,
ReactRouterHistory,
} from '@grafana/faro-react';
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
import { DocumentLoadInstrumentation } from '@opentelemetry/instrumentation-document-load';
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
import { UserInteractionInstrumentation } from '@opentelemetry/instrumentation-user-interaction';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import { Route } from 'react-router-dom';
import { shouldCollect } from './utils';
import { History } from 'history';
export async function initializeFaro(browserHistory: History): Promise<Faro> {
// prevent faro from sending metrics on development
if (!shouldCollect()) return null;
const COLLECTOR_URL = 'some-url';
const ignoreUrls = [COLLECTOR_URL];
const propagateTraceHeaderCorsUrls = [new RegExp('my-apis-urls-pattern')];
const faro = coreInit({
instrumentations: [
...getWebInstrumentations({
captureConsole: true,
}),
new TracingInstrumentation({
instrumentations: [
new DocumentLoadInstrumentation(),
new FetchInstrumentation({
ignoreUrls,
propagateTraceHeaderCorsUrls,
}),
new XMLHttpRequestInstrumentation({
ignoreUrls,
propagateTraceHeaderCorsUrls,
}),
new UserInteractionInstrumentation(),
],
resourceAttributes: {
'service.name': config.global.FARO_SERVICE,
'team.name': process.env.REACT_APP_FARO_TEAM,
},
}),
new ReactIntegration({
router: {
version: ReactRouterVersion.V5,
dependencies: {
history: browserHistory as ReactRouterHistory,
Route,
},
},
}),
],
session: (window as any).__PRELOADED_STATE__?.faro?.session,
app: {
name: config.global.FARO_SERVICE,
version: process.env.REACT_APP_VERSION,
environment: undefined,
release: process.env.REACT_APP_FARO_TEAM,
},
user: {
username: 'some-username',
},
transports: [
new FetchTransport({
url: COLLECTOR_URL,
apiKey: config.global.FARO_SECRET,
}),
new ConsoleTransport(),
],
});
faro.api.pushLog(['Faro was initialized']);
return faro;
}
Expected behavior
Would like to see tracestate header propagated, or have a documented way of doing so.
Actual behavior
With the workaround I just manage to propagate traceparent header
Environment
- SDK version: 1.0.2
- SDK instrumentations: React
- Device type: desktop
- Device name: MacBook Air M1 13"
- **OS:**MacOS
- **Browser:**Chrome
Hi @alioshr thank you for the bug report.
Would you please add the following information:
- Web-SDK version
- OS and Browser (Vendor + Version)
Hy @codecapitano ! Thanks for replying back to me once again.
I have added the environment info and also the config used to initialize faro
Hi @codecapitano. Could you please confirm if you need more info?
Hi @alioshr thanks a lot. This looks good.
hey @codecapitano. Did you ever manage to look into this issue?
Hi @alioshr, unfortunately not.