Skip to content

Commit 62e9069

Browse files
committed
Refactor max_housekeeping_interval to move in manager package
Signed-off-by: Harshal Patil <[email protected]>
1 parent 5ed5a2f commit 62e9069

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

cmd/cadvisor.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"sort"
2727
"strings"
2828
"syscall"
29-
"time"
3029

3130
cadvisorhttp "github.com/google/cadvisor/cmd/internal/http"
3231
"github.com/google/cadvisor/container"
@@ -59,11 +58,6 @@ var httpDigestRealm = flag.String("http_digest_realm", "localhost", "HTTP digest
5958

6059
var prometheusEndpoint = flag.String("prometheus_endpoint", "/metrics", "Endpoint to expose Prometheus metrics on")
6160

62-
var housekeepingConfig = manager.HouskeepingConfig{
63-
flag.Duration("max_housekeeping_interval", 60*time.Second, "Largest interval to allow between container housekeepings"),
64-
flag.Bool("allow_dynamic_housekeeping", true, "Whether to allow the housekeeping interval to be dynamic"),
65-
}
66-
6761
var enableProfiling = flag.Bool("profiling", false, "Enable profiling via web interface host:port/debug/pprof/")
6862

6963
var collectorCert = flag.String("collector_cert", "", "Collector's certificate, exposed to endpoints for certificate based authentication.")
@@ -195,7 +189,7 @@ func main() {
195189

196190
collectorHttpClient := createCollectorHttpClient(*collectorCert, *collectorKey)
197191

198-
resourceManager, err := manager.New(memoryStorage, sysFs, housekeepingConfig, includedMetrics, &collectorHttpClient, strings.Split(*rawCgroupPrefixWhiteList, ","), *perfEvents)
192+
resourceManager, err := manager.New(memoryStorage, sysFs, manager.HousekeepingConfigFlags, includedMetrics, &collectorHttpClient, strings.Split(*rawCgroupPrefixWhiteList, ","), *perfEvents)
199193
if err != nil {
200194
klog.Fatalf("Failed to create a manager: %s", err)
201195
}

manager/manager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ var eventStorageAgeLimit = flag.String("event_storage_age_limit", "default=24h",
6262
var eventStorageEventLimit = flag.String("event_storage_event_limit", "default=100000", "Max number of events to store (per type). Value is a comma separated list of key values, where the keys are event types (e.g.: creation, oom) or \"default\" and the value is an integer. Default is applied to all non-specified event types")
6363
var applicationMetricsCountLimit = flag.Int("application_metrics_count_limit", 100, "Max number of application metrics to store (per container)")
6464

65+
var HousekeepingConfigFlags = HouskeepingConfig{
66+
flag.Duration("max_housekeeping_interval", 60*time.Second, "Largest interval to allow between container housekeepings"),
67+
flag.Bool("allow_dynamic_housekeeping", true, "Whether to allow the housekeeping interval to be dynamic"),
68+
}
69+
6570
// The Manager interface defines operations for starting a manager and getting
6671
// container and machine information.
6772
type Manager interface {

0 commit comments

Comments
 (0)