Skip to content
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

Use higher precision clock measurements for Python 3 #6849

Merged
merged 2 commits into from
Jun 16, 2020

Conversation

mgarabed
Copy link
Member

@mgarabed mgarabed commented Jun 8, 2020

What does this PR do?

Use the higher precision clock available in Python 3, time.perf_counter. This pattern has been previously adopted as part of #6478 and #6682.

Additionally, test this check under Windows CI as well.

@mgarabed mgarabed changed the title Use higher performance clock measurements for Python 3 Use higher precision clock measurements for Python 3 Jun 8, 2020
os: linux
- checkName: tcp_check
displayName: TCP (Windows)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this due to a specific issue on windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a similar reason we added Windows testing to the dns_check, time gets handled slightly differently on the two platforms.

from datadog_checks.base import AgentCheck, ConfigurationError
from datadog_checks.base.utils.platform import Platform

if PY3:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this to some place in the base package (we'd still need to put it here at least for one release)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be beneficial, but it wouldn't be universal - time.time is used pretty broadly across the integration checks, but sometimes for actual timestamps vs just performance monitoring.

I can tackle it in a separate PR, though.

@mgarabed mgarabed merged commit 0349e99 into master Jun 16, 2020
@mgarabed mgarabed deleted the mgarabed/tcp_check_timefunc branch June 16, 2020 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants