Skip to content

[Regression test required] [$500] HIGH: Add Avatar > About > Troubleshooting section  #34082

Closed

Description

@quinthar

Strategy:
A billion users means a billion problems. To diagnose and solve them at scale, we capture client-side logs and upload centrally.

Problem:
Some problems can't be diagnosed cleanly after the fact from the logs, for a few reasons:

  • External contributors don't have access to production logs.
  • Internal engineers do have production access, but they're often cumbersome to access.
  • The logs are often ambiguous, such as if you have multiple devices connected and tabs open at the same time -- reverse engineering what happened for a particular client is confusing and time consuming.
  • Observing logs in realtime is cumbersome or sometimes impossible, which slows down and complicates testing.
  • Even if you have all the access you need, when talking with a user sometimes it's difficult to find the logs specific to them.

Solution:
Let's expand our ability to remotely diagnose production devices with better dev tools built into the app itself. Specifically:

  • Add a Troubleshooting section to the Avatar > About page, just above Report a bug
    • This will always be available, both on staging and production builds
  • Move the following Test preferences settings into this new menu:
    • Use staging server
    • Force offline
    • Simulate failing network requests
    • Authentication status: Invalidate
    • Device credentials: Destroy
  • Add Reset and refresh, which wipes Onyx clean except for the minimum needed to call OpenApp (so you don't need to reauthenticate)
  • Add View console which opens a simple console:
    • This would first open up and initialize with all locally stored logs, so you can scroll back and see what happened
    • It would also append new logs in realtime
    • There would also be a Save button that just copies all available logs into a text file that is saved on the device
    • Add a Share button that brings up a Search selector and just posts the logs into the selected room (and then leaves the user navigated there, so they can talk about them). I'm imagining this would be useful for chatting with a real world user and asking them to do something and send you the logs.
    • At the bottom is a command line that works similar to the Chrome console, where you can execute arbitrary JavaScript, with the results output to the console

This is blocking #33040.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c2a08b8b8ae90e21
  • Upwork Job ID: 1744202378047897600
  • Last Price Increase: 2024-01-15
  • Automatic offers:
    • fedirjh | Reviewer | 28115102

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    NewFeatureSomething to build that is a new item.
    on Jan 8, 2024
  2. changed the title [-]HIGH: Add `Avatar > About > Troubleshooting` section [/-] [+][$500] HIGH: Add `Avatar > About > Troubleshooting` section [/+] on Jan 8, 2024
  3. melvin-bot commented on Jan 8, 2024

    @melvin-bot
  4. melvin-bot commented on Jan 8, 2024

    @melvin-bot
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    and removed on Jan 8, 2024
  6. melvin-bot commented on Jan 8, 2024

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (External)

  7. 159 remaining items

  8. melvin-bot commented on Feb 19, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.42-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-02-26. 🎊

    For reference, here are some details about the assignees on this issue:

  9. melvin-bot commented on Feb 19, 2024

    @melvin-bot

    BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@fedirjh] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
    • [@greg-schroeder] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.
  10. marcochavezf commented on Feb 23, 2024

    @marcochavezf
    Contributor

    Hi @TMisiukiewicz! We got an alert in the backend that we're receiving a massive message log from NewDot, and it seems it's coming from this PR that was deployed recently. This is an example of the message:

    LogAPI - Massive log message given ~~ 0: '[info] [Onyx] merge() called for key: logs properties: 1708058686372,1708058686377,1708058696327,1708058730961,1708058732236,1708058732237,1708058734681,1708058734923,1708058734924,1708058734925,1708058734926,1708058734934,1708058734983,1708058734984,1708058734985,1708058734986,1708058735023,1708058735064,1708058735083,1708058735101,1708058735102,1708058735106,1708058735138,1708058735153,1708058735167,1708058735302,1708058735331,1708058735446,1708058735453,1708058735459,1708058735465,1708058735572,1708058735586,1708058735588,1708058735771,1708058735787,1708058735859,1708058735877,1708058735886,1708058735887,1708058735992,1708058735993,1708058736070,1708058736119,1708058736120,1708058737117,1708058737118,1708058737128,1708058737139,1708058741789,1708058741809,1708058741810,1708058741811,1708058741812,1708058741966,1708058741967,1708058741976,1708058742114,1708058748941,1708058749061,1708058749062,1708058749070,1708058749209,1708058749218,1708058749219,1708058749233,1708058749235,1708058749272,1708058749573,170'
    

    We are already trimming the message in the backend using this logic:

    if (strlen($log['message']) > 1024 * 1024) {
        self::alert('Massive log message given', substr($log['message'], 0, 1024));
    } 
    

    And I was wondering if we do the same in the frontend also to avoid sending large amounts of data for the logs, thoughts?

  11. TMisiukiewicz commented on Feb 23, 2024

    @TMisiukiewicz
    Contributor

    Hi @marcochavezf! That's weird because there is a condition to not attach logs with pattern [Onyx] merge() called for key: logs because otherwise it would create an infinite loop and end up with tons of huge log messages (since new log is attached to logs, which triggers logging a message that merge was called for key logs... and so on). Is this happening frequently? My only idea for now is someone did some changes in the codebase locally and removed this condition

  12. marcochavezf commented on Feb 23, 2024

    @marcochavezf
    Contributor

    Oh interesting, I happened several times yesterday, and according to the logs it wasn't coming from a local environment. I will report again if the alert pops up again, thanks!

  13. greg-schroeder commented on Feb 26, 2024

    @greg-schroeder
    Contributor

    Reviewing

  14. greg-schroeder commented on Feb 26, 2024

    @greg-schroeder
    Contributor

    Paid!

    @fedirjh can you create a regression test for this new feature? Thanks!

  15. changed the title [-][HOLD for payment 2024-02-26] [$500] HIGH: Add `Avatar > About > Troubleshooting` section [/-] [+][Regression test required] [$500] HIGH: Add `Avatar > About > Troubleshooting` section [/+] on Feb 26, 2024
  16. fedirjh commented on Feb 26, 2024

    @fedirjh
    Contributor

    Regression Test Proposal

    Test 1 :

    1. Go to Profile -> About
    2. Verify "Troubleshoot" is available in the menu
    3. Go to Troubleshoot
    4. Verify "Test preferences" section is visible
    5. Press "Reset and refresh"
    6. Confirm the modal
    7. Go back to home screen
    8. Verify list of chats is visible
    9. If you are on the home screen and the list is not visible yet, wait a moment until it's available (it means data is still loading)
    

    Test 2 :

    1. Go to Profile -> About -> Troubleshoot
    2. Verify "Client side logging" is disabled
    3. Enable "Client side logging"
    4. Verify "View debug console" option appears
    5. Press "View debug console"
    6. Verify Debug console screen is open and logs are displayed in a console in real-time
    7. Type 5+5 in the input below the console and press "Execute"
    8. Verify 10 was displayed in a console
    9. Press "Save log"
    10. Verify file is downloaded to a device
    11. Press "Share log"
    12. Verify you are navigated to the search page
    13. Press on any report
    14. Verify you are moved to the report and logs are sent as an attachment
    
    • Do we agree 👍 or 👎
  17. techievivek commented on Feb 27, 2024

    @techievivek
    Contributor

    Nice, regression tests look good to me. 👍 CC @greg-schroeder

  18. greg-schroeder commented on Feb 28, 2024

    @greg-schroeder
    Contributor

    LGTM! Filing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2InternalRequires API changes or must be handled by Expensify staffNewFeatureSomething to build that is a new item.Task

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions