From 1fd72a78714bddac2e6cc36d909bd53ac507fc1b Mon Sep 17 00:00:00 2001 From: "Tim St. Clair" Date: Tue, 15 Dec 2015 16:12:30 -0800 Subject: [PATCH] Change default cAdvisor housekeeping interval to 10s Change the default interval cAdvisor uses to gather stats to 10 seconds. --- pkg/kubelet/cadvisor/cadvisor_linux.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/kubelet/cadvisor/cadvisor_linux.go b/pkg/kubelet/cadvisor/cadvisor_linux.go index d936652919a..ea55b722fb9 100644 --- a/pkg/kubelet/cadvisor/cadvisor_linux.go +++ b/pkg/kubelet/cadvisor/cadvisor_linux.go @@ -19,6 +19,7 @@ limitations under the License. package cadvisor import ( + "flag" "fmt" "net/http" "regexp" @@ -46,8 +47,17 @@ var _ Interface = new(cadvisorClient) // The amount of time for which to keep stats in memory. const statsCacheDuration = 2 * time.Minute const maxHousekeepingInterval = 15 * time.Second +const defaultHousekeepingInterval = 10 * time.Second const allowDynamicHousekeeping = true +func init() { + // Override the default cAdvisor housekeeping interval. + if f := flag.Lookup("housekeeping_interval"); f != nil { + f.DefValue = defaultHousekeepingInterval.String() + f.Value.Set(f.DefValue) + } +} + // Creates a cAdvisor and exports its API on the specified port if port > 0. func New(port uint) (Interface, error) { sysFs, err := sysfs.NewRealSysFs()