firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Allow Firestore emulator to show reads and writes count

Open saurabh-mhaisekar opened this issue 4 years ago • 13 comments

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.

saurabh-mhaisekar avatar Feb 19 '21 08:02 saurabh-mhaisekar

@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.

samtstern avatar Feb 19 '21 11:02 samtstern

@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?

akauppi avatar Mar 27 '21 13:03 akauppi

@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.

samtstern avatar Mar 29 '21 10:03 samtstern

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

Thanks

jgavazzisp avatar Jul 23 '21 06:07 jgavazzisp

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.

akauppi avatar Jul 23 '21 08:07 akauppi

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!

samtstern avatar Jul 23 '21 08:07 samtstern

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.

jgavazzisp avatar Jul 23 '21 20:07 jgavazzisp

@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/

akauppi avatar Jul 23 '21 21:07 akauppi

Is this feature available?

davidecampello avatar Oct 19 '21 21:10 davidecampello

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).

kovan avatar Dec 02 '21 14:12 kovan

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 ...)

jersonal-com avatar Nov 09 '22 17:11 jersonal-com

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?

felippi avatar Mar 20 '23 22:03 felippi

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.

ahlivehr avatar Feb 26 '24 19:02 ahlivehr