This document describes how you explore the execution history of your synthetic monitors, and it also describes how to view the collected metrics and logs.
Before you begin
To get the permissions that you need to view synthetic monitors execution results by using the Google Cloud console, ask your administrator to grant you the following IAM roles on your project:
-
Monitoring Viewer (
roles/monitoring.editor
) -
Cloud Functions Developer (
roles/cloudfunctions.developer
) -
Logs Viewer (
roles/logging.viewer
)
For more information about granting roles, see Manage access.
You might also be able to get the required permissions through custom roles or other predefined roles.
View execution history for a synthetic monitor
To understand the history of passing and failing executions, view the Synthetic monitor details page for the synthetic monitor:
-
In the Google Cloud console, select Monitoring, and then select
Synthetic monitoring, or click the following button:
- To open the Synthetic monitor details page, locate the synthetic monitor that you want to view, and then click its name.
The Synthetic monitor details page lists summary information, such as the success rate and duration and the most recent status. This page also charts the recorded duration of the execution and it contains a table that displays one row for each execution.
Each row in the table lists the status, date, duration, and it links to a page that displays the current code and logs relevant to that execution.
View details of execution
To view summary information about an execution, on the Synthetic monitor details page, click the link to the execution. The new page displays the following:
A pane with summary information and a link to the Cloud Functions page for the Cloud Function.
For Mocha test, a Test results pane lists the results for each test. For example, if your synthetic monitor contains four Mocha tests, then the Test results pane contains four entries. Each entry in the list is annotated as a pass or fail.
If you select an entry marked as failed, then the failing code is displayed and highlighted.
A Code tab, that when selected, displays the current code.
An Execution logs pane that lists logs related to the execution. If you expand a log entry, then you can use the Logs Explorer with the query preconfigured to your log name and time period.
View Cloud Function metrics
Metrics let you understand how a service or application is behaving. For synthetic monitors, metrics are collected by both Cloud Monitoring and Cloud Functions:
Cloud Monitoring collects metrics about each execution of a synthetic monitor. These metrics include the latency of the code execution and the success history. For information about how to view these metrics, see View execution history for a synthetic monitor.
Cloud Functions collects metrics about each Cloud Function. These metrics record the execution time, the memory utilization, the instance count, and the number of invocations per section. The remainder of this section describes how to view these metrics.
Console
To view Cloud Function metrics, do the following:
- In the pane with the name of your synthetic monitor, click the Cloud Function name.
- On the Function details page, select the Metrics tab.
To zoom into a specific time range, do the following:
- On a chart, place your pointer at one end of the time range and then left click your pointer.
- Drag your pointer horizontally to the other end of the time range, and then release the pointer button.
To explore the displayed data in a chart in more detail, on the chart toolbar, select more_vert More chart options, and then make a selection. The options include the following:
- Download the chart as a PNG or CSV
- Save the chart to a custom dashboard
- Open Metrics Explorer
- Expand or collapse the chart legend
- Reset the zoom
API
For information about how to read Cloud Function metrics programmatically, see Viewing monitored metrics.
View Cloud Function logs
Logs provide you with information about the actions your
Cloud Function is performing.
For example, logs that contain a field named userAgent
with a value of
GoogleStackdriverMonitoring-UptimeChecks
, indicate that your service
received a request from the uptime check service.
Console
To view Cloud Function logs, do the following:
- In the pane with the name of your synthetic monitor, click the Cloud Function name.
- On the Function details page, select the Logs tab.
To explore the log data in a chart in more detail, expand a log entry and then select Open in Logs Explorer. From the Logs Explorer, you can perform actions such as refining the query, creating a log-based metric, or create a log-based alert.
API
For information about how to read and write Cloud Function logs programmatically, see Writing, Viewing, and Responding to Logs.