firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 917 forks source link

Allow Firestore emulator to show reads and writes count #3149

Open saurabh-mhaisekar opened 3 years ago

saurabh-mhaisekar commented 3 years ago

Similar to firestore console, please add section in firestore emulator ui to show current read and write operation. This would be really helpful to optimize the code.

samtstern commented 3 years ago

@saurabh-mhaisekar thanks for the feature request. We're actively working on showing more usage information in the Firestore emulator (and other emulators) although we intend to do something a little different than the production Firebase console since we have more information to work with.

akauppi commented 3 years ago

@samtstern I'd ask this a bit further, even.

When testing my Security Rules, it would be delightful to be able to confirm from the emulator (via an API, I guess) the read counts accumulated so far (or attached to a certain operation). This allows programmatic confirmation of the cost budget of such rules.

If you see this as something meaningful, I should probably make a separate issue about it?

samtstern commented 3 years ago

@akauppi we can track this here in this issue, we have done some work on this feature request and we are also considering reads from security rules in that work.

jgavazzisp commented 2 years ago

Hi, @samtstern do you have an ETA for an MVP of this feature?

Thanks

akauppi commented 2 years ago

If there’s anything you can reveal about the approach, that would be helpful.

Just to make sure: the programmatic confirmation is the key, imho. Just writing the counts on the console (for humans) is not enough, since it doesn’t allow for breaking a CI build in case assumptions on the read/write counts are wrong.

samtstern commented 2 years ago

No ETA on this exact feature but the latest release includes a brand new Firestore Request Monitor which will show you each request in detail!

jgavazzisp commented 2 years ago

The Request Monitor is really good thanks for that.

Are you guys planning to add the Admin SDK count too? It would be nice to be able to have the count after for instance run an integration test suit for background schedulers and at glance and getting a good idea if an improvement could be made or not based on the final counts.

akauppi commented 2 years ago

@jgavazzisp Where can I see this Request Monitor?

Have firebase-tools 9.16.0 and looked into the Firestore tab of localhost:4000. Not there.


Okay, found this fuzzy video: https://www.reddit.com/r/Firebase/comments/ogwap9/check_out_the_new_firestore_request_monitor_in/

davidecampello commented 2 years ago

Is this feature available?

kovan commented 2 years ago

Would it be possible to just print the request log to the logs?. This way we can use standard tools to analyze it. Like for example, as this case is about counting requests, wc -l (maybe along with some grep).

jersonal-com commented 1 year ago

Getting more insights about the read and write count would be awesome.

Is it possible to derive the read / write (i.e. charging relevant) transactions from the requests? One would most likely take the data in the resource field somehow into account?!?

(and to do that effectively getting the requests in a log would be great ...)

felippi commented 1 year ago

I have a problem with a complex system, where I have many side effects, especially in balance tables. It would be very useful to be able to have the count of reads and writes after running the tests on emulator. Is there any preview for this feature?

ahlivehr commented 4 months ago

The ability to access read/write counts in the emulator would be invaluable. Right now, it's near impossible for me to estimate how optimized my app is to minimize reads/writes. This is especially true in a React application, where it's easy for an update to a component to result in triggering numerous reads.