Skip to content
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

fix(controller): Publish Work-queue Prometheus metrics #17017

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions controller/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"context"
"errors"
"fmt"
"github.com/prometheus/client_golang/prometheus/collectors"
"net/http"
"os"
"regexp"
certWatcherMetrics "sigs.k8s.io/controller-runtime/pkg/certwatcher/metrics"
"sigs.k8s.io/controller-runtime/pkg/metrics"
"strconv"
"time"

Expand Down Expand Up @@ -160,12 +163,20 @@ func NewMetricsServer(addr string, appLister applister.ApplicationLister, appFil

mux := http.NewServeMux()
registry := NewAppRegistry(appLister, appFilter, appLabels)
registry.MustRegister(depth, adds, latency, workDuration, unfinished, longestRunningProcessor, retries)

// These metrics are already present in the DefaultGatherer
metrics.Registry.Unregister(collectors.NewGoCollector())
// Remove unwanted metrics
metrics.Registry.Unregister(certWatcherMetrics.ReadCertificateTotal)
metrics.Registry.Unregister(certWatcherMetrics.ReadCertificateErrors)

mux.Handle(MetricsPath, promhttp.HandlerFor(prometheus.Gatherers{
// contains app controller specific metrics
registry,
// contains process, golang and controller workqueues metrics
// contains process and golang metrics
prometheus.DefaultGatherer,
// controller workqueue metrics
metrics.Registry,
}, promhttp.HandlerOpts{}))
profile.RegisterProfiler(mux)
healthz.ServeHealthCheck(mux, healthCheck)
Expand Down
101 changes: 0 additions & 101 deletions controller/metrics/workqueue.go

This file was deleted.

Loading