Skip to content

Commit efe3df6

Browse files
authored
Merge pull request #2925 from harche/refactory_flags
Refactor max_housekeeping_interval to move in manager package
2 parents 2dc3079 + 62e9069 commit efe3df6

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
@@ -25,7 +25,6 @@ import (
2525
"runtime"
2626
"strings"
2727
"syscall"
28-
"time"
2928

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

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

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

6862
var collectorCert = flag.String("collector_cert", "", "Collector's certificate, exposed to endpoints for certificate based authentication.")
@@ -135,7 +129,7 @@ func main() {
135129

136130
collectorHttpClient := createCollectorHttpClient(*collectorCert, *collectorKey)
137131

138-
resourceManager, err := manager.New(memoryStorage, sysFs, housekeepingConfig, includedMetrics, &collectorHttpClient, strings.Split(*rawCgroupPrefixWhiteList, ","), *perfEvents)
132+
resourceManager, err := manager.New(memoryStorage, sysFs, manager.HousekeepingConfigFlags, includedMetrics, &collectorHttpClient, strings.Split(*rawCgroupPrefixWhiteList, ","), *perfEvents)
139133
if err != nil {
140134
klog.Fatalf("Failed to create a manager: %s", err)
141135
}

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)