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

chore: reduce logs for redux logger, analytics, remote config #6103

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/analytics/AppAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@
...eventProperties,
}

Logger.info(TAG, `Tracking event ${eventName} with properties:`, props)
if (__DEV__) {
Logger.debug(TAG, `Tracking event ${eventName} with properties:`, props)

Check warning on line 207 in src/analytics/AppAnalytics.ts

View check run for this annotation

Codecov / codecov/patch

src/analytics/AppAnalytics.ts#L207

Added line #L207 was not covered by tests
} else {
Logger.info(TAG, `Tracking event ${eventName}`)
}

this.segmentClient.track(eventName, props).catch((err) => {
Logger.error(TAG, `Failed to track event ${eventName}`, err)
Expand Down
2 changes: 0 additions & 2 deletions src/firebase/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ export async function fetchRemoteConfigValues(): Promise<RemoteConfigValues | nu
await remoteConfig().fetchAndActivate()

const flags: FirebaseRemoteConfigTypes.ConfigValues = remoteConfig().getAll()
Logger.debug(TAG, `Updated remote config values:`, flags)

// When adding a new remote config value there are 2 places that need updating:
// the RemoteConfigValues interface as well as the REMOTE_CONFIG_VALUES_DEFAULTS map
// REMOTE_CONFIG_VALUES_DEFAULTS is in remoteConfigValuesDefaults.ts
Expand Down
32 changes: 26 additions & 6 deletions src/redux/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
checkAndroidMobileServicesSaga,
} from 'src/app/saga'
import { dappsSaga } from 'src/dapps/saga'
import { fetchDappsListCompleted } from 'src/dapps/slice'
import { earnSaga } from 'src/earn/saga'
import { fiatExchangesSaga } from 'src/fiatExchanges/saga'
import { fiatConnectSaga } from 'src/fiatconnect/saga'
Expand All @@ -28,30 +29,48 @@
import { localCurrencySaga } from 'src/localCurrency/saga'
import { networkInfoSaga } from 'src/networkInfo/saga'
import { nftsSaga } from 'src/nfts/saga'
import { fetchNftsCompleted } from 'src/nfts/slice'
import { pointsSaga } from 'src/points/saga'
import { positionsSaga } from 'src/positions/saga'
import { fetchPositionsSuccess, fetchShortcutsSuccess } from 'src/positions/slice'
import { priceHistorySaga } from 'src/priceHistory/saga'
import { setPhoneRecipientCache, updateAppRecipientCache } from 'src/recipients/reducer'
import { fetchPriceHistorySuccess } from 'src/priceHistory/slice'
import {
rewardsSendersFetched,
setPhoneRecipientCache,
updateAppRecipientCache,
} from 'src/recipients/reducer'
import { recipientsSaga } from 'src/recipients/saga'
import { sendSaga } from 'src/send/saga'
import { sentrySaga } from 'src/sentry/saga'
import { swapSaga } from 'src/swap/saga'
import { tokensSaga } from 'src/tokens/saga'
import { setTokenBalances } from 'src/tokens/slice'
import { Actions as TransactionActions } from 'src/transactions/actions'
import { transactionSaga } from 'src/transactions/saga'
import Logger from 'src/utils/Logger'
import { checkAccountExistenceSaga } from 'src/utils/accountChecker'
import { walletConnectSaga } from 'src/walletConnect/saga'
import { call, select, spawn, take, takeEvery } from 'typed-redux-saga'

const loggerBlocklist = [
// Actions that should not be logged along with their payload, particularly
// those containing API responses, as they add unnecessary noise to the logs.
const loggerPayloadBlocklist = [
REHYDRATE,
AppActions.PHONE_NUMBER_VERIFICATION_COMPLETED,
AccountActions.SET_PHONE_NUMBER,
ImportActions.IMPORT_BACKUP_PHRASE,
setPhoneRecipientCache.toString(),
updateAppRecipientCache.toString(),
TransactionActions.UPDATE_TRANSACTIONS,
setTokenBalances.toString(),
fetchPriceHistorySuccess.toString(),
rewardsSendersFetched.toString(),
fetchDappsListCompleted.toString(),
fetchNftsCompleted.toString(),
fetchPositionsSuccess.toString(),
fetchShortcutsSuccess.toString(),
kathaypacific marked this conversation as resolved.
Show resolved Hide resolved
AppActions.UPDATE_REMOTE_CONFIG_VALUES,
]

function* loggerSaga() {
Expand All @@ -63,11 +82,12 @@
yield* takeEvery('*', (action: UnknownAction) => {
if (
action?.type &&
(action.type.includes('IDENTITY/') || loggerBlocklist.includes(action.type))
(action.type.includes('IDENTITY/') || loggerPayloadBlocklist.includes(action.type))

Check warning on line 85 in src/redux/sagas.ts

View check run for this annotation

Codecov / codecov/patch

src/redux/sagas.ts#L85

Added line #L85 was not covered by tests
) {
// Log only action type, but not the payload as it can have
// sensitive information. Excluding all IDENTITY/ actions because high likelyhood
// they contain PII and the blocklist may get out of date.
// Log only action type, but not the payload as it can have sensitive
// information or information that is not helpful for debugging. Excluding
// all IDENTITY/ actions because high likelyhood they contain PII and the
// blocklist may get out of date.
Logger.debug('redux/saga@logger', `${action.type} (payload not logged)`)
return
}
Expand Down
Loading