-
Notifications
You must be signed in to change notification settings - Fork 32
Add start time to .last_run_stats #288
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
Open
urosgruber
wants to merge
1
commit into
bsdpot:master
Choose a base branch
from
urosgruber:add-time-start-last_run_stats
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
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.
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.
Right now, last-run-stats is only used programmatically by the nomad pot driver, which extracts the exit code of the container from this file in case the container already exited (this is important, as restarting the nomad pot driver means it needs to re-attach and could miss the exit code otherwise). Therefore it contains not more information. In general, it could contain more things (including various timestamps), but in case of non-persistent containers (which is why the feature was implemented in the first place), it will be written when the container exits. That's also why it's called
.last_run_statsand not.current_run_stats.I admit that this is a bit confusing, since in all cases the file contains the exit code of the configured
pot.cmd- with persistent jails that's usually (but not always an necessarily) the exit code of running rc (so that's usually written after "booting" the jail), while for non-persistent jails, that's always when the container exited, which makes no sense.Long story short, writing
StartedAtinto this file is not universally useful, as it's not always written while the jail is running, but after it started. So for non-persistent jails, it could be interesting to have some statistics in there about for long it ran (which would hard to write for persistent ones, as it's written after rc started).I hope the above makes sense. So basically, to be more useful, the last_run_stats feature would first need to be refined, so it means the same for persistent and non-persistent jails. When I introduced it, I had mostly non-persistent jails in mind. I didn't realize that for persistent jails the file is written much earlier in their lifetime and therefore has a different meaning.
What you still could do without making things worse:
_epochto_started_at_started_at=$(date +%s)to line 654This way it reflects the real "started at" time of the jail and would be correct in all cases (even though having it for non-persistent jails would be "after the fact" and for persistent jails, it only becomes available after the rc script ran).
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.
Thanks for the explanation, I'll amend as instructed.