-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add prometheus metrics #190
feat: add prometheus metrics #190
Conversation
pkg/stats/stats.go
Outdated
if s.logMetrics { | ||
fields := convertTToFields(tags) | ||
msg := fmt.Sprintf("counter %s.%s + %v", s.prefix, name, val) | ||
msg := fmt.Sprintf("rate %s_%s + %v", s.prefix, name, val) | ||
log.WithFields(fields).Infoln(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider removing the logrus dependency?
ctx, keyedLogger := logging.InjectLoggerValues(ctx, "origin", "reconcileLeader", "type", key.sourceGK.String(), "key", key.ObjectSourceKey()) | ||
startTime := time.Now() | ||
|
||
keyedLogger.V(3).Info("Starting reconcileLeader") | ||
defer func() { | ||
c.metrics.Duration(fmt.Sprintf("follower-controller-%s.latency", key.sourceGK.String()), startTime) | ||
c.metrics.Duration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add these KV to all controller reconcile metrics?
b84636f
to
ec9e329
Compare
flags.BoolVar(&o.PrometheusMetrics, "export-prometheus", true, "Whether to expose metrics through a prometheus endpoint") | ||
flags.StringVar(&o.PrometheusAddr, "prometheus-addr", "", "prometheus collector address") | ||
flags.Uint16Var(&o.PrometheusPort, "prometheus-port", 9090, "prometheus collector port") | ||
flags.StringToStringVar( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to pass quantiles as parameters to the controller? Kind of rare.
@@ -123,6 +128,16 @@ func (o *Options) AddFlags(flags *pflag.FlagSet, allControllers []string, disabl | |||
flags.BoolVar(&o.EnablePodPruning, "enable-pod-pruning", false, "Enable pod pruning for pod informer. "+ | |||
"Enabling this can reduce memory usage of the pod informer, but will disable pod propagation.") | |||
o.addKlogFlags(flags) | |||
|
|||
flags.BoolVar(&o.PrometheusMetrics, "export-prometheus", true, "Whether to expose metrics through a prometheus endpoint") | |||
flags.StringVar(&o.PrometheusAddr, "prometheus-addr", "", "prometheus collector address") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flags.StringVar(&o.PrometheusAddr, "prometheus-addr", "", "prometheus collector address") | |
flags.StringVar(&o.PrometheusAddr, "prometheus-addr", "", "Prometheus collector address") |
Capitalize the first letter of the description.
ec9e329
to
8165a9b
Compare
7b3fe83
into
kubewharf:refactor/unified-federated-type
feat: add prometheus metrics
No description provided.