Annotate notifications with user-defined documentation Stay organized with collections Save and categorize content based on your preferences.
This page describes how you can configure your alerting policy documentationso that notifications provide incident responders with resources andadditional information for incident resolution.
Documentation structure
The documentation of an alerting policy consists of a subject, content,and links. You can configure documentation in the Google Cloud console, theCloud Monitoring API, and the Google Cloud CLI.
Subjects
Thesubject of your documentation appears in the subject ofnotifications for incidents related to your alerting policy.Notification recipients can manage and sort their notifications by subject.
Subject lines are limited to 255 characters. If you don't define a subject inyour documentation, then Cloud Monitoring determines the subject line.Subject lines support plain text andvariables.
Cloud Monitoring API
Configure the notification subject line by using thesubject fieldof the alerting policydocumentation.
Google Cloud console
Configure the notification subject line by using theNotification subject line field in theNotifications and name section of theCreate alerting policy page.
Content
Thecontent of your documentation appears in the following notificationtypes:
- Email, in thePolicy Documentation section
- PagerDuty
- Pub/Sub
- Slack
- Webhooks
We recommend configuring your content so that incidentresponders can view remediation steps and incident information innotifications related to your alerting policy. For example, you might configurethe documentation to include a summary of the incident andinformation about relevant resources.
Documentation content supports the following:
Cloud Monitoring API
Configure documentation content by using thecontent fieldof the alerting policydocumentation.
Google Cloud console
Configure documentation content by using theDocumentation field in theNotifications and name section of theCreate alerting policy page.
Links
You can add links to your documentation so that incident responders canaccess resources such as playbooks, repositories, and Google Cloud dashboardsfrom a notification.
The Cloud Monitoring API lets you define an object that contains the most relevantlinks for responders. While the Google Cloud console doesn't have a fieldspecifically for links, you can add a section for links in your documentationbody.
Cloud Monitoring API
You can add links to your documentation by defining one or moreLink objects in thelinks field of the alerting policydocumentation. EachLink object consists of adisplay_name and aurl. You can have up to three links inyour documentation.
The following configuration shows thelinks field with oneLink objectrepresenting a URL to an incident playbook. The URL includes a variableso that notification recipients can access the correct playbook based on themonitored resource where the incident occurred:
"links"[{"displayName":"Playbook","url":"https://myownpersonaldomain.com/playbook?name=${resource.type}"}]Documentation links added using theLink field appear in the followingnotification types:
- Email, in theQuick Links section
- PagerDuty
- Pub/Sub
- Webhooks
Google Cloud console
You can add links to your documentation content by including themin theDocumentation field of your alerting policy. For example, thefollowing documentation lists a URL for a customer playbook:
### Troubleshooting and Debug ReferencesPlaybook: https://myownpersonaldomain.com/playbook?name=${resource.type}Documentation links added using the Google Cloud console appear with therest of your documentation content in the following notification types:
- Email, in thePolicy Documentation section
- PagerDuty
- Pub/Sub
- Slack
- Webhooks
Markdown in documentation content
You can use Markdown to format your documentation content.Documentation content supports the following subset of Markdown tagging:
- Headers, indicated by initial hash characters.
- Unordered lists, indicated by initial plus, minus, or asterisk characters.
- Ordered lists, indicated by an initial number followed by a period.
- Italic text, indicated by single underscores or asterisks around a phrase.
- Bold text, indicated by double underscores or asterisks around a phrase.
- Links, indicated by
[link text](url)syntax. To addlinks to your notification, we recommend that you use theCloud Monitoring API and configure theLinkobject.
For more information about this tagging, see any Markdown reference,for example,Markdown guide.
Variables in documentation
To customize the text in your documentation, you can use variablesof the form${varname}. When the documentation is sent witha notification, the string${varname} is replaced with a value drawn from thecorresponding Google Cloud resource, as described in the following table.
| Variable | Value |
|---|---|
condition.name | The REST resource name of the condition, such asprojects/foo/alertPolicies/1234/conditions/5678. |
condition.display_name | The display name of a condition, such asCPU usage increasing rapidly. |
log.extracted_label.KEY | The value of the labelKEY, extracted from a log entry. For log-based alerting policies only; for more information, see Create a log-based alerting policy by using the Monitoring API. |
metadata.system_label.KEY | The value of the system-supplied resource metadata labelKEY.1 |
metadata.user_label.KEY | The value of the user-defined resource metadata labelKEY.1,3 |
metric.type | The metric type, such ascompute.googleapis.com/instance/cpu/utilization. |
metric.display_name | The display name for the metric type, such asCPU utilization. |
metric.label.KEY | The value of the metric label When the value of the variable When youmigrate a Prometheus alerting rule, the Prometheus alert field templates You can also use |
metric.label.metadata_system_VALUE | References a PromQL metadata system label, whereVALUE is the specific label name, such as Example usage: |
metric.label.metadata_user_VALUE | References a PromQL metadata user label, whereVALUE is the specific label name, such as Example usage: |
metric_or_resource.labels | This variable renders all metric and resource label values as a sorted list of When youmigrate a Prometheus alerting rule, the Prometheus alert field templates |
metric_or_resource.label.KEY |
When youmigrate a Prometheus alerting rule, the Prometheus alert field templates |
policy.name | The REST resource name of the policy, such asprojects/foo/alertPolicies/1234. |
policy.display_name | The display name of a policy, such asHigh CPU rate of change. |
policy.user_label.KEY | The value of the user labelKEY.1Keys must start with a lowercase letter. Keys and values can contain only lowercase letters, digits, underscores, and dashes. |
project | The ID of the scoping project of a metrics scope, such asa-gcp-project. |
resource.type | The monitored-resource type, such asgce_instance. |
resource.project | The project ID of the monitored resource of the alerting policy. |
resource.label.KEY | The value of the resource labelKEY.1,2,3To find the labels associated with the monitored-resource type, seeResource list. |
1 For example,${resource.label.zone} is replaced withthe value of thezone label. The values of these variables are subject togrouping; seenull values for more information.
2 To retrieve the value of theproject_id label on amonitored resource in the alerting policy, use${resource.project}.
3 You can't access user-defined resource metadata labels byusingresource.label.KEY. Usemetadata.user_label.KEYinstead.
Usage notes
- Only the variables in the table are supported. You can't combine them intomore complex expressions, like
${varname1 + varname2}. - To include the literal string
${in your documentation, escape the$symbol with a second$symbol, and$${renders as${in yourdocumentation. - These variables are replaced by their values only in notifications sentthrough notification channels. In the Google Cloud console, when thedocumentation is shown, you see the variables, not the values. Examplesin the console include the descriptions of incidents and the preview ofthe documentation when creating an alerting policy.
- Verify that the aggregation settings of the condition don't eliminate thelabel. If the label is eliminated, then the value of the label in thenotification is
null. For more information,seeVariable for a metric label is null.
null values
Values for themetric.*,resource.* andmetadata.* variablesare derived from time series. Their values can benull if no values arereturned from the time series query.
The
resource.label.KEYandmetric.label.KEYvariables can havenullvalues if your alerting policy uses cross-series aggregation(reduction), for example, calculating the SUM across each of thetime-series that match a filter. When using cross-series aggregation,any labelsnot used in grouping are dropped and as a result they render asnullwhen the variable is replaced with its value. All labelsare retained when there is no cross-series aggregation.For more information,seeVariable for a metric label is null.Values for
metadata.*variables are available only ifthe labels are explicitly included in a condition's filter or grouping forcross-series aggregation. That is, you must refer to the metadata label ineither filter or grouping for it to have a value for the template.
Variable resolution
Variables in documentation templates are resolved only in the notificationssent by using the following notification channels:
- Google Chat
- Slack
- Pub/Sub, JSON schema version 1.2
- Webhooks, JSON schema version 1.2
- PagerDuty, JSON schema version 1.2
${varname},in other contexts, in notifications sent by using other notificationchannels.Channel controls
The text in the documentation field can also include special characters usedby the notification channel itself to control formatting and notifications.
For example, Slack uses@ for mentions. You can use@ to link thenotification to a specific user ID. Mentions can't include names.Suppose you include a string like this in the documentation field:
<@backendoncall>Incidentcreatedbasedonpolicy${policy.display_name}When the documentation field is received by the relevant Slack channel as partof the notification, the previous string causes Slack to send anadditional message to the user IDbackendoncall. The message sent by Slack to the usercould contain relevant information from the notification; for example,"Incident created based on policy High CPU rate of change".
These additional options are specific to the channels; for more informationon what may be available, consult the documentation provided by the channelvendor.
Example
The following example shows Google Cloud console and Cloud Monitoring API versions oftemplate documentation for a CPU utilization alerting policy.These examples use an email for thenotification channel type.The documentation templates include several variables to summarize theincident and to reference the alerting policy and condition RESTresources.
Cloud Monitoring API
"documentation":{"content":"### CPU utilization exceeded\n\n### Summary\n\nThe ${metric.display_name} of the ${resource.type} ${resource.label.instance_id} in the project ${resource.project} has exceeded 5% for over 60 seconds.\n\n#### Additional resource information\n\nCondition resource name: ${condition.name} \nAlerting policy resource name: ${policy.name}","mimeType":"text/markdown","subject":"Alert: ${metric.display_name} exceeded","links":[{"displayName":"Playbook","url":"https://myownpersonaldomain.com/playbook?name=${resource.type}"},{"displayName":"Repository with debug scripts","url":"https://altostrat.com"},{"displayName":"Google Cloud dashboard","url":"https://example.com"}]}The following image shows how this template appears in an emailnotification:

Google Cloud console
### CPU utilization exceeded#### SummaryThe ${metric.display_name} of the ${resource.type}${resource.label.instance_id} in the project ${resource.project} hasexceeded 5% for over 60 seconds.#### Additional resource informationCondition resource name: ${condition.name} Alerting policy resource name: ${policy.name} #### Troubleshooting and Debug ReferencesPlaybook: https://myownpersonaldomain.com/playbook?name=${resource.type} Repository with debug scripts: https://altostrat.com ${resource.type} dashboard: https://example.comThe following image shows how this template appears in an emailnotification:

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.