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

[Internal] Research and Set up Firebase for Web #47707

Closed
rinej opened this issue Aug 20, 2024 · 12 comments
Closed

[Internal] Research and Set up Firebase for Web #47707

rinej opened this issue Aug 20, 2024 · 12 comments
Assignees
Labels
AutoAssignerAppLibraryReview Auto assign someone to review a new library being added to App Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2

Comments

@rinej
Copy link
Contributor

rinej commented Aug 20, 2024

Problem
Currently we use react-native-firebase for tracking performance issues on mobile.
According to docs https://rnfirebase.io/platforms the lib doesn't support web platform. It would be beneficial to use firebase to track web performance as well.

Solution
We need to do some reaserch and check if we are able to use the the firebase SDK to use performance tracking on the web.

We already have Firebase set up for our mobile platforms, and recently we started using it.
And with relatively low effort, we can extend this setup to the web platform.

It allows us to monitor default key metrics (e.g. firstContentfulPaint ) and our custom metrics (e.g. trie_initialization )

We can add additional context to the trace, like userId or the number of reports, which can be valuable for diagnosing issues or analyzing performance trends.

In practice, this means that we both can use the dashboard to track any potential performance regressions.
While it might feel somewhat similar to Grafana in terms of monitoring capabilities, Firebase is relatively easier to configure—especially since we already have the setup in place for mobile.

Here are some screenshots from firebase console from test project:
Screenshot 2024-08-22 at 11 24 49
Screenshot 2024-08-21 at 15 23 42

Issue OwnerCurrent Issue Owner: @rinej
@puneetlath puneetlath added the AutoAssignerAppLibraryReview Auto assign someone to review a new library being added to App label Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

Triggered auto assignment to @luacmartins (AutoAssignerAppLibraryReview), see https://stackoverflowteams.com/c/expensify/questions/17737 for more details.

Copy link

melvin-bot bot commented Aug 22, 2024

New Library Review

  • Are all the answers in the main description filled out properly and make sense?
  • Who maintains the library and how well is it maintained?
  • How viable are the alternatives?
  • Should we build it ourselves instead?

Once these questions are answered, start a thread in #engineering-chat, ping the @app_deployers group, and call for a vote to accept the new library. Once the vote is complete, update this issue with the outcome and procede accordingly. Here is a sample post:

Hey @app_deployers,

There is a request to add a new library to App that we need to consider. Please look at this GH and then vote :+1: or :-1: on accepting this new library or not.

GH_LINK

@melvin-bot melvin-bot bot added the Weekly KSv2 label Aug 22, 2024
@luacmartins
Copy link
Contributor

@rinej could you provide some examples of how we're using react-native-firebase to track mobile performance issues now?

Could you also please fill in this information:

  • Library size:
  • GitHub stars:

  • Last release date:

Thank you!

@rinej
Copy link
Contributor Author

rinej commented Aug 23, 2024

How we currently use react-native-firebase for tracking performance:

Custom Metrics Tracking:
We monitor specific custom metrics to gain deeper insights into key functionalities. For example:

  • chat_render: Tracks the time taken to render the chat interface.
  • load_search_options: Monitors the duration for loading search options.
  • switch_report: Measures the time spent switching between reports.

Detailed Trace Logging:
We log additional details in each trace, such as accountId, the number of reports, and the length of personalDetails. This helps in identifying performance bottlenecks more easily.

Network Request Timing:
We track the time taken for network requests, such as ReconnectApp or OpenApp, to monitor their performance.

Crashlytics Integration:
We use the crashlytics module to help identify the root causes of crashes. (Currently, crashlytics is only available on mobile platforms. For web monitoring, we can use other tools like Sentry or Bugsnag.)

Flexibility
As this is a relatively new initiative, we have the flexibility to add or modify metrics as our needs evolve.

Url to firebase console -> https://console.firebase.google.com/u/0/project/expensify-chat/performance/app/android:com.expensify.chat/trends?time=last-thirty-days

Additional Info:

New package npm url: https://www.npmjs.com/package/firebase

Library size:

GitHub stars: 4.8k

Last release date: a day ago (22 August)

@luacmartins
Copy link
Contributor

Thanks! I'll bring this to Slack tomorrow

@luacmartins luacmartins added the Daily KSv2 label Aug 27, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 29, 2024
@rinej
Copy link
Contributor Author

rinej commented Aug 30, 2024

I created the Draft PR with the project configuration: #47795
We will need someone from Exp to create new Web project in firebase console so we can add the proper config:

FB_API_KEY=YOUR_API_KEY
FB_APP_ID=YOUR_APP_ID
FB_PROJECT_ID=YOUR_PROJECT_ID

Copy link

melvin-bot bot commented Aug 30, 2024

@luacmartins Whoops! This issue is 2 days overdue. Let's get this updated quick!

@luacmartins
Copy link
Contributor

We have a draft PR

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 30, 2024
@rinej rinej changed the title Research Firebase for Web [Internal] Research and Set up Firebase for Web Sep 2, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue Weekly KSv2 labels Sep 2, 2024
@rinej
Copy link
Contributor Author

rinej commented Sep 2, 2024

The PR is ready for review.
We will just need someone from the internal team to create new Firebase Project and set the proper environmental variables so we can take it from ENV. More details in the PR -> #47795

@luacmartins luacmartins added the Internal Requires API changes or must be handled by Expensify staff label Sep 2, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@rinej
Copy link
Contributor Author

rinej commented Sep 23, 2024

the issue was resolved in the following ticket: #49443 (comment)

@luacmartins
Copy link
Contributor

Closing issue!

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Oct 31, 2024
@melvin-bot melvin-bot bot added the Weekly KSv2 label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoAssignerAppLibraryReview Auto assign someone to review a new library being added to App Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

3 participants