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.
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||
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
metadata.user_labels.name values will be 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 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,
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,
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 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. 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: 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 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: https://console.cloud.google.com/monitoring/dashboards/custom/2826428163455705326?project=[PROJECT_ID] metadata.user_labels.name is deprecated for gce_instance. This reference will be auto-migrated to metadata.system_labels.name.
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.
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.
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: