Skip to content

Commit 2aee57f

Browse files
authored
Merge pull request #94 from lxxstc/mysqlconnector_compatible
code adding for mysqlconnector compatible
2 parents 0df2794 + daf8bda commit 2aee57f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## 1.5.1
5+
6+
- Add compatibility with `mysqlconnector` DB connection [#94](https://github.com/epoch8/airflow-exporter/pull/94) by @lxxstc
7+
48
## 1.5.0
59

610
- Add `airflow_dag_last_status` [#96](https://github.com/epoch8/airflow-exporter/pull/96) by @nvn01234
@@ -15,7 +19,7 @@ All notable changes to this project will be documented in this file.
1519

1620
## 1.3.2
1721

18-
- Remove 'hostname' from airflow_task_status by @cansjt see https://github.com/epoch8/airflow-exporter/issues/77 for details
22+
- Remove 'hostname' from airflow_task_status by @cansjt see [#77](https://github.com/epoch8/airflow-exporter/issues/77) for details
1923

2024
## 1.3.0
2125

airflow_exporter/prometheus_exporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def get_dag_duration_info() -> List[DagDurationInfo]:
139139
durations = {
140140
'pysqlite': func.julianday(func.current_timestamp() - func.julianday(DagRun.start_date)) * 86400.0,
141141
'mysqldb': func.timestampdiff(text('second'), DagRun.start_date, func.now()),
142+
'mysqlconnector': func.timestampdiff(text('second'), DagRun.start_date, func.now()),
142143
'pyodbc': func.sum(func.datediff(text('second'), DagRun.start_date, func.now())),
143144
'default': func.now() - DagRun.start_date
144145
}
@@ -156,7 +157,7 @@ def get_dag_duration_info() -> List[DagDurationInfo]:
156157
res = []
157158

158159
for i in sql_res:
159-
if driver == 'mysqldb' or driver == 'pysqlite':
160+
if driver in ('mysqldb', 'mysqlconnector', 'pysqlite'):
160161
dag_duration = i.duration
161162
else:
162163
dag_duration = i.duration.seconds

0 commit comments

Comments
 (0)