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

feat(auto-edit): improve error logging #6609

Merged
merged 3 commits into from
Jan 14, 2025
Merged

Conversation

valerybugakov
Copy link
Member

@valerybugakov valerybugakov commented Jan 13, 2025

  • Most changes are whitespace-related; hide them for easier review.
  • Wraps the logic inside the autoedit provider's provideInlineCompletionItems method in a try-catch block and logs errors to our telemetry backend and Sentry.
  • Eases the conditions for filtering out errors on the client by checking for the sourcegraph.cody-ai substring in the error stack. We haven't seen any errors in Sentry for the last 90 days, which is suspicious. Let's verify if this condition is still valid and ensure we aren't missing any false positives due to this logic.
  • Closes CODY-4649: Telemetry: integrate with Sentry for error reporting

Test plan

CI and updated integration tests for the autoedit provider.

}
// if (isError(error) && !insideAgent && !error.stack?.includes('sourcegraph.cody-ai')) {
// return false
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a leftover from local testing ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll remove it since it's easy to get it back if we need to.

// Reason: we don't have _any_ errors in Sentry which is suspicious.
// Original PR: https://github.com/sourcegraph/cody/pull/3540
// Follow-up issue: https://linear.app/sourcegraph/issue/CODY-4673/telemetry-verify-error-filtering-conditions-after-the-change
//
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we verify this before merging, since without it we won't get errors even if we get them at runtime and would defeat the purpose of the PR

Copy link
Contributor

Choose a reason for hiding this comment

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

or I see we already created a issue, so maybe we can follow up as well

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried debugging it locally, but I couldn't verify it by running the extension in the extension host. The stack traces must be different in the production environment, and I'm not sure how to replicate them locally. cc @umpox for ideas on getting production error stack traces locally

With the current implementation, we don't get any errors. My PR loosens the filters we use, so the opposite might happen — we could overwhelm Sentry with errors. However, we've dealt with this situation before, and if it happens again, we can re-enable this filter with a backport or introduce a new one based on the stack traces we see.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense !!

@hitesh-1997 hitesh-1997 changed the title feat(audoedit): improve error logging feat(audo-edit): improve error logging Jan 13, 2025
@hitesh-1997 hitesh-1997 changed the title feat(audo-edit): improve error logging feat(auto-edit): improve error logging Jan 13, 2025
return result
} catch (error) {
const errorToReport =
error instanceof Error
Copy link
Contributor

Choose a reason for hiding this comment

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

does it also make sense to send the error to BQ for easy querying and filtering ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already do! The analytics logger logic sends data to both BigQuery and Sentry. The only difference is that we manually prevent bursts of errors from being sent to BigQuery to limit the event load.

Copy link
Contributor

Choose a reason for hiding this comment

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

That awesome !! Thanks for confirming :)

Copy link
Contributor

@hitesh-1997 hitesh-1997 left a comment

Choose a reason for hiding this comment

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

minor comments; most changes looks good to me !!

@valerybugakov valerybugakov merged commit a134b91 into main Jan 14, 2025
19 of 21 checks passed
@valerybugakov valerybugakov deleted the vb/log-autoedit-errors branch January 14, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants