-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat(toolbar): add a replay panel for start/stop current replay #75403
Conversation
Bundle ReportChanges will increase total bundle size by 7.23kB ⬆️
|
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #75403 +/- ##
==========================================
- Coverage 80.06% 78.22% -1.84%
==========================================
Files 6996 6830 -166
Lines 312723 303280 -9443
Branches 52171 52182 +11
==========================================
- Hits 250370 237244 -13126
+ Misses 61911 59661 -2250
- Partials 442 6375 +5933
|
This comment was marked as outdated.
This comment was marked as outdated.
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
static/app/components/devtoolbar/components/replay/replayPanel.tsx
Outdated
Show resolved
Hide resolved
export default function useReplayRecorder(): ReplayRecorderState { | ||
const {SentrySDK} = useConfiguration(); | ||
const replay = | ||
SentrySDK && 'getReplay' in SentrySDK ? SentrySDK.getReplay() : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use SentrySDK.getIntegrationByName()
, it's just a bit more annoying dealing with types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm my VSCode can't find this method in browser or react packages..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm it might be on the SDK client instead of the Sentry namespace... e.g. SentrySDK.getClient().getIntegrationByName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, does this have any improvements over the current approach? Right now I'm using these conditions to get the disabledReason
(see screenshots I just added in the description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah just as a fallback if the SDK is too old to support getReplay
as it was a relatively recent addition, but it's fine not to support older
static/app/utils/useDevToolbar.tsx
Outdated
organizationSlug: | ||
process.env.NODE_ENV !== 'development' ? 'sentry' : 'sentry-test', | ||
projectId: process.env.NODE_ENV !== 'development' ? 11276 : 5270453, | ||
projectPlatform: 'javascript', | ||
projectSlug: 'javascript', | ||
projectSlug: | ||
process.env.NODE_ENV !== 'development' ? 'javascript' : 'app-frontend', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is PoC we are hard coding the org/project slugs, this allows the links to work in dev mode (assuming the replay integration is enabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you test by running the app with yarn dev-ui
. my workflow depends on that command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works, but you need to comment out this condition in getsentry's useReplayInit: https://github.com/getsentry/getsentry/blob/2a1da081f3a9e4e4111b577d5551fa24691da374/static/getsentry/gsApp/utils/useReplayInit.tsx#L85-L87
I think it's disabled so we don't record everyone's dev-ui sessions. Maybe we could uncomment but set both sample rates to 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make a ticket and add it to the dev toolbar project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably hold off on a ticket to change useReplayInit
. The toolbar should support whatever env it finds itself inside of. So if sometimes there's no replayIntegration
at all, that should be ok. We'll be able to test that case in dev, and on prod there will be a replayIntegration
so we can test that case as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't thinking about the other panels, this change would break them for dev. I'm done testing, let's just leave this panel disabled in dev.
disabled={isDisabled || buttonLoading} | ||
onClick={async () => { | ||
setButtonLoading(true); | ||
isRecordingSession ? await stopRecording() : await startRecordingSession(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not allowing users to stop buffering.
|
||
const startRecordingSession = useCallback(async () => { | ||
let success = false; | ||
if (replay) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to try-catch here because we can already condition to make sure we're in a safe state.
Closes #74583
Closes #74452
getReplay
returns undefined:SentrySDK doesn't have
getReplay
method:SentrySDK is falsey (failed to import the package):
If you want to checkout this branch to test it, you need to run dev-ui in getsentry and make local changes:
Notes:
Follow-ups before merging
getReplay
/public API is unknown, but it was ~2yr ago near the release of the whole productFollow-ups after merging