Explore synthetic monitor results

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:

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:

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Synthetic monitoring:

    Go to Synthetic monitoring

  2. 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 logs and traces for an execution

To view the logs, traces, and summary information for an execution, on the Synthetic monitor details page, click the link to the execution. From this page, you can do the following:

  • View log data.
  • View trace data.
  • View the current code.

  • Access the Cloud Function.

  • For Mocha test, view 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.

View log data

Logs are automatically collected by Cloud Monitoring. These logs contain information about the test and failure details. The available logs depend on your Cloud Function. For example, if you use Mocha, then the logs include information about whether the test passed or failed, test duration, and, in the case of failure, a full stack trace. The stack trace includes the line of code that failed, error types, and error messages.

To view details of your related logs, in the Execution logs pane, expand a log entry.

The log entry is displayed in JSON format. If you prefer to view the logs with the Logs Explorer, then click Open in Logs Explorer. The Logs Explorer is opened and a query is preconfigured.

View trace data

Trace data is automatically collected when your Cloud Function executes. The following screenshot shows the kind of data that trace captures when you use the generic template:

Cloud Trace displaying details of a trace for a Cloud Function.

In the previous screenshot, the first row of the gantt chart displays the HTTP request initiated by Cloud Monitoring. The trace data displays the text that was passed to the winston logger, and it displays the outbound HTTP request that was issued by the axios get call.

On the trace flyout, if you click View in trace, then you can view your trace data by using the Cloud Trace explorer. Your trace is already expanded to show details. When your trace or span displays a circle, you can click the circle to display the log entry. The Cloud Function can be identified by viewing the resource.labels.service_name field.

Console

To view your trace data, do one the following:

  • To view summary information for a trace, in the toolbar of the details page for an execution, click View trace details.

    A flyout opens that displays a summary of the latency data. For complete information about the trace and its spans, view the data in Cloud Trace. To open Cloud Trace, click View in trace.

  • View your traces in Cloud Trace:

    1. In the navigation panel of the Google Cloud console, select Trace, and then select Trace explorer:

      Go to Trace explorer

    2. In the scatter plot or in the table, select a trace.
    3. For each log or event associated with a span, the span is annotated with a circle. To get details about the event or log, select the circle.

For more information about exploring your trace data, see Find and explore traces.

API

We recommend that you use the Google Cloud console to view trace data. However, if you want to use the Cloud Trace API, use the traces.list method to list the available traces, and then use the traces.get method to get the details of a trace.

View logs and metrics for a Cloud Function

Logs and metrics 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.

The remainder of this section describes how to view the logs and metrics collected by Cloud Functions.

View function logs

Console

To view Cloud Function logs, do the following:

  1. In the pane with the name of your synthetic monitor, click the Cloud Function name.
  2. 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.

View function metrics

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:

  1. In the pane with the name of your synthetic monitor, click the Cloud Function name.
  2. On the Function details page, select the Metrics tab.

To zoom into a specific time range, do the following:

  1. On a chart, place your pointer at one end of the time range and then left-click your pointer.
  2. 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 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.