Skip to content
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(source-map-debug): Connect source map debug modal to backend #56257

Merged
merged 9 commits into from
Sep 25, 2023

Conversation

lforst
Copy link
Member

@lforst lforst commented Sep 14, 2023

This connects the source map debugger modal to the current version of our source maps debug endpoint.

Additionally, we show a pill on stack frames that aren't symbolicated.

The "self hosting" tab is currently disabled as we are waiting on work in symbolicator to forward data needed for this tab.

This feature is currently behind a feature flag.

Screenshot 2023-09-15 at 12 12 52
Screenshot 2023-09-15 at 12 13 07

Ref: #55662

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 14, 2023
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is already handled in the modal code (didn't review the original PR) but do we show the wizard snippet for all of the JS SDKs? I think it's generally fine but for SDKs like Nextjs, Remix and Sveltekit, it might not be optimal.
Also, (probably more important) do we show the DebugId tab for Next and Sveltekit?

@lforst
Copy link
Member Author

lforst commented Sep 15, 2023

Maybe this is already handled in the modal code (didn't review the original PR) but do we show the wizard snippet for all of the JS SDKs? I think it's generally fine but for SDKs like Nextjs, Remix and Sveltekit, it might not be optimal.

Yep, we show it for all SDKs. Afaik the wizard can always be used - worst case people need to fall back to CLI.

Also, (probably more important) do we show the DebugId tab for Next and Sveltekit?

Dang almost forgot to implement this. So right now we will at least not show the "(recommended)" label for these platforms. Lemme push something along the lines of "you are using an SDK that officially doesn't support debug IDs. Please use the release process instead.".

I would still like to show the tab. By default they will probably put onto the release tab anyhow.

import {
mapSourceMapDebuggerFrameInformation,
useSourceMapDebuggerBlueThunder,
} from 'sentry/components/events/interfaces/crashContent/exception/useSourceMapDebuggerBlueThunder';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: the name is cool, but let's just remove blue thunder - otherwise we have to remember to come back and change it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a useSourceMapDebug already 😢 What do I do?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it returns sourceMapDebuggerData maybe call it useSourceMapDebuggerData?

debuggerFrame.debug_id_process.uploaded_source_map_with_correct_debug_id,
sdkVersion: sourceMapDebuggerData.sdk_version,
matchingSourceMapName:
debuggerFrame.release_process?.matching_source_map_name ?? null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: If this is our mapped data, can we just avoid using null? undefined should just work for our use case right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lemme think about this. The endpoint returns null in many cases so we would have to map it to undefined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a shot at implementing this by widening the type to accept null | undefined but it complicates the logic downstream so I would not do this right now. Does that make sense?

refetchOnWindowFocus: false,
}
);
return sourceMapDebuggerData;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: shouldn't we also return isLoading and isError here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we display the button to open the as a tag on the stack frames we probably don't want a loading indicator so we don't care about isLoading.

If the request errors out we probably also don't care.

export function frameIsFullyResolvedBasedOnDebuggerData(
frameDebuggerData: FrameSourceMapDebuggerData
): boolean {
const {debugIdProgressPercent} = getDebugIdProgress(frameDebuggerData);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: I don't like that we have to run the getters to decide if we have to render the component, and then run it again when the component renders.

Can we lift this logic out of the SourceMapsDebuggerModal and inject in the progress percent as props?

There's a bunch of props to inject so we could also inject it all as a single object.

Copy link
Member

@ArthurKnaus ArthurKnaus Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The progress could already be calculated in mapSourceMapDebuggerFrameInformation.
Even though it then does a bit more than mapping 🤷

Copy link
Member

@ArthurKnaus ArthurKnaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ from my side.
Looking forward to see this awesome feature in production! 🎉

Comment on lines 151 to 155
const frameSourceMapDebuggerData = sourceMapDebuggerData?.exceptions[
excIdx
].frames.map(debuggerFrame =>
mapSourceMapDebuggerFrameInformation(sourceMapDebuggerData, debuggerFrame)
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use useMemo so the array is not re-created every time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see an easy way of doing this? I am asking because we're already one .map() deep which means I can't just simply useMemo here without majorly refactoring this component :/ (I believe)

Since this component basically re-renders very rarely anyhow I would just keep it like this for now. Thoughts?

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

@lforst lforst merged commit 9ec3aa8 into master Sep 25, 2023
@lforst lforst deleted the lforst-fix-up-modal branch September 25, 2023 08:50
@sentry-io
Copy link

sentry-io bot commented Sep 25, 2023

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ React ErrorBoundary Error: Cannot read properties of null (reading 'startsWith') sourceMapDebuggerData(app/components/events/int... View Issue

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants