Created
December 24, 2019 20:01
-
-
Save nkgokul/452ddb5d2905dd0f92f9084c7090a134 to your computer and use it in GitHub Desktop.
Sentry Fractional Logging
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
const percentateOfErrorsToLog = 30; | |
const percentateOfErrorsToLogFraction = percentateOfErrorsToLog/100; | |
const threshold = 1 - percentateOfErrorsToLogFraction; | |
try { | |
someErrorCasuingFunction(); | |
} | |
catch(error) { | |
if(Math.random() >= threshold) { | |
Sentry.captureException(error); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment