Resource metadata labels

Monitored resources in Cloud Monitoring come with a set of labels that are used to identify a particular instance of the monitored-resource type. These labels are documented for each monitored-resource type in the Monitored resource list.

In addition, Monitoring might create additional labels to capture metadata about a monitored resource. These system metadata labels are available to users as read-only values. Users can also create their own resource metadata labels. For more information, see Resource metadata labels.

A group of monitored-resource metadata labels is being deprecated. The labels in the set are either redundant and can be replaced by existing equivalent labels, or they represent obsolete concepts that are no longer supported by Cloud Monitoring alerting policies, charts, scorecards, or resource groups.

Effects of the deprecation

All alerting policies, charts, scorecards, and resource groups that specify a monitored resource and use metadata labels for which replacement labels exists will be automatically migrated to use the replacements on July 31, 2020.

All alerting policies, charts, scorecards, and resource groups that use metadata labels for which no replacement labels exist will stop working on July 31, 2020.

Required action

To prevent unexpected system behavior in active alerting policies, charts, scorecards, or resource groups that use metadata labels without replacements, you must take some action. You can remove the alertng policies, charts, scorecards, or groups, or you can modify any filters that use those deprecated labels to use labels that provide similar behavior.

Similarly, if you have filters that use metadata labels but do not specify monitored resources, it isn't possible to determine automatically if these labels are deprecated. You must evaluate and address them manually.

This page includes a script to help you identify uses of deprecated metadata labels.

Deprecated metadata labels

The following table lists the resource metadata labels being deprecated and their replacements, if any.

Monitored-resource type Deprecated label Equivalent label
All Google Cloud types metadata.system_labels.cloud_account resource.labels.project_id
gae_app metadata.system_labels.gaeapp
l7_lb_rule metadata.system_labels.state none
vpn_gateway metadata.system_labels.region resource.labels.region

For gce_disk and gce_instance resources: If you do not otherwise set, it is currently auto-populated with the value from This auto-population also ends on July 31, 2020. Alerting policies, charts, scorecards, and resource groups that filter on auto-populated values will be migrated to use instead.

For pubsub_topic and pubsub_subscription resources: We have fixed a long-standing bug causing to be automatically converted to lowercase (for example, "My-Subscription" becomes "my-subscription"). This produced unexpected behavior in cases where users had multiple resources whose lowercase names are identical. This behavior also ends on July 31, 2020. After this date, the metadata system label name will reflect the actual name of the topic or subscription (for example, "My-Subscription").

What do I need to do?

There are two high-level steps:

  1. Determine if you are using any metadata labels affected by this deprecation. See Find deprecated metadata labels for information on running the provided detector script.

  2. If you are using any affected metadata labels, update or remove them. See Update your filters for more detailed steps.

Find deprecated metadata labels

You can use this Python script to identify references to deprecated metadata labels:

Syntax summary: python3 [PROJECT_ID_OR_NUMBER]

PROJECT_ID_OR_NUMBER can be either a project ID (for example, my-project), or a project number (for example, 123456789).

The following steps describe a way to use the script:

  1. Go to the Google Cloud Console.

    Go to Cloud Console

  2. Click Activate Cloud Shell at the top of the Google Cloud Console page for your project.

  3. Click Open Editor on the Cloud Shell toolbar. If the workspace for your home directory is not already open, open it by selecting File and then Open Workspace. Choose the workspace with your username.

  4. Create a new file called by selecting File and then New File. Paste the text of the into the editor. Save the file by selecting File and then Save.

  5. Go back to the terminal by clicking Open Terminal on the Cloud Shell toolbar.

  6. At the command-line prompt in Cloud Shell, install the script dependencies by running the following command:

    sudo pip3 install google-cloud-monitoring google-cloud-monitoring-dashboards
  7. After installing the dependencies, run the detector script:


The script generates a report like the following excerpt:

Alert "Test alert" (projects/[PROJECT_ID]/alertPolicies/8401129027900817186) is affected.
        metadata.system_labels.cloud_account is deprecated for non-AWS resource
types. This reference will be auto-migrated to resource.labels.project_id.
Group "Test group" (projects/[PROJECT_ID]/groups/4518177785663978371) might be affected,
depending on the type of resources it is used for.
URL:[PROJECT_ID] is deprecated for dataflow_job. Please
manually remove the reference if this group is used for dataflow_job resources. is deprecated for cloud_tasks_queue. Please
manually migrate to resource.labels.queue_id if this group is used for cloud_tasks_queue resources.
Xy_chart "Test chart" in dashboard "Demo dashboard" (projects/[PROJECT_NUM]/dashboards/2826428163455705326) is affected.
URL:[PROJECT_ID] is deprecated for gce_instance. This
reference will be auto-migrated to

Update your filters

To update your alerting policies, charts, scorecards, and resource groups:

  1. Log into the Google Cloud Console.

  2. Run the detector script as described in Find deprecated labels.

  3. Inspect each of your alerting policies, charts, and resource groups to check if the value you're retrieving comes from one of the deprecated labels identified by the script.

    To check the all the charts, you must check each chart on each custom dashboard you have defined.

    For each deprecated label, do one of the following:

    • If the label has no replacement, remove the use of the label or delete the alerting policy, chart, or resource group.

      If you do nothing, the filter using the label will not work after July 31, 2020.

    • If the label has a replacement, replace the deprecated label with the replacement.

      If you do nothing, the replacement will be made for you on July 31, 2020.

    For additional help on making updates, see the resources listed in Editing.

  4. Run the detector script again, to verify that no deprecated labels remain.

Additional information

For information on resource metadata labels, filters, or specific monitored-resource types, see the following:


For information on updating alerting policies, charts, dashboards, and resources groups, see the following: