Closed
Description
Problem Statement
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
environment: process.env.NODE_ENV,
sampleRate: 0.1,
//tracesSampleRate: 0.05,
integrations: [
new TracingIntegrations.BrowserTracing({
routingInstrumentation: Sentry.reactRouterV5Instrumentation(history),
tracingOrigins: [
REACT_APP_APOLLO_SERVER,
REACT_APP_SEARCH_API,
REACT_APP_AUTH_URL,
REACT_APP_PUBLIC_API,
/^\//,
],
idleTimeout: 15000,
}),
],
tracesSampler(samplingContext) {
console.log('samplingContext: ', samplingContext)
return 1
},
beforeBreadcrumb: (breadcrumb, hint) => {
const graphQLStringQuery = (hint?.input || [])[1]?.body;
const graphQLQuery = graphQLStringQuery && JSON.parse(graphQLStringQuery);
const subUrl =
graphQLQuery && breadcrumb.data?.url === REACT_APP_APOLLO_SERVER ?
graphQLQuery.operationName :
''
return {
...breadcrumb,
data: {
...breadcrumb.data,
url: breadcrumb.data?.url + '/' + 'subUrl'
},
}
},
});
For now, I'm using the BrowserTracing instrumentation, it creates a child span for each fetch/xhr request. However, nothing I can do to update the descriptions, URLs of the spans (I'm using apollo client and all the queries' description is the same)
Solution Brainstorm
How about creating a hook to update the spans before adding to the transaction (similar to the beforeBreadcrumb)