Skip to content

Commit c5017c7

Browse files
authored
Merge pull request #807 from thaniri/issue-97-add-configurable-collection-intervals
feat: add config flags for collection intervals
2 parents 2ed22f0 + 613d6ba commit c5017c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/server/start.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ func NewCommandStartAdapterServer(stopCh <-chan struct{}) *cobra.Command {
133133
"disregard failing to create collectors for incompatible HPAs")
134134
flags.DurationVar(&o.MetricsTTL, "metrics-ttl", 15*time.Minute, "TTL for metrics that are stored in in-memory cache.")
135135
flags.DurationVar(&o.GCInterval, "garbage-collector-interval", 10*time.Minute, "Interval to clean up metrics that are stored in in-memory cache.")
136+
flags.DurationVar(&o.CollectionInterval, "default-collection-interval", 60*time.Second, "Default interval used for collecting metrics.")
137+
flags.DurationVar(&o.ResourceUpdateInterval, "resource-update-interval", 30*time.Second, "Interval at which HPA resources get updated.")
136138
flags.BoolVar(&o.ScalingScheduleMetrics, "scaling-schedule", o.ScalingScheduleMetrics, ""+
137139
"whether to enable time-based ScalingSchedule metrics")
138140
flags.DurationVar(&o.DefaultScheduledScalingWindow, "scaling-schedule-default-scaling-window", 10*time.Minute, "Default rampup and rampdown window duration for ScalingSchedules")
@@ -391,7 +393,7 @@ func (o AdapterServerOptions) RunCustomMetricsAdapterServer(stopCh <-chan struct
391393
go scheduledScalingController.Run(ctx)
392394
}
393395

394-
hpaProvider := provider.NewHPAProvider(client, 30*time.Second, 1*time.Minute, collectorFactory, o.DisregardIncompatibleHPAs, o.MetricsTTL, o.GCInterval)
396+
hpaProvider := provider.NewHPAProvider(client, o.ResourceUpdateInterval, o.CollectionInterval, collectorFactory, o.DisregardIncompatibleHPAs, o.MetricsTTL, o.GCInterval)
395397

396398
go hpaProvider.Run(ctx)
397399

@@ -509,6 +511,10 @@ type AdapterServerOptions struct {
509511
MetricsTTL time.Duration
510512
// Interval to clean up metrics that are stored in in-memory cache
511513
GCInterval time.Duration
514+
// Default interval used for collecting metrics
515+
CollectionInterval time.Duration
516+
// Interval at which HPA resources get updated
517+
ResourceUpdateInterval time.Duration
512518
// Time-based scaling based on the CRDs ScheduleScaling and ClusterScheduleScaling.
513519
ScalingScheduleMetrics bool
514520
// Default ramp-up/ramp-down window duration for scheduled metrics

0 commit comments

Comments
 (0)