Skip to content
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

allow ignoreMetrics in new manager #1159

Merged
merged 1 commit into from
Mar 14, 2016

Conversation

sjenning
Copy link
Contributor

kubelet would like to be able to set the ignore metrics but currently this is only supported when invoking cadvisor from the command line.

This allows the caller of manger.New() to pass in a set of metrics to ignore, falling back to the defaults if none are provided.

cc @ncdc @derekwaynecarr

@k8s-bot
Copy link
Collaborator

k8s-bot commented Mar 14, 2016

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@ncdc
Copy link
Collaborator

ncdc commented Mar 14, 2016

cc @vishh

@derekwaynecarr
Copy link
Collaborator

LGTM

@@ -184,6 +184,10 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
inHostNamespace = true
}

if ignoreMetricsSet == nil {
ignoreMetricsSet = ignoreMetrics.MetricSet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer that this was explicitly passed in from the main module rather than implicitly set here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - so move the flag defined in this file to cadvisor.go in the project root and pass it down from there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds good.

@sjenning sjenning force-pushed the manager-accept-ignoremetrics branch from 776e615 to 5156f5d Compare March 14, 2016 21:41
@sjenning
Copy link
Contributor Author

@timstclair updated

if err == nil {
t.Fatalf("Expected nil manager to return error")
}
}

func TestTcpMetricsAreDisabledByDefault(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we keep this test around?

@vishh
Copy link
Contributor

vishh commented Mar 14, 2016

Just one nit. Otherwise LGTM

func main() {
defer glog.Flush()
// Tcp metrics are ignored by default.
flag.Var(&ignoreMetrics, "disable_metrics", "comma-separated list of metrics to be disabled. Options are `disk`, `network`, `tcp`. Note: tcp is disabled by default due to high CPU usage.")
flag.Set("disable_metrics", "tcp")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than calling flag.Set, just add TCP to the default metrics on line 58

@sjenning sjenning force-pushed the manager-accept-ignoremetrics branch from 5156f5d to 574820f Compare March 14, 2016 22:02
@sjenning
Copy link
Contributor Author

@vishh @timothysc updated

func main() {
defer glog.Flush()
// Tcp metrics are ignored by default.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) move the comment too.

@sjenning sjenning force-pushed the manager-accept-ignoremetrics branch from 574820f to 00934be Compare March 14, 2016 22:07
@timstclair
Copy link
Contributor

Thanks. BTW - I'm @timstclair not @timothysc - there are 2 of us :)

@vishh
Copy link
Contributor

vishh commented Mar 14, 2016

LGTM.

@sjenning sjenning force-pushed the manager-accept-ignoremetrics branch from 00934be to 8aa6164 Compare March 14, 2016 22:17
@sjenning
Copy link
Contributor Author

@timstclair undetected name collision, my bad :) updated

@timstclair
Copy link
Contributor

LGTM

timstclair pushed a commit that referenced this pull request Mar 14, 2016
@timstclair timstclair merged commit 23cde28 into google:master Mar 14, 2016
vishh added a commit that referenced this pull request Mar 15, 2016
@sjenning sjenning deleted the manager-accept-ignoremetrics branch June 13, 2016 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants