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

[AXON-41] Implement AtlascodeErrorBoundary #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sdzh-atlassian
Copy link
Member

@sdzh-atlassian sdzh-atlassian commented Dec 24, 2024

What is this?

This is the 1st PR in a series related to improving our observability when something goes wrong.

In React, there's a concept of an Error Boundary - a special component which is intended to address rendering errors in the tree, and which is very notably missing in our pages 😉

Further, we are already pulling @atlaskit/analytics-next as a dependency, which conveniently offers an implementation we could use.

After the changes in this PR, we can receive an event with some data on rendering errors occuring in prod:
image

⚠️ Note: The exact structure and content of the analytics event are temporary and subject to change

What does this PR have, mechanically?

  • Basic support for firing error-related events from webviews with this architecture:
    image
    • New "common" action type SendAnalytics
    • Handling for it in all controllers
    • Type definitions
  • AtlascodeErrorBoundary implementation and usage

What is notably NOT included here?

  • Tests - I ran into dependency conflicts when trying to pull react testing utils. Might make sense to add them in a separate PR after bumping react version
  • AtlascodeErrorBoundary usage in other pages - to not overwhelm reviewers further ;D

How was this tested?

I've introduced the new error boundary to our Settings page, and then added a special component that fails on rendering. With that, when running our settings page, it was possible to show alternative HTML on render errors, while also receiving an event in the analityics service:

image
(all the extra components were removed during clean-up)

@sdzh-atlassian sdzh-atlassian force-pushed the AXON-41-atlascode-error-boundary branch 3 times, most recently from a092942 to 3865a53 Compare December 24, 2024 01:16
* Add support to receive rendering error events from UI
* Add AtlascodeErrorBoundary component
* Put the new boundary to Settings page
@sdzh-atlassian sdzh-atlassian force-pushed the AXON-41-atlascode-error-boundary branch from 3865a53 to 3a11fea Compare December 24, 2024 18:28
@@ -255,6 +256,13 @@ export async function viewScreenEvent(

// UI Events

export async function uiErrorEvent(errorInfo: UIErrorInfo): Promise<TrackEvent> {
const e = trackEvent('failedTest', 'ui', {
Copy link
Member Author

Choose a reason for hiding this comment

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

Intentionally leaving the temporary event here for now while we figure out a more permanent structure for events and metrics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant