-
Notifications
You must be signed in to change notification settings - Fork 312
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
dm,cluster: display with uptime returned #1231
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1231 +/- ##
==========================================
+ Coverage 53.42% 53.85% +0.43%
==========================================
Files 289 277 -12
Lines 20687 20355 -332
==========================================
- Hits 11051 10963 -88
+ Misses 7903 7668 -235
+ Partials 1733 1724 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@AstroProfundis @lucklove PTAL |
if status == "-" { | ||
since := "-" | ||
if !opt.ShowUptime { | ||
since = formatInstanceSince(ins.Uptime(tlsCfg)) |
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'm a little confused, why call ins.Uptime
even if the user didn't specify --show-uptime
?
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.
Looks like the opposite logical ...
} | ||
|
||
// Query the service status and uptime | ||
if status == "-" || (opt.ShowUptime && since == "-") { |
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.
It seems this check is not necessary since we checked if status == "-"
and if opt.ShowUptime && since == "-"
latter.
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.
Sorry, the previous check is reversed, so the check here is necessary, if user specifies opt.ShowUptime
but since
is empty(not implemented or server was down), we try to fetch it via ssh-systemctl-status
)
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.
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.
No, the check is necessary.
The previous check is A or B
,
because they all need to invoke operator.GetServiceStatus
,
and later for condition A I'm trying to get the status
(if not this condition, don't need to rewrite status
), and for B to get the since
.
1d9b083
to
9257678
Compare
It seems the format is not consistent when the data source different from metric and systemd. It's better to make it consistent:
@9547 @AndreMouche What do you think about it? |
Agree with it, keep the format consistent, I'll try to parse the output of systemd's output. +1 to hide |
6cde2c0
to
055bb80
Compare
/lgtm |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 055bb80
|
@9547: Your PR was out of date, I have automatically updated it for you. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
implement #1223
What is changed and how it works?
display the uptime of the instance,
if this instance is up, then
uptime
means the alive time, else is the inactive time.see #1223 for more detail
Check List
Tests
Code changes
Side effects
Related changes
Release notes: