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 has been 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 could be determined were automatically migrated to use the replacements by July 31, 2020. All other uses of deprecated labels must be manually migrated. This page provides information about how to migrate them.
Any alerting policies, charts, scorecards, and resource groups using metadata labels that were not migrated automatically or manually by July 31, 2020, are no longer supported and might stop working.
To repair alerting policies, charts, scorecards, or resource groups that have stopped working because of deprecated metadata labels, you must take some action. You can remove the alerting 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||
* The Cloud Monitoring filter syntax does not allow the
resources.labels.project_id label to be used as flexibly as the
metadata.system_labels.cloud_account label could be used.
For example, you can't do the following:
OR to combine an expression using the
project_id label and an expression using metadata
!= operation with the
gae_app resources: The noted resource
labels are similar to the deprecated metadata labels, so they might be good
replacements. But because they are only similar, they were not migrated
resources: If you do not otherwise set
it had been auto-populated with the value from
This auto-population also ended on July 31, 2020.
Alerting policies, charts, scorecards, and resource groups that filter on
metadata.user_labels.name value were migrated
pubsub_subscription resources: We have fixed a long-standing bug
metadata.system_labels.name to be
automatically converted to lowercase (for example,
"my-subscription"). This produced unexpected behavior in
cases where users had multiple resources whose lowercase names are identical.
This behavior also ended on July 31, 2020. After this date, the
metadata system label
name reflects the actual name of the
topic or subscription (for example,
What do I need to do?
There are two high-level steps:
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.
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
python3 metadata_label_detection.py PROJECT_ID_OR_NUMBER
PROJECT_ID_OR_NUMBER can be either a project ID (for example,
or a project number (for example,
123456789). Do not include the
The following steps describe a way to use the script:
Go to the Google Cloud Console.
Click Activate Cloud Shell at the top of the Google Cloud Console page for your project.
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.
Create a new file called
metadata_label_detection.pyby selecting File and then New File. Paste the text of the
metadata_label_detection.pyinto the editor. Save the file by selecting File and then Save.
Go back to the terminal by clicking Open Terminal on the Cloud Shell toolbar.
At the command-line prompt in Cloud Shell, install the script dependencies by running the following command:
sudo pip3 install google-cloud-monitoring=="1.*" google-cloud-monitoring-dashboards
After installing the dependencies, run the detector script:
python3 metadata_label_detection.py $GOOGLE_CLOUD_PROJECT
The script generates a report like the following excerpt:
Alert "Test alert" (projects/PROJECT_ID/alertPolicies/8401129027900817186) is affected. URL: https://console.cloud.google.com/monitoring/alerting/policies/8401129027900817186?project=PROJECT_ID metadata.system_labels.cloud_account is deprecated for non-AWS resource types. Please manually remove the reference. Group "Test group" (projects/PROJECT_ID/groups/4518177785663978371) might be affected, depending on the type of resources it is used for. URL: https://console.cloud.google.com/monitoring/groups/4518177785663978371?project=PROJECT_ID metadata.system_labels.name is deprecated for dataflow_job. Please manually remove the reference if this group is used for dataflow_job resources. metadata.system_labels.name is deprecated for cloud_tasks_queue. Please manually remove the reference if this group is used for cloud_tasks_queue resources. Xy_chart "Test chart" in dashboard "Demo dashboard" (projects/PROJECT_ID/dashboards/2826428163455705326) is affected. URL: https://console.cloud.google.com/monitoring/dashboards/custom/2826428163455705326?project=PROJECT_ID metadata.user_labels.name is deprecated for gce_instance. Please manually remove the reference.
Update your filters
To update your alerting policies, charts, scorecards, and resource groups:
Log into the Google Cloud Console.
Run the detector script as described in Find deprecated labels.
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.
Remember that filters use the prefix
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 the label has a replacement, replace the deprecated label with the replacement.
If you do nothing, the affected alerting policy, chart, or resource group will not work.
For additional help on making updates by using the Google Cloud Console, see the resources listed in Editing.
In some cases, you might need to use the Cloud Monitoring API rather than the Cloud Console. The API can express some queries that can't otherwise be constructed.
Run the detector script again, to verify that no deprecated labels remain.
For information on resource metadata labels, filters, or specific monitored-resource types, see the following:
- Labels: Resource metadata labels
- Filters: Monitoring filters
- Specific monitored-resource types: Monitored resource list
For information on updating alerting policies, charts, dashboards, and resources groups, see the following:
- Alerting policies: Managing policies
- Dashboards and charts by using the Google Cloud Console: Managing dashboards
- Dashboards by using the Monitoring API: Updating dashboards
- Resource groups: Editing a group