newrelic-airflow-plugin icon indicating copy to clipboard operation
newrelic-airflow-plugin copied to clipboard

Timing metrics only report the microseconds part of the measurement

Open allait opened this issue 3 years ago • 0 comments

When NewRelicStatsLogger.timing is called with a timedelta as an argument it sends timedelta.microseconds to New Relic.

This attribute doesn't convert the full value to microseconds, it only contains the microseconds part of the difference:

>>> timedelta(minutes=10, seconds=10, microseconds=500).microseconds
500

.timing should probably call timedelta.total_seconds() instead:

>>> timedelta(minutes=10, seconds=10, microseconds=500).total_seconds()
610.0005

allait avatar Mar 09 '21 15:03 allait