Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications. Cloud Monitoring 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 access to logs and metrics:
- Read-only access to logs, including private logs:
- Read/write access to metrics:
For more information, see Cloud Composer Access Control.
- Read-only access to logs and metrics:
To avoid duplicate logging, Cloud Logging for Google Kubernetes Engine is disabled.
Cloud Logging produces an entry for each status and event that occurs in your Google Cloud project. You can use exclusion filters to reduce the volume of logs, including the logs that Cloud Logging produces for Cloud Composer. Note that excluding logs from
jobs.pycan cause health check failures and
CrashLoopBackOfferrors. You must include
-jobs.pyin exclusion filters to prevent it from being excluded.
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|
Cloud Monitoring 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 Cloud Monitoring documentation also includes the following information about Cloud Composer metrics and resources:
- For the list of usage metrics that Cloud Composer reports to Cloud Monitoring, see Metrics List.
- For details on the
cloud_composer_environmentresource type, see Monitored Resource Types in the Cloud Monitoring 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 Console, select Monitoring, or use the following button:
Select Dashboards > 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 alerting policies to monitor the values of metrics and to notify you when those metrics violate a condition. The general steps for creating an alerting policy that monitors the Cloud Composer Environment or Cloud Composer Workflow resource(s) are listed below:
- In the Google Cloud Console, go to Monitoring or use the following button:
Go to Monitoring
- In the Monitoring navigation pane, select notificationsAlerting and then select Create Policy.
- Enter a name for the alerting policy.
- Click Add Condition:
- The settings in the Target pane specify the resource and metric to be monitored. Click the text box to enable a menu and then select the resouce Cloud Composer Environment or Cloud Composer Workflow. Next, select a metric from the metrics list.
- The settings in the Configuration pane of the alerting policy determine when the alert is triggered. Most fields in this pane is populated with default values. For more information on the fields in the pane, see Configuration in the alerting policy documentation.
- Click Add.
- (Optional) Click Add Notification Channel and enter your notification channel information.
- (Optional) Click Documentation and add any information that you want included in a notification message.
- Click Save.
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.