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

Support for python 3.6 #13

Closed
Xisabla opened this issue May 5, 2022 · 1 comment · Fixed by #14
Closed

Support for python 3.6 #13

Xisabla opened this issue May 5, 2022 · 1 comment · Fixed by #14

Comments

@Xisabla
Copy link
Contributor

Xisabla commented May 5, 2022

I have been experiencing the following warning with ansible-trace using python3.6:

[WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible_collections.mhansen.ansible_trace.plugins.callback.trace.CallbackModule object at 0x7fcddc736358>):
module 'time' has no attribute 'time_ns'

It causes not having trace at all, such as:

[
{
  "args": {
    "name": "localhost"
  },
  "cat": "process",
  "name": "process_name",
  "ph": "M",
  "pid": 1
}
]

This issue is caused by the fact that python have implemented time.time_ns() since 3.7 only.

For python 3.6 we could be using time.time() * 1000000 instead of time.time_ns() / 1000 when time_ns is not present in time package, such as:

"ts": time.time_ns() / 1000 if "time_ns" in time.__dict__ else time.time() * 100000,

for the follwing lines:

The precision level seems to be good enough to don't impact the behavior of ansible-trace:

image

@mhansen
Copy link
Owner

mhansen commented May 5, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants