newrelic / newrelic-airflow-plugin

Send airflow metrics to New Relic!
Apache License 2.0
25 stars 19 forks source link

Timing metrics only report the microseconds part of the measurement #21

Open allait opened 3 years ago

allait commented 3 years ago

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