This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 302
fleetctl: service uptime for list-units #1669
Open
dongsupark
wants to merge
4
commits into
coreos:master
Choose a base branch
from
endocode:dongsu/fleetctl-list-units-uptime
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
fleetctl: service uptime for list-units #1669
dongsupark
wants to merge
4
commits into
coreos:master
from
endocode:dongsu/fleetctl-list-units-uptime
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
I'm not sure about this one - please hold off until I can give it a little more thought |
@jonboulle I see. |
dongsupark
force-pushed
the
master
branch
2 times, most recently
from
August 30, 2016 12:26
bdc94e8
to
fa5aa3a
Compare
dongsupark
force-pushed
the
master
branch
3 times, most recently
from
November 10, 2016 15:24
20a3e96
to
3aaa1ab
Compare
dongsupark
force-pushed
the
master
branch
2 times, most recently
from
November 24, 2016 15:35
eb6872f
to
365565e
Compare
dongsupark
force-pushed
the
master
branch
6 times, most recently
from
December 15, 2016 19:48
39a99ba
to
44591b0
Compare
We can get the uptime from systemctl, the resolve is like below: localhost # /home/wood/fleet/fleetctl list-units UNIT MACHINE ACTIVE SUB UPTIME world.service 06ecd4f7.../192.168.122.30 active running 2015-07-06 07:38:38 AM, Since 11m39s world2.service 1d3430ef.../192.168.122.31 active running 2015-07-06 07:48:24 AM, Since 1m54s world_glob.service 06ecd4f7.../192.168.122.30 active running 2015-07-06 07:48:00 AM, Since 2m18s world_glob.service 1d3430ef.../192.168.122.31 active running 2015-07-06 07:47:59 AM, Since 2m18s
To avoid an additional iteration of unit states for each unit, set UnitState.ActiveEnterTimestamp accordingly, by calling m.systemd.GetUnitProperty(). Note that we need to retrieve the property not only in the normal loop for the current systemd (>=230), but also in the fallback handling for the older version of systemd (<=229).
dongsupark
force-pushed
the
dongsu/fleetctl-list-units-uptime
branch
from
December 16, 2016 13:47
7a8a336
to
63a3b28
Compare
* fix typo in registry/unit_state*.go, from ActiveEnterTimestamp to activeEnterTimestamp. * Add a new field systemdActiveEnterTimestamp to both v1-json.go and v1.json.
Actually it's not necessary to check that both units have the same value for ActiveEnterTimestamp, as it can vary at any time. So let's exclude ActiveEnterTimestamp from the condition for unit comparison.
dongsupark
force-pushed
the
dongsu/fleetctl-list-units-uptime
branch
from
December 16, 2016 14:22
63a3b28
to
d3c8fe8
Compare
dongsupark
force-pushed
the
master
branch
2 times, most recently
from
February 8, 2017 10:21
0132632
to
6974811
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Allow
fleetctl list-units
to retrieve per-unit uptime from systemd, for example:What's changed since #1293:
UnitState
, both for the normal loop for systemd (>= 230) and for the fallback loop for systemd (<= 229).ActiveEnterTimestamp
from unit comparison condition.UTC
to the outputFixes #1128
Supersedes #1293
/cc @wuqixuan