Skip to content

feat(protocol-designer): introduce sentry #18153

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

Merged
merged 15 commits into from
Apr 28, 2025
Merged

feat(protocol-designer): introduce sentry #18153

merged 15 commits into from
Apr 28, 2025

Conversation

koji
Copy link
Contributor

@koji koji commented Apr 22, 2025

Overview

introduce Sentry to PD for better error tracking.
the usage of Sentry is similar to Mixpanel.
Sentry init is called when a user allows pd to track data (getHasOptedIn: true)

sent an invitation of Sentry to each reviewers

Test Plan and Hands on Testing

Changelog

  • add sentry.ts for configuration
  • update ErrorBoundary to capture an error when PD shows the white-screen
  • add one job to pd workflow for uploading pd source map to Sentry but they are commented out at this moment since it requires the account setup

Review requests

I add DEV_DNS as well as Mixpanel. Do we want to use Sentry for our dev environment (sandbox)

Risk assessment

low

@koji
Copy link
Contributor Author

koji commented Apr 22, 2025

  • update GitHub Actions

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 15.21739% with 39 lines in your changes missing coverage. Please review.

Project coverage is 22.63%. Comparing base (a74a574) to head (1420384).
Report is 30 commits behind head on edge.

Files with missing lines Patch % Lines
protocol-designer/src/resources/sentry.ts 0.00% 37 Missing ⚠️
protocol-designer/src/index.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #18153      +/-   ##
==========================================
- Coverage   23.76%   22.63%   -1.14%     
==========================================
  Files        3038     3039       +1     
  Lines      253513   255892    +2379     
  Branches    23604    23798     +194     
==========================================
- Hits        60252    57922    -2330     
- Misses     193246   197961    +4715     
+ Partials       15        9       -6     
Flag Coverage Δ
protocol-designer 19.00% <15.21%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...gner/src/resources/ProtocolDesignerAppFallback.tsx 94.33% <100.00%> (+9.72%) ⬆️
protocol-designer/src/index.tsx 0.00% <0.00%> (ø)
protocol-designer/src/resources/sentry.ts 0.00% <0.00%> (ø)

... and 1114 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@koji koji marked this pull request as ready for review April 23, 2025 16:32
@koji koji requested a review from a team as a code owner April 23, 2025 16:32
@ddcc4
Copy link
Contributor

ddcc4 commented Apr 23, 2025

Thanks Koji!

One more idea for part 2 of this: at my previous company, in our Python projects, we also added a hook that reported everything logged at level ERROR or higher to Sentry.

I wonder if the Sentry JavaScript API can do something similar. We have a lot of places in PD where we chose to console.error() instead of throwing an exception, but those are all cases where something went wrong and we should investigate if we're alerted about them.

@@ -47,6 +49,12 @@ export function ProtocolDesignerAppFallback({
dispatch(actions.saveProtocolFile())
}

useEffect(() => {
if (error) {
captureException(error, { extra: { errorId } })
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not so familiar with this part of the code. Can you tell me if error is a JavaScript exception here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, error is the captured JavaScript exception object provided by react-error-boundary

@koji
Copy link
Contributor Author

koji commented Apr 23, 2025

  • modify vite config to enable source map upload for only prod

@koji
Copy link
Contributor Author

koji commented Apr 23, 2025

Thanks Koji!

One more idea for part 2 of this: at my previous company, in our Python projects, we also added a hook that reported everything logged at level ERROR or higher to Sentry.

I wonder if the Sentry JavaScript API can do something similar. We have a lot of places in PD where we chose to console.error() instead of throwing an exception, but those are all cases where something went wrong and we should investigate if we're alerted about them.

if what you mean is this, we can set error as a logging level.

Copy link
Contributor

@ddcc4 ddcc4 left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@koji koji merged commit 0789b56 into edge Apr 28, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants