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

fix(metrics): add validation/formatting before sending errors to BugSnag #5455

Merged
merged 7 commits into from
Mar 18, 2024

Conversation

jackbrewer
Copy link
Contributor

@jackbrewer jackbrewer commented Dec 28, 2023

Summary

Fixes #5398

This is my first time working with this repo, so let me know if I've missed anything ☺️

For a while, errors coming from the GitHub API have been in a format not accepted by BugSnag. These appear in the BugSnag dashboard all grouped into a generic notify() received a non-error error. The volume of these is causing issues when looking for actual new errors!

This PR runs the error through some formatting/validation logic. If it already fits one of the expected NotifiableError shapes, we let it through. Non-recognised formats are tweaked to ensure they actually return an Error.

For reference, a valid NotifiableError should match:

export type NotifiableError = Error
  | { errorClass: string, errorMessage: string }
  | { name: string, message: string }
  | string

The objects returned from a GitHub API error are in the unexpected format:

{ message: string, documentation_url: string }

In this case, we throw an error using the message, then append the documentation_url to the event as additional metadata so it's not lost.

Whilst this change won't reduce the volume of errors reported, we'll be able to triage the variations individually (and likely set them back to "handled" like we had done in the past).


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

image

@jackbrewer jackbrewer marked this pull request as ready for review December 28, 2023 11:33
@jackbrewer jackbrewer requested review from a team as code owners December 28, 2023 11:33
Copy link
Member

@JGAntunes JGAntunes left a comment

Choose a reason for hiding this comment

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

🚀 thank you very much for the 🧹. This looks great 👍

@jackbrewer jackbrewer enabled auto-merge (squash) January 5, 2024 14:52
@kodiakhq kodiakhq bot merged commit e48532f into main Mar 18, 2024
36 checks passed
@kodiakhq kodiakhq bot deleted the jbr/5398/bugsnagReportingFormattingFix branch March 18, 2024 10:09
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.

[build-info] Bugsnag error formatting is incorrect and noisy
2 participants