App
App copied to clipboard
HIGH: [Debugability] [$250] Add logging around offline state to help diagnose bugs
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: Needs reproduction Reproducible in staging?: N/A Reproducible in production?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): @quinthar Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @quinthar Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1712886605520589
Action Performed:
- Open NewDot being online
- Observe there is a message " You appear to be offline"
- Do some actions and check the API request
Expected Result:
- " You appear to be offline" should not show when online
- If offline then success
200 OKAPI request should not be showin - No pusher notification Add something to the logs that will help diagnose this
Actual Result:
- " You appear to be offline" message appears when online
- Success
200 OKAPI request appears - Push notification is received I don't see anything useful in the logs. Can we maybe improve the logging around whatever code we use to determine if we're online to output its logic so we can diagnose and fix it.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Native
- [ ] Android: mWeb Chrome
- [ ] iOS: Native
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~016051a56c40abfc4a
- Upwork Job ID: 1782729213837856768
- Last Price Increase: 2024-04-23
Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
@sonialiap Whoops! This issue is 2 days overdue. Let's get this updated quick!
I can reproduce, but not consistently. Sometimes when I open ND the "you're offline" message appears and then usually clears within 30 seconds. If I open ND, close, and immediately open a new tab with ND the message doesn't appear. It seems to require some time between opening ND in a new tab for it to show as offline
Job added to Upwork: https://www.upwork.com/jobs/~016051a56c40abfc4a
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External)
Proposal
Please re-state the problem that we are trying to solve in this issue.
Nothing useful in the logs to debug online/offline issues
What is the root cause of that problem?
We don't have such logs.
What changes do you think we should make in order to solve the problem?
There're 3 places we're setting offline status via setOfflineStatus, we should add additional logs with the context by Log.info
- In https://github.com/Expensify/App/blob/7ca0748be632d0ef4f93a6171a8dc768fc11817b/src/libs/NetworkConnection.ts#L62 We should log:
Log.info(`[NetworkStatus] Setting "offlineStatus" to "true" because user is under force offline`);
- In https://github.com/Expensify/App/blob/7ca0748be632d0ef4f93a6171a8dc768fc11817b/src/libs/NetworkConnection.ts#L65
We should log the full state that NetInfo returned
Log.info(`[NetworkStatus] The user is not under force offline, calling NetInfo.fetch, setting "offlineStatus" to ${(state.isInternetReachable ?? false) === false} with network state: ${JSON.stringify(state)}`);
- In https://github.com/Expensify/App/blob/7ca0748be632d0ef4f93a6171a8dc768fc11817b/src/libs/NetworkConnection.ts#L109
We should log the full state that NetInfo returned, and mention that this is set in NetInfo.addEventListener
Log.info(`[NetworkStatus] NetInfo.addEventListener event coming, setting "offlineStatus" to ${(state.isInternetReachable ?? false) === false} with network state: ${JSON.stringify(state)}`);
We can logs the logic we use to determine offline status (state.isInternetReachable ?? false) === false, if that's necessary.
Those are the core places we need the logs, the specifics of the log content/params can be adjusted in the PR phase.
What alternative solutions did you explore? (Optional)
Currently we have only true/false network status, if later we decide to have enum/number/string network statuses, then we need to log that value in the same way.
@sonialiap, @Santhosh-Sellavel Whoops! This issue is 2 days overdue. Let's get this updated quick!
What's the next step here, and the ETA?
@sonialiap @Santhosh-Sellavel this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Triggered auto assignment to @hayata-suenaga, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Yes I believe we just need to log in places where we're setting the log status. @nkdengineer's proposal looks good to me
Let me double-check how we're handling the logs from New Expensify internally though first
okay, so because these events or logs are not associated with any request ID, when we use these logs to troubleshoot the offline status issues, we will use the customer's email address to search for logs
okay I'll assign @nkdengineer
π£ @nkdengineer π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
Issue not reproducible during KI retests. (First week)
this GH ticket is not specific to an issue. the issue in the description is just an example.
we will proceed adding logs
@nkdengineer what's your EAT for PR? π
bumped @nkdengineer in Slack
@hayata-suenaga Sorry for delay, Will open PR today.
@Santhosh-Sellavel The PR is here
This issue has not been updated in over 15 days. @sonialiap, @Santhosh-Sellavel, @hayata-suenaga, @nkdengineer eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
The PR has been merged
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.79-11 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/41719
If no regressions arise, payment will be issued on 2024-06-13. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @Santhosh-Sellavel requires payment through NewDot Manual Requests
- @nkdengineer requires payment automatic offer (Contributor)
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
- [ ] [@hayata-suenaga] The PR that introduced the bug has been identified. Link to the PR:
- [ ] [@hayata-suenaga] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
- [ ] [@hayata-suenaga] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
- [ ] [@Santhosh-Sellavel / @nkdengineer] Determine if we should create a regression test for this bug.
- [ ] [@Santhosh-Sellavel / @nkdengineer] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
- [ ] [@sonialiap] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
[@hayata-suenaga] The PR that introduced the bug has been identified. Link to the PR:
This issue not a bug fix. It's about adding a logging
[@hayata-suenaga] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
N/A
[@hayata-suenaga] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
N/A
Payment summary @Santhosh-Sellavel $250 - please request in ND @nkdengineer $250 - offer sent
Please complete the two steps on the checklist
@nkdengineer please accept the offer so that I can issue payment
@sonialiap Could you help to add the High Priority label to the issue, similar to this case? This was HIGH priority when the issue was opened, and only changed after the PR is up.