Prerequisites
- An Astro Deployment running the Astro Executor on:
- Hosted execution mode with Astro Runtime 3.1+, or
- Remote Execution mode on Astro Runtime 3.1+, using a Remote Execution Agent 1.5.0+ and Helm chart 2.0.0+. See Helm chart versioning for the Agent-to-chart compatibility matrix.
What you’ll see
Task-level utilization metrics appear in three places in the Airflow UI:- A Resource Metrics tab on Dag, Dag run, task, and task instance pages.
- The Task Resource Metrics page, which ranks tasks across all worker queues in the Deployment.
- A card on the Airflow UI home page that lists the tasks with the highest typical p99 memory in the last 24 hours.
Resource Metrics tab
A Resource Metrics tab appears in the Airflow UI with four views:- Dag: CPU and memory usage for each task in a Dag, summarized across its recent task instances.
- Dag Run: CPU and memory usage for each task instance in a single Dag run, compared with that task’s typical usage.
- Task: CPU and memory usage for a specific task across its recent runs.
- Task Instance: CPU and memory usage for a single task run, mapped to the worker that ran it.
- Which tasks are consuming the most CPU or memory?
- Which tasks are likely causing out-of-memory (OOM) errors?
- Which Dags are driving infrastructure cost?
- Which tasks are good candidates for right-sizing or optimization?
Task Resource Metrics page
The Task Resource Metrics page lists every task that ran in the Deployment during a selected period, with its CPU and memory usage. To open it, go to Browse > Task Resource Metrics in the Airflow UI. Use the page to:- Find the tasks that use the most CPU or memory in the Deployment, and check whether that usage is expected.
- Find tasks with similar CPU and memory profiles, and assign them to a worker queue with an appropriate worker size.
Because typical p99 values are a median across attempts, a single unusual attempt doesn’t set the value. To see the worst attempt, use the peak columns.
To change what the page shows:
- Period: Select 24 hours, 3 days, or 7 days. The default is 24 hours. Changing the period clears the queue filter.
- Queues: Select one or more worker queues to show only tasks that ran on those queues.
- Sort: By default, the page ranks tasks by typical p99 memory usage, highest first, and shows 50 tasks per page. Click a memory or CPU column header to rank all tasks by that metric, highest first. Clicking any other column header sorts only the tasks on the current page.
Home page card
The Airflow UI home page shows a card titled Top tasks by typical p99 memory, last 24 hours. The card lists up to five tasks with the highest typical p99 memory usage in the Deployment. Click a task to open its Resource Metrics tab, or click See all to open the Task Resource Metrics page. The card appears only when at least one task reported metrics in the last 24 hours.How Astro collects task-level metrics
Astro samples task-level metrics on their own interval, separate from the interval used for Deployment-wide worker metrics. For long-running tasks, samples can lag up to five seconds behind the task. This sampling shapes what each metric represents:- CPU values account for all work the task performs, but averaging across the sampling interval smooths very short-lived peaks.
- Memory values reflect usage at each sample, so a spike shorter than the sampling interval on an otherwise idle task doesn’t appear.