Back to Skywalking

Airflow monitoring

docs/en/setup/backend/backend-airflow-monitoring.md

11.0.08.3 KB
Original Source

Airflow monitoring

SkyWalking ingests Apache Airflow 3.x metrics from Airflow's native OpenTelemetry exporter via the OpenTelemetry receiver, aggregates them with MAL, and shows them in Horizon UI under Workflow Scheduler → Airflow.

Data flow

  1. Airflow exports metrics via native OpenTelemetry (otel_on / OTEL_EXPORTER_OTLP_*) from scheduler and triggerer.
  2. OpenTelemetry Collector receives OTLP metrics and forwards them to SkyWalking OAP.
  3. OAP aggregates metrics with MAL.
  4. Horizon UI displays them under Workflow Scheduler → Airflow.

Setup

1. Enable Airflow OpenTelemetry metrics

Install the OTel extra and point export at your Collector. See Airflow metrics documentation.

bash
pip install 'apache-airflow[otel]'

export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_RESOURCE_ATTRIBUTES=cluster=prod-airflow

Set AIRFLOW__METRICS__OTEL_ON=True on scheduler and triggerer.

Required OTLP resource attributes:

AttributePurpose
clusterNames the Service (airflow::{cluster})
host.nameIdentifies scheduler or triggerer (UI Components tab)

2. OpenTelemetry Collector

Forward OTLP metrics to OAP. Example pipeline:

yaml
receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318
      grpc:
        endpoint: 0.0.0.0:4317

processors:
  batch:

exporters:
  otlp:
    endpoint: oap:11800
    tls:
      insecure: true

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp]

Full example: cluster/otel-collector-config.yaml. Do not hard-code service or instance names in Collector processors — derive them from Airflow's resource attributes.

3. SkyWalking OAP

Ensure airflow/* is in SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES (enabled by default).

Entity model

SkyWalking entityMapping
Serviceairflow::{cluster} from resource cluster
Instance (OAP) / Components (UI)Scheduler or triggerer from host.name

Components vs SkyWalking Instance vs Airflow Task Instance

OAP stores scheduler/triggerer hosts as Instance; Horizon UI labels the tab Components so operators do not confuse it with an Airflow Task Instance (one task run inside a DAG run).

TermMeaning
SkyWalking ServiceOne Airflow cluster (airflow::{cluster})
Components (UI) / Instance (OAP)Long-running scheduler or triggerer (host.name)
Airflow Task InstanceSingle task execution — not on this dashboard

Service panels aggregate cluster-wide samples. Component panels are scoped per host.name.

On Kubernetes, run a Collector sidecar per monitored pod; Airflow pushes to localhost:4318 and the sidecar forwards to OAP. Set cluster via OTEL_RESOURCE_ATTRIBUTES; host.name comes from the pod hostname.

Supported metrics

MAL rules: otel-rules/airflow/airflow-service.yaml and airflow-instance.yaml. Asset counters use airflow.asset.* (Airflow 3.x only). Data source: Airflow native OpenTelemetry export.

Airflow Service Supported Metrics

Monitoring PanelUnitMetric NameDescription
Tasks Executablecountmeter_airflow_scheduler_tasks_executableTasks ready for execution
Running Taskscountmeter_airflow_executor_running_tasksTasks currently running on executor
Queued Taskscountmeter_airflow_executor_queued_tasksQueued tasks on executor
Scheduled Slotscountmeter_airflow_pool_scheduled_slotsScheduled but not yet running slots in pool
Executor Open Slotscountmeter_airflow_executor_open_slotsOpen executor slots
DAG File Queue Sizecountmeter_airflow_dag_file_queue_sizeDAG files pending scan
DAG Import Errorscountmeter_airflow_dag_import_errorsDAG files that failed to parse
DAG Bag Sizecountmeter_airflow_dagbag_sizeDAGs found in the last scheduler scan
DAG Total Parse Timesecondsmeter_airflow_dag_total_parse_timeTime to scan and import queued DAG files
DAG File Refresh Errorscount/minmeter_airflow_dag_file_refresh_errorDAG file load failures per minute
Asset Updatescount/minmeter_airflow_asset_updatesUpdated assets per minute

Airflow Instance Supported Metrics

Monitoring PanelUnitMetric NameDescription
Pool Open / Deferred / Running Slotscountmeter_airflow_instance_pool_open_slots, meter_airflow_instance_pool_deferred_slots, meter_airflow_instance_pool_running_slotsPool capacity on the scheduler
Running Tasks / Scheduled Slotscountmeter_airflow_instance_executor_running_tasks, meter_airflow_instance_pool_scheduled_slotsExecutor queue depth and pool slots waiting to run
Scheduler Heartbeatcount/minmeter_airflow_instance_scheduler_heartbeatScheduler heartbeats per minute
Executor Open / Queued Slotscountmeter_airflow_instance_executor_open_slots, meter_airflow_instance_executor_queued_tasksExecutor capacity and queue depth on the scheduler
Asset Updatescount/minmeter_airflow_instance_asset_updatesAsset updates on this host
Asset Triggered DagRunscount/minmeter_airflow_instance_asset_triggered_dagrunsDagRuns triggered by assets
Triggerer Heartbeatcount/minmeter_airflow_instance_triggerer_heartbeatTriggerer heartbeats per minute
Triggers Running / Capacity Leftcountmeter_airflow_instance_triggers_running, meter_airflow_instance_triggerer_capacity_leftLive deferrable trigger load on the triggerer
Triggers Blocked / Failed / Succeededcount/minmeter_airflow_instance_triggers_blocked_main_thread, meter_airflow_instance_triggers_failed, meter_airflow_instance_triggers_succeededDeferred trigger outcomes on the triggerer

Panel-to-metric mapping details: SWIP-7.

Verification

Run the e2e suites (same as CI):

SuiteCommandChecks
Mock (full MAL contract)e2e run -c test/e2e-v2/cases/airflow/mock/e2e.yaml29
Cluster (native OTel smoke)e2e run -c test/e2e-v2/cases/airflow/cluster/e2e.yaml16

CI runs both via .github/workflows/skywalking.yaml (Airflow and Airflow Cluster matrix jobs) after make docker.all.

Details: e2e README.

Horizon UI

Open Workflow Scheduler → Airflow after OAP ingests metrics.

When Airflow is linked to K8S_SERVICE via service hierarchy, start from the 3D Infrastructure Map (middleware tier) and drill down into Kubernetes Services:

Service — cluster KPIs and DAG processing trends (11 panels).

Components — per-host scheduler (six widgets) or triggerer (three widgets); the template defines nine widgets and each host shows only metrics present in OAP for that role.

Kubernetes Services — service, instances, endpoints, and topology for the linked K8S_SERVICE:

Customization

Override MAL rules under otel-rules/airflow/ or extend Horizon UI dashboards. Restart OAP after rule changes.