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

Add plugin timing information in debug mode #1056

Merged
merged 2 commits into from
Sep 19, 2017
Merged

Add plugin timing information in debug mode #1056

merged 2 commits into from
Sep 19, 2017

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Sep 11, 2017

A reoccurring problem in Ohai is the runs taking too long. It's hard to troubleshoot since you can't tell what plugin is causing the long runs. This simple debug information provides us with the information we need to troubleshoot unusually long ohai run times.

Example output

[2017-09-11T09:20:27-07:00] DEBUG: Plugin Ruby took 1.568772 seconds to run.
[2017-09-11T09:20:27-07:00] DEBUG: Plugin Rust: ran 'rustc --version' and returned 0
[2017-09-11T09:20:27-07:00] DEBUG: Plugin Rust took 0.356488 seconds to run.
[2017-09-11T09:20:31-07:00] DEBUG: Plugin Scala: ran 'scala -version' and returned 0
[2017-09-11T09:20:31-07:00] DEBUG: Plugin Scala took 3.216373 seconds to run.
[2017-09-11T09:20:36-07:00] DEBUG: Ohai took 16.940469 total seconds to run.

Signed-off-by: Tim Smith tsmith@chef.io

A reoccurring problem in Ohai is the runs taking too long. It's hard to troubleshoot since you can't tell what plugin is causing the long runs. This simple debug information provides us with the information we need to troubleshoot unusually long ohai run times.

Example output

```
[2017-09-11T09:20:27-07:00] DEBUG: Plugin Ruby took 1.568772 seconds to run.
[2017-09-11T09:20:27-07:00] DEBUG: Plugin Rust: ran 'rustc --version' and returned 0
[2017-09-11T09:20:27-07:00] DEBUG: Plugin Rust took 0.356488 seconds to run.
[2017-09-11T09:20:31-07:00] DEBUG: Plugin Scala: ran 'scala -version' and returned 0
[2017-09-11T09:20:31-07:00] DEBUG: Plugin Scala took 3.216373 seconds to run.
[2017-09-11T09:20:36-07:00] DEBUG: Ohai took 16.940469 total seconds to run.
```

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50 tas50 requested a review from a team September 11, 2017 16:22
@thommay
Copy link
Contributor

thommay commented Sep 11, 2017

I'd be tempted to use Benchmark.measure (https://ruby-doc.org/stdlib-2.4.0/libdoc/benchmark/rdoc/Benchmark.html#method-c-measure) rather than manual Times.

Seems like a bit of overkill, but it does nicely format the time strings, which I'll take

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50
Copy link
Contributor Author

tas50 commented Sep 19, 2017

@thommay I updated it with Benchmark. I'll take sane time notation.

@lamont-granquist
Copy link
Contributor

👍 on Benchmark.measure

code looks entirely correct.

@tas50 tas50 merged commit 66ce52b into master Sep 19, 2017
@tas50 tas50 deleted the timing branch September 19, 2017 18:49
@chef chef locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants