Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed 2.2 compatibility #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 10 additions & 3 deletions airflow_prometheus_exporter/prometheus_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from airflow.configuration import conf
from airflow.models import DagModel, DagRun, TaskInstance, TaskFail, XCom
from airflow.plugins_manager import AirflowPlugin
from airflow.settings import RBAC, Session
from airflow.settings import Session
from airflow.utils.state import State
from airflow.utils.log.logging_mixin import LoggingMixin
from flask import Response
Expand All @@ -18,6 +18,7 @@
from airflow_prometheus_exporter.xcom_config import load_xcom_config

CANARY_DAG = "canary_dag"
RBAC = "True"


@contextmanager
Expand Down Expand Up @@ -260,7 +261,10 @@ def get_task_duration_info():
TaskInstance.task_id,
TaskInstance.start_date,
TaskInstance.end_date,
TaskInstance.execution_date,
DagRun.execution_date,
)
.join(
DagRun, TaskInstance.run_id == DagRun.run_id
)
.join(
max_execution_dt_query,
Expand Down Expand Up @@ -318,7 +322,7 @@ def get_task_scheduler_delay():
return (
session.query(
task_status_query.c.queue,
TaskInstance.execution_date,
DagRun.execution_date,
TaskInstance.queued_dttm,
task_status_query.c.max_start.label("start_date"),
)
Expand All @@ -329,6 +333,9 @@ def get_task_scheduler_delay():
TaskInstance.start_date == task_status_query.c.max_start,
),
)
.join(
DagRun, TaskInstance.run_id == DagRun.run_id
)
.filter(
TaskInstance.dag_id
== CANARY_DAG, # Redundant, for performance.
Expand Down