Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,29 @@ jobs:
python-version: '3.8'

- name: Setup database
run: docker-compose -f tests/docker-compose.yml up -d
run: docker compose -f tests/docker-compose.yml up -d

- name: Install Airflow
run: pip install "apache-airflow == ${{ matrix.airflow-version }}" mysqlclient==1.4.6 wtforms==2.3.3
run: pip install "apache-airflow == ${{ matrix.airflow-version }}" mysqlclient==1.4.6

- name: Install airflow-exporter for 2.6.1
if: matrix.airflow-version == '2.6.1'
run: pip install '.[airflow-2.6.1]'

- name: Install airflow-exporter
if: matrix.airflow-version != '2.6.1'
run: pip install .

- name: Init Airflow DB
run: |
airflow db init
airflow db init

- name: Prepare DAG statuses
run: |
airflow dags list

airflow dags reserialize

airflow dags unpause dummy_dag
airflow dags unpause slow_dag

Expand Down
4 changes: 2 additions & 2 deletions airflow_exporter/prometheus_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from airflow.utils.state import State

# Importing base classes that we need to derive
from prometheus_client import generate_latest, REGISTRY
from prometheus_client import generate_latest, REGISTRY, CONTENT_TYPE_LATEST
from prometheus_client.core import GaugeMetricFamily, Metric
from prometheus_client.samples import Sample

Expand Down Expand Up @@ -467,7 +467,7 @@ class RBACMetrics(FABBaseView):

@FABexpose('/')
def list(self):
return Response(generate_latest(), mimetype='text')
return Response(generate_latest(), mimetype=CONTENT_TYPE_LATEST)


# Metrics View for Flask app builder used in airflow with rbac enabled
Expand Down
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,20 @@
"apache-airflow>=2.6.1",
"prometheus_client>=0.4.2",
],
extras_require={
# NOTE: airflow==2.6.1 has no upper bound on several dependencies. A
# new installation brings newer versions which contain breaking
# changes, requiring us to explicitly pin these dependencies to
# compatible versions.
"airflow-2.6.1": [
"apache-airflow==2.6.1",
"pydantic<2.0.0",
"pendulum<3.0.0",
"Flask-Session<0.6.0",
"connexion<3.0",
],
},
entry_points={
"airflow.plugins": [
"AirflowPrometheus = airflow_exporter.prometheus_exporter:AirflowPrometheusPlugins"
]
"airflow.plugins": ["AirflowPrometheus = airflow_exporter.prometheus_exporter:AirflowPrometheusPlugins"]
},
)