diff --git a/metrics/metrics.go b/metrics/metrics.go index edb2a96f9d..1b24e29959 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -4,6 +4,8 @@ import ( "context" "net/http" + "github.com/prometheus/client_golang/prometheus/collectors" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "go.uber.org/zap" @@ -167,8 +169,9 @@ func (m *Metrics) ActionDuration(sensorName, triggerName string, num float64) { func (m *Metrics) Run(ctx context.Context, addr string) { log := logging.FromContext(ctx) metricsRegistry := prometheus.NewRegistry() - metricsRegistry.MustRegister(m) + metricsRegistry.MustRegister(collectors.NewGoCollector(), m) http.Handle("/metrics", promhttp.HandlerFor(metricsRegistry, promhttp.HandlerOpts{})) + log.Info("starting metrics server") if err := http.ListenAndServe(addr, nil); err != nil { log.Fatalw("failed to start metrics server", zap.Error(err))