-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat: Update Sentry SDK to 8.0.0-beta.5 #68520
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
Changes from all commits
1d85f2c
adaba91
13d4b32
e288bba
34ce0fb
63c66bc
a1baa82
1c4a136
4f68800
34243dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// eslint-disable-next-line simple-import-sort/imports | ||
import {browserHistory, createRoutes, match} from 'react-router'; | ||
import {extraErrorDataIntegration} from '@sentry/integrations'; | ||
import * as Sentry from '@sentry/react'; | ||
import {_browserPerformanceTimeOriginMode} from '@sentry/utils'; | ||
import type {Event} from '@sentry/types'; | ||
|
@@ -51,19 +50,17 @@ const shouldOverrideBrowserProfiling = window?.__initialData?.user?.isSuperuser; | |
*/ | ||
function getSentryIntegrations(routes?: Function) { | ||
const integrations = [ | ||
extraErrorDataIntegration({ | ||
Sentry.extraErrorDataIntegration({ | ||
// 6 is arbitrary, seems like a nice number | ||
depth: 6, | ||
}), | ||
Sentry.metrics.metricsAggregatorIntegration(), | ||
Sentry.reactRouterV3BrowserTracingIntegration({ | ||
history: browserHistory as any, | ||
routes: typeof routes === 'function' ? createRoutes(routes()) : [], | ||
match, | ||
_experiments: { | ||
enableInteractions: true, | ||
}, | ||
enableInp: true, | ||
mydea marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: INP is now enabled by default. |
||
}), | ||
Sentry.browserProfilingIntegration(), | ||
]; | ||
|
@@ -103,7 +100,8 @@ export function initializeSdk(config: Config, {routes}: {routes?: Function} = {} | |
profilesSampleRate: shouldOverrideBrowserProfiling ? 1 : 0.1, | ||
tracePropagationTargets: ['localhost', /^\//, ...extraTracePropagationTargets], | ||
tracesSampler: context => { | ||
if (context.transactionContext.op?.startsWith('ui.action')) { | ||
const op = context.attributes?.[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP] || ''; | ||
if (op.startsWith('ui.action')) { | ||
return tracesSampleRate / 100; | ||
} | ||
return tracesSampleRate; | ||
|
@@ -120,9 +118,7 @@ export function initializeSdk(config: Config, {routes}: {routes?: Function} = {} | |
|
||
// If we removed any spans at the end above, the end timestamp needs to be adjusted again. | ||
if (event.spans) { | ||
const newEndTimestamp = Math.max( | ||
...event.spans.map(span => span.endTimestamp ?? 0) | ||
); | ||
const newEndTimestamp = Math.max(...event.spans.map(span => span.timestamp ?? 0)); | ||
event.timestamp = newEndTimestamp; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type {RefObject} from 'react'; | ||
import {useEffect} from 'react'; | ||
import {type Feedback, getClient} from '@sentry/react'; | ||
import * as Sentry from '@sentry/react'; | ||
|
||
import {t} from 'sentry/locale'; | ||
import ConfigStore from 'sentry/stores/configStore'; | ||
|
@@ -13,9 +13,7 @@ interface Props { | |
|
||
export default function useFeedbackWidget({buttonRef, messagePlaceholder}: Props) { | ||
const config = useLegacyStore(ConfigStore); | ||
const client = getClient(); | ||
// Note that this is only defined in environments where Feedback is enabled (getsentry) | ||
const feedback = client?.getIntegrationByName?.<Feedback>('Feedback'); | ||
const feedback = Sentry.getFeedback(); | ||
|
||
useEffect(() => { | ||
if (!feedback) { | ||
|
@@ -32,15 +30,12 @@ export default function useFeedbackWidget({buttonRef, messagePlaceholder}: Props | |
|
||
if (buttonRef) { | ||
if (buttonRef.current) { | ||
const widget = feedback.attachTo(buttonRef.current, options); | ||
return () => { | ||
feedback.removeWidget(widget); | ||
}; | ||
return feedback.attachTo(buttonRef.current, options); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is working ✅ |
||
} | ||
} else { | ||
const widget = feedback.createWidget(options); | ||
return () => { | ||
feedback.removeWidget(widget); | ||
widget.removeFromDom(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as Sentry from '@sentry/react'; | ||
|
||
/** | ||
* Gets the current root span, if one exists. | ||
*/ | ||
export default function getCurrentSentryReactRootSpan() { | ||
const span = Sentry.getActiveSpan(); | ||
return span ? Sentry.getRootSpan(span) : undefined; | ||
} |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.