kaxil commented on a change in pull request #20470:
URL: https://github.com/apache/airflow/pull/20470#discussion_r777029795
##########
File path: airflow/stats.py
##########
@@ -65,7 +65,7 @@ def gauge(cls, stat: str, value: float, rate: int = 1, delta:
bool = False) -> N
"""Gauge stat"""
@classmethod
- def timing(cls, stat: str, dt: Union[float, datetime.timedelta]) -> None:
+ def timing(cls, stat: str, dt: Optional[Union[float, datetime.timedelta]])
-> None:
Review comment:
In that case the following should be ok:
```diff
diff --git a/airflow/dag_processing/manager.py
b/airflow/dag_processing/manager.py
index 408bb48aa..25c6ec70f 100644
--- a/airflow/dag_processing/manager.py
+++ b/airflow/dag_processing/manager.py
@@ -920,7 +920,7 @@ class DagFileProcessorManager(LoggingMixin):
self._file_stats[processor.file_path] = stat
file_name =
os.path.splitext(os.path.basename(processor.file_path))[0].replace(os.sep, '.')
- Stats.timing(f'dag_processing.last_duration.{file_name}',
stat.last_duration)
+ Stats.timing(f'dag_processing.last_duration.{file_name}',
cast(float, stat.last_duration))
def collect_results(self) -> None:
"""Collect the result from any finished DAG processors"""
```
`Stats.timing` should never receive `None` as value -
https://github.com/jsocol/pystatsd/blob/f3f304b4b2c3d5eddeb9f4977d9c82c64c37a052/statsd/client/base.py#L26-L30
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]