Patrick M.
Patrick M.

Reputation: 819

Firestore billing & USage API

Does anybody know if Google provides an API to programmatically retrieve the current usage of firestore?

More precisely, I'm referring to the current number of read & write operations, as shown here: enter image description here

Upvotes: 3

Views: 883

Answers (1)

user13068860
user13068860

Reputation:

As your screenshot indicates, Firestore provide a Monitor to check the usage of your plan. Unfortunately, though, there is not an API to programmatically return the usage of your Firestore.

However, as mentioned in the official documentation Monitoring usage, you can create an alert policy to track your metrics and send an email to you, based on limits that you set, informing that the usage reached this certain point defined.

The steps for you to achieve the configuration are the following:

  1. In the Cloud Monitoring Page, open your workspace, and go to the Alerting page.
  2. Go to the Create New Alerting Policy page
  3. Click Create Policy.
  4. Enter a name for your alerting policy.
  5. Add an alerting condition based on one of the Cloud Firestore metrics. Click Add Condition.
  6. Select a Target. In the Find resource type and metric field, enter Cloud Firestore. From the auto-populated dropdown, select one of the Cloud Firestore metrics.
  7. Under Policy triggers, use the dropdown fields to define your alerting condition.
  8. Add a notification channel to your alerting policy. Under Notifications, Click Add Notification Channel. Select Email from the dropdown menu.
  9. Enter your email in the Email address field. Click Add.
  10. Optionally, fill out the documentation field to include additional information in your email notification.
  11. Click Save.

I believe this should help you, even though it's not an API was you might prefer. Besides that, I would recommend you to raise a Feature Request on Google's system for them to check the possibility of this be implemented in the future.

Let me know if the information helped you!

Upvotes: 6

Related Questions