filter our own messages to send to sentry#461
Merged
cpul merged 2 commits intoJul 21, 2022
Merged
Conversation
COD-1378 SyntaxError: Unexpected end of JSON input
Sentry Issue: VSCODE-2RK |
tednology
reviewed
Jul 20, 2022
| release: `${SENTRY_RELEASE_PREFIX}@${process.env.VERSION}`, | ||
| environment: process.env.ENVIRONMENT || "development", | ||
| normalizeDepth: 10, | ||
| beforeSend: (event: Event) => { |
derrickpersson
approved these changes
Jul 20, 2022
Contributor
derrickpersson
left a comment
There was a problem hiding this comment.
Sounds like it'll work.. just wondering about 'unhandled' errors?
Not sure how they are currently logged, and if they'll be filtered by this. We definitely want to record some of the unhandled errors (as we cause them).
| }); | ||
|
|
||
| const options = { | ||
| const options: SentryTransport.SentryTransportOptions = { |
Contributor
Author
|
@derrickpersson I have updated the PR to improve upon how we can be more certain the error is ours. This check is now more robust, but more costly to perform when the error events are not ours. |
derrickpersson
approved these changes
Jul 21, 2022
Contributor
derrickpersson
left a comment
There was a problem hiding this comment.
Looks good!
We can improve in future iterations #80/20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Use the
beforeSendSentry callback option to filter out messages that we do not want to send to Sentry.In order to check that it is our extension that is generating the errors, this change will look through the stacktrace and its stack frames and determine if our extension is the one that is emitting the event.
This will test the

filenameproperty on aStackFrameto see if the file matches that of our extension.Here's an example of a stack frame that is generated locally in dev mode:
and here's what we see in production:

The regex used to test
filenamechanges at runtime depending on the environment the extension is running in.In order to make this test as quick as possible, the check will stop at the first matching instance where we determine the error was generated by our extension. Unfortunately, errors not generated by our extension will take longer to determine it isn't a match.
If anyone has a better idea on how to improve this lookup time for non-matching events, please let me know.
Type of Change
How Has This Been Tested?
Test Configuration:
Checklist:
Screenshots: