-
Notifications
You must be signed in to change notification settings - Fork 349
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 support for {max,avg,min} autovacuum duration
& fix autovacuum
's system usage: CPU: ...
line parsing
#791
Merged
darold
merged 13 commits into
darold:master
from
franciscoreinolds:fr/longest-and-average-vacuum-duration
Aug 18, 2023
Merged
Add support for {max,avg,min} autovacuum duration
& fix autovacuum
's system usage: CPU: ...
line parsing
#791
darold
merged 13 commits into
darold:master
from
franciscoreinolds:fr/longest-and-average-vacuum-duration
Aug 18, 2023
Conversation
This file contains 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
darold
requested changes
Aug 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the regexp should be:
if ($line =~ /^[\s\t]*system usage: CPU: user: (.*) (?:sec|s,) system: (.*) (?:sec|s,) elapsed: ([^\s]+)/)
to avoid getting the sec
or s
at end of the line.
Now I think this is okay! I tested it with the following lines: Details
Feb 10 23:26:30 test-pc postgres[10808]: [1-1] db=,user=,app=,client= LOG: automatic analyze of table "db.public.table1" system usage: CPU: user: 0.77 s, system: 0.90 s, elapsed: 12.36 s
Feb 10 23:26:30 test-pc postgres[10808]: [1-1] db=,user=,app=,client= LOG: automatic analyze of table "db.public.table2" system usage: CPU: user: 0.19 s, system: 0.03 s, elapsed: 0.57 s
Feb 10 23:26:30 test-pc postgres[10808]: [1-1] db=,user=,app=,client= LOG: automatic analyze of table "db.public.table3" system usage: CPU: user: 0.11 s, system: 0.01 s, elapsed: 0.63 s
Feb 10 23:26:30 test-pc postgres[10808]: [1-1] db=,user=,app=,client= LOG: automatic analyze of table "db.public.table4" system usage: CPU: user: 0.56 s, system: 0.07 s, elapsed: 2.29 s
Feb 10 23:26:30 test-pc postgres[10808]: [1-1] db=,user=,app=,client= LOG: automatic analyze of table "db.public.table4" system usage: CPU: user: 0.56 s, system: 0.07 s, elapsed: 20.29 And the result: |
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.
Hello 👋🏽
I thought this would be an interesting feature to add as one can have a decent average autovacuum duration, but some of them might be running too long and one wouldn't know it.
While trying to implement this feature, I stumbled upon the fact that the parsing for
autovacuum
'ssystem usage: CPU: user: ...
line is broken. I hadn't noticed it thus far, but have checked a report I generated a couple of days ago and it's also missing the longest vacuum duration:So, I fixed that, and begun implementing the chart.
To test my implementation, I generated a report from the following output:
Details
The result (I know it's missing the
Key Values
, I just wanted to get the biggest part out of the way) is:This seems decent enough, but I might be forgetting something, but I guess we can cross that bridge when we cross it.
Looking forward to hear from you, Gilles!