[dogstatsd] use monotonic clock source when available for timers#615
Merged
zippolyte merged 1 commit intoDataDog:masterfrom Jan 8, 2021
Merged
[dogstatsd] use monotonic clock source when available for timers#615zippolyte merged 1 commit intoDataDog:masterfrom
zippolyte merged 1 commit intoDataDog:masterfrom
Conversation
Kyle-Verhoog
previously approved these changes
Nov 12, 2020
Contributor
Author
|
@DataDog/integrations-tools-and-libraries can I get a review on this? |
zippolyte
requested changes
Jan 6, 2021
datadog/threadstats/base.py
Outdated
| from functools import wraps | ||
| from time import time | ||
| try: | ||
| from time import monotonic as time # type: ignore[attr-defined] |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
I totally missed that. Will update.
Contributor
Author
|
Not sure the failure are related to the PR? |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Contributor
|
The python3 no indeed, as they fail on master too for some reason, but the py2 failure seems related as master works ok |
zippolyte
reviewed
Jan 8, 2021
datadog/threadstats/base.py
Outdated
| finally: | ||
| end = time() | ||
| end = monotonic() | ||
| self.timing(metric_name, end - start, end, tags=tags, |
Contributor
There was a problem hiding this comment.
ooh the end time is used here too as timestamp
This makes sure the computed time is correct by using a monotonic clock source.
Contributor
|
/azp run DataDog.datadogpy.integration |
|
Azure Pipelines successfully started running 1 pipeline(s). |
zippolyte
approved these changes
Jan 8, 2021
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.
This makes sure the computed time is correct by using a monotonic clock source.