Skip to content

Commit

Permalink
koord-manager: fix the prom metrics handler
Browse files Browse the repository at this point in the history
Signed-off-by: saintube <saintube@foxmail.com>
  • Loading branch information
saintube committed Jun 18, 2024
1 parent 6f1debb commit 3ec9367
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/koord-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func main() {
mgrOpt.Cache.DefaultNamespaces[namespace] = cache.Config{}
}

installMetricsHandler(mgrOpt)
installMetricsHandler(&mgrOpt)
ctx := ctrl.SetupSignalHandler()

if utilfeature.DefaultFeatureGate.Enabled(features.WebhookFramework) {
Expand Down Expand Up @@ -207,11 +207,13 @@ func setRestConfig(c *rest.Config) {
}
}

func installMetricsHandler(mgr ctrl.Options) {
mgr.Metrics.ExtraHandlers = map[string]http.Handler{
func installMetricsHandler(mgr *ctrl.Options) {
for path, handler := range map[string]http.Handler{
metrics.InternalHTTPPath: promhttp.HandlerFor(metrics.InternalRegistry, promhttp.HandlerOpts{}),
metrics.ExternalHTTPPath: promhttp.HandlerFor(metrics.ExternalRegistry, promhttp.HandlerOpts{}),
metrics.DefaultHTTPPath: promhttp.HandlerFor(
metricsutil.MergedGatherFunc(metrics.InternalRegistry, metrics.ExternalRegistry, ctrlmetrics.Registry), promhttp.HandlerOpts{}),
} {
mgr.Metrics.ExtraHandlers[path] = handler
}
}

0 comments on commit 3ec9367

Please sign in to comment.