How to track Firestore read/write operations?

Viewed 347

I want to know the read/write operation count for each operation I would perform with Firestore. I know that get() costs as much reads as returned in the result, or set() costs 1 write.

However, there are some gotchas. For example, serverTimestamp() or increment() cost an extra write, or empty result for get() costs 1 read.

As the app grows and count of read/write increases, this becomes hard to track which operation is costing how much. Additionally, this will be really helpful information for optimizing the operations and make sure they stay in the expected limit. So,

  1. Is there any way I can get to know this on the client-side?
  2. Does the emulator provide this info as far as the server-side is concerned?

PS: This is developer-specific logging info and will not be shown to users.

1 Answers
  1. Is there any way I can get to know this on the client-side?

No, you should create your own mechanism for that. Firebase console only shows the total number of reads and writes per project. There is no tool that can provide you the number of reads and writes for each document separately.

  1. Does the emulator provide this info as far as the server-side is concerned?

No, it does not.

Related