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 utility decorator to log time spent in function calls #317

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

lunkwill42
Copy link
Member

@lunkwill42 lunkwill42 commented Jul 17, 2024

Scope and purpose

This adds a utility decorator log_time_spent(), which will log the number of seconds spent in the decorated function. It also applies this to functions that load polldevs config or loads/dumps the Zino state, in order to get a picture of the performance of these functions.

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Zino can be found in the
README.

  • Added a changelog fragment for towncrier
    • Purely an internal change.
  • Added/amended tests for new/changed code
  • Added/changed documentation
    • Well, tests are documentation, right?
  • Linted/formatted the code with black, ruff and isort, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done

@lunkwill42 lunkwill42 self-assigned this Jul 17, 2024
Copy link

github-actions bot commented Jul 17, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 100 0 1.71s
✅ PYTHON isort 100 0 0.34s
✅ PYTHON ruff 100 0 0.03s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Copy link

github-actions bot commented Jul 17, 2024

Test results

    3 files      3 suites   1m 17s ⏱️
  514 tests   514 ✅ 0 💤 0 ❌
1 542 runs  1 540 ✅ 2 💤 0 ❌

Results for commit 7367e79.

♻️ This comment has been updated with latest results.

@lunkwill42 lunkwill42 marked this pull request as ready for review July 17, 2024 10:29
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.32%. Comparing base (5fb634d) to head (126c493).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
+ Coverage   97.31%   97.32%   +0.01%     
==========================================
  Files          64       64              
  Lines        7888     7910      +22     
==========================================
+ Hits         7676     7698      +22     
  Misses        212      212              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lunkwill42 lunkwill42 requested a review from a team July 17, 2024 10:30
The time spent in these functions may have performance implications for
Zino.  This ensures the time spent in each call is debug logged.
Copy link

sonarcloud bot commented Jul 23, 2024

@johannaengland
Copy link
Contributor

I didn't do any change to the code, only fixed a typo in the commit message

@johannaengland johannaengland merged commit 395ac8e into master Jul 23, 2024
8 of 9 checks passed
@johannaengland johannaengland deleted the feature/timelogger-decorator branch July 23, 2024 11:49
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 this pull request may close these issues.

2 participants