-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dogstatsd] use monotonic clock source when available for timers #615
Conversation
@DataDog/integrations-tools-and-libraries can I get a review on this? |
datadog/threadstats/base.py
Outdated
@@ -13,7 +13,10 @@ | |||
# stdlib | |||
from contextlib import contextmanager | |||
from functools import wraps | |||
from time import time | |||
try: | |||
from time import monotonic as time # type: ignore[attr-defined] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's kinda problematic here, since the time is used in several places to compute the actual timestamp of a metric, and not in a difference of end - start
You'd need to separate the usages here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally missed that. Will update.
Not sure the failure are related to the PR? |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
The python3 no indeed, as they fail on master too for some reason, but the py2 failure seems related as master works ok |
datadog/threadstats/base.py
Outdated
try: | ||
yield | ||
finally: | ||
end = time() | ||
end = monotonic() | ||
self.timing(metric_name, end - start, end, tags=tags, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh the end time is used here too as timestamp
This makes sure the computed time is correct by using a monotonic clock source.
/azp run DataDog.datadogpy.integration |
Azure Pipelines successfully started running 1 pipeline(s). |
This makes sure the computed time is correct by using a monotonic clock source.