Monitor workflows

Google Cloud Observability provides monitoring, logging, and diagnostic tools. These tools can help you monitor and analyze workflow deployments and executions, and understand the behavior, health, and performance of your applications.

By default, Workflows is configured to do the following:

  • Send data and system audit logs to Cloud Logging. You can use the collected logs to debug, troubleshoot, and gain insights about your applications.
  • Send system and resource metrics to Cloud Monitoring. You can use the collected metrics to monitor health and performance, identify trends and issues, and notify for changes in behavior.

Send audit logs to Cloud Logging

Workflows sends the following types of audit log data to Cloud Logging:

Data Access audit logs are disabled by default because these audit logs can be quite large. For more information, see Enable Data Access audit logs.

For more information about audit logs in Workflows, see the following:

You can also send execution logs to Cloud Logging.

Send metrics to Cloud Monitoring

Workflows sends metric data from monitored resources to Google Cloud Observability. A monitored resource in Monitoring represents a logical or physical entity, such as a virtual machine, a database, or an application. Monitored resources contain a unique set of metrics that can be explored, reported through a dashboard, or used to create alerts. Each resource also has a set of resource labels, which are key-value pairs that hold additional information about the resource. Resource labels are available for all metrics associated with the resource.

To view all resource types, see Monitored resource types. To view all metric types, see Google Cloud metrics. Expand the following to see a list of the metric types sent from Workflows to Google Cloud Observability:

Workflows metric types

Read metric data

You can read metric data, also called time-series data, by using the timeSeries.list method in the Cloud Monitoring API. There are several ways to call the method, including using a language-specific client library, or by creating a chart with Metrics Explorer.You can also try out the timeSeries.list method using the forms-based APIs Explorer. For an introduction to metrics and time series, see Metrics, time series, and resources. To learn how to read your metric data, see Retrieve time-series data.

Monitor quota metrics

The following example demonstrates how to use the APIs Explorer to query the total consumed allocation quota for Workflows. Specifically, it uses the serviceruntime.googleapis.com/quota/allocation/usage metric on the Consumer Quota resource type. You can set additional label filters (service, quota_metric) to specify the quota type. For more information about how to monitor quota metrics, including further examples and how to create alerting policies, see Chart and monitor quota metrics.

  1. Open the timeSeries.list reference page.

  2. If the Try this method pane isn't visible, click Try it!

  3. In the name field, enter your Google Cloud project ID using the following format:

    projects/PROJECT_ID
    
  4. In the filter field, specify a single metric type and, optionally, metric labels and other information. For example:

    metric.type = "serviceruntime.googleapis.com/quota/allocation/usage" AND resource.labels.service = "workflowexecutions.googleapis.com"
    
  5. In the interval.endTime field, enter an end time to limit how much data is returned, and that's applicable to your usage. It should be formatted as an RFC 3339 string; for example, 2024-11-07T03:01:02Z.

  6. In the interval.startTime field, enter a start time to limit how much data is returned, and that's applicable to your usage. It should be formatted as an RFC 3339 string; for example, 2024-11-07T03:01:00Z.

  7. Click Execute.

    The result should be similar to the following with 350 indicating the concurrent executions quota metric.

    {
    "timeSeries": [
       {
          "metric": {
          "labels": {
             "quota_metric": "workflowexecutions.googleapis.com/concurrency"
          },
          "type": "serviceruntime.googleapis.com/quota/allocation/usage"
          },
          "resource": {
          "type": "consumer_quota",
          "labels": {
             "service": "workflowexecutions.googleapis.com",
             "project_id": "PROJECT_ID",
             "location": "europe-west1"
          }
          },
          "metricKind": "GAUGE",
          "valueType": "INT64",
          "points": [
          {
             "interval": {
                "startTime": "2024-11-07T03:01:02Z",
                "endTime": "2024-11-07T03:01:02Z"
             },
             "value": {
                "int64Value": "350"
             }
          }
          ]
       }
    
  8. In the collapsed APIs Explorer side panel, you can click Full screen to expand the APIs Explorer. The full-screen panel displays an extra pane containing code samples, application/json responses, and Raw HTTP responses. For example, in this case, you can view the comparable curl command:

    curl \
    'https://monitoring.googleapis.com/v3/projects/PROJECT_ID/timeSeries?filter=metric.type%20%3D%20%22serviceruntime.googleapis.com%2Fquota%2Fallocation%2Fusage%22%20AND%20resource.labels.service%20%3D%20%22workflowexecutions.googleapis.com%22&interval.endTime=2024-11-07T03%3A01%3A02Z&interval.startTime=2024-11-07T03%3A01%3A00Z&key=YOUR_API_KEY' \
       --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
       --header 'Accept: application/json' \
       --compressed
    

Use Monitoring dashboards and alerts

You can use Monitoring dashboards and their associated charts to visualize the data for Workflows metrics.

To monitor these metrics in Monitoring, you can create custom dashboards. You can also add alerts based on these metrics.

What's next