Go to console

Monitor Cloud Storage for Firebase usage

This page describes how you can monitor your Cloud Storage for Firebase usage and spot potential problems in your app. Looking at your app's usage can also give you an idea of what to expect on your bill. Additionally, if something seems off, getting a clear picture of your storage bucket's operations (for example, by monitoring evaluation of Storage Security Rules) can be a helpful for troubleshooting.

Firebase console

The Firebase console includes a usage dashboard that shows Storage Bytes stored, object count, bandwidth, and download requests over time.

Go to the Usage page

The Cloud Storage usage dashboard in the Firebase console.

Google Cloud Platform Console

When you create a Firebase project, you're also creating a project in the Google Cloud Platform (GCP). The App Engine Quotas page in the GCP Console tracks daily storage usage information including Bytes stored, object counts, bandwidth used, and download requests.

Cloud Storage usage in the App Engine Quotas page.

Stackdriver Monitoring

Stackdriver Monitoring collects metrics, events, and metadata from GCP products that you can use to create dashboards, charts, and alerts. Stackdriver Monitoring includes the following Security Rules-related Cloud Storage metrics:

Metric Name Description
Rule evaluations The number of Cloud Storage Rules evaluations performed in response to write or read requests. You can break this metric down by the result of the request (ALLOW, DENY, or ERROR) or the bucket name.
Sampling rate
The Cloud Storage metrics are sampled every 60 seconds, but updates may take up to 4 minutes to show up in your dashboards.

Using these metrics, you can set up a Cloud Storage dashboard like the following:

Cloud Storage usage in a Stackdriver Monitoring dashboard.

Complete the steps below to start monitoring Cloud Storage with Stackdriver Monitoring.

Create a Stackdriver workspace

To monitor a Cloud Storage for Firebase Bucket with Stackdriver Monitoring, you must set up a Stackdriver workspace for your project. A workspace organizes monitoring information from one or more projects. After setting up a workspace, you can create custom dashboards and alerting policies.

Skip these steps if your project is already part of a workspace.

  1. Create a Workspace from the Stackdriver Console

    Enter your GCP project ID and click Create workspace.

  2. Optionally, select additional projects to monitor in the same workspace. Click Continue.

  3. Skip the steps to Add AWS accounts and Install Stackdriver agents. These steps are not required to monitor Cloud Storage. Click Continue.

  4. Configure your preference for email reports. Click Continue.

  5. Click Launch Monitoring.

Create a dashboard and add a chart

Display the Cloud Storage metrics collected from Stackdriver Monitoring in your own charts and dashboards. Before you proceed, make sure your project is part of a Stackdriver workspace.

  1. In the Stackdriver Console, open your workspace and go to Dashboards > Create dashboard. Go to the Create Dashboard page
  2. In the upper-right hand corner, click Add Chart.
  3. In the Add Chart window, click the Metric tab.
  4. In the Find resource type and metric field, enter GCS Bucket. From the auto-populated dropdown, select one of the available metrics, for instance, Rule evaluations.
  5. To add more metrics to the same chart, click Add Metric and repeat the previous step.
  6. Tailor your chart as needed. For example, in the Filter field, click + Add a filter. Scroll down, then select result and the Rules evaluation result (ALLOW, DENY, or ERROR) you wish to filter the chart on.
  7. Click Save.

For more on Stackdriver Monitoring charts, see Working with charts.

Create an alerting policy

You can create an alerting policy based on the Storage metrics. Follow the steps below can create an alerting policy that emails you whenever a specific Storage metric meets a certain threshold. Before you proceed, make sure your project is part of a Stackdriver workspace.

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

If your Storage Bucket usage exceeds the configured threshold, you will receive an email alert. For more on alerting policies, see Introduction to alerting.

What's next