fix(deps): update dependency @sentry/browser to v8
This commit is contained in:
+2
-38
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
ApolloClient,
|
||||
ApolloLink,
|
||||
createHttpLink,
|
||||
from,
|
||||
InMemoryCache,
|
||||
@@ -67,40 +66,7 @@ const authLink = setContext(async (_, { headers }) => {
|
||||
}))
|
||||
})
|
||||
|
||||
const traceHeaders = setContext((_, { headers }) => {
|
||||
const th = Sentry.getCurrentHub().traceHeaders()
|
||||
return {
|
||||
headers: {
|
||||
...headers,
|
||||
...th,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
const sentryTransactionLink = new ApolloLink((operation, forward) => {
|
||||
const existingTransaction = Sentry.getCurrentHub()
|
||||
.getScope()
|
||||
?.getTransaction()
|
||||
// Create a transaction if one does not exist in order to work around
|
||||
// https://github.com/getsentry/sentry-javascript/issues/3169
|
||||
// https://github.com/getsentry/sentry-javascript/issues/4072
|
||||
const transaction =
|
||||
existingTransaction ??
|
||||
Sentry.startTransaction({
|
||||
name: `Apollo Request: ${operation.operationName}`,
|
||||
})
|
||||
|
||||
Sentry.getCurrentHub().configureScope((scope) => scope.setSpan(transaction))
|
||||
|
||||
operation.setContext({ tracing: { transaction } })
|
||||
return forward(operation).map((data) => {
|
||||
operation.getContext().tracing?.transaction?.finish()
|
||||
return data
|
||||
})
|
||||
})
|
||||
|
||||
const link = sentryTransactionLink.concat(
|
||||
traceHeaders.concat(
|
||||
const link =
|
||||
from([
|
||||
new SentryLink({}),
|
||||
split(
|
||||
@@ -114,9 +80,7 @@ const link = sentryTransactionLink.concat(
|
||||
authLink.concat(wsLink),
|
||||
authLink.concat(httpLink),
|
||||
),
|
||||
]),
|
||||
),
|
||||
)
|
||||
])
|
||||
|
||||
const instance = new ApolloClient({
|
||||
connectToDevTools: true,
|
||||
|
||||
Reference in New Issue
Block a user