Skip to content

Commit

Permalink
Merge pull request #94 from lxxstc/mysqlconnector_compatible
Browse files Browse the repository at this point in the history
code adding for mysqlconnector compatible
  • Loading branch information
elephantum authored Jun 18, 2021
2 parents 0df2794 + daf8bda commit 2aee57f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.5.1

- Add compatibility with `mysqlconnector` DB connection [#94](https://github.com/epoch8/airflow-exporter/pull/94) by @lxxstc

## 1.5.0

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

## 1.3.2

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

## 1.3.0

Expand Down
3 changes: 2 additions & 1 deletion airflow_exporter/prometheus_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def get_dag_duration_info() -> List[DagDurationInfo]:
durations = {
'pysqlite': func.julianday(func.current_timestamp() - func.julianday(DagRun.start_date)) * 86400.0,
'mysqldb': func.timestampdiff(text('second'), DagRun.start_date, func.now()),
'mysqlconnector': func.timestampdiff(text('second'), DagRun.start_date, func.now()),
'pyodbc': func.sum(func.datediff(text('second'), DagRun.start_date, func.now())),
'default': func.now() - DagRun.start_date
}
Expand All @@ -156,7 +157,7 @@ def get_dag_duration_info() -> List[DagDurationInfo]:
res = []

for i in sql_res:
if driver == 'mysqldb' or driver == 'pysqlite':
if driver in ('mysqldb', 'mysqlconnector', 'pysqlite'):
dag_duration = i.duration
else:
dag_duration = i.duration.seconds
Expand Down

0 comments on commit 2aee57f

Please sign in to comment.