-
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
playground: deprecate bootstrap option --monitor
and add a new option --without-monitor
to disable monitors.
#1512
Conversation
[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 submitting an approval review. |
--monitor
.
/cc @tisonkun |
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.
Rest LGTM.
I think it's better figure out why tiup/components/playground/main.go Line 367 in 9a1ad59
|
hi @tisonkun @AstroProfundis, I've investigated why rootCmd.Flags().Bool(withMonitor, false, "Start prometheus and grafana component") will create a flag.NoOptDefVal = "true" and when if len(split) == 2 {
// '--flag=arg'
value = split[1]
} else if flag.NoOptDefVal != "" {
// '--flag' (arg was optional)
value = flag.NoOptDefVal
} else if len(a) > 0 {
// '--flag arg'
value = a[0]
a = a[1:]
} else {
// '--flag' (arg was required)
err = f.failf("flag needs an argument: %s", s)
return
} |
A simple fix is set rootCmd.Flags().Bool(withMonitor, false, "Start prometheus and grafana component")
rootCmd.Flags().Lookup(withMonitor).NoOptDefVal = "" but this will introduce a compatible issue:
what do you think about this? |
Codecov Report
@@ Coverage Diff @@
## master #1512 +/- ##
==========================================
+ Coverage 26.27% 30.82% +4.54%
==========================================
Files 267 279 +12
Lines 24041 24536 +495
==========================================
+ Hits 6317 7562 +1245
+ Misses 16901 15976 -925
- Partials 823 998 +175
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
another thing is that after this patch, the help message will be like because it's written in name = flag.Value.Type()
switch name {
case "bool":
name = ""
case "float64":
name = "float"
case "int64":
name = "int"
case "uint64":
name = "uint"
case "stringSlice":
name = "strings"
case "intSlice":
name = "ints"
case "uintSlice":
name = "uints"
case "boolSlice":
name = "bools"
} |
--monitor
.--monitor
.
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 it is as complex as before...
Ummmmmm, I'd agree that change this argument to |
--monitor
.--monitor
to --no-monitor
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'd prefer disable-
or without-
.
BTW, what about user facing interface changes? Previous settings based on --monitor will break.
--monitor
to --no-monitor
--monitor
to --without-monitor
/merge |
This pull request has been accepted and is ready to merge. Commit hash: cb4257b
|
--monitor
to --without-monitor
--monitor
and add a new option --without-monitor
to disable monitors.
--monitor
and add a new option --without-monitor
to disable monitors.--monitor
and add a new option --without-monitor
to disable monitors.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 4b9381c
|
What problem does this PR solve?
What
--monitor Start prometheus and grafana component
means is unclear,tiup playground nightly
andtiup playground nightly --monitor
has no difference.What is changed and how it works?
--monitor
, after this pr, if you add this, it still work but will reportFlag --monitor has been deprecated, Please use --without-monitor to control whether to disable monitor.
--without-monitor
, in help messagae:--without-monitor Don't start prometheus and grafana component
. by the way, help message won't show--mointor
anymore.Check List
Tests
Related changes
Release notes: