Skip to content

Commit

Permalink
Merge pull request #1953 from CharlesQQ/karmada-agent-metrics
Browse files Browse the repository at this point in the history
feat: agent add metrics-bind-address flag
  • Loading branch information
karmada-bot authored Jun 13, 2022
2 parents de95b74 + fe40364 commit 5c3336e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/agent/app/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func run(ctx context.Context, karmadaConfig karmadactl.KarmadaConfig, opts *opti
LeaderElectionID: fmt.Sprintf("karmada-agent-%s", opts.ClusterName),
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
MetricsBindAddress: opts.MetricsBindAddress,
Controller: v1alpha1.ControllerConfigurationSpec{
GroupKindConcurrency: map[string]int{
workv1alpha1.SchemeGroupVersion.WithKind("Work").GroupKind().String(): opts.ConcurrentWorkSyncs,
Expand Down
6 changes: 6 additions & 0 deletions cmd/agent/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ type Options struct {
// ConcurrentWorkSyncs is the number of work objects that are
// allowed to sync concurrently.
ConcurrentWorkSyncs int
// MetricsBindAddress is the TCP address that the controller should bind to
// for serving prometheus metrics.
// It can be set to "0" to disable the metrics serving.
// Defaults to ":8080".
MetricsBindAddress string

RateLimiterOpts ratelimiterflag.Options
}
Expand Down Expand Up @@ -111,5 +116,6 @@ func (o *Options) AddFlags(fs *pflag.FlagSet, allControllers []string) {
fs.DurationVar(&o.ResyncPeriod.Duration, "resync-period", 0, "Base frequency the informers are resynced.")
fs.IntVar(&o.ConcurrentClusterSyncs, "concurrent-cluster-syncs", 5, "The number of Clusters that are allowed to sync concurrently.")
fs.IntVar(&o.ConcurrentWorkSyncs, "concurrent-work-syncs", 5, "The number of Works that are allowed to sync concurrently.")
fs.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The TCP address that the controller should bind to for serving prometheus metrics(e.g. 127.0.0.1:8088, :8088)")
o.RateLimiterOpts.AddFlags(fs)
}

0 comments on commit 5c3336e

Please sign in to comment.