How to query firebase firestore usage by source (admin vs web) - firebase

is there any way in firebase or google cloud console to view the firestore document reads by source (admin or web sdk)? we had a massive spike and need this info to triage.

All options are listed on the documentation page on monitoring usage, but there is no view of what specific document caused the spike in reads. If you want such a thing, you'll have to build it yourself - which unfortunately won't help for this incident that has already occurred.

Related

Extremely high READ hits on website using Firebase Firestore

I have more than 52k hits on my small project which is using NextJS with Firebase 9.
I don't know what the problem is because the data I am using is very limited and I have only two snapshot listener and one Authentication feature. But somehow in just two days Firestore quota has exceeded and there are more than 52k READ hits.
I don't know why that happened because there are no memory leaks and I am also closing the API listeners which come attached with Firebase.
I am providing github link in case anyone wants to take a look https://github.com/jainChetan81/Todo-List
Attached screenshot of Firebase console:
Use of the Firebase console will incur reads. If you leave the console open on a collection or document with busy write activity then the Firebase console will automatically read the changes that update the console's display. Most of the time this is the reason for unexpected high reads. You can go through this answer. Also, currently there are no tools to trace the reads in Firestore. So to limit the Firestore database reads you have to configure security rules.
So, I would suggest you check your Firestore rules. And if not, it is better to contact Firebase Support as this kind of issue needs visibility into your project and they will have access to it.
I am having the same problem as you with my React app. The solution is to use the useEffect hook and call the function that requests for firestore collection;
useEffect(()=> {
getPosts();
}, []);

Discrepency in Number of writes in Firebase console and Google cloud console Quota pages

Last couple of weeks, I have been Observing difference between number of writes in Firebase console Firestore Usage tab and Google cloud console Quota page.
Before that, The count fairly used to sync.
Number of writes in Firebase Firestore console usage tab: 9.2K
Number of writes in Google Cloud Console page, Quotas Page: 19307
Which is approximately double the number of writes in Firebase Firestore Usage Tab. Are there any Internal writes happening which google doesn't report?
Firebase Console Firestore Usage Tab Page
Google cloud Console Quotas page
I have attached the screenshots for the same.
Can anyone clear My Query. Is this a valid Scenario?
Note: I Don't have any other project linked to the platform.
From your first screenshot you can see at the top left written on the graph “Does not include Imports/exports and may not match billing and quota usage”. Moreover, Google public documentation states that the Firebase console includes a usage dashboard that shows Cloud Firestore reads, writes, deletes and other metrics over time.
As a result of how the dashboard computes usage, the numbers reported can differ from billing reports. The billing reports are the final usage numbers.
The usage dashboard does not include reads and writes from managed import and export operations.
So,I have to answer my question.
I've found out the root cause. Firestore FieldValue atomic operations causing the double writes.
This double writes happening with any SDK version even in Cloud functions Admin SDK.
I've skipped the use of atomic operations using FieldValue. All Fine now.
Firebase Support Investigating the Issue. Will update When I Got more Info from them.
Edit:2
Response from Firebase support:
"The two writes come from: 1) the initial write and 2) the transformation. This is not a bug, and what is shown in the Cloud console is correct. We do have an internal ticket now to make sure the Firebase console syncs up this information better, as well, so hopefully that'll help."
That means Fieldvalue functions to increment and array Union, servertimestamp will cause two writes and I also found that they are causing extra reads as well. I feel Firebase should reconsider their decision of not considering it as bug or atleast restructure this Atomic Operation. Let's Wait and See.

Firestore reads - inconsistency between App Engine Quota and Firebase Console

I started using Firestore recently (Free plan) in my iOS app, the app is in Production now, and I see huge discrepancy in the number of Reads. App Engine Quota shows 1M reads of 0.05M (free quota) (Cloud Firestore Read Operations), while Firebase Console (Database tab) shows just a one hundred reads for today - 10,000 times difference!
The app can still read the data from the servers (it's not from cache as I tried to delete the app and reinstall), so the Firestore functionality is not limited by exceeding the free quota.
Each app user can read only one document (via listener) with applied security rules, and it reads own document only 3-5 times per session. There are about 50 users so far, so the expected number of reads matches Firebase console.
Is there a known bug in App Engine console?
Is there a way or free tool to understand the source of all those reads?
Which reporting tool is more reliable in general - Firebase Console or App Engine Console?
I appreciate your help guys!

How can I see Firebase Storage Usage in the Console

I am using Firebase for almost 2 months now for my app in production and right now I am on Spark plan for sometime until I get user base. I see that the Spark pricing allows 1GB of downloads per day and 5GB of total storage but nowhere on the console I am able to see how much storage quota I have used up now. This is really important to a lot of users, if you show usage information for Database you should show it for storage as well.
As long as Storage is concerned it's actually a Google Cloud Storage Bucket, you can visit the Google Cloud Console and see the details. Firebase currently does not show the bucket usage details.
You can send them a feature request from this link :
https://firebase.google.com/support/contact/bugs-features/
Like Raghvendra said, you can view it on the Google Cloud Console at the following link: https://console.cloud.google.com/storage/browser/my-app.appspot.com
my-app will be your project name, and is the same as the one you use on Firebase: https://console.firebase.google.com/project/my-app/storage/my-app.appspot.com/files

Where to find Firebase usage report? [duplicate]

After I migrated my app to console.firebase.google.com I cannot view the database usage quota, bandwidth usage and several other statistics in the firebase.com analytics tab. Is there any way to check this using new panel?
Update: you can now see your project's Realtime Database, Cloud Storage, and Hosting usage in the Firebase console.
Update (20160727): you can now see your project's database usage from the Firebase Console. Thanks for your patience!
Previous answer: the database usage quota charts are not yet available in the new Firebase Console. We're working on adding them, as well as adding similar charts for Storage and Hosting. Hang in there!
I see a new Usage tab now. Console > Database > Usage
Currently shows Sent Bytes, Storage and Connections. Looks like it may not be stable yet, because it does not match the stats reflected in my billing section.

Resources