TimotheBarbe commented on code in PR #74848:
URL: https://github.com/apache/airflow/pull/74848#discussion_r4311269261
##########
shared/observability/tests/observability/metrics/test_stats.py:
##########
@@ -253,19 +253,20 @@ def
test_does_send_stats_using_dogstatsd_when_statsd_and_dogstatsd_both_on(self)
metric="empty_key", sample_rate=1, tags=[], value=1
)
- @mock.patch.object(time, "perf_counter", side_effect=[0.0, 100.0])
- def test_timer(self, time_mock):
+ @mock.patch.object(time, "perf_counter", side_effect=[0.0, 0.0004])
+ def test_timer_sends_duration_in_milliseconds(self, time_mock):
with self.dogstatsd.timer("empty_timer") as timer:
pass
- self.dogstatsd_client.timed.assert_called_once_with("empty_timer",
tags=[])
- expected_duration = 1000.0 * 100.0
- assert expected_duration == timer.duration
- assert time_mock.call_count == 2
+ assert timer.duration == pytest.approx(0.4)
+ self.dogstatsd_client.timing.assert_called_once_with(
+ metric="empty_timer", value=timer.duration, tags=[]
+ )
Review Comment:
agreed, updated
--
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]