1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Sampling API error report rate

This commit is contained in:
Zhiyuan Zheng
2022-01-04 09:09:45 +01:00
parent 65d54f73ec
commit e3c84f6146
7 changed files with 34 additions and 19 deletions

View File

@ -29,7 +29,7 @@ const apiTooot = async <T = unknown>({
params,
headers,
body,
sentry = false
sentry = true
}: Params): Promise<{ body: T }> => {
console.log(
ctx.bgGreen.bold(' API tooot ') +
@ -61,8 +61,12 @@ const apiTooot = async <T = unknown>({
})
})
.catch(error => {
if (sentry) {
Sentry.Native.setExtras(error.response || error.request)
if (sentry && Math.random() < 0.005) {
Sentry.Native.setExtras({
API: 'tooot',
...(error.response && { response: error.response }),
...(error.request && { request: error.request })
})
Sentry.Native.captureException(error)
}