ref(related_issues): Improve code for title, subtitle and message#73053
ref(related_issues): Improve code for title, subtitle and message#73053armenzg wants to merge 10 commits into
Conversation
Bundle ReportChanges will decrease total bundle size by 16.5kB ⬇️
|
1d3f5a1 to
bee438f
Compare
bee438f to
cc3e1e3
Compare
cc3e1e3 to
afd9492
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #73053 +/- ##
==========================================
- Coverage 78.13% 78.13% -0.01%
==========================================
Files 6652 6652
Lines 297597 297598 +1
Branches 51204 51205 +1
==========================================
- Hits 232527 232526 -1
- Misses 58766 58768 +2
Partials 6304 6304
|
This change tries to bring the code closer to what the Issues Details UI does for getting the title, subtitle and message displayed.
afd9492 to
adaa46c
Compare
| try { | ||
| title = event.title.trimEnd(); | ||
| if (event['event.type'] === 'error') { | ||
| if (title[title.length - 1] !== ':') { |
| // This is a case where the culprit is available while the transaction is not | ||
| transaction: '', | ||
| 'event.type': event.type, | ||
| 'stack.function': [], |
There was a problem hiding this comment.
Typing is now actually working. I was not warned about this until now.
| ); | ||
| }); | ||
|
|
||
| it('trace-related: check title, subtitle for error event', async () => { |
There was a problem hiding this comment.
Since the code path to generating is different than an issue platform event we need this test.
| <NoOverflowDiv> | ||
| <TraceIssueEventTitle>{title}</TraceIssueEventTitle> | ||
| <TraceIssueEventSubtitle>{subtitle}</TraceIssueEventSubtitle> | ||
| <TraceIssueEventSubtitle data-test-id="subtitle-span"> |
There was a problem hiding this comment.
This will enable a test for the default event type (which is the empty string).
| } | ||
| // https://github.com/getsentry/sentry/blob/f08644a004f9980d48f93dec2d7cfc9eeecd9a9e/static/app/utils/events.tsx#L48-L50 | ||
| // It uses metadata.value which could differ depending on what error.value is used in the event manager | ||
| message = event['error.value'][event['error.value'].length - 1]; |
There was a problem hiding this comment.
The case I'm thinking of is ANR mobile issues where the stack trace is reversed, thus, the title could come from the other end.
I'm still comfortable going this way as this would fix the majority of all other platforms.
| // https://github.com/getsentry/sentry/blob/f08644a004f9980d48f93dec2d7cfc9eeecd9a9e/static/app/utils/events.tsx#L48-L50 | ||
| // It uses metadata.value which could differ depending on what error.value is used in the event manager | ||
| message = event['error.value'][event['error.value'].length - 1]; | ||
| } else if (event['event.type'] === 'default') { |
| const issuePlatformEvent = event as TimelineIssuePlatformEvent; | ||
| // It is suspected that this value is calculated somewhere in Relay | ||
| // and we deconstruct it here to match what the Issue details page shows | ||
| message = issuePlatformEvent.message |
| transaction: string; | ||
| } | ||
|
|
||
| interface TimelineDiscoverEvent extends BaseEvent {} |
There was a problem hiding this comment.
This was incorrect as it should have contained event.type and stack.function.
| expect(await screen.findByText('The last error value')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('trace-related: check title, subtitle for default event', async () => { |
There was a problem hiding this comment.
The test for the default event.
| // It is suspected that this value is calculated somewhere in Relay | ||
| // and we deconstruct it here to match what the Issue details page shows | ||
| message = event.message.replace(event.transaction, '').replace(title, ''); | ||
| let subtitle = event.culprit || ''; |
There was a problem hiding this comment.
This moves us away from event.transaction:

getTitle in events.tsx sets the value to these:
sentry/static/app/utils/events.tsx
Line 136 in 7a19d0b
sentry/static/app/utils/events.tsx
Line 190 in 7a19d0b


This fixes the rendering of some issues to match what we do on the Issue Details page.
Changes:
culpritanderror.valueinformationThis shows a working default event:


instead of this:
NOTE: We can't use the same function we use for the Issue Details page since the data come from different endpoints and have different types.