add disclaimer to CLI help text

Change-Id: I32e52e97ec6bc7514a0030c8d83ad74bc346f7d5
This commit is contained in:
Han Kang 2021-02-18 16:01:32 -08:00
parent 0e32c43e07
commit 51be88a845
2 changed files with 9 additions and 6 deletions

View File

@ -61,17 +61,18 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
"disabled-metrics",
o.DisabledMetrics,
"This flag provides an escape hatch for misbehaving metrics. "+
"You must provide the fully qualified metric name in order to disable it.")
"You must provide the fully qualified metric name in order to disable it. "+
"Disclaimer: disabling metrics is higher in precedence than showing hidden metrics.")
}
// Apply applies parameters into global configuration of metrics.
func (o *Options) Apply() {
if o != nil && len(o.ShowHiddenMetricsForVersion) > 0 {
SetShowHidden()
// set disabled metrics
for _, metricName := range o.DisabledMetrics {
SetDisabledMetric(metricName)
}
}
// set disabled metrics
for _, metricName := range o.DisabledMetrics {
SetDisabledMetric(metricName)
}
}

View File

@ -517,7 +517,9 @@ func TestRegistryReset(t *testing.T) {
}
func TestDisabledMetrics(t *testing.T) {
SetDisabledMetric("should_be_disabled")
o := NewOptions()
o.DisabledMetrics = []string{"should_be_disabled"}
o.Apply()
currentVersion := apimachineryversion.Info{
Major: "1",
Minor: "17",