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:
		
							
								
								
									
										2
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -22,7 +22,7 @@ jobs: | ||||
|       - name: -- Step 3 -- Use Expo action | ||||
|         uses: expo/expo-github-action@v6 | ||||
|         with: | ||||
|           expo-version: 4.x | ||||
|           expo-version: 5.x | ||||
|           username: ${{ secrets.EXPO_USERNAME }} | ||||
|           token: ${{ secrets.EXPO_TOKEN }} | ||||
|       - name: -- Step 4 -- Install node dependencies | ||||
|   | ||||
| @@ -24,7 +24,7 @@ const apiGeneral = async <T = unknown>({ | ||||
|   params, | ||||
|   headers, | ||||
|   body, | ||||
|   sentry = false | ||||
|   sentry = true | ||||
| }: Params): Promise<{ body: T }> => { | ||||
|   console.log( | ||||
|     ctx.bgGreen.bold(' API general ') + | ||||
| @@ -58,8 +58,12 @@ const apiGeneral = async <T = unknown>({ | ||||
|       }) | ||||
|     }) | ||||
|     .catch(error => { | ||||
|       if (sentry) { | ||||
|         Sentry.Native.setExtras(error.response || error.request) | ||||
|       if (sentry && Math.random() < 0.001) { | ||||
|         Sentry.Native.setExtras({ | ||||
|           API: 'instance', | ||||
|           ...(error.response && { response: error.response }), | ||||
|           ...(error.request && { request: error.request }) | ||||
|         }) | ||||
|         Sentry.Native.captureException(error) | ||||
|       } | ||||
|  | ||||
|   | ||||
| @@ -3,6 +3,7 @@ import axios, { AxiosRequestConfig } from 'axios' | ||||
| import chalk from 'chalk' | ||||
| import Constants from 'expo-constants' | ||||
| import li from 'li' | ||||
| import * as Sentry from 'sentry-expo' | ||||
|  | ||||
| const ctx = new chalk.Instance({ level: 3 }) | ||||
|  | ||||
| @@ -97,6 +98,15 @@ const apiInstance = async <T = unknown>({ | ||||
|       }) | ||||
|     }) | ||||
|     .catch(error => { | ||||
|       if (Math.random() < 0.001) { | ||||
|         Sentry.Native.setExtras({ | ||||
|           API: 'instance', | ||||
|           ...(error.response && { response: error.response }), | ||||
|           ...(error.request && { request: error.request }) | ||||
|         }) | ||||
|         Sentry.Native.captureException(error) | ||||
|       } | ||||
|  | ||||
|       if (error.response) { | ||||
|         // The request was made and the server responded with a status code | ||||
|         // that falls out of the range of 2xx | ||||
|   | ||||
| @@ -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) | ||||
|       } | ||||
|  | ||||
|   | ||||
| @@ -28,8 +28,7 @@ const subscribe = async ({ | ||||
|   return apiTooot({ | ||||
|     method: 'post', | ||||
|     url: `/push/subscribe/${expoToken}/${instanceUrl}/${accountId}`, | ||||
|     body: { accountFull, serverKey, auth }, | ||||
|     sentry: true | ||||
|     body: { accountFull, serverKey, auth } | ||||
|   }) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -21,8 +21,7 @@ const pushUnregister = async (state: RootState, expoToken: string) => { | ||||
|  | ||||
|   await apiTooot<{ endpoint: string; publicKey: string; auth: string }>({ | ||||
|     method: 'delete', | ||||
|     url: `/push/unsubscribe/${expoToken}/${instance.url}/${instance.account.id}`, | ||||
|     sentry: true | ||||
|     url: `/push/unsubscribe/${expoToken}/${instance.url}/${instance.account.id}` | ||||
|   }) | ||||
|  | ||||
|   if (Platform.OS === 'android') { | ||||
|   | ||||
| @@ -33,8 +33,7 @@ export const updateInstancePushDecode = createAsyncThunk( | ||||
|       url: `/push/update-decode/${expoToken}/${instance.url}/${instance.account.id}`, | ||||
|       body: { | ||||
|         auth: !disable ? null : instance.push.keys.auth | ||||
|       }, | ||||
|       sentry: true | ||||
|       } | ||||
|     }) | ||||
|  | ||||
|     if (Platform.OS === 'android') { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user