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

Switch error tracking to Sentry #4409

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

Switch error tracking to Sentry #4409

wants to merge 1 commit into from

Conversation

rakyi
Copy link
Contributor

@rakyi rakyi commented Jan 8, 2025

  • Remove all usage of Bugsnag
  • Add Sentry to admin client bundle and all server side processes
    • Move the Sentry initialization to be as early as possible to maximize the chance an error will be captured
    • Include node profiling integration for server side
    • Create a new admin project for the admin client and server processes
  • Tell Sentry about:
    • release is the COMMIT_SHA of the currently running code - helps with triage and works with GitHub integration for stuff like comments on PRs and other features
    • environment is good for filtering issues, we are gonna distinguish between prod and staging from now on. Running Sentry on staging should help us catch issues before they get to prod.
  • Add GitHub action for creating Sentry releases
    • Telling Sentry about a release before it gets the first event from that version makes some features nicer to use (I think e.g. "Mark as resolved in the next release")
  • Add Sentry Vite plugin - used to upload source maps as part of the production build. This is the recommended way to do it and AFAIK the easiest to get client source maps to work also in staging.
  • Rework manual capturing of errors:
    • Rename logErrorAndMaybeSendToBugsnag to logErrorAndMaybeCaptureInSentry
    • Where it makes sense, throw an error instead of calling this function and let the Sentry error handler capture it
    • Remove two instances of logging gdoc validation errors and warnings during baking, since we get more than 1k of them in one bake, which makes them useless and consumes a lot of our quota. We should add it back only if we making it smarter or fix most of the errors first.
    • Remove unnecessary warn wrapper for console.warn
    • Change JsonError to Error where it isn't necessary
  • Increase Bundlewatch limit substantially - Sentry dependencies were previously not included in the build at all, giving us a false sense of the bundle being smaller than it was

You can see various testing issues and new issues from baking etc. from this branch as well as current ones from production in Sentry.

Resolves #4204

Depends on https://github.com/owid/ops/pull/263

@rakyi rakyi force-pushed the remove-bugsnag branch 2 times, most recently from 0ab560e to 34156fa Compare January 8, 2025 17:28
@rakyi
Copy link
Contributor Author

rakyi commented Jan 8, 2025

Bundle watch originally failed here with a large bundle size increase. We are in fact making the bundle smaller from 2.91 MB to 2.87 MB (I compared prod vs staging), but Bundlewatch didn't pick it up, because it seems that rollup is smart enough to remove code that won't run at import time when it's guarded by a falsy condition, i.e. the SENTRY_DSN isn't set in CI, so the code that was using Sentry didn't run, so rollup didn't include in the bundle previously.

We have now removed the condition and initialize Sentry always (which is fine to do and fails gracefully without DSN). So rollup now doesn't remove the code, and Bundlewatch thus detects the bundle increase.

@owidbot
Copy link
Contributor

owidbot commented Jan 8, 2025

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-remove-bugsnag

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2025-01-13 15:57:55 UTC
Execution time: 1.24 seconds

@rakyi rakyi force-pushed the remove-bugsnag branch 16 times, most recently from 0fe4200 to fe458c8 Compare January 14, 2025 10:00
@rakyi rakyi marked this pull request as ready for review January 14, 2025 11:02
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.

🐝 analytics: swap out Bugsnag for Sentry
2 participants