Profiling firebase storage requests - firebase

I have an app which uses firebase storage and I am observing an unusual traffic to the storage. The bandwidth usage is unusually high, which shouldn't happen with the usual behavior of the app.
I need to isolate a user or a stored file which causes this unusual bandwidth usage. Is there any way I can get more information about the storage usage, other than the information shown at the Usage tab of firebase console?

Firebase Storage only tracks and shows aggregate data for the usage in your project. It does not tie this usage to specific Firebase Authentication users.
If you need that, consider adding your own tracking for this, for example by logging uploads/downloads to Google Analytics for Firebase.
You can also log to Stack Driver, although it might only be in aggregate there too. For the exact metrics, see the Google Cloud Platform documentation on its storage metrics.
Alternatively you could reach out to Firebase support for personalized help in troubleshooting. But I'm not sure if they have access to the type of data you're looking for.

Related

Google Cloud Logging VS Datastore for logging app activity

I'm trying to log user activity in my appengine app, which will server both web and mobile users. I'm having a problem deciding which google product I should store the activities to. Two options I'm considering are (Fairly new to both of these):
Google Cloud Datastore as kinds (I think it's a different lingo for tables)
Google Cloud logging as JSON
Price-wise, it seems like Google Cloud logging is cheaper at $0.50/GiB(one time charge for the amount logged) and $0.01/GiB per month, whereas Google Cloud Datastore charge for Read, write, delete + $0.18/GiB/month of storage.
Interface wise, It seems easier to use Cloud Datastore during debugging process. I still haven't gotten a hang of Log explorer yet.
Both have the option to export the data out to CSV.
Which one is recommended for the purpose of activity logging in the long run?
I recommend using Cloud Logging, it is the best for logging any app activity for your application and Google Cloud as it designed for this kind of requirement. For long terms, you can configure your Cloud Logging retention period to retain your Logs up to 3650 days or 10 years. For pricing, the data retention will be priced at $0.01/GiB per month above default retention periods(30 days).

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.

Getting firestore usage stats from firebase client libraries

I am trying to identify the reason for an abnormally high firestore read count in my android and web app.
If there was a way to profile firestore, I could get an idea of which collection, or which user is causing this high read count, but currently there is no way to profile firestore.
I added a log entry to my android and web apps to log the read count to a remote server, so I can troubleshoot the issue. But this log doesn't match the actual read count I see in the firestore console, so it looks like I have missed to log some places where firestore is queried.
The reason why firestore hasn't provided a way to profile firestore is because it is technically difficult for them to do it with the high load, as I read somewhere. But, it shouldn't be hard to track the usage at client library level.
Does anyone know a way to get the usage statistics out of the firestore client library? Or any other way to troubleshoot this issue?
There is currently no profiler. Please contact Firebase support and file a feature request to vote for this. Also, they might be able to help you understand the traffic.

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

Firebase plans and usage quotas

I want to test Firebase analytics to monitor my app but i'm a little concerned about the free mode. Am I obligated to use Firebase storage, real time database, hosting and all that? or can I have my own and use Firebase just for analytics?
What I fear is giving up my current infra structure and end up with the app turned off during release because it got too many access or something like that.
You can use Firebase Analytics without using any of the other Firebase features. Firebase Analytics is free and unlimited.

Resources