fix(metrics): report DogStatsD timer durations in milliseconds - #72112
Open
waterWang wants to merge 1 commit into
Open
fix(metrics): report DogStatsD timer durations in milliseconds#72112waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
datadog's ``timed()`` context manager defaults to ``use_ms=False``, which reports the elapsed time in seconds even though the metric is sent with the ``|ms`` type. Airflow's ``Timer`` measures in milliseconds, so with ``statsd_datadog_enabled`` every ``Stats.timer()`` metric was under-reported by 1000x while ``Stats.timing()`` metrics were unaffected. Pass ``use_ms=True`` to keep the units consistent. Fixes apache#72110
Contributor
|
Also, the issue author mentioned they were already planning to submit a PR for this. It might not be ideal to open a PR over them, so you might want to keep that in mind when picking up issues in the future. Please check my comment in your previously PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #72110
Problem
With
[metrics] statsd_datadog_enabled = True, every metric emitted viaStats.timer()is under-reported by 1000x.Stats.timing()metrics are unaffected, so units become inconsistent on the same backend.datadog'stimed()context manager defaults touse_ms=False, so it reports the elapsed time in seconds even though the metric is sent with the|mstype. Airflow'sTimermeasures in milliseconds (1000.0 * (time.perf_counter() - start)).Fix
Pass
use_ms=Truetodogstatsd.timed()inSafeDogStatsdLogger.timer()so elapsed times are reported in milliseconds, consistent withStats.timing()and Airflow's ownTimer.duration.Tests
Updated the existing
TestDogStats.test_timerassertion to expectuse_ms=True.