Airflow Exporter

2.0.0 · active · verified Wed Apr 15

Airflow Exporter is an Apache Airflow plugin designed to expose DAG and task-based metrics to a Prometheus-compatible endpoint. The current version, 2.0.0, is built for Airflow 3.0+ and Python 3.9+. It is actively maintained with ongoing development and regular releases.

Warnings

Install

Quickstart

The quickstart involves installing the `airflow-exporter` package into your Airflow environment. Once installed and Airflow components (webserver, scheduler) are restarted, the exporter automatically exposes a Prometheus-compatible metrics endpoint. No direct Python code is needed in your DAGs for the basic functionality.

# Assuming Apache Airflow is already installed and running in your environment.
# The airflow-exporter functions as an Airflow plugin and does not require
# explicit Python imports within your DAG files for its core functionality.
# Simply installing the package into your Airflow environment is sufficient.

# 1. Install the airflow-exporter package:
# pip install airflow-exporter

# 2. Restart your Airflow scheduler and webserver components
#    (or redeploy if in a containerized environment) to ensure the plugin loads.

# 3. Access the Prometheus metrics endpoint exposed by Airflow Exporter:
#    Metrics will be available at http://<your_airflow_host_and_port>/admin/metrics/

# Example of how you might check the endpoint (requires curl to be available):
# import os
# airflow_host = os.environ.get('AIRFLOW_WEBSERVER_HOST', 'localhost')
# airflow_port = os.environ.get('AIRFLOW_WEBSERVER_PORT', '8080')
# metrics_url = f"http://{airflow_host}:{airflow_port}/admin/metrics/"
# print(f"Access metrics at: {metrics_url}")
# # You would typically use a tool like curl or Prometheus to scrape this endpoint.
# # Example using Python requests (if installed):
# # import requests
# # try:
# #     response = requests.get(metrics_url)
# #     response.raise_for_status()
# #     print("Successfully fetched metrics (first 500 chars):")
# #     print(response.text[:500])
# # except requests.exceptions.RequestException as e:
# #     print(f"Failed to fetch metrics: {e}")

view raw JSON →