Skip to content

Improve type casting inside of replayDataUtils.tsx #46130

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

Closed
ryan953 opened this issue Mar 21, 2023 · 1 comment · Fixed by #50707
Closed

Improve type casting inside of replayDataUtils.tsx #46130

ryan953 opened this issue Mar 21, 2023 · 1 comment · Fixed by #50707
Assignees

Comments

@ryan953
Copy link
Member

ryan953 commented Mar 21, 2023

Inside replayDataUtils there is a lot of type casting, effectively foo as any as Crumb or whatever.

We should have steps inside here to validate that the objects/params to the methods do indeed match the types that we assign to those objects/structs.

That would prevent issues like e.category.split is not a function or its return value is not iterable. We assume the value was a string but it was false. The SDK can send anything into the server, and the server doesn't mind, breadcrumbs and rrweb events are all stored as json in blob storage, no schema is applied.

Relates to https://sentry.sentry.io/issues/3913702422/?query=url%3A%2A%2Freplays%2F%2A&referrer=issue-stream

@github-actions
Copy link
Contributor

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@ryan953 ryan953 self-assigned this Jun 16, 2023
ryan953 added a commit that referenced this issue Jun 16, 2023
)

The idea here is that we can have some standard base-types
(BreadcrumbFrame, SpanFrame, and ErrorFrame) which we can return from
our ReplayReader instance. With memoized returns we can reduce the
amount of iterations that we run against the arrays whenever we're
switching tabs in the Replay Details view, this will come at a cost of
some more memory.

This PR focuses on adding the new hydrated type definitions, and doing
the up-front work to insert missing fields to make things consistent and
easy to use. More fields could be added over time too (like bringing
back `transformCrumbs()` or some more specific version.)

To follow up we will need to go through each component and convert types
into the new *Frame system. The only tough areas will be the Breadcrumb
List and Timeline. Both of those expect arrays of type Breadcrumb, but
not they'll be getting Breadcrumb, Spans, and Errors mixed together.
It'll be a small matter of some if-statements and then using the correct
field.

Related to #47991
Fixes #50590
Fixes #46130
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants