Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications. Stackdriver collects and ingests metrics, events, and metadata from Cloud Composer to generate insights via dashboards and charts. You can use Monitoring to understand the performance and health of your Cloud Composer environments and Airflow metrics.
Logging captures the logs that the scheduler and worker containers produce. The logs contain useful system-level and Airflow dependency information to help with debugging. For information about viewing logs, see Viewing Airflow logs.
Before you begin
The following permissions are required to access the logs and metrics for your Cloud Composer environment:
- Read-only logging and monitoring:
- Read-only logging including private logs:
For more information, see Cloud Composer Access Control.
- Read-only logging and monitoring:
To avoid duplicate logging, Stackdriver Logging for Google Kubernetes Engine is disabled.
Stackdriver Logging produces an entry for each status and event that occurs in your Google Cloud Platform project. You can use exclusion filters to reduce the volume of logs, including the logs that Stackdriver produces for Cloud Composer.
Monitoring cannot plot the count values for workflows and tasks that execute more than once per minute, and currently, does not plot metrics for failed tasks.
Metrics and resource types
You can examine Airflow metrics in Monitoring for workflows (DAGs) and the Celery Executor.
To check the health of your environment, you can use the following health status metric: composer.googleapis.com/environment/healthy
Cloud Composer runs a liveness DAG named
airflow_monitoring every 5
minutes and reports environment health as follows:
- When the DAG run finishes successfully, the health status is
- If the DAG run fails, the health status is
- If the DAG run does not finish, Cloud Composer polls the DAG's
state every 5 minutes and reports
Falseif the one-hour timeout occurs.
The liveness DAG is stored in the
dags/ folder and visible in
the Airflow web UI. The frequency and contents of the liveness DAG are immutable
and should not be modified, as changes will not persist.
To check the health of your database, you can use the following health status metric: composer.googleapis.com/environment/database_health
The Cloud Composer Airflow monitoring pod pings the database every minute
and reports health status as
True if a SQL connection can be established or
To help you monitor the efficiency of your workflow runs and identify straggler tasks that cause long latency, the following workflow metrics are available:
|Number of workflow runs||composer.googleapis.com/workflow/run_count|
|Duration of each workflow run||composer.googleapis.com/workflow/run_duration|
|Number of task runs||composer.googleapis.com/workflow/task/run_count|
|Duration of each task||composer.googleapis.com/workflow/task/run_duration|
Stackdriver shows only the metrics for completed workflow and task runs (success or failure). No Data displays when there is no workflow activity and for in-progress workflow and task runs.
The following Celery Executor metrics are available. These metrics can help you determine if there are sufficient worker resources in your environment.
|Celery Executor Metric||API|
|Number of tasks in the queue||composer.googleapis.com/environment/task_queue_length|
|Number of online Celery workers||composer.googleapis.com/environment/num_celery_workers|
The Stackdriver documentation also includes the following information about Cloud Composer metrics and resources:
- For the list of usage metrics that Cloud Composer reports to Stackdriver, see Metrics List.
- For details on the
cloud_composer_environmentresource type, see Monitored Resource Types in the Stackdriver documentation.
Using Monitoring on Cloud Composer environments
- After creating a Cloud Composer environment, go to the Monitoring console to view environment monitoring data.
- When you first access Monitoring, you are asked to create a Workspace and select a project.
- Select Resources > Metrics Explorer and choose Cloud Composer:
- Click in the Find resource type and metric input box to display the resource drop-down list.
- Select the Cloud Composer Environment or Cloud Composer Workflow resource. Alternatively, enter cloud_composer_environment or cloud_composer_workflow in the box.
- Click again in the input box and then select a metric from the drop-down list. Hovering over the metric name displays information about the metric.
- Cloud Composer environment information is contained
in the workflow_name label: workflow_name=
environment.workflow. To view workflow metrics for a specific environment, add a filter:
- Create a filter for
- Filter the prefix by using the regular expression
=~ "your-environment-name.*"with the name of the environment you want to view workflow metrics for. For information about using regular expression in filtering labels, see Filtering.
- Create a filter for
- Click Save Chart.
You can also group by metric labels, perform aggregations, and select chart viewing options. See the Monitoring documentation.
After setting up the Workspace, the Monitoring console appears.
You can use the Monitoring
API to capture and list metrics defined by a
Use the Try this API template on the API page to send
an API request and display the response.
Building a custom Monitoring dashboard
You can build a custom Monitoring dashboard that display charts of selected metrics for your Cloud Composer environment.
In the Google Cloud Platform Console, go to Monitoring. In the Dashboards menu, select Create Dashboard:
In the Untitled Dashboard, click Add Chart and create the chart:
- In the Add Chart window, select Cloud Composer Environment as the resource type.
- Select one or more metrics and chart properties.
- Confirm or type a new chart title and click Save.
- Add additional charts to your dashboard, as needed, and Save.
The following example shows the metric
Task Duration. This metric plots the duration of active tasks in your workflows, which is useful for fine-tuning performance.
To view the dashboard, click the title in the Monitoring Dashboards menu.
From the dashboard display page, you can view, update, and delete charts.
Using Monitoring alerts
You can create a Monitoring alert that notifies you when a Cloud Composer metric crosses a specified threshold.
Creating an alert
To create an alert:
In the Google Cloud Platform Console, go to Monitoring. In the Alerting menu, select Create a Policy:
In Conditions, click Add Condition.
On the Create condition page:
- Add a name for the condition.
- In the tab header, scroll to Metric.
- Under Target, choose Cloud Composer Environment or Cloud Composer Workflow as the Resource type.
- Select a metric for the selected Resource type.
After setting the alert condition, complete the alert policy by setting notification channels, documentation, and the name for the new alert policy from the Create a new alerting policy page.
When an alert is triggered by a metric threshold condition, Monitoring creates an incident (and a corresponding event).
You can review incidents from the Monitoring Alerting > Incidents page.
If you defined a notification mechanism in the alert policy, such as an email or SMS notification, Monitoring also sends a notification of the incident.